~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/nfslocalio.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 /*
  3  * Copyright (C) 2024 Mike Snitzer <snitzer@hammerspace.com>
  4  * Copyright (C) 2024 NeilBrown <neilb@suse.de>
  5  */
  6 #ifndef __LINUX_NFSLOCALIO_H
  7 #define __LINUX_NFSLOCALIO_H
  8 
  9 /* nfsd_file structure is purposely kept opaque to NFS client */
 10 struct nfsd_file;
 11 
 12 #if IS_ENABLED(CONFIG_NFS_LOCALIO)
 13 
 14 #include <linux/module.h>
 15 #include <linux/list.h>
 16 #include <linux/uuid.h>
 17 #include <linux/sunrpc/clnt.h>
 18 #include <linux/sunrpc/svcauth.h>
 19 #include <linux/nfs.h>
 20 #include <net/net_namespace.h>
 21 
 22 /*
 23  * Useful to allow a client to negotiate if localio
 24  * possible with its server.
 25  *
 26  * See Documentation/filesystems/nfs/localio.rst for more detail.
 27  */
 28 typedef struct {
 29         uuid_t uuid;
 30         struct list_head list;
 31         struct net __rcu *net; /* nfsd's network namespace */
 32         struct auth_domain *dom; /* auth_domain for localio */
 33 } nfs_uuid_t;
 34 
 35 void nfs_uuid_init(nfs_uuid_t *);
 36 bool nfs_uuid_begin(nfs_uuid_t *);
 37 void nfs_uuid_end(nfs_uuid_t *);
 38 void nfs_uuid_is_local(const uuid_t *, struct list_head *,
 39                        struct net *, struct auth_domain *, struct module *);
 40 void nfs_uuid_invalidate_clients(struct list_head *list);
 41 void nfs_uuid_invalidate_one_client(nfs_uuid_t *nfs_uuid);
 42 
 43 /* localio needs to map filehandle -> struct nfsd_file */
 44 extern struct nfsd_file *
 45 nfsd_open_local_fh(struct net *, struct auth_domain *, struct rpc_clnt *,
 46                    const struct cred *, const struct nfs_fh *,
 47                    const fmode_t) __must_hold(rcu);
 48 
 49 struct nfsd_localio_operations {
 50         bool (*nfsd_serv_try_get)(struct net *);
 51         void (*nfsd_serv_put)(struct net *);
 52         struct nfsd_file *(*nfsd_open_local_fh)(struct net *,
 53                                                 struct auth_domain *,
 54                                                 struct rpc_clnt *,
 55                                                 const struct cred *,
 56                                                 const struct nfs_fh *,
 57                                                 const fmode_t);
 58         void (*nfsd_file_put_local)(struct nfsd_file *);
 59         struct file *(*nfsd_file_file)(struct nfsd_file *);
 60 } ____cacheline_aligned;
 61 
 62 extern void nfsd_localio_ops_init(void);
 63 extern const struct nfsd_localio_operations *nfs_to;
 64 
 65 struct nfsd_file *nfs_open_local_fh(nfs_uuid_t *,
 66                    struct rpc_clnt *, const struct cred *,
 67                    const struct nfs_fh *, const fmode_t);
 68 
 69 static inline void nfs_to_nfsd_file_put_local(struct nfsd_file *localio)
 70 {
 71         /*
 72          * Once reference to nfsd_serv is dropped, NFSD could be
 73          * unloaded, so ensure safe return from nfsd_file_put_local()
 74          * by always taking RCU.
 75          */
 76         rcu_read_lock();
 77         nfs_to->nfsd_file_put_local(localio);
 78         rcu_read_unlock();
 79 }
 80 
 81 #else   /* CONFIG_NFS_LOCALIO */
 82 static inline void nfsd_localio_ops_init(void)
 83 {
 84 }
 85 static inline void nfs_to_nfsd_file_put_local(struct nfsd_file *localio)
 86 {
 87 }
 88 #endif  /* CONFIG_NFS_LOCALIO */
 89 
 90 #endif  /* __LINUX_NFSLOCALIO_H */
 91 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php