Skip to contentSkip to conversation

Declare functions and structures as static

PATCH Superseded Shraddha Barke 3 participants 11 messages Oct 2, 2015 Staging

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Declare functions and structures as static

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

Changes in v2-
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 v2 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 v2-
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
#6 lore raw

PATCH v2 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 v2-
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
#7 lore raw

PATCH v2 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 v2-
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
#8 lore raw

PATCH v2 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 v2-
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
#9 lore raw

PATCH v2 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 it's declaration from header file

---
Changes in v2-
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
#10 lore raw

PATCH v2 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 it's declaration from header file

---
Changes in v2-
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
#2 lore raw

Re: [Outreachy kernel] [PATCH v2 1/6] Staging: lustre: ptlrpc: Declare sptlrpc_rule_set_merge as static

In reply to Shraddha Barke
Quoted 6 lines · Shraddha Barke

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 v2-
No change

Hi,

You need to write 'Changes in v2' part under --- . So that when the patch will be applied, part under --- will go away.

Quoted 52 lines
---
 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 -5
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.
--

2.1.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1443773747-2985-2-git-send-email-shraddha.6596%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Signature · 1 line
Vaishali
#3 lore raw

Re: [Outreachy kernel] [PATCH v2 1/6] Staging: lustre: ptlrpc: Declare sptlrpc_rule_set_merge as static

Quoted 5 lines · Vaishali Thakkar
Quoted 4 lines · Shraddha Barke

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

Quoted 7 lines
Quoted 2 lines

Changes in v2-
No change

Hi,

You need to write 'Changes in v2' part under --- . So that when the patch will be applied, part under --- will go away.

Shoot. Will I have to send v3 ? Or just that one patch again?

Quoted 59 lines
Quoted 53 lines
---
 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 -5
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.
--

2.1.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1443773747-2985-2-git-send-email-shraddha.6596%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Signature · 1 line
Vaishali
#4 lore raw

Re: [Outreachy kernel] [PATCH v2 1/6] Staging: lustre: ptlrpc: Declare sptlrpc_rule_set_merge as static

Quoted 15 lines · Shraddha Barke
Quoted 11 lines · Vaishali Thakkar
Quoted 7 lines · Shraddha Barke

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 v2-
No change

Quoted 8 lines
Quoted 5 lines

Hi,

You need to write 'Changes in v2' part under --- . So that when the patch will
be applied, part under --- will go away.

Shoot. Will I have to send v3 ? Or just that one patch again?

If Greg has not yet applied any of the patches from this series, then it is better to send v3 of whole series so that it will be easy for him to pick all these patches at a time without any confusion.

Quoted 69 lines
Quoted 68 lines
Quoted 52 lines
---
 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 -2
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;
drivers/staging/lustre/lustre/ptlrpc/sec_config.c +0 -2
@@ -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.
--
2.1.4

Quoted 9 lines

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected]. To view this discussion on the web visit
https://groups.google.com/d/msgid/outreachy-kernel/1443773747-2985-2-git-send-email-shraddha.6596%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
Vaishali

Signature · 1 line
Vaishali
maintainer
#5 lore raw

Re: [Outreachy kernel] [PATCH v2 1/6] Staging: lustre: ptlrpc: Declare sptlrpc_rule_set_merge as static

In reply to Shraddha Barke
Quoted 12 lines · Shraddha Barke
Quoted 8 lines · Vaishali Thakkar
Quoted 6 lines · Shraddha Barke

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 v2-
No change

Quoted 6 lines
Quoted 4 lines

Hi,

You need to write 'Changes in v2' part under --- . So that when the patch will be applied, part under --- will go away.

Shoot. Will I have to send v3 ? Or just that one patch again?

Please send a whole new series, that's much easier for me to handle than individual patch versions.

thanks,

greg k-h