From patchwork Fri Jun 20 11:52:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wan, Kaike" X-Patchwork-Id: 4388551 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E35DEBEEAA for ; Fri, 20 Jun 2014 11:53:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1AB8F203DA for ; Fri, 20 Jun 2014 11:53:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E2380203B5 for ; Fri, 20 Jun 2014 11:53:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966645AbaFTLxV (ORCPT ); Fri, 20 Jun 2014 07:53:21 -0400 Received: from mga14.intel.com ([192.55.52.115]:9832 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966096AbaFTLxU (ORCPT ); Fri, 20 Jun 2014 07:53:20 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP; 20 Jun 2014 04:48:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.01,513,1400050800"; d="scan'208";a="550872010" Received: from phlsvsds.ph.intel.com ([10.228.195.38]) by fmsmga001.fm.intel.com with ESMTP; 20 Jun 2014 04:53:15 -0700 Received: from phlsvsds.ph.intel.com (localhost.localdomain [127.0.0.1]) by phlsvsds.ph.intel.com (8.13.8/8.13.8) with ESMTP id s5KBrFDX032386; Fri, 20 Jun 2014 07:53:15 -0400 Received: (from kaikewan@localhost) by phlsvsds.ph.intel.com (8.13.8/8.13.8/Submit) id s5KBrEuS032383; Fri, 20 Jun 2014 07:53:14 -0400 X-Authentication-Warning: phlsvsds.ph.intel.com: kaikewan set sender to kaike.wan@intel.com using -f From: kaike.wan@intel.com To: sean.hefty@intel.com Cc: linux-rdma@vger.kernel.org, Kaike Wan Subject: [PATCH 1/2] ibacm/prov: export a function to return config file name Date: Fri, 20 Jun 2014 07:52:45 -0400 Message-Id: <1403265166-32346-1-git-send-email-kaike.wan@intel.com> X-Mailer: git-send-email 1.7.1 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Kaike Wan 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 --- 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) {