]> Git Repo - linux.git/blame - fs/nfs/nfs42.h
Merge tag 'chrome-platform-for-6.13' of git://git.kernel.org/pub/scm/linux/kernel...
[linux.git] / fs / nfs / nfs42.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
1c6dcbe5
AS
2/*
3 * Copyright (c) 2014 Anna Schumaker <[email protected]>
4 */
5
6#ifndef __LINUX_FS_NFS_NFS4_2_H
7#define __LINUX_FS_NFS_NFS4_2_H
8
04a5da69
FL
9#include <linux/xattr.h>
10
be3a5d23
TM
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)
303a7805 16#define READ_PLUS_SCRATCH_SIZE (16)
be3a5d23 17
1c6dcbe5 18/* nfs4.2proc.c */
0491567b 19#ifdef CONFIG_NFS_V4_2
f4ac1674 20int nfs42_proc_allocate(struct file *, loff_t, loff_t);
1d38f3f0 21ssize_t nfs42_proc_copy(struct file *, loff_t, struct file *, loff_t, size_t,
12751010 22 struct nl4_server *, nfs4_stateid *, bool);
624bd5b7 23int nfs42_proc_deallocate(struct file *, loff_t, loff_t);
1c6dcbe5 24loff_t nfs42_proc_llseek(struct file *, loff_t, int);
be3a5d23
TM
25int nfs42_proc_layoutstats_generic(struct nfs_server *,
26 struct nfs42_layoutstat_data *);
e5341f3a 27int nfs42_proc_clone(struct file *, struct file *, loff_t, loff_t, loff_t);
3eb86093
TM
28int nfs42_proc_layouterror(struct pnfs_layout_segment *lseg,
29 const struct nfs42_layout_error *errors,
30 size_t n);
0491567b
OK
31int nfs42_proc_copy_notify(struct file *, struct file *,
32 struct nfs42_copy_notify_res *);
33static inline bool nfs42_files_from_same_server(struct file *in,
34 struct file *out)
35{
36 struct nfs_client *c_in = (NFS_SERVER(file_inode(in)))->nfs_client;
37 struct nfs_client *c_out = (NFS_SERVER(file_inode(out)))->nfs_client;
1c6dcbe5 38
0491567b
OK
39 return nfs4_check_serverowner_major_id(c_in->cl_serverowner,
40 c_out->cl_serverowner);
41}
04a5da69 42
c10a7514
FL
43ssize_t nfs42_proc_getxattr(struct inode *inode, const char *name,
44 void *buf, size_t buflen);
45int nfs42_proc_setxattr(struct inode *inode, const char *name,
46 const void *buf, size_t buflen, int flags);
47ssize_t nfs42_proc_listxattrs(struct inode *inode, void *buf,
48 size_t buflen, u64 *cookiep, bool *eofp);
49int nfs42_proc_removexattr(struct inode *inode, const char *name);
50
04a5da69
FL
51/*
52 * Maximum XDR buffer size needed for a listxattr buffer of buflen size.
53 *
54 * The upper boundary is a buffer with all 1-byte sized attribute names.
55 * They would be 7 bytes long in the eventual buffer ("user.x\0"), and
56 * 8 bytes long XDR-encoded.
57 *
bcac8bff
JM
58 * Include the trailing eof word as well and make the result a multiple
59 * of 4 bytes.
04a5da69
FL
60 */
61static inline u32 nfs42_listxattr_xdrsize(u32 buflen)
62{
bcac8bff
JM
63 u32 size = 8 * buflen / (XATTR_USER_PREFIX_LEN + 2) + 4;
64
65 return (size + 3) & ~3;
04a5da69 66}
0491567b 67#endif /* CONFIG_NFS_V4_2 */
1c6dcbe5 68#endif /* __LINUX_FS_NFS_NFS4_2_H */
This page took 0.504711 seconds and 4 git commands to generate.