]> git.openfabrics.org - ~shefty/ibacm.git/commitdiff
ibacm/prov: export a function to return config file name
authorKaike Wan <kaike.wan@intel.com>
Fri, 20 Jun 2014 15:54:43 +0000 (08:54 -0700)
committerSean Hefty <sean.hefty@intel.com>
Fri, 20 Jun 2014 15:54:43 +0000 (08:54 -0700)
Instead of exposing the ibacm configuration file name directly,
this patch exports a function to return the configuration file
name. This provides better encapsulation.

Signed-off-by: Kaike Wan <kaike.wan@intel.com>
Signed-off-by: Sean Hefty <sean.hefty@intel.com>
include/infiniband/acm_prov.h
prov/acmp/src/acmp.c
src/acm.c

index dcfdf5fce7373a7d57bcbe3fe54d6fe5d81935e2..9e299b98e75680f67cb216782e602b08a771ca35 100644 (file)
@@ -82,7 +82,6 @@ struct acm_provider {
 
 /* Variables exported from core */
 extern atomic_t counter[ACM_MAX_COUNTER];
-extern char *opts_file;
 
 int provider_query(struct acm_provider **info, uint32_t *version);
 
@@ -117,4 +116,6 @@ acm_alloc_sa_mad(const struct acm_endpoint *endpoint, void *context,
 extern void acm_free_sa_mad(struct acm_sa_mad *mad);
 extern int acm_send_sa_mad(struct acm_sa_mad *mad);
 
+extern char * acm_get_opts_file(void);
+
 #endif /* ACM_PROV_H */
index 45ad03b9caac11d649d57287346e01f4f561e208..5db62e25120545d0ee2bfbbec6e2f47c91868670 100644 (file)
@@ -2776,6 +2776,7 @@ static void acmp_set_options(void)
        FILE *f;
        char s[120];
        char opt[32], value[256];
+       char *opts_file = acm_get_opts_file();
 
        if (!(f = fopen(opts_file, "r")))
                return;
index 6d18ac53a16e10db8b324d84d4c16fb88878bfe4..97b773e8d02766878301efef8f7e12097148e97b 100644 (file)
--- a/src/acm.c
+++ b/src/acm.c
@@ -186,7 +186,7 @@ static struct sa_data {
  * Service options - may be set through ibacm_opts.cfg file.
  */
 static char *acme = IBACM_BIN_PATH "/ib_acme -A";
-char *opts_file = ACM_CONF_DIR "/" ACM_OPTS_FILE;
+static char *opts_file = ACM_CONF_DIR "/" ACM_OPTS_FILE;
 static char *addr_file = ACM_CONF_DIR "/" ACM_ADDR_FILE;
 static char log_file[128] = "/var/log/ibacm.log";
 static int log_level = 0;
@@ -256,6 +256,11 @@ int ib_any_gid(union ibv_gid *gid)
        return ((gid->global.subnet_prefix | gid->global.interface_id) == 0);
 }
 
+char * acm_get_opts_file(void)
+{
+       return opts_file;
+}
+
 static struct acmc_prov_context *
 acm_alloc_prov_context(struct acm_provider *prov)
 {