Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Anna Schumaker | 1c6dcbe | 2014-09-26 13:58:48 -0400 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2014 Anna Schumaker <Anna.Schumaker@Netapp.com> |
| 4 | */ |
| 5 | |
| 6 | #ifndef __LINUX_FS_NFS_NFS4_2_H |
| 7 | #define __LINUX_FS_NFS_NFS4_2_H |
| 8 | |
Frank van der Linden | 04a5da6 | 2020-06-23 22:38:54 +0000 | [diff] [blame] | 9 | #include <linux/xattr.h> |
| 10 | |
Trond Myklebust | be3a5d2 | 2015-06-23 19:51:55 +0800 | [diff] [blame] | 11 | /* |
| 12 | * FIXME: four LAYOUTSTATS calls per compound at most! Do we need to support |
| 13 | * more? Need to consider not to pre-alloc too much for a compound. |
| 14 | */ |
| 15 | #define PNFS_LAYOUTSTATS_MAXDEV (4) |
| 16 | |
Anna Schumaker | 1c6dcbe | 2014-09-26 13:58:48 -0400 | [diff] [blame] | 17 | /* nfs4.2proc.c */ |
Olga Kornievskaia | 0491567 | 2019-06-04 16:14:30 -0400 | [diff] [blame] | 18 | #ifdef CONFIG_NFS_V4_2 |
Anna Schumaker | f4ac167 | 2014-11-25 13:18:15 -0500 | [diff] [blame] | 19 | int nfs42_proc_allocate(struct file *, loff_t, loff_t); |
Olga Kornievskaia | 1d38f3f | 2019-06-04 11:54:18 -0400 | [diff] [blame] | 20 | ssize_t nfs42_proc_copy(struct file *, loff_t, struct file *, loff_t, size_t, |
Olga Kornievskaia | 1275101 | 2019-07-03 10:38:02 -0400 | [diff] [blame] | 21 | struct nl4_server *, nfs4_stateid *, bool); |
Anna Schumaker | 624bd5b | 2014-11-25 13:18:16 -0500 | [diff] [blame] | 22 | int nfs42_proc_deallocate(struct file *, loff_t, loff_t); |
Anna Schumaker | 1c6dcbe | 2014-09-26 13:58:48 -0400 | [diff] [blame] | 23 | loff_t nfs42_proc_llseek(struct file *, loff_t, int); |
Trond Myklebust | be3a5d2 | 2015-06-23 19:51:55 +0800 | [diff] [blame] | 24 | int nfs42_proc_layoutstats_generic(struct nfs_server *, |
| 25 | struct nfs42_layoutstat_data *); |
Peng Tao | e5341f3 | 2015-09-26 02:24:35 +0800 | [diff] [blame] | 26 | int nfs42_proc_clone(struct file *, struct file *, loff_t, loff_t, loff_t); |
Trond Myklebust | 3eb8609 | 2019-02-08 10:31:05 -0500 | [diff] [blame] | 27 | int nfs42_proc_layouterror(struct pnfs_layout_segment *lseg, |
| 28 | const struct nfs42_layout_error *errors, |
| 29 | size_t n); |
Olga Kornievskaia | 0491567 | 2019-06-04 16:14:30 -0400 | [diff] [blame] | 30 | int nfs42_proc_copy_notify(struct file *, struct file *, |
| 31 | struct nfs42_copy_notify_res *); |
| 32 | static inline bool nfs42_files_from_same_server(struct file *in, |
| 33 | struct file *out) |
| 34 | { |
| 35 | struct nfs_client *c_in = (NFS_SERVER(file_inode(in)))->nfs_client; |
| 36 | struct nfs_client *c_out = (NFS_SERVER(file_inode(out)))->nfs_client; |
Anna Schumaker | 1c6dcbe | 2014-09-26 13:58:48 -0400 | [diff] [blame] | 37 | |
Olga Kornievskaia | 0491567 | 2019-06-04 16:14:30 -0400 | [diff] [blame] | 38 | return nfs4_check_serverowner_major_id(c_in->cl_serverowner, |
| 39 | c_out->cl_serverowner); |
| 40 | } |
Frank van der Linden | 04a5da6 | 2020-06-23 22:38:54 +0000 | [diff] [blame] | 41 | |
Frank van der Linden | c10a751 | 2020-06-23 22:39:02 +0000 | [diff] [blame] | 42 | ssize_t nfs42_proc_getxattr(struct inode *inode, const char *name, |
| 43 | void *buf, size_t buflen); |
| 44 | int nfs42_proc_setxattr(struct inode *inode, const char *name, |
| 45 | const void *buf, size_t buflen, int flags); |
| 46 | ssize_t nfs42_proc_listxattrs(struct inode *inode, void *buf, |
| 47 | size_t buflen, u64 *cookiep, bool *eofp); |
| 48 | int nfs42_proc_removexattr(struct inode *inode, const char *name); |
| 49 | |
Frank van der Linden | 04a5da6 | 2020-06-23 22:38:54 +0000 | [diff] [blame] | 50 | /* |
| 51 | * Maximum XDR buffer size needed for a listxattr buffer of buflen size. |
| 52 | * |
| 53 | * The upper boundary is a buffer with all 1-byte sized attribute names. |
| 54 | * They would be 7 bytes long in the eventual buffer ("user.x\0"), and |
| 55 | * 8 bytes long XDR-encoded. |
| 56 | * |
| 57 | * Include the trailing eof word as well. |
| 58 | */ |
| 59 | static inline u32 nfs42_listxattr_xdrsize(u32 buflen) |
| 60 | { |
| 61 | return ((buflen / (XATTR_USER_PREFIX_LEN + 2)) * 8) + 4; |
| 62 | } |
Olga Kornievskaia | 0491567 | 2019-06-04 16:14:30 -0400 | [diff] [blame] | 63 | #endif /* CONFIG_NFS_V4_2 */ |
Anna Schumaker | 1c6dcbe | 2014-09-26 13:58:48 -0400 | [diff] [blame] | 64 | #endif /* __LINUX_FS_NFS_NFS4_2_H */ |