^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) 2014 Anna Schumaker <Anna.Schumaker@Netapp.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #ifndef __LINUX_FS_NFS_NFS4_2_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #define __LINUX_FS_NFS_NFS4_2_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/xattr.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) * FIXME: four LAYOUTSTATS calls per compound at most! Do we need to support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) * more? Need to consider not to pre-alloc too much for a compound.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #define PNFS_LAYOUTSTATS_MAXDEV (4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) /* nfs4.2proc.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #ifdef CONFIG_NFS_V4_2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) int nfs42_proc_allocate(struct file *, loff_t, loff_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) ssize_t nfs42_proc_copy(struct file *, loff_t, struct file *, loff_t, size_t,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) struct nl4_server *, nfs4_stateid *, bool);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) int nfs42_proc_deallocate(struct file *, loff_t, loff_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) loff_t nfs42_proc_llseek(struct file *, loff_t, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) int nfs42_proc_layoutstats_generic(struct nfs_server *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) struct nfs42_layoutstat_data *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) int nfs42_proc_clone(struct file *, struct file *, loff_t, loff_t, loff_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) int nfs42_proc_layouterror(struct pnfs_layout_segment *lseg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) const struct nfs42_layout_error *errors,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) size_t n);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) int nfs42_proc_copy_notify(struct file *, struct file *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) struct nfs42_copy_notify_res *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) static inline bool nfs42_files_from_same_server(struct file *in,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) struct file *out)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) struct nfs_client *c_in = (NFS_SERVER(file_inode(in)))->nfs_client;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) struct nfs_client *c_out = (NFS_SERVER(file_inode(out)))->nfs_client;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) return nfs4_check_serverowner_major_id(c_in->cl_serverowner,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) c_out->cl_serverowner);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) ssize_t nfs42_proc_getxattr(struct inode *inode, const char *name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) void *buf, size_t buflen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) int nfs42_proc_setxattr(struct inode *inode, const char *name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) const void *buf, size_t buflen, int flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) ssize_t nfs42_proc_listxattrs(struct inode *inode, void *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) size_t buflen, u64 *cookiep, bool *eofp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) int nfs42_proc_removexattr(struct inode *inode, const char *name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) * Maximum XDR buffer size needed for a listxattr buffer of buflen size.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) * The upper boundary is a buffer with all 1-byte sized attribute names.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) * They would be 7 bytes long in the eventual buffer ("user.x\0"), and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) * 8 bytes long XDR-encoded.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) * Include the trailing eof word as well.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) static inline u32 nfs42_listxattr_xdrsize(u32 buflen)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) return ((buflen / (XATTR_USER_PREFIX_LEN + 2)) * 8) + 4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) #endif /* CONFIG_NFS_V4_2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) #endif /* __LINUX_FS_NFS_NFS4_2_H */