Merge ~bhill/epics-base:pvAccess-envDefs.h into epics-base:7.0
- Git
- lp:~bhill/epics-base
- pvAccess-envDefs.h
- Merge into 7.0
Status: | Needs review |
---|---|
Proposed branch: | ~bhill/epics-base:pvAccess-envDefs.h |
Merge into: | epics-base:7.0 |
Diff against target: |
127 lines (+80/-0) 3 files modified
configure/CONFIG_ENV (+18/-0) modules/libcom/src/env/envDefs.h (+20/-0) modules/libcom/src/env/envSubr.c (+42/-0) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
mdavidsaver | Needs Fixing | ||
Andrew Johnson | Needs Fixing | ||
Review via email:
|
Commit message
Description of the change
Adds pvAccess env variables to envDefs.h
- 6e96884... by Bruce Hill
-
Added pvAccess environment variable defaults to CONFIG_ENV.

Bruce Hill (bhill) wrote : | # |
Sorry, didn't notice the env defaults in CONFIG_ENV.
I got the defaults from pvAccessConfig.xlsx

mdavidsaver (mdavidsaver) wrote : | # |
> I got the defaults from pvAccessConfig.xlsx
Where did you find this file? I don't think I've come across it before.
I like the idea of allowing users to check the PVA settings in the same way as the CA settings. The unfortunate reality is that these two are managed quite differently. cf. pv/configuration.h
I don't think it would be a good idea to merge this without corresponding changes to pvAccessCPP. To do so would potentially confuse users by showing incorrect values when defaults are being override in code, of when environment variables are ignored altogether.

Bruce Hill (bhill) wrote : | # |
There are 2 copies online of pvAccessConfig.xlsx I know of:
https:/
https:/
Both appear to be compatible.
I agree w/ your concern re the settings matching w/ pvAccessCPP.
I noticed these env variables were missing when I was asked to update our iocAdmin (iocStats)
with the PVA env variables. We use it to create PV's that display how each
env variable is set, but I don't think it will reflect how one env variable can get
it's default from another env variable.
There doesn't appear to be any support in the CA libs either re staying in sync
with the env variables in envDefs.h.

Andrew Johnson (anj) wrote : | # |
Hi Bruce,
I don't understand your point about env variables getting defaults from other env variables, we don't do that.
The CA code uses the routines in envDefs.h to access environment variables, but because of our default mechanism (and to avoid confusion) the code calls them environment parameters. There is a script libCom/
The PVA code does not currently use the routines in envDefs.h to access environment variables, so it can't rely on the default value mechanism of environment parameters. This was probably because it's not possible to add extra environment parameters in a sub-module or support module, they currently have to be listed in the envDefs.h file in libCom/env.
I do want to change the way that this code works so modules can define their own parameters and this is probably the right time to do that (after the 7.0.2 release), but exactly how that should work isn't completely clear without doing some more development.
The ENV_PARAM objects with their default values should be compiled into the library built by the module, so the bldEnvData.pl script will need to be modified to load a module-specific header file. How and where we specify default values (particularly for parameters that we expect sites to want to set themselves — they shouldn't have to edit CONFIG_SITE* files inside sub-modules) still needs some thought and discussion; it would be best to have that discussion before writing significant amounts of code to implement something.
- Andrew
- f6b12f8... by Bruce Hill
-
Replaced defaults w/ empty for EPICS_PVAS_* env vars that default to their EPICS_PVA_* equivalent.
Allows code such as the following from rsrc/caservertask.c to work for EPICS_PVA_* environment parameters.
if ( envGetConfigParamPtr ( &EPICS_ CAS_SERVER_ PORT ) ) {
ca_server_ port = envGetInetPortC onfigParam ( &EPICS_ CAS_SERVER_ PORT, (unsigned short) CA_SERVER_PORT );
}
else {
ca_server_ port = envGetInetPortC onfigParam ( &EPICS_ CA_SERVER_ PORT, (unsigned short) CA_SERVER_PORT );
}

Bruce Hill (bhill) wrote : | # |
So looking more in to how defaults are handled in CA vs PVA code, I needed to change
CONFIG_ENV to set most of the EPICS_PVAS_* defaults to empty or empty string.
The empty setting allows code such as this from rsrv/caservertask.c to use
EPICS_CA_
actually defined as process environment variables.
if ( envGetConfigPar
ca_server_port = envGetInetPortC
}
else {
ca_server_port = envGetInetPortC
}
My point from this is that the envGet*
provide any insight to client code such as in iocStats() re this defaulting
of EPICS_CAS_
part of Michael's objection.
As I see it, the make variables defined in CONFIG_ENV allow user overrides
via CONFIG_SITE_ENV to set site defaults for CA environment parameters.
The only change needed to make pvAccess compatible is to use those make
variables to override the default values in pvAccess/
pvAccess wouldn't need to use the envGet*
code in src/server/
can stay as is.

Bruce Hill (bhill) wrote : | # |
I was reviewing this merge request to see what remaining work I needed to do and am not convinced any more changes are needed other than perhaps modifying pvAccessCPP to allow EPICS_PVA* defaults to be configured via configure/
As I see it, there are two issues here.
1. Allowing configuration of CA and PVA defaults via configure/
2. Allowing runtime examination of CA and PVA settings via the various envGet*() functions and modules such as iocStats that expose them as PVs.
I think the current state of the patch supports the 2nd use case, and a separate patch would be needed for pvAccessCPP to support build time configuration of PVA defaults.

Andrew Johnson (anj) wrote : | # |
Core Mtg: AI on MAD tyo trim the list of var's and Bruce to adjust this. Approved after that.

mdavidsaver (mdavidsaver) wrote : | # |
Some of these ENVs need to be removed. I need to go through the list again.
- 688a339... by Bruce Hill
-
Added envFindConfigPa
ram() function so clients can find ENV_PARAM instances.

Bruce Hill (bhill) wrote : | # |
Should I remove EPICS_PVAS_
Any others?

Bruce Hill (bhill) wrote : | # |
Also EPICS_PVA_

mdavidsaver (mdavidsaver) wrote : | # |
pvAccessCPP will now use these parameters.
However, I'm having second (third?) thoughts about the idea of having a second or third set of default values for these parameters, which are sometimes are used, and sometimes ignored.
Probably the most confusing is EPICS_PVAS_
I'm tempted to say that it would be better to defer to the "pvasr" iocsh function, which can print the configuration actually being used by the running server (in IOCs).
That said, the set of parameters which I think should be advertised are:
EPICS_PVA_ADDR_LIST
EPICS_PVA_
EPICS_PVA_
EPICS_PVA_
EPICS_PVAS_
EPICS_PVAS_
EPICS_PVAS_
EPICS_PVAS_
Unmerged commits
- 688a339... by Bruce Hill
-
Added envFindConfigPa
ram() function so clients can find ENV_PARAM instances. - f6b12f8... by Bruce Hill
-
Replaced defaults w/ empty for EPICS_PVAS_* env vars that default to their EPICS_PVA_* equivalent.
Allows code such as the following from rsrc/caservertask.c to work for EPICS_PVA_* environment parameters.
if ( envGetConfigParamPtr ( &EPICS_ CAS_SERVER_ PORT ) ) {
ca_server_ port = envGetInetPortC onfigParam ( &EPICS_ CAS_SERVER_ PORT, (unsigned short) CA_SERVER_PORT );
}
else {
ca_server_ port = envGetInetPortC onfigParam ( &EPICS_ CA_SERVER_ PORT, (unsigned short) CA_SERVER_PORT );
} - 6e96884... by Bruce Hill
-
Added pvAccess environment variable defaults to CONFIG_ENV.
- 78addcc... by Bruce Hill
-
Adding pvAccess env variables to envDefs.h
Preview Diff
1 | diff --git a/configure/CONFIG_ENV b/configure/CONFIG_ENV |
2 | index 59e72d8..826be9f 100644 |
3 | --- a/configure/CONFIG_ENV |
4 | +++ b/configure/CONFIG_ENV |
5 | @@ -47,6 +47,24 @@ EPICS_CAS_SERVER_PORT= |
6 | EPICS_CAS_INTF_ADDR_LIST="" |
7 | EPICS_CAS_IGNORE_ADDR_LIST="" |
8 | |
9 | +EPICS_PVA_ADDR_LIST="" |
10 | +EPICS_PVA_AUTO_ADDR_LIST=YES |
11 | +EPICS_PVA_BEACON_PERIOD=15.0 |
12 | +EPICS_PVA_BROADCAST_PORT=5076 |
13 | +EPICS_PVA_CONN_TMO=30.0 |
14 | +EPICS_PVA_DEBUG=0 |
15 | +EPICS_PVA_MAX_ARRAY_BYTES=16384 |
16 | +EPICS_PVA_PROVIDER_NAMES="local" |
17 | +EPICS_PVA_SERVER_PORT=5075 |
18 | + |
19 | +EPICS_PVAS_AUTO_BEACON_ADDR_LIST="" |
20 | +EPICS_PVAS_BEACON_ADDR_LIST="" |
21 | +EPICS_PVAS_BEACON_PERIOD= |
22 | +EPICS_PVAS_BROADCAST_PORT= |
23 | +EPICS_PVAS_MAX_ARRAY_BYTES= |
24 | +EPICS_PVAS_PROVIDER_NAMES="" |
25 | +EPICS_PVAS_SERVER_PORT= |
26 | + |
27 | # Servers to disable |
28 | EPICS_IOC_IGNORE_SERVERS="" |
29 | |
30 | diff --git a/modules/libcom/src/env/envDefs.h b/modules/libcom/src/env/envDefs.h |
31 | index 8be00a9..915e822 100644 |
32 | --- a/modules/libcom/src/env/envDefs.h |
33 | +++ b/modules/libcom/src/env/envDefs.h |
34 | @@ -60,6 +60,25 @@ epicsShareExtern const ENV_PARAM EPICS_CAS_SERVER_PORT; |
35 | epicsShareExtern const ENV_PARAM EPICS_CA_BEACON_PERIOD; /* deprecated */ |
36 | epicsShareExtern const ENV_PARAM EPICS_CAS_BEACON_PERIOD; |
37 | epicsShareExtern const ENV_PARAM EPICS_CAS_BEACON_PORT; |
38 | + |
39 | +epicsShareExtern const ENV_PARAM EPICS_PVA_ADDR_LIST; |
40 | +epicsShareExtern const ENV_PARAM EPICS_PVA_AUTO_ADDR_LIST; |
41 | +epicsShareExtern const ENV_PARAM EPICS_PVA_BEACON_PERIOD; |
42 | +epicsShareExtern const ENV_PARAM EPICS_PVA_BROADCAST_PORT; |
43 | +epicsShareExtern const ENV_PARAM EPICS_PVA_CONN_TMO; |
44 | +epicsShareExtern const ENV_PARAM EPICS_PVA_DEBUG; |
45 | +epicsShareExtern const ENV_PARAM EPICS_PVA_MAX_ARRAY_BYTES; |
46 | +epicsShareExtern const ENV_PARAM EPICS_PVA_PROVIDER_NAMES; |
47 | +epicsShareExtern const ENV_PARAM EPICS_PVA_SERVER_PORT; |
48 | + |
49 | +epicsShareExtern const ENV_PARAM EPICS_PVAS_AUTO_BEACON_ADDR_LIST; |
50 | +epicsShareExtern const ENV_PARAM EPICS_PVAS_BEACON_ADDR_LIST; |
51 | +epicsShareExtern const ENV_PARAM EPICS_PVAS_BEACON_PERIOD; |
52 | +epicsShareExtern const ENV_PARAM EPICS_PVAS_BROADCAST_PORT; |
53 | +epicsShareExtern const ENV_PARAM EPICS_PVAS_MAX_ARRAY_BYTES; |
54 | +epicsShareExtern const ENV_PARAM EPICS_PVAS_PROVIDER_NAMES; |
55 | +epicsShareExtern const ENV_PARAM EPICS_PVAS_SERVER_PORT; |
56 | + |
57 | epicsShareExtern const ENV_PARAM EPICS_BUILD_COMPILER_CLASS; |
58 | epicsShareExtern const ENV_PARAM EPICS_BUILD_OS_CLASS; |
59 | epicsShareExtern const ENV_PARAM EPICS_BUILD_TARGET_ARCH; |
60 | @@ -87,6 +106,7 @@ epicsShareFunc const char * epicsShareAPI |
61 | envGetConfigParamPtr(const ENV_PARAM *pParam); |
62 | epicsShareFunc long epicsShareAPI |
63 | envPrtConfigParam(const ENV_PARAM *pParam); |
64 | +epicsShareFunc const ENV_PARAM * envFindConfigParam( const char * envVarName ); |
65 | epicsShareFunc long epicsShareAPI |
66 | envGetInetAddrConfigParam(const ENV_PARAM *pParam, struct in_addr *pAddr); |
67 | epicsShareFunc long epicsShareAPI |
68 | diff --git a/modules/libcom/src/env/envSubr.c b/modules/libcom/src/env/envSubr.c |
69 | index 283b132..1e0f9ba 100644 |
70 | --- a/modules/libcom/src/env/envSubr.c |
71 | +++ b/modules/libcom/src/env/envSubr.c |
72 | @@ -24,6 +24,7 @@ |
73 | * QUICK REFERENCE |
74 | * #include "envDefs.h" |
75 | * ENV_PARAM param; |
76 | +* ENV_PARAM * envFindConfigParam( envVarName ) |
77 | * char *envGetConfigParamPtr( pParam ) |
78 | * char *envGetConfigParam( pParam, bufDim, pBuf ) |
79 | * long envGetLongConfigParam( pParam, pLong ) |
80 | @@ -52,6 +53,47 @@ |
81 | |
82 | |
83 | |
84 | /*+/subr********************************************************************** |
85 | +* NAME envFindConfigParam - Find an ENV_PARAM for the specified environment variable. |
86 | +* |
87 | +* DESCRIPTION |
88 | +* Returns a pointer to an environment configuration parameter. |
89 | +* If the configuration parameter isn't found in the environment, |
90 | +* then a NULL pointer is returned. |
91 | +* |
92 | +* RETURNS |
93 | +* pointer to the environment variable, or |
94 | +* NULL if no environment configuration parameter was found |
95 | +* |
96 | +* EXAMPLES |
97 | +* 1. Get a pointer to the ENV_PARAM for the EPICS-defined |
98 | +* environment parameter EPICS_TS_NTP_INET. |
99 | +* |
100 | +* #include "envDefs.h" |
101 | +* const ENV_PARAM * pParam; |
102 | +* |
103 | +* pParam = envFindConfigParam( "EPICS_TS_NTP_INET" ); |
104 | +* if (!pParam) { |
105 | +* printf("No ENV_PARAM for EPICS_TS_NTP_INET\n" ); |
106 | +* } |
107 | +* |
108 | +*-*/ |
109 | +const ENV_PARAM * envFindConfigParam( const char * envVarName ) |
110 | +{ |
111 | + const ENV_PARAM **ppParam = env_param_list; |
112 | + |
113 | + /* Find a match with one of the EPICS env vars */ |
114 | + while (*ppParam) { |
115 | + if ( strcmp( envVarName, (*ppParam)->name ) == 0 ) { |
116 | + return *ppParam; |
117 | + } |
118 | + ppParam++; |
119 | + } |
120 | + |
121 | + return 0; |
122 | +} |
123 | + |
124 | + |
125 | |
126 | +/*+/subr********************************************************************** |
127 | * NAME envGetConfigParamPtr - returns a pointer to the configuration |
128 | * parameter value string |
129 | * |
Will you be making the necessary pvAccessCPP changes to have it use the envDefs.h envConfigParam APIs to match? Any appropriate default values should also be set in the configure/ CONFIG_ ENV and/or configure/ CONFIG_ SITE_ENV files.