Skip to contentSkip to conversation

Declare functions and structures as static

PATCH New Shraddha Barke 1 participant 7 messages Oct 2, 2015 Staging

lore
Share & tools
lore
#0 lore raw

v3 cover Declare functions and structures as static

These patches declare the functions and structures which are not used anywhere else as static.

Changes in v3-
These patches are made against the latest staging-testing branch.

Shraddha Barke (6):
Staging: lustre: ptlrpc: Declare sptlrpc_rule_set_merge as static
Staging: lustre: ptlrpc: Declare sptlrpc_rule_set_free as static
Staging: lustre: ptlrpc: Declare sptlrpc_rule_set_expand as static
Staging: lustre: ptlrpc: Declare sptlrpc_rule_set_choose as static
Staging: lustre: ptlrpc: Declare sptlrpc_req_replace_dead_ctx as
static
Staging: lustre: ptlrpc: Declare sptlrpc_parse_rule as static

 drivers/staging/lustre/lustre/include/lustre_sec.h | 12 -----------
 drivers/staging/lustre/lustre/ptlrpc/sec.c         |  3 +--
 drivers/staging/lustre/lustre/ptlrpc/sec_config.c  | 25 +++++++++-------------
 3 files changed, 11 insertions(+), 29 deletions(-)
Signature · 1 line
2.1.4
#1 lore raw

PATCH v3 1/6 Staging: lustre: ptlrpc: Declare sptlrpc_rule_set_merge as static

Declare sptlrpc_rule_set_merge as static since it is accessed from this particular file only. Also remove its declaration from header file

---
Changes in v3-
No change.

 drivers/staging/lustre/lustre/include/lustre_sec.h | 2 --
 drivers/staging/lustre/lustre/ptlrpc/sec_config.c  | 6 ++----
 2 files changed, 2 insertions(+), 6 deletions(-)
drivers/staging/lustre/lustre/include/lustre_sec.h +0 -2
index 1d2c572..96a717e2 100644
@@ -331,8 +331,6 @@ static inline void sptlrpc_rule_set_init(struct sptlrpc_rule_set *set)
 
 void sptlrpc_rule_set_free(struct sptlrpc_rule_set *set);
 int  sptlrpc_rule_set_expand(struct sptlrpc_rule_set *set);
-int  sptlrpc_rule_set_merge(struct sptlrpc_rule_set *set,
-			    struct sptlrpc_rule *rule);
 int sptlrpc_rule_set_choose(struct sptlrpc_rule_set *rset,
 			    enum lustre_sec_part from,
 			    enum lustre_sec_part to,
drivers/staging/lustre/lustre/ptlrpc/sec_config.c +2 -4
index 0d29b87..6fb5b4c 100644
@@ -285,8 +285,8 @@ static inline int rule_match_net(struct sptlrpc_rule *r1,
  * merge @rule into @rset.
  * the @rset slots might be expanded.
  */
-int sptlrpc_rule_set_merge(struct sptlrpc_rule_set *rset,
-			   struct sptlrpc_rule *rule)
+static int sptlrpc_rule_set_merge(struct sptlrpc_rule_set *rset,
+				  struct sptlrpc_rule *rule)
 {
 	struct sptlrpc_rule *p = rset->srs_rules;
 	int spec_dir, spec_net;
@@ -370,8 +370,6 @@ int sptlrpc_rule_set_merge(struct sptlrpc_rule_set *rset,
 
 	return 0;
 }
-EXPORT_SYMBOL(sptlrpc_rule_set_merge);
-
 /**
  * given from/to/nid, determine a matching flavor in ruleset.
  * return 1 if a match found, otherwise return 0.
Signature · 1 line
2.1.4
#2 lore raw

PATCH v3 2/6 Staging: lustre: ptlrpc: Declare sptlrpc_rule_set_free as static

In reply to Shraddha Barke

Declare sptlrpc_rule_set_free as static since it is accessed from this particular file only. Also remove its declaration from header file

---
Changes in v3-
No change.

 drivers/staging/lustre/lustre/include/lustre_sec.h | 1 -
 drivers/staging/lustre/lustre/ptlrpc/sec_config.c  | 3 +--
 2 files changed, 1 insertion(+), 3 deletions(-)
drivers/staging/lustre/lustre/include/lustre_sec.h +0 -1
index 96a717e2..d284f91 100644
@@ -329,7 +329,6 @@ static inline void sptlrpc_rule_set_init(struct sptlrpc_rule_set *set)
 	memset(set, 0, sizeof(*set));
 }
 
-void sptlrpc_rule_set_free(struct sptlrpc_rule_set *set);
 int  sptlrpc_rule_set_expand(struct sptlrpc_rule_set *set);
 int sptlrpc_rule_set_choose(struct sptlrpc_rule_set *rset,
 			    enum lustre_sec_part from,
drivers/staging/lustre/lustre/ptlrpc/sec_config.c +1 -2
index 6fb5b4c..0309817 100644
@@ -215,7 +215,7 @@ int sptlrpc_parse_rule(char *param, struct sptlrpc_rule *rule)
 }
 EXPORT_SYMBOL(sptlrpc_parse_rule);
 
-void sptlrpc_rule_set_free(struct sptlrpc_rule_set *rset)
+static void sptlrpc_rule_set_free(struct sptlrpc_rule_set *rset)
 {
 	LASSERT(rset->srs_nslot ||
 		(rset->srs_nrule == 0 && rset->srs_rules == NULL));
@@ -225,7 +225,6 @@ void sptlrpc_rule_set_free(struct sptlrpc_rule_set *rset)
 		sptlrpc_rule_set_init(rset);
 	}
 }
-EXPORT_SYMBOL(sptlrpc_rule_set_free);
 
 /*
  * return 0 if the rule set could accommodate one more rule.
Signature · 1 line
2.1.4
#3 lore raw

PATCH v3 3/6 Staging: lustre: ptlrpc: Declare sptlrpc_rule_set_expand as static

In reply to Shraddha Barke

Declare sptlrpc_rule_set_expand as static since it is accessed from this particular file only. Also remove its declaration from header file

---
Changes in v3-
No change

 drivers/staging/lustre/lustre/include/lustre_sec.h | 1 -
 drivers/staging/lustre/lustre/ptlrpc/sec_config.c  | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)
drivers/staging/lustre/lustre/include/lustre_sec.h +0 -1
index d284f91..4f1d983 100644
@@ -329,7 +329,6 @@ static inline void sptlrpc_rule_set_init(struct sptlrpc_rule_set *set)
 	memset(set, 0, sizeof(*set));
 }
 
-int  sptlrpc_rule_set_expand(struct sptlrpc_rule_set *set);
 int sptlrpc_rule_set_choose(struct sptlrpc_rule_set *rset,
 			    enum lustre_sec_part from,
 			    enum lustre_sec_part to,
drivers/staging/lustre/lustre/ptlrpc/sec_config.c +1 -1
index 0309817..0664042 100644
@@ -229,7 +229,7 @@ static void sptlrpc_rule_set_free(struct sptlrpc_rule_set *rset)
 /*
  * return 0 if the rule set could accommodate one more rule.
  */
-int sptlrpc_rule_set_expand(struct sptlrpc_rule_set *rset)
+static int sptlrpc_rule_set_expand(struct sptlrpc_rule_set *rset)
 {
 	struct sptlrpc_rule *rules;
 	int nslot;
Signature · 1 line
2.1.4
#4 lore raw

PATCH v3 4/6 Staging: lustre: ptlrpc: Declare sptlrpc_rule_set_choose as static

In reply to Shraddha Barke

Declare sptlrpc_rule_set_choose as static since it is accessed from this particular file only. Also remove its declaration from header file

---
Changes in v3-
No change

 drivers/staging/lustre/lustre/include/lustre_sec.h |  6 ------
 drivers/staging/lustre/lustre/ptlrpc/sec_config.c  | 11 +++++------
 2 files changed, 5 insertions(+), 12 deletions(-)
drivers/staging/lustre/lustre/include/lustre_sec.h +0 -6
index 4f1d983..50560a8 100644
@@ -329,12 +329,6 @@ static inline void sptlrpc_rule_set_init(struct sptlrpc_rule_set *set)
 	memset(set, 0, sizeof(*set));
 }
 
-int sptlrpc_rule_set_choose(struct sptlrpc_rule_set *rset,
-			    enum lustre_sec_part from,
-			    enum lustre_sec_part to,
-			    lnet_nid_t nid,
-			    struct sptlrpc_flavor *sf);
-
 int  sptlrpc_process_config(struct lustre_cfg *lcfg);
 void sptlrpc_conf_log_start(const char *logname);
 void sptlrpc_conf_log_stop(const char *logname);
drivers/staging/lustre/lustre/ptlrpc/sec_config.c +5 -6
index 0664042..7e698f3 100644
@@ -373,11 +373,11 @@ static int sptlrpc_rule_set_merge(struct sptlrpc_rule_set *rset,
  * given from/to/nid, determine a matching flavor in ruleset.
  * return 1 if a match found, otherwise return 0.
  */
-int sptlrpc_rule_set_choose(struct sptlrpc_rule_set *rset,
-			    enum lustre_sec_part from,
-			    enum lustre_sec_part to,
-			    lnet_nid_t nid,
-			    struct sptlrpc_flavor *sf)
+static int sptlrpc_rule_set_choose(struct sptlrpc_rule_set *rset,
+				   enum lustre_sec_part from,
+				   enum lustre_sec_part to,
+				   lnet_nid_t nid,
+				   struct sptlrpc_flavor *sf)
 {
 	struct sptlrpc_rule *r;
 	int n;
@@ -404,7 +404,6 @@ int sptlrpc_rule_set_choose(struct sptlrpc_rule_set *rset,
 
 	return 0;
 }
-EXPORT_SYMBOL(sptlrpc_rule_set_choose);
 
 /**********************************
  * sptlrpc configuration support  *
Signature · 1 line
2.1.4
#5 lore raw

PATCH v3 5/6 Staging: lustre: ptlrpc: Declare sptlrpc_req_replace_dead_ctx as static

In reply to Shraddha Barke

Declare sptlrpc_req_replace_dead_ctx as static since it is accessed from this particular file only. Also remove its declaration from header file

---
Changes in v3-
No change

 drivers/staging/lustre/lustre/include/lustre_sec.h | 1 -
 drivers/staging/lustre/lustre/ptlrpc/sec.c         | 3 +--
 2 files changed, 1 insertion(+), 3 deletions(-)
drivers/staging/lustre/lustre/include/lustre_sec.h +0 -1
index 50560a8..ab963b9 100644
@@ -1026,7 +1026,6 @@ void sptlrpc_import_flush_all_ctx(struct obd_import *imp);
 int  sptlrpc_req_get_ctx(struct ptlrpc_request *req);
 void sptlrpc_req_put_ctx(struct ptlrpc_request *req, int sync);
 int  sptlrpc_req_refresh_ctx(struct ptlrpc_request *req, long timeout);
-int  sptlrpc_req_replace_dead_ctx(struct ptlrpc_request *req);
 void sptlrpc_req_set_flavor(struct ptlrpc_request *req, int opcode);
 
 int sptlrpc_parse_rule(char *param, struct sptlrpc_rule *rule);
drivers/staging/lustre/lustre/ptlrpc/sec.c +1 -2
index 67604b5..84e9881 100644
@@ -470,7 +470,7 @@ int sptlrpc_req_ctx_switch(struct ptlrpc_request *req,
  * \note a request must have a context, to keep other parts of code happy.
  * In any case of failure during the switching, we must restore the old one.
  */
-int sptlrpc_req_replace_dead_ctx(struct ptlrpc_request *req)
+static int sptlrpc_req_replace_dead_ctx(struct ptlrpc_request *req)
 {
 	struct ptlrpc_cli_ctx *oldctx = req->rq_cli_ctx;
 	struct ptlrpc_cli_ctx *newctx;
@@ -523,7 +523,6 @@ int sptlrpc_req_replace_dead_ctx(struct ptlrpc_request *req)
 	sptlrpc_cli_ctx_put(oldctx, 1);
 	return 0;
 }
-EXPORT_SYMBOL(sptlrpc_req_replace_dead_ctx);
 
 static
 int ctx_check_refresh(struct ptlrpc_cli_ctx *ctx)
Signature · 1 line
2.1.4
#6 lore raw

PATCH v3 6/6 Staging: lustre: ptlrpc: Declare sptlrpc_parse_rule as static

In reply to Shraddha Barke

Declare sptlrpc_parse_rule as static since it is accessed from this particular file only. Also remove its declaration from header file

---
Changes in v3-
No change

 drivers/staging/lustre/lustre/include/lustre_sec.h | 1 -
 drivers/staging/lustre/lustre/ptlrpc/sec_config.c  | 3 +--
 2 files changed, 1 insertion(+), 3 deletions(-)
drivers/staging/lustre/lustre/include/lustre_sec.h +0 -1
index ab963b9..fc1f573 100644
@@ -1028,7 +1028,6 @@ void sptlrpc_req_put_ctx(struct ptlrpc_request *req, int sync);
 int  sptlrpc_req_refresh_ctx(struct ptlrpc_request *req, long timeout);
 void sptlrpc_req_set_flavor(struct ptlrpc_request *req, int opcode);
 
-int sptlrpc_parse_rule(char *param, struct sptlrpc_rule *rule);
 
 /* gc */
 void sptlrpc_gc_add_sec(struct ptlrpc_sec *sec);
drivers/staging/lustre/lustre/ptlrpc/sec_config.c +1 -2
index 7e698f3..c96a5c7 100644
@@ -159,7 +159,7 @@ static void sptlrpc_rule_init(struct sptlrpc_rule *rule)
 /*
  * format: network[.direction]=flavor
  */
-int sptlrpc_parse_rule(char *param, struct sptlrpc_rule *rule)
+static int sptlrpc_parse_rule(char *param, struct sptlrpc_rule *rule)
 {
 	char *flavor, *dir;
 	int rc;
@@ -213,7 +213,6 @@ int sptlrpc_parse_rule(char *param, struct sptlrpc_rule *rule)
 
 	return 0;
 }
-EXPORT_SYMBOL(sptlrpc_parse_rule);
 
 static void sptlrpc_rule_set_free(struct sptlrpc_rule_set *rset)
 {
Signature · 1 line
2.1.4