All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
To: lustre-devel@lists.lustre.org
Subject: [lustre-devel] [PATCH v2] staging: lustre: ptlrpc: constify ptlrpc_sec_cops structs
Date: Fri, 27 Nov 2015 22:41:23 +0200	[thread overview]
Message-ID: <20151127204123.GA8719@waves> (raw)

Constifies ptlrpc_sec_cops structures in the lustre driver
since they are not modified after their initialization.

Detected and found using Coccinelle.

Suggested-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
---
Changelog:
	v2: added const to a ptlrpc_sec_cops structure
	in the definition of ptlrpc_sec_policy
	
 drivers/staging/lustre/lustre/include/lustre_sec.h | 2 +-
 drivers/staging/lustre/lustre/ptlrpc/sec.c         | 2 +-
 drivers/staging/lustre/lustre/ptlrpc/sec_null.c    | 2 +-
 drivers/staging/lustre/lustre/ptlrpc/sec_plain.c   | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_sec.h b/drivers/staging/lustre/lustre/include/lustre_sec.h
index dd1033b..de35e2f 100644
--- a/drivers/staging/lustre/lustre/include/lustre_sec.h
+++ b/drivers/staging/lustre/lustre/include/lustre_sec.h
@@ -779,7 +779,7 @@ struct ptlrpc_sec_policy {
 	struct module		   *sp_owner;
 	char			   *sp_name;
 	__u16			   sp_policy; /* policy number */
-	struct ptlrpc_sec_cops	 *sp_cops;   /* client ops */
+	const struct ptlrpc_sec_cops	 *sp_cops;   /* client ops */
 	struct ptlrpc_sec_sops	 *sp_sops;   /* server ops */
 };
 
diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec.c b/drivers/staging/lustre/lustre/ptlrpc/sec.c
index 39f5261..f959897 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/sec.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/sec.c
@@ -1580,7 +1580,7 @@ int sptlrpc_cli_enlarge_reqbuf(struct ptlrpc_request *req,
 			       int segment, int newsize)
 {
 	struct ptlrpc_cli_ctx *ctx = req->rq_cli_ctx;
-	struct ptlrpc_sec_cops *cops;
+	const struct ptlrpc_sec_cops *cops;
 	struct lustre_msg *msg = req->rq_reqmsg;
 
 	LASSERT(ctx);
diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_null.c b/drivers/staging/lustre/lustre/ptlrpc/sec_null.c
index ebfa609..ffdad15 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/sec_null.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/sec_null.c
@@ -378,7 +378,7 @@ static struct ptlrpc_ctx_ops null_ctx_ops = {
 	.verify		 = null_ctx_verify,
 };
 
-static struct ptlrpc_sec_cops null_sec_cops = {
+static const struct ptlrpc_sec_cops null_sec_cops = {
 	.create_sec	     = null_create_sec,
 	.destroy_sec	    = null_destroy_sec,
 	.lookup_ctx	     = null_lookup_ctx,
diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_plain.c b/drivers/staging/lustre/lustre/ptlrpc/sec_plain.c
index f448b45..71351de 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/sec_plain.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/sec_plain.c
@@ -956,7 +956,7 @@ static struct ptlrpc_ctx_ops plain_ctx_ops = {
 	.unwrap_bulk	    = plain_cli_unwrap_bulk,
 };
 
-static struct ptlrpc_sec_cops plain_sec_cops = {
+static const struct ptlrpc_sec_cops plain_sec_cops = {
 	.create_sec	     = plain_create_sec,
 	.destroy_sec	    = plain_destroy_sec,
 	.kill_sec	       = plain_kill_sec,
-- 
2.4.3


-- 
Kind Regards,
Aya Saif El-yazal Mahfouz

WARNING: multiple messages have this Message-ID (diff)
From: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
To: Oleg Drokin <oleg.drokin@intel.com>,
	Andreas Dilger <andreas.dilger@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Julia Lawall <Julia.Lawall@lip6.fr>,
	lustre-devel@lists.lustre.org, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH v2] staging: lustre: ptlrpc: constify ptlrpc_sec_cops structs
Date: Fri, 27 Nov 2015 22:41:23 +0200	[thread overview]
Message-ID: <20151127204123.GA8719@waves> (raw)

Constifies ptlrpc_sec_cops structures in the lustre driver
since they are not modified after their initialization.

Detected and found using Coccinelle.

Suggested-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
---
Changelog:
	v2: added const to a ptlrpc_sec_cops structure
	in the definition of ptlrpc_sec_policy
	
 drivers/staging/lustre/lustre/include/lustre_sec.h | 2 +-
 drivers/staging/lustre/lustre/ptlrpc/sec.c         | 2 +-
 drivers/staging/lustre/lustre/ptlrpc/sec_null.c    | 2 +-
 drivers/staging/lustre/lustre/ptlrpc/sec_plain.c   | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_sec.h b/drivers/staging/lustre/lustre/include/lustre_sec.h
index dd1033b..de35e2f 100644
--- a/drivers/staging/lustre/lustre/include/lustre_sec.h
+++ b/drivers/staging/lustre/lustre/include/lustre_sec.h
@@ -779,7 +779,7 @@ struct ptlrpc_sec_policy {
 	struct module		   *sp_owner;
 	char			   *sp_name;
 	__u16			   sp_policy; /* policy number */
-	struct ptlrpc_sec_cops	 *sp_cops;   /* client ops */
+	const struct ptlrpc_sec_cops	 *sp_cops;   /* client ops */
 	struct ptlrpc_sec_sops	 *sp_sops;   /* server ops */
 };
 
diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec.c b/drivers/staging/lustre/lustre/ptlrpc/sec.c
index 39f5261..f959897 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/sec.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/sec.c
@@ -1580,7 +1580,7 @@ int sptlrpc_cli_enlarge_reqbuf(struct ptlrpc_request *req,
 			       int segment, int newsize)
 {
 	struct ptlrpc_cli_ctx *ctx = req->rq_cli_ctx;
-	struct ptlrpc_sec_cops *cops;
+	const struct ptlrpc_sec_cops *cops;
 	struct lustre_msg *msg = req->rq_reqmsg;
 
 	LASSERT(ctx);
diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_null.c b/drivers/staging/lustre/lustre/ptlrpc/sec_null.c
index ebfa609..ffdad15 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/sec_null.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/sec_null.c
@@ -378,7 +378,7 @@ static struct ptlrpc_ctx_ops null_ctx_ops = {
 	.verify		 = null_ctx_verify,
 };
 
-static struct ptlrpc_sec_cops null_sec_cops = {
+static const struct ptlrpc_sec_cops null_sec_cops = {
 	.create_sec	     = null_create_sec,
 	.destroy_sec	    = null_destroy_sec,
 	.lookup_ctx	     = null_lookup_ctx,
diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_plain.c b/drivers/staging/lustre/lustre/ptlrpc/sec_plain.c
index f448b45..71351de 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/sec_plain.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/sec_plain.c
@@ -956,7 +956,7 @@ static struct ptlrpc_ctx_ops plain_ctx_ops = {
 	.unwrap_bulk	    = plain_cli_unwrap_bulk,
 };
 
-static struct ptlrpc_sec_cops plain_sec_cops = {
+static const struct ptlrpc_sec_cops plain_sec_cops = {
 	.create_sec	     = plain_create_sec,
 	.destroy_sec	    = plain_destroy_sec,
 	.kill_sec	       = plain_kill_sec,
-- 
2.4.3


-- 
Kind Regards,
Aya Saif El-yazal Mahfouz

             reply	other threads:[~2015-11-27 20:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-27 20:41 Aya Mahfouz [this message]
2015-11-27 20:41 ` [PATCH v2] staging: lustre: ptlrpc: constify ptlrpc_sec_cops structs Aya Mahfouz

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=20151127204123.GA8719@waves \
    --to=mahfouz.saif.elyazal@gmail.com \
    --cc=lustre-devel@lists.lustre.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.