Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) #ifndef NFSD_EXPORT_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) #define NFSD_EXPORT_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include <linux/sunrpc/cache.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include <uapi/linux/nfsd/export.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include <linux/nfs4.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) struct knfsd_fh;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) struct svc_fh;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) struct svc_rqst;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  * FS Locations
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #define MAX_FS_LOCATIONS	128
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) struct nfsd4_fs_location {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 	char *hosts; /* colon separated list of hosts */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 	char *path;  /* slash separated list of path components */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) struct nfsd4_fs_locations {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 	uint32_t locations_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 	struct nfsd4_fs_location *locations;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) /* If we're not actually serving this data ourselves (only providing a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31)  * list of replicas that do serve it) then we set "migrated": */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 	int migrated;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36)  * We keep an array of pseudoflavors with the export, in order from most
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37)  * to least preferred.  For the foreseeable future, we don't expect more
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38)  * than the eight pseudoflavors null, unix, krb5, krb5i, krb5p, skpm3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39)  * spkm3i, and spkm3p (and using all 8 at once should be rare).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) #define MAX_SECINFO_LIST	8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) #define EX_UUID_LEN		16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) struct exp_flavor_info {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	u32	pseudoflavor;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	u32	flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) struct svc_export {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	struct cache_head	h;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	struct auth_domain *	ex_client;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	int			ex_flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	struct path		ex_path;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	kuid_t			ex_anon_uid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	kgid_t			ex_anon_gid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	int			ex_fsid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	unsigned char *		ex_uuid; /* 16 byte fsid */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	struct nfsd4_fs_locations ex_fslocs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	uint32_t		ex_nflavors;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	struct exp_flavor_info	ex_flavors[MAX_SECINFO_LIST];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	u32			ex_layout_types;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	struct nfsd4_deviceid_map *ex_devid_map;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	struct cache_detail	*cd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	struct rcu_head		ex_rcu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) /* an "export key" (expkey) maps a filehandlefragement to an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68)  * svc_export for a given client.  There can be several per export,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69)  * for the different fsid types.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) struct svc_expkey {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	struct cache_head	h;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	struct auth_domain *	ek_client;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	int			ek_fsidtype;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	u32			ek_fsid[6];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	struct path		ek_path;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	struct rcu_head		ek_rcu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) #define EX_ISSYNC(exp)		(!((exp)->ex_flags & NFSEXP_ASYNC))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) #define EX_NOHIDE(exp)		((exp)->ex_flags & NFSEXP_NOHIDE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) #define EX_WGATHER(exp)		((exp)->ex_flags & NFSEXP_GATHERED_WRITES)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) int nfsexp_flags(struct svc_rqst *rqstp, struct svc_export *exp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) __be32 check_nfsd_access(struct svc_export *exp, struct svc_rqst *rqstp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90)  * Function declarations
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) int			nfsd_export_init(struct net *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) void			nfsd_export_shutdown(struct net *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) void			nfsd_export_flush(struct net *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) struct svc_export *	rqst_exp_get_by_name(struct svc_rqst *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 					     struct path *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) struct svc_export *	rqst_exp_parent(struct svc_rqst *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 					struct path *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) struct svc_export *	rqst_find_fsidzero_export(struct svc_rqst *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) int			exp_rootfh(struct net *, struct auth_domain *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 					char *path, struct knfsd_fh *, int maxsize);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) __be32			exp_pseudoroot(struct svc_rqst *, struct svc_fh *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) __be32			nfserrno(int errno);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) static inline void exp_put(struct svc_export *exp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	cache_put(&exp->h, exp->cd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) static inline struct svc_export *exp_get(struct svc_export *exp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	cache_get(&exp->h);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	return exp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) struct svc_export * rqst_exp_find(struct svc_rqst *, int, u32 *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) #endif /* NFSD_EXPORT_H */