From: kaike.wan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
To: sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Kaike Wan <kaike.wan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Subject: [PATCH 1/2] ibacm/prov: export a function to return config file name
Date: Fri, 20 Jun 2014 07:52:45 -0400 [thread overview]
Message-ID: <1403265166-32346-1-git-send-email-kaike.wan@intel.com> (raw)
From: Kaike Wan <kaike.wan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
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-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
include/infiniband/acm_prov.h | 3 ++-
prov/acmp/src/acmp.c | 1 +
src/acm.c | 7 ++++++-
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/include/infiniband/acm_prov.h b/include/infiniband/acm_prov.h
index dcfdf5f..9e299b9 100644
--- a/include/infiniband/acm_prov.h
+++ b/include/infiniband/acm_prov.h
@@ -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 */
diff --git a/prov/acmp/src/acmp.c b/prov/acmp/src/acmp.c
index 45ad03b..5db62e2 100644
--- a/prov/acmp/src/acmp.c
+++ b/prov/acmp/src/acmp.c
@@ -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;
diff --git a/src/acm.c b/src/acm.c
index 6d18ac5..97b773e 100644
--- 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)
{
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next reply other threads:[~2014-06-20 11:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-20 11:52 kaike.wan-ral2JQCrhuEAvxtiuMwx3w [this message]
[not found] ` <1403265166-32346-1-git-send-email-kaike.wan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-06-20 11:52 ` [PATCH 2/2] ibacm/prov: export a function to increment performance counters kaike.wan-ral2JQCrhuEAvxtiuMwx3w
[not found] ` <1403265166-32346-2-git-send-email-kaike.wan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-06-20 15:58 ` Hefty, Sean
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1403265166-32346-1-git-send-email-kaike.wan@intel.com \
--to=kaike.wan-ral2jqcrhueavxtiumwx3w@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox