Skip to contentSkip to conversation

support: mark unused arguments in netlink handlers with UNUSED()

PATCH In review Jeff Layton 2 participants 2 messages May 25 – May 30

Subsystems (2)
lore
Share & tools
lore

Jeff Layton

author maintainer
#0 lore raw

PATCH 1/1 support: mark unused arguments in netlink handlers with UNUSED()

Use the project's UNUSED() macro from nfslib.h to suppress -Wunused-parameter warnings on the error_handler, finish_handler, and ack_handler callback parameters that are required by the libnl callback signatures but not referenced in the function bodies.

Fixes 3ddc8e81240f ("exportfs: release NFSv4 state when last client is unexported")

---
Just some fixes for some new warnings I saw crop up recently.

---
 support/nfs/nfsdnl.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
support/nfs/nfsdnl.c +4 -3
index ece0b57afd4b..ded035b90b1f 100644
@@ -16,6 +16,7 @@
 #include <netlink/msg.h>
 #include <netlink/attr.h>
 
+#include "nfslib.h"
 #include "xlog.h"
 #include "nfsdnl.h"
 
@@ -27,7 +28,7 @@
 
 #define NFSDNL_BUFSIZE	(4096)
 
-static int error_handler(struct sockaddr_nl *nla, struct nlmsgerr *err,
+static int error_handler(struct sockaddr_nl *UNUSED(nla), struct nlmsgerr *err,
 			 void *arg)
 {
 	int *ret = arg;
@@ -35,14 +36,14 @@ static int error_handler(struct sockaddr_nl *nla, struct nlmsgerr *err,
 	return NL_STOP;
 }
 
-static int finish_handler(struct nl_msg *msg, void *arg)
+static int finish_handler(struct nl_msg *UNUSED(msg), void *arg)
 {
 	int *ret = arg;
 	*ret = 0;
 	return NL_SKIP;
 }
 
-static int ack_handler(struct nl_msg *msg __attribute__((unused)),
+static int ack_handler(struct nl_msg *UNUSED(msg),
 		       void *arg)
 {
 	int *ret = arg;

---
base-commit: a806c9d65662ecf5d40c00d60a514e13ada8d76e
change-id: 20260525-fixes-2d98ed62dfae

Best regards,

Signature · 1 line
Jeff Layton <[email protected]>
#1 lore raw
Quoted 7 lines · Jeff Layton

Use the project's UNUSED() macro from nfslib.h to suppress -Wunused-parameter warnings on the error_handler, finish_handler, and ack_handler callback parameters that are required by the libnl callback signatures but not referenced in the function bodies.

Fixes 3ddc8e81240f ("exportfs: release NFSv4 state when last client is unexported")

Committed... (tag: nfs-utils-2-9-2-rc4)

steved

Quoted 50 lines

---
Just some fixes for some new warnings I saw crop up recently.

---
  support/nfs/nfsdnl.c | 7 ++++---
  1 file changed, 4 insertions(+), 3 deletions(-)
support/nfs/nfsdnl.c +4 -4
index ece0b57afd4b..ded035b90b1f 100644
@@ -16,6 +16,7 @@
  #include <netlink/msg.h>
  #include <netlink/attr.h>
 
+#include "nfslib.h"
  #include "xlog.h"
  #include "nfsdnl.h"
 
@@ -27,7 +28,7 @@
 
  #define NFSDNL_BUFSIZE	(4096)
 
-static int error_handler(struct sockaddr_nl *nla, struct nlmsgerr *err,
+static int error_handler(struct sockaddr_nl *UNUSED(nla), struct nlmsgerr *err,
  			 void *arg)
  {
  	int *ret = arg;
@@ -35,14 +36,14 @@ static int error_handler(struct sockaddr_nl *nla, struct nlmsgerr *err,
  	return NL_STOP;
  }
 
-static int finish_handler(struct nl_msg *msg, void *arg)
+static int finish_handler(struct nl_msg *UNUSED(msg), void *arg)
  {
  	int *ret = arg;
  	*ret = 0;
  	return NL_SKIP;
  }
 
-static int ack_handler(struct nl_msg *msg __attribute__((unused)),
+static int ack_handler(struct nl_msg *UNUSED(msg),
  		       void *arg)
  {
  	int *ret = arg;
 
---

base-commit: a806c9d65662ecf5d40c00d60a514e13ada8d76e
change-id: 20260525-fixes-2d98ed62dfae

Best regards,