Skip to contentSkip to conversation

drivers/staging: Fixed sparse error "directive in argument list"

PATCH In review Filipe Gonçalves 3 participants 5 messages Oct 11, 2014 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/staging: Fixed sparse error "directive in argument list"

This patch fixes a sparse warning on layout.c (ptlrpc) that was caused by having preprocessor directives in the arguments to a macro.

---
 drivers/staging/lustre/lustre/ptlrpc/layout.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/ptlrpc/layout.c +5 -2
index 5b83371..211df78 100644
@@ -978,10 +978,11 @@ struct req_msg_field RMF_CONN =
 EXPORT_SYMBOL(RMF_CONN);
 
 struct req_msg_field RMF_CONNECT_DATA =
+#if LUSTRE_VERSION_CODE > OBD_OCD_VERSION(2, 7, 50, 0)
 	DEFINE_MSGF("cdata",
 		    RMF_F_NO_SIZE_CHECK /* we allow extra space for interop */,
-#if LUSTRE_VERSION_CODE > OBD_OCD_VERSION(2, 7, 50, 0)
 		    sizeof(struct obd_connect_data),
+		    lustre_swab_connect, NULL);
 #else
 /* For interoperability with 1.8 and 2.0 clients/servers.
  * The RPC verification code allows larger RPC buffers, but not
@@ -990,9 +991,11 @@ struct req_msg_field RMF_CONNECT_DATA =
  * size is at least as large as obd_connect_data_v1.  That is not
  * not in itself harmful, since the chance of just corrupting this
  * field is low.  See JIRA LU-16 for details. */
+	DEFINE_MSGF("cdata",
+		    RMF_F_NO_SIZE_CHECK /* we allow extra space for interop */,
 		    sizeof(struct obd_connect_data_v1),
-#endif
 		    lustre_swab_connect, NULL);
+#endif
 EXPORT_SYMBOL(RMF_CONNECT_DATA);
 
 struct req_msg_field RMF_DLM_REQ =
Signature · 1 line
1.9.1
maintainer
#1 lore raw
Quoted 12 lines · Filipe Gonçalves

This patch fixes a sparse warning on layout.c (ptlrpc) that was caused by having preprocessor directives in the arguments to a macro.

---
 drivers/staging/lustre/lustre/ptlrpc/layout.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/ptlrpc/layout.c +0 -0
index 5b83371..211df78 100644

drivers/staging/lustre/lustre/ptlrpc/layout.c struct req_msg_field RMF_CONN = · line 985

Quoted 9 lines
drivers/staging/lustre/lustre/ptlrpc/layout.c +2 -1
@@ -978,10 +978,11 @@ struct req_msg_field RMF_CONN =
 EXPORT_SYMBOL(RMF_CONN);
 
 struct req_msg_field RMF_CONNECT_DATA =
+#if LUSTRE_VERSION_CODE > OBD_OCD_VERSION(2, 7, 50, 0)
 	DEFINE_MSGF("cdata",
 		    RMF_F_NO_SIZE_CHECK /* we allow extra space for interop */,
-#if LUSTRE_VERSION_CODE > OBD_OCD_VERSION(2, 7, 50, 0)
 		    sizeof(struct obd_connect_data),
+		    lustre_swab_connect, NULL);

Ick ick ick.

Yeah, sparse might complain about this, but how about just properly deleting the #ifdef entirely, and not perpetuate it even more?

It shouldn't be needed anymore now that the code is in the kernel tree.

greg k-h

#2 lore raw

Ah .. right! I didn't know what OBD_OCD_VERSION() was. Now I see it's a way to test kernel version. I am going to submit a new patch shortly.

Thanks,
Filipe

Quoted 32 lines · Greg KH
Quoted 12 lines · Filipe Gonçalves

This patch fixes a sparse warning on layout.c (ptlrpc) that was caused by having preprocessor directives in the arguments to a macro.

---
 drivers/staging/lustre/lustre/ptlrpc/layout.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/ptlrpc/layout.c +0 -0
index 5b83371..211df78 100644

drivers/staging/lustre/lustre/ptlrpc/layout.c struct req_msg_field RMF_CONN = · line 985

Quoted 9 lines
drivers/staging/lustre/lustre/ptlrpc/layout.c +2 -1
@@ -978,10 +978,11 @@ struct req_msg_field RMF_CONN =
 EXPORT_SYMBOL(RMF_CONN);
 
 struct req_msg_field RMF_CONNECT_DATA =
+#if LUSTRE_VERSION_CODE > OBD_OCD_VERSION(2, 7, 50, 0)
      DEFINE_MSGF("cdata",
                  RMF_F_NO_SIZE_CHECK /* we allow extra space for interop */,
-#if LUSTRE_VERSION_CODE > OBD_OCD_VERSION(2, 7, 50, 0)
                  sizeof(struct obd_connect_data),
+                 lustre_swab_connect, NULL);

Ick ick ick.

Yeah, sparse might complain about this, but how about just properly deleting the #ifdef entirely, and not perpetuate it even more?

It shouldn't be needed anymore now that the code is in the kernel tree.

greg k-h

#3 lore raw

Hello!

No, it's not the way to test the kernel version, it's the way to test internal lustre version.
Either way maintaining compatibility with Lustre 1.8 and 2.0 servers should not be important anymore, so it's fine to drop this check indeed.

Bye,
Oleg

Quoted 40 lines · Filipe Gonçalves

Ah .. right! I didn't know what OBD_OCD_VERSION() was. Now I see it's a way to test kernel version. I am going to submit a new patch shortly.

Thanks,
Filipe

Quoted 32 lines · Greg KH
Quoted 15 lines · Filipe Gonçalves

This patch fixes a sparse warning on layout.c (ptlrpc) that was caused by having preprocessor directives in the arguments to a macro.

---
drivers/staging/lustre/lustre/ptlrpc/layout.c | 7 +++++--

1 file changed, 5 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/ptlrpc/layout.c +0 -0
index 5b83371..211df78 100644
@@ -978,10 +978,11 @@ struct req_msg_field RMF_CONN =
 EXPORT_SYMBOL(RMF_CONN);
 

struct req_msg_field RMF_CONNECT_DATA =

drivers/staging/lustre/lustre/ptlrpc/layout.c struct req_msg_field RMF_CONN = · line 985

Quoted 6 lines
drivers/staging/lustre/lustre/ptlrpc/layout.c +2 -1
+#if LUSTRE_VERSION_CODE > OBD_OCD_VERSION(2, 7, 50, 0)
     DEFINE_MSGF("cdata",
                 RMF_F_NO_SIZE_CHECK /* we allow extra space for interop */,
-#if LUSTRE_VERSION_CODE > OBD_OCD_VERSION(2, 7, 50, 0)
                 sizeof(struct obd_connect_data),
+                 lustre_swab_connect, NULL);

Ick ick ick.

Yeah, sparse might complain about this, but how about just properly deleting the #ifdef entirely, and not perpetuate it even more?

It shouldn't be needed anymore now that the code is in the kernel tree.

greg k-h

#4 lore raw

Hi,

Oops.. sorry for the mess then. I am still trying to get to know the codebase. I submitted a new patch where I removed the check.

Thanks for your patience :)

Best,
Filipe

Quoted 53 lines · Oleg

Hello!

No, it's not the way to test the kernel version, it's the way to test internal lustre version.
Either way maintaining compatibility with Lustre 1.8 and 2.0 servers should not be important anymore, so it's fine to drop this check indeed.

Bye,
Oleg

Quoted 40 lines · Filipe Gonçalves

Ah .. right! I didn't know what OBD_OCD_VERSION() was. Now I see it's a way to test kernel version. I am going to submit a new patch shortly.

Thanks,
Filipe

Quoted 32 lines · Greg KH
Quoted 15 lines · Filipe Gonçalves

This patch fixes a sparse warning on layout.c (ptlrpc) that was caused by having preprocessor directives in the arguments to a macro.

---
drivers/staging/lustre/lustre/ptlrpc/layout.c | 7 +++++--

1 file changed, 5 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/ptlrpc/layout.c +0 -0
index 5b83371..211df78 100644
@@ -978,10 +978,11 @@ struct req_msg_field RMF_CONN =
 EXPORT_SYMBOL(RMF_CONN);
 

struct req_msg_field RMF_CONNECT_DATA =

drivers/staging/lustre/lustre/ptlrpc/layout.c struct req_msg_field RMF_CONN = · line 985

Quoted 6 lines
drivers/staging/lustre/lustre/ptlrpc/layout.c +2 -1
+#if LUSTRE_VERSION_CODE > OBD_OCD_VERSION(2, 7, 50, 0)
     DEFINE_MSGF("cdata",
                 RMF_F_NO_SIZE_CHECK /* we allow extra space for interop */,
-#if LUSTRE_VERSION_CODE > OBD_OCD_VERSION(2, 7, 50, 0)
                 sizeof(struct obd_connect_data),
+                 lustre_swab_connect, NULL);

Ick ick ick.

Yeah, sparse might complain about this, but how about just properly deleting the #ifdef entirely, and not perpetuate it even more?

It shouldn't be needed anymore now that the code is in the kernel tree.

greg k-h