1 /* SPDX-License-Identifier: GPL-2.0 */ 1 2 /* 3 * Copyright (C) 2024 Mike Snitzer <snitzer@ha 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 opaqu 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 lo 24 * possible with its server. 25 * 26 * See Documentation/filesystems/nfs/localio.r 27 */ 28 typedef struct { 29 uuid_t uuid; 30 struct list_head list; 31 struct net __rcu *net; /* nfsd's netwo 32 struct auth_domain *dom; /* auth_domai 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 39 struct net *, struct au 40 void nfs_uuid_invalidate_clients(struct list_h 41 void nfs_uuid_invalidate_one_client(nfs_uuid_t 42 43 /* localio needs to map filehandle -> struct n 44 extern struct nfsd_file * 45 nfsd_open_local_fh(struct net *, struct auth_d 46 const struct cred *, const 47 const fmode_t) __must_hold( 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 53 54 55 56 57 58 void (*nfsd_file_put_local)(struct nfs 59 struct file *(*nfsd_file_file)(struct 60 } ____cacheline_aligned; 61 62 extern void nfsd_localio_ops_init(void); 63 extern const struct nfsd_localio_operations *n 64 65 struct nfsd_file *nfs_open_local_fh(nfs_uuid_t 66 struct rpc_clnt *, const st 67 const struct nfs_fh *, cons 68 69 static inline void nfs_to_nfsd_file_put_local( 70 { 71 /* 72 * Once reference to nfsd_serv is drop 73 * unloaded, so ensure safe return fro 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( 86 { 87 } 88 #endif /* CONFIG_NFS_LOCALIO */ 89 90 #endif /* __LINUX_NFSLOCALIO_H */ 91
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.