FILE
export.h
File preview with syntax highlighting.
linux-6.19.14/fs/nfsd/export.h
1/* SPDX-License-Identifier: GPL-2.0 */ 2/* 3 * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de> 4 */ 5#ifndef NFSD_EXPORT_H 6#define NFSD_EXPORT_H 7 8#include <linux/sunrpc/cache.h> 9#include <linux/percpu_counter.h> 10#include <linux/workqueue.h> 11#include <uapi/linux/nfsd/export.h> 12#include <linux/nfs4.h> 13 14struct knfsd_fh; 15struct svc_fh; 16struct svc_rqst; 17 18/* 19 * FS Locations 20 */ 21 22#define MAX_FS_LOCATIONS 128 23 24struct nfsd4_fs_location { 25 char *hosts; /* colon separated list of hosts */ 26 char *path; /* slash separated list of path components */ 27}; 28 29struct nfsd4_fs_locations { 30 uint32_t locations_count; 31 struct nfsd4_fs_location *locations; 32/* If we're not actually serving this data ourselves (only providing a 33 * list of replicas that do serve it) then we set "migrated": */ 34 int migrated; 35}; 36 37/* 38 * We keep an array of pseudoflavors with the export, in order from most 39 * to least preferred. For the foreseeable future, we don't expect more 40 * than the eight pseudoflavors null, unix, krb5, krb5i, krb5p, skpm3, 41 * spkm3i, and spkm3p (and using all 8 at once should be rare). 42 */ 43#define MAX_SECINFO_LIST 8 44#define EX_UUID_LEN 16 45 46struct exp_flavor_info { 47 u32 pseudoflavor; 48 u32 flags; 49}; 50 51/* Per-export stats */ 52enum { 53 EXP_STATS_FH_STALE, 54 EXP_STATS_IO_READ, 55 EXP_STATS_IO_WRITE, 56 EXP_STATS_COUNTERS_NUM 57}; 58 59struct export_stats { 60 time64_t start_time; 61 struct percpu_counter counter[EXP_STATS_COUNTERS_NUM]; 62}; 63 64struct svc_export { 65 struct cache_head h; 66 struct auth_domain * ex_client; 67 int ex_flags; 68 int ex_fsid; 69 struct path ex_path; 70 kuid_t ex_anon_uid; 71 kgid_t ex_anon_gid; 72 unsigned char * ex_uuid; /* 16 byte fsid */ 73 struct nfsd4_fs_locations ex_fslocs; 74 uint32_t ex_nflavors; 75 struct exp_flavor_info ex_flavors[MAX_SECINFO_LIST]; 76 u32 ex_layout_types; 77 struct nfsd4_deviceid_map *ex_devid_map; 78 struct cache_detail *cd; 79 struct rcu_work ex_rwork; 80 unsigned long ex_xprtsec_modes; 81 struct export_stats *ex_stats; 82}; 83 84/* an "export key" (expkey) maps a filehandlefragement to an 85 * svc_export for a given client. There can be several per export, 86 * for the different fsid types. 87 */ 88struct svc_expkey { 89 struct cache_head h; 90 91 struct auth_domain * ek_client; 92 u8 ek_fsidtype; 93 u32 ek_fsid[6]; 94 95 struct path ek_path; 96 struct rcu_work ek_rwork; 97}; 98 99#define EX_ISSYNC(exp) (!((exp)->ex_flags & NFSEXP_ASYNC)) 100#define EX_NOHIDE(exp) ((exp)->ex_flags & NFSEXP_NOHIDE) 101#define EX_WGATHER(exp) ((exp)->ex_flags & NFSEXP_GATHERED_WRITES) 102 103struct svc_cred; 104int nfsexp_flags(struct svc_cred *cred, struct svc_export *exp); 105__be32 check_xprtsec_policy(struct svc_export *exp, struct svc_rqst *rqstp); 106__be32 check_security_flavor(struct svc_export *exp, struct svc_rqst *rqstp, 107 bool may_bypass_gss); 108__be32 check_nfsd_access(struct svc_export *exp, struct svc_rqst *rqstp, 109 bool may_bypass_gss); 110 111/* 112 * Function declarations 113 */ 114int nfsd_export_wq_init(void); 115void nfsd_export_wq_shutdown(void); 116int nfsd_export_init(struct net *); 117void nfsd_export_shutdown(struct net *); 118void nfsd_export_flush(struct net *); 119struct svc_export * rqst_exp_get_by_name(struct svc_rqst *, 120 const struct path *); 121struct svc_export * rqst_exp_parent(struct svc_rqst *, 122 struct path *); 123struct svc_export * rqst_find_fsidzero_export(struct svc_rqst *); 124int exp_rootfh(struct net *, struct auth_domain *, 125 char *path, struct knfsd_fh *, int maxsize); 126__be32 exp_pseudoroot(struct svc_rqst *, struct svc_fh *); 127 128static inline void exp_put(struct svc_export *exp) 129{ 130 cache_put(&exp->h, exp->cd); 131} 132 133static inline struct svc_export *exp_get(struct svc_export *exp) 134{ 135 cache_get(&exp->h); 136 return exp; 137} 138struct svc_export *rqst_exp_find(struct cache_req *reqp, struct net *net, 139 struct auth_domain *cl, struct auth_domain *gsscl, 140 int fsid_type, u32 *fsidv); 141 142#endif /* NFSD_EXPORT_H */
~/
Read-only file preview.