]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
lockd: Rename struct nlm_cookie to lockd_cookie
authorChuck Lever <chuck.lever@oracle.com>
Tue, 12 May 2026 18:13:42 +0000 (14:13 -0400)
committerChuck Lever <cel@kernel.org>
Tue, 9 Jun 2026 20:32:59 +0000 (16:32 -0400)
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 <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/lockd/clnt4xdr.c
fs/lockd/clntproc.c
fs/lockd/clntxdr.c
fs/lockd/lockd.h
fs/lockd/svc4proc.c
fs/lockd/svclock.c
fs/lockd/svcxdr.h
fs/lockd/xdr.h

index 2058733eacf838d15483d45a7c961038ba0c434c..6d881f9702a92df8050993bfe4b16e0621b2af62 100644 (file)
@@ -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;
index 7f211008a5d2fa71bde8eb87e5ee47d7da98f777..50cfab2f31c7ac9a7f7eca0d54c71b2993c82114 100644 (file)
@@ -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);
 
index 65555f5224b14b4fe9ae7632aab75d68ba65e5d0..2a4d28847254832594d265994babd7176a0d79c5 100644 (file)
@@ -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;
index 1db6cb3525425d05afa823abe5c1dd8ba090742b..11981856850746b0aee2f93f2d48faee940912ec 100644 (file)
@@ -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);
index e3a6d69c1fa6686d0249f8313ffc24aad39cace7..249ef49f1bcd1d0a77e09eb8dc48794f9f0d26e6 100644 (file)
@@ -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;
index f4520149d6d79428e9454d4e3306ca7b841380c1..7fb03042ebee4b0bded655019b53841a1e97920f 100644 (file)
@@ -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;
index 4f1a451da5ba23794903bb34697dfa9197993580..911b5fd707b1bfd8c929af5e9cd31670ac43802e 100644 (file)
@@ -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;
 
index 3c60817c4349a0d22a83808caf91b6cc2139bf7e..c7e0518862d7eeef4a08ecebd3e039f908ab33ad 100644 (file)
@@ -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;
 };