Re: [PATCH] support: mark unused arguments in netlink handlers with UNUSED()

Steve Dickson <[email protected]>
Newsgroups gmane.linux.nfs
Message-ID <[email protected]>

On 5/25/26 8:34 AM, Jeff Layton wrote:
> 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")
> Signed-off-by: Jeff Layton <[email protected]>
Committed... (tag: nfs-utils-2-9-2-rc4)

steved
> ---
> Just some fixes for some new warnings I saw crop up recently.
> ---
>   support/nfs/nfsdnl.c | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/support/nfs/nfsdnl.c b/support/nfs/nfsdnl.c
> index ece0b57afd4b..ded035b90b1f 100644
> --- a/support/nfs/nfsdnl.c
> +++ b/support/nfs/nfsdnl.c
> @@ -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,
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.