Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Copyright (c) 2014 Anna Schumaker <Anna.Schumaker@Netapp.com>
0004  */
0005 
0006 #ifndef __LINUX_FS_NFS_NFS4_2_H
0007 #define __LINUX_FS_NFS_NFS4_2_H
0008 
0009 #include <linux/xattr.h>
0010 
0011 /*
0012  * FIXME:  four LAYOUTSTATS calls per compound at most! Do we need to support
0013  * more? Need to consider not to pre-alloc too much for a compound.
0014  */
0015 #define PNFS_LAYOUTSTATS_MAXDEV (4)
0016 
0017 /* nfs4.2proc.c */
0018 #ifdef CONFIG_NFS_V4_2
0019 int nfs42_proc_allocate(struct file *, loff_t, loff_t);
0020 ssize_t nfs42_proc_copy(struct file *, loff_t, struct file *, loff_t, size_t,
0021             struct nl4_server *, nfs4_stateid *, bool);
0022 int nfs42_proc_deallocate(struct file *, loff_t, loff_t);
0023 loff_t nfs42_proc_llseek(struct file *, loff_t, int);
0024 int nfs42_proc_layoutstats_generic(struct nfs_server *,
0025                    struct nfs42_layoutstat_data *);
0026 int nfs42_proc_clone(struct file *, struct file *, loff_t, loff_t, loff_t);
0027 int nfs42_proc_layouterror(struct pnfs_layout_segment *lseg,
0028                const struct nfs42_layout_error *errors,
0029                size_t n);
0030 int nfs42_proc_copy_notify(struct file *, struct file *,
0031                struct nfs42_copy_notify_res *);
0032 static inline bool nfs42_files_from_same_server(struct file *in,
0033                         struct file *out)
0034 {
0035     struct nfs_client *c_in = (NFS_SERVER(file_inode(in)))->nfs_client;
0036     struct nfs_client *c_out = (NFS_SERVER(file_inode(out)))->nfs_client;
0037 
0038     return nfs4_check_serverowner_major_id(c_in->cl_serverowner,
0039                            c_out->cl_serverowner);
0040 }
0041 
0042 ssize_t nfs42_proc_getxattr(struct inode *inode, const char *name,
0043                 void *buf, size_t buflen);
0044 int nfs42_proc_setxattr(struct inode *inode, const char *name,
0045             const void *buf, size_t buflen, int flags);
0046 ssize_t nfs42_proc_listxattrs(struct inode *inode, void *buf,
0047                    size_t buflen, u64 *cookiep, bool *eofp);
0048 int nfs42_proc_removexattr(struct inode *inode, const char *name);
0049 
0050 /*
0051  * Maximum XDR buffer size needed for a listxattr buffer of buflen size.
0052  *
0053  * The upper boundary is a buffer with all 1-byte sized attribute names.
0054  * They would be 7 bytes long in the eventual buffer ("user.x\0"), and
0055  * 8 bytes long XDR-encoded.
0056  *
0057  * Include the trailing eof word as well.
0058  */
0059 static inline u32 nfs42_listxattr_xdrsize(u32 buflen)
0060 {
0061     return ((buflen / (XATTR_USER_PREFIX_LEN + 2)) * 8) + 4;
0062 }
0063 #endif /* CONFIG_NFS_V4_2 */
0064 #endif /* __LINUX_FS_NFS_NFS4_2_H */