From: Chuck Lever Date: Tue, 12 May 2026 18:13:42 +0000 (-0400) Subject: lockd: Rename struct nlm_cookie to lockd_cookie X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b3ef4d4688ebb78ed46d9c3adc6f2b82f1e05721;p=thirdparty%2Flinux.git lockd: Rename struct nlm_cookie to lockd_cookie Machine-generated XDR types derived from the NLM specification use names that match the protocol. Internal lockd types with identical names cause compilation failures when machine-generated encoders replace hand-coded ones. Rename the internal struct nlm_cookie type to lockd_cookie to prevent such collisions. The "lockd_" prefix distinguishes implementation-specific types from specified NLM protocol types. Reviewed-by: Jeff Layton Signed-off-by: Chuck Lever --- diff --git a/fs/lockd/clnt4xdr.c b/fs/lockd/clnt4xdr.c index 2058733eacf83..6d881f9702a92 100644 --- a/fs/lockd/clnt4xdr.c +++ b/fs/lockd/clnt4xdr.c @@ -132,13 +132,13 @@ static int decode_netobj(struct xdr_stream *xdr, * netobj cookie; */ static void encode_cookie(struct xdr_stream *xdr, - const struct nlm_cookie *cookie) + const struct lockd_cookie *cookie) { encode_netobj(xdr, (u8 *)&cookie->data, cookie->len); } static int decode_cookie(struct xdr_stream *xdr, - struct nlm_cookie *cookie) + struct lockd_cookie *cookie) { u32 length; __be32 *p; diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c index 7f211008a5d2f..50cfab2f31c7a 100644 --- a/fs/lockd/clntproc.c +++ b/fs/lockd/clntproc.c @@ -42,7 +42,7 @@ static const struct rpc_call_ops nlmclnt_cancel_ops; */ static atomic_t nlm_cookie = ATOMIC_INIT(0x1234); -void nlmclnt_next_cookie(struct nlm_cookie *c) +void nlmclnt_next_cookie(struct lockd_cookie *c) { u32 cookie = atomic_inc_return(&nlm_cookie); diff --git a/fs/lockd/clntxdr.c b/fs/lockd/clntxdr.c index 65555f5224b14..2a4d288472548 100644 --- a/fs/lockd/clntxdr.c +++ b/fs/lockd/clntxdr.c @@ -130,13 +130,13 @@ static int decode_netobj(struct xdr_stream *xdr, * netobj cookie; */ static void encode_cookie(struct xdr_stream *xdr, - const struct nlm_cookie *cookie) + const struct lockd_cookie *cookie) { encode_netobj(xdr, (u8 *)&cookie->data, cookie->len); } static int decode_cookie(struct xdr_stream *xdr, - struct nlm_cookie *cookie) + struct lockd_cookie *cookie) { u32 length; __be32 *p; diff --git a/fs/lockd/lockd.h b/fs/lockd/lockd.h index 1db6cb3525425..1198185685074 100644 --- a/fs/lockd/lockd.h +++ b/fs/lockd/lockd.h @@ -257,7 +257,7 @@ __be32 nlmclnt_grant(const struct sockaddr *addr, void nlmclnt_recovery(struct nlm_host *); int nlmclnt_reclaim(struct nlm_host *, struct file_lock *, struct nlm_rqst *); -void nlmclnt_next_cookie(struct nlm_cookie *); +void nlmclnt_next_cookie(struct lockd_cookie *); #ifdef CONFIG_LOCKD_V4 extern const struct rpc_version nlm_version4; @@ -314,7 +314,7 @@ typedef int (*nlm_host_match_fn_t)(void *cur, struct nlm_host *ref); int lock_to_openmode(struct file_lock *); __be32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *, struct nlm_host *, struct nlm_lock *, int, - struct nlm_cookie *, int); + struct lockd_cookie *, int); __be32 nlmsvc_unlock(struct net *net, struct nlm_file *, struct nlm_lock *); __be32 nlmsvc_testlock(struct svc_rqst *rqstp, struct nlm_file *file, struct nlm_host *host, struct nlm_lock *lock, @@ -323,7 +323,7 @@ __be32 nlmsvc_cancel_blocked(struct net *net, struct nlm_file *, struct nlm_l void nlmsvc_retry_blocked(struct svc_rqst *rqstp); void nlmsvc_traverse_blocks(struct nlm_host *, struct nlm_file *, nlm_host_match_fn_t match); -void nlmsvc_grant_reply(struct nlm_cookie *, __be32); +void nlmsvc_grant_reply(struct lockd_cookie *, __be32); void nlmsvc_release_call(struct nlm_rqst *); void nlmsvc_locks_init_private(struct file_lock *, struct nlm_host *, pid_t); int nlmsvc_dispatch(struct svc_rqst *rqstp); diff --git a/fs/lockd/svc4proc.c b/fs/lockd/svc4proc.c index e3a6d69c1fa66..249ef49f1bcd1 100644 --- a/fs/lockd/svc4proc.c +++ b/fs/lockd/svc4proc.c @@ -39,7 +39,7 @@ static_assert(offsetof(struct nlm4_testargs_wrapper, xdrgen) == 0); struct nlm4_lockargs_wrapper { struct nlm4_lockargs xdrgen; - struct nlm_cookie cookie; + struct lockd_cookie cookie; struct nlm_lock lock; }; @@ -88,7 +88,7 @@ static_assert(offsetof(struct nlm4_testres_wrapper, xdrgen) == 0); struct nlm4_res_wrapper { struct nlm4_res xdrgen; - struct nlm_cookie cookie; + struct lockd_cookie cookie; }; static_assert(offsetof(struct nlm4_res_wrapper, xdrgen) == 0); @@ -100,7 +100,7 @@ struct nlm4_shareres_wrapper { static_assert(offsetof(struct nlm4_shareres_wrapper, xdrgen) == 0); static __be32 -nlm4_netobj_to_cookie(struct nlm_cookie *cookie, netobj *object) +nlm4_netobj_to_cookie(struct lockd_cookie *cookie, netobj *object) { if (object->len > NLM_MAXCOOKIELEN) return nlm_lck_denied_nolocks; diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c index f4520149d6d79..7fb03042ebee4 100644 --- a/fs/lockd/svclock.c +++ b/fs/lockd/svclock.c @@ -48,7 +48,7 @@ static LIST_HEAD(nlm_blocked); static DEFINE_SPINLOCK(nlm_blocked_lock); #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) -static const char *nlmdbg_cookie2a(const struct nlm_cookie *cookie) +static const char *nlmdbg_cookie2a(const struct lockd_cookie *cookie) { /* * We can get away with a static buffer because this is only called @@ -75,7 +75,7 @@ static const char *nlmdbg_cookie2a(const struct nlm_cookie *cookie) return buf; } #else -static inline const char *nlmdbg_cookie2a(const struct nlm_cookie *cookie) +static inline const char *nlmdbg_cookie2a(const struct lockd_cookie *cookie) { return "???"; } @@ -171,7 +171,7 @@ nlmsvc_lookup_block(struct nlm_file *file, struct nlm_lock *lock) return NULL; } -static inline int nlm_cookie_match(struct nlm_cookie *a, struct nlm_cookie *b) +static int lockd_cookie_match(struct lockd_cookie *a, struct lockd_cookie *b) { if (a->len != b->len) return 0; @@ -184,13 +184,13 @@ static inline int nlm_cookie_match(struct nlm_cookie *a, struct nlm_cookie *b) * Find a block with a given NLM cookie. */ static inline struct nlm_block * -nlmsvc_find_block(struct nlm_cookie *cookie) +nlmsvc_find_block(struct lockd_cookie *cookie) { struct nlm_block *block; spin_lock(&nlm_blocked_lock); list_for_each_entry(block, &nlm_blocked, b_list) { - if (nlm_cookie_match(&block->b_call->a_args.cookie,cookie)) + if (lockd_cookie_match(&block->b_call->a_args.cookie, cookie)) goto found; } spin_unlock(&nlm_blocked_lock); @@ -222,7 +222,7 @@ found: static struct nlm_block * nlmsvc_create_block(struct svc_rqst *rqstp, struct nlm_host *host, struct nlm_file *file, struct nlm_lock *lock, - struct nlm_cookie *cookie) + struct lockd_cookie *cookie) { struct nlm_block *block; struct nlm_rqst *call = NULL; @@ -477,7 +477,7 @@ nlmsvc_defer_lock_rqst(struct svc_rqst *rqstp, struct nlm_block *block) __be32 nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file, struct nlm_host *host, struct nlm_lock *lock, int wait, - struct nlm_cookie *cookie, int reclaim) + struct lockd_cookie *cookie, int reclaim) { struct inode *inode __maybe_unused = nlmsvc_file_inode(file); struct nlm_block *block = NULL; @@ -982,7 +982,7 @@ static const struct rpc_call_ops nlmsvc_grant_ops = { * block. */ void -nlmsvc_grant_reply(struct nlm_cookie *cookie, __be32 status) +nlmsvc_grant_reply(struct lockd_cookie *cookie, __be32 status) { struct nlm_block *block; struct file_lock *fl; diff --git a/fs/lockd/svcxdr.h b/fs/lockd/svcxdr.h index 4f1a451da5ba2..911b5fd707b1b 100644 --- a/fs/lockd/svcxdr.h +++ b/fs/lockd/svcxdr.h @@ -70,7 +70,7 @@ svcxdr_decode_string(struct xdr_stream *xdr, char **data, unsigned int *data_len * specially. */ static inline bool -svcxdr_decode_cookie(struct xdr_stream *xdr, struct nlm_cookie *cookie) +svcxdr_decode_cookie(struct xdr_stream *xdr, struct lockd_cookie *cookie) { __be32 *p; u32 len; @@ -98,7 +98,7 @@ out_hpux: } static inline bool -svcxdr_encode_cookie(struct xdr_stream *xdr, const struct nlm_cookie *cookie) +svcxdr_encode_cookie(struct xdr_stream *xdr, const struct lockd_cookie *cookie) { __be32 *p; diff --git a/fs/lockd/xdr.h b/fs/lockd/xdr.h index 3c60817c4349a..c7e0518862d7e 100644 --- a/fs/lockd/xdr.h +++ b/fs/lockd/xdr.h @@ -49,8 +49,7 @@ struct nlm_lock { * 32 bytes. */ -struct nlm_cookie -{ +struct lockd_cookie { unsigned char data[NLM_MAXCOOKIELEN]; unsigned int len; }; @@ -59,7 +58,7 @@ struct nlm_cookie * Generic lockd arguments for all but sm_notify */ struct nlm_args { - struct nlm_cookie cookie; + struct lockd_cookie cookie; struct nlm_lock lock; u32 block; u32 reclaim; @@ -73,7 +72,7 @@ struct nlm_args { * Generic lockd result */ struct nlm_res { - struct nlm_cookie cookie; + struct lockd_cookie cookie; __be32 status; struct nlm_lock lock; };