X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/0a7de7458d150b5d4dffc935ba399be265ef0a1a..4ba76501152d51ccb5647018f3192c6096367d48:/bsd/nfs/nfsm_subs.h diff --git a/bsd/nfs/nfsm_subs.h b/bsd/nfs/nfsm_subs.h index 6f348ac36..b16669fc5 100644 --- a/bsd/nfs/nfsm_subs.h +++ b/bsd/nfs/nfsm_subs.h @@ -82,7 +82,7 @@ int nfsm_chain_add_opaque_nopad_f(struct nfsm_chain *, const u_char *, uint32_t) int nfsm_chain_add_uio(struct nfsm_chain *, uio_t, uint32_t); int nfsm_chain_add_fattr4_f(struct nfsm_chain *, struct vnode_attr *, struct nfsmount *); int nfsm_chain_add_v2sattr_f(struct nfsm_chain *, struct vnode_attr *, uint32_t); -int nfsm_chain_add_v3sattr_f(struct nfsm_chain *, struct vnode_attr *); +int nfsm_chain_add_v3sattr_f(struct nfsmount *, struct nfsm_chain *, struct vnode_attr *); int nfsm_chain_add_string_nfc(struct nfsm_chain *, const uint8_t *, uint32_t); int nfsm_chain_advance(struct nfsm_chain *, uint32_t); @@ -91,7 +91,7 @@ int nfsm_chain_reverse(struct nfsm_chain *, uint32_t); int nfsm_chain_get_opaque_pointer_f(struct nfsm_chain *, uint32_t, u_char **); int nfsm_chain_get_opaque_f(struct nfsm_chain *, uint32_t, u_char *); int nfsm_chain_get_uio(struct nfsm_chain *, uint32_t, uio_t); -int nfsm_chain_get_fh_attr(struct nfsm_chain *, nfsnode_t, +int nfsm_chain_get_fh_attr(struct nfsmount *, struct nfsm_chain *, nfsnode_t, vfs_context_t, int, uint64_t *, fhandle_t *, struct nfs_vattr *); int nfsm_chain_get_wcc_data_f(struct nfsm_chain *, nfsnode_t, struct timespec *, int *, u_int64_t *); int nfsm_chain_get_secinfo(struct nfsm_chain *, uint32_t *, int *); @@ -415,10 +415,10 @@ int nfsm_chain_trim_data(struct nfsm_chain *, int, int *); } while (0) /* Add an NFSv3 "sattr" structure to an mbuf chain */ -#define nfsm_chain_add_v3sattr(E, NMC, VAP) \ +#define nfsm_chain_add_v3sattr(NMP, E, NMC, VAP) \ do { \ if (E) break; \ - (E) = nfsm_chain_add_v3sattr_f((NMC), (VAP)); \ + (E) = nfsm_chain_add_v3sattr_f((NMP), (NMC), (VAP)); \ } while (0) /* Add an NFSv4 "fattr" structure to an mbuf chain */ @@ -664,13 +664,13 @@ int nfsm_chain_trim_data(struct nfsm_chain *, int, int *); } while (0) /* get postop attributes from an mbuf chain */ -#define nfsm_chain_postop_attr_get(E, NMC, F, VAP) \ +#define nfsm_chain_postop_attr_get(NMP, E, NMC, F, VAP) \ do { \ (F) = 0; \ if ((E) || !(NMC)->nmc_mhead) break; \ nfsm_chain_get_32((E), (NMC), (F)); \ if ((E) || !(F)) break; \ - if (((E) = nfs_parsefattr((NMC), NFS_VER3, (VAP)))) \ + if (((E) = nfs_parsefattr((NMP), (NMC), NFS_VER3, (VAP)))) \ (F) = 0; \ } while (0) @@ -679,7 +679,7 @@ int nfsm_chain_trim_data(struct nfsm_chain *, int, int *); #define nfsm_chain_postop_attr_update_flag(E, NMC, NP, F, X) \ do { \ struct nfs_vattr ttvattr; \ - nfsm_chain_postop_attr_get((E), (NMC), (F), &ttvattr); \ + nfsm_chain_postop_attr_get(NFSTONMP(NP), (E), (NMC), (F), &ttvattr); \ if ((E) || !(F)) break; \ if (((E) = nfs_loadattrcache((NP), &ttvattr, (X), 1))) { \ (F) = 0; \ @@ -703,15 +703,28 @@ int nfsm_chain_trim_data(struct nfsm_chain *, int, int *); (E) = nfsm_chain_get_wcc_data_f((NMC), (NP), (PREMTIME), (NEWPOSTATTR), (X)); \ } while (0) +#if CONFIG_NFS4 +/* separate v4 variant for loading attrs that only runs when NFSv4 is set */ +#define __nfsm_chain_loadattr_v4(E, NMC, VERS, X, VATTR) \ + do { \ + (E) = nfs4_parsefattr((NMC), NULL, (VATTR), NULL, NULL, NULL); \ + } while (0) +#else +#define __nfsm_chain_loadattr_v4(E, NMC, VERS, X, VATTR) \ + do { \ + break; \ + } while (0) +#endif + /* update a node's attribute cache with attributes from an mbuf chain */ #define nfsm_chain_loadattr(E, NMC, NP, VERS, X) \ do { \ struct nfs_vattr ttvattr; \ if (E) break; \ if ((VERS) == NFS_VER4) { \ - (E) = nfs4_parsefattr((NMC), NULL, &ttvattr, NULL, NULL, NULL); \ + __nfsm_chain_loadattr_v4((E), (NMC), (VERS), (X), &ttvattr); \ } else { \ - (E) = nfs_parsefattr((NMC), (VERS), &ttvattr); \ + (E) = nfs_parsefattr(NFSTONMP(NP), (NMC), (VERS), &ttvattr); \ } \ if (!(E) && (NP)) \ (E) = nfs_loadattrcache((NP), &ttvattr, (X), 0); \