J. Bruce Fields | 7663dac | 2009-12-04 19:49:00 -0500 | [diff] [blame] | 1 | /* XDR types for nfsd. This is mainly a typing exercise. */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | |
| 3 | #ifndef LINUX_NFSD_H |
| 4 | #define LINUX_NFSD_H |
| 5 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | #include <linux/vfs.h> |
Boaz Harrosh | 9a74af2 | 2009-12-03 20:30:56 +0200 | [diff] [blame] | 7 | #include "nfsd.h" |
J. Bruce Fields | 1557aca | 2009-12-04 19:36:06 -0500 | [diff] [blame] | 8 | #include "nfsfh.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | |
| 10 | struct nfsd_fhandle { |
| 11 | struct svc_fh fh; |
| 12 | }; |
| 13 | |
| 14 | struct nfsd_sattrargs { |
| 15 | struct svc_fh fh; |
| 16 | struct iattr attrs; |
| 17 | }; |
| 18 | |
| 19 | struct nfsd_diropargs { |
| 20 | struct svc_fh fh; |
| 21 | char * name; |
Chuck Lever | 29d5e55 | 2007-11-01 16:57:04 -0400 | [diff] [blame] | 22 | unsigned int len; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | }; |
| 24 | |
| 25 | struct nfsd_readargs { |
| 26 | struct svc_fh fh; |
| 27 | __u32 offset; |
| 28 | __u32 count; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | int vlen; |
| 30 | }; |
| 31 | |
| 32 | struct nfsd_writeargs { |
| 33 | svc_fh fh; |
| 34 | __u32 offset; |
| 35 | int len; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | int vlen; |
| 37 | }; |
| 38 | |
| 39 | struct nfsd_createargs { |
| 40 | struct svc_fh fh; |
| 41 | char * name; |
Chuck Lever | 29d5e55 | 2007-11-01 16:57:04 -0400 | [diff] [blame] | 42 | unsigned int len; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | struct iattr attrs; |
| 44 | }; |
| 45 | |
| 46 | struct nfsd_renameargs { |
| 47 | struct svc_fh ffh; |
| 48 | char * fname; |
Chuck Lever | 29d5e55 | 2007-11-01 16:57:04 -0400 | [diff] [blame] | 49 | unsigned int flen; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | struct svc_fh tfh; |
| 51 | char * tname; |
Chuck Lever | 29d5e55 | 2007-11-01 16:57:04 -0400 | [diff] [blame] | 52 | unsigned int tlen; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | }; |
| 54 | |
| 55 | struct nfsd_readlinkargs { |
| 56 | struct svc_fh fh; |
| 57 | char * buffer; |
| 58 | }; |
| 59 | |
| 60 | struct nfsd_linkargs { |
| 61 | struct svc_fh ffh; |
| 62 | struct svc_fh tfh; |
| 63 | char * tname; |
Chuck Lever | 29d5e55 | 2007-11-01 16:57:04 -0400 | [diff] [blame] | 64 | unsigned int tlen; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 | }; |
| 66 | |
| 67 | struct nfsd_symlinkargs { |
| 68 | struct svc_fh ffh; |
| 69 | char * fname; |
Chuck Lever | 29d5e55 | 2007-11-01 16:57:04 -0400 | [diff] [blame] | 70 | unsigned int flen; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 71 | char * tname; |
Chuck Lever | 48b4ba3 | 2007-11-01 16:57:25 -0400 | [diff] [blame] | 72 | unsigned int tlen; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 73 | struct iattr attrs; |
| 74 | }; |
| 75 | |
| 76 | struct nfsd_readdirargs { |
| 77 | struct svc_fh fh; |
| 78 | __u32 cookie; |
| 79 | __u32 count; |
Al Viro | 131a21c | 2006-10-19 23:28:56 -0700 | [diff] [blame] | 80 | __be32 * buffer; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 81 | }; |
| 82 | |
| 83 | struct nfsd_attrstat { |
| 84 | struct svc_fh fh; |
David Shaw | a334de2 | 2006-01-06 00:19:58 -0800 | [diff] [blame] | 85 | struct kstat stat; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 86 | }; |
| 87 | |
| 88 | struct nfsd_diropres { |
| 89 | struct svc_fh fh; |
David Shaw | a334de2 | 2006-01-06 00:19:58 -0800 | [diff] [blame] | 90 | struct kstat stat; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 91 | }; |
| 92 | |
| 93 | struct nfsd_readlinkres { |
| 94 | int len; |
| 95 | }; |
| 96 | |
| 97 | struct nfsd_readres { |
| 98 | struct svc_fh fh; |
| 99 | unsigned long count; |
David Shaw | a334de2 | 2006-01-06 00:19:58 -0800 | [diff] [blame] | 100 | struct kstat stat; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 101 | }; |
| 102 | |
| 103 | struct nfsd_readdirres { |
| 104 | int count; |
| 105 | |
| 106 | struct readdir_cd common; |
Al Viro | 131a21c | 2006-10-19 23:28:56 -0700 | [diff] [blame] | 107 | __be32 * buffer; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 108 | int buflen; |
Al Viro | 131a21c | 2006-10-19 23:28:56 -0700 | [diff] [blame] | 109 | __be32 * offset; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 110 | }; |
| 111 | |
| 112 | struct nfsd_statfsres { |
| 113 | struct kstatfs stats; |
| 114 | }; |
| 115 | |
| 116 | /* |
| 117 | * Storage requirements for XDR arguments and results. |
| 118 | */ |
| 119 | union nfsd_xdrstore { |
| 120 | struct nfsd_sattrargs sattr; |
| 121 | struct nfsd_diropargs dirop; |
| 122 | struct nfsd_readargs read; |
| 123 | struct nfsd_writeargs write; |
| 124 | struct nfsd_createargs create; |
| 125 | struct nfsd_renameargs rename; |
| 126 | struct nfsd_linkargs link; |
| 127 | struct nfsd_symlinkargs symlink; |
| 128 | struct nfsd_readdirargs readdir; |
| 129 | }; |
| 130 | |
| 131 | #define NFS2_SVC_XDRSIZE sizeof(union nfsd_xdrstore) |
| 132 | |
| 133 | |
Al Viro | 131a21c | 2006-10-19 23:28:56 -0700 | [diff] [blame] | 134 | int nfssvc_decode_void(struct svc_rqst *, __be32 *, void *); |
| 135 | int nfssvc_decode_fhandle(struct svc_rqst *, __be32 *, struct nfsd_fhandle *); |
| 136 | int nfssvc_decode_sattrargs(struct svc_rqst *, __be32 *, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 137 | struct nfsd_sattrargs *); |
Al Viro | 131a21c | 2006-10-19 23:28:56 -0700 | [diff] [blame] | 138 | int nfssvc_decode_diropargs(struct svc_rqst *, __be32 *, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 139 | struct nfsd_diropargs *); |
Al Viro | 131a21c | 2006-10-19 23:28:56 -0700 | [diff] [blame] | 140 | int nfssvc_decode_readargs(struct svc_rqst *, __be32 *, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 141 | struct nfsd_readargs *); |
Al Viro | 131a21c | 2006-10-19 23:28:56 -0700 | [diff] [blame] | 142 | int nfssvc_decode_writeargs(struct svc_rqst *, __be32 *, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 143 | struct nfsd_writeargs *); |
Al Viro | 131a21c | 2006-10-19 23:28:56 -0700 | [diff] [blame] | 144 | int nfssvc_decode_createargs(struct svc_rqst *, __be32 *, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 145 | struct nfsd_createargs *); |
Al Viro | 131a21c | 2006-10-19 23:28:56 -0700 | [diff] [blame] | 146 | int nfssvc_decode_renameargs(struct svc_rqst *, __be32 *, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 147 | struct nfsd_renameargs *); |
Al Viro | 131a21c | 2006-10-19 23:28:56 -0700 | [diff] [blame] | 148 | int nfssvc_decode_readlinkargs(struct svc_rqst *, __be32 *, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 149 | struct nfsd_readlinkargs *); |
Al Viro | 131a21c | 2006-10-19 23:28:56 -0700 | [diff] [blame] | 150 | int nfssvc_decode_linkargs(struct svc_rqst *, __be32 *, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 151 | struct nfsd_linkargs *); |
Al Viro | 131a21c | 2006-10-19 23:28:56 -0700 | [diff] [blame] | 152 | int nfssvc_decode_symlinkargs(struct svc_rqst *, __be32 *, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 153 | struct nfsd_symlinkargs *); |
Al Viro | 131a21c | 2006-10-19 23:28:56 -0700 | [diff] [blame] | 154 | int nfssvc_decode_readdirargs(struct svc_rqst *, __be32 *, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 155 | struct nfsd_readdirargs *); |
Al Viro | 131a21c | 2006-10-19 23:28:56 -0700 | [diff] [blame] | 156 | int nfssvc_encode_void(struct svc_rqst *, __be32 *, void *); |
| 157 | int nfssvc_encode_attrstat(struct svc_rqst *, __be32 *, struct nfsd_attrstat *); |
| 158 | int nfssvc_encode_diropres(struct svc_rqst *, __be32 *, struct nfsd_diropres *); |
| 159 | int nfssvc_encode_readlinkres(struct svc_rqst *, __be32 *, struct nfsd_readlinkres *); |
| 160 | int nfssvc_encode_readres(struct svc_rqst *, __be32 *, struct nfsd_readres *); |
| 161 | int nfssvc_encode_statfsres(struct svc_rqst *, __be32 *, struct nfsd_statfsres *); |
| 162 | int nfssvc_encode_readdirres(struct svc_rqst *, __be32 *, struct nfsd_readdirres *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 163 | |
NeilBrown | a0ad13e | 2007-01-26 00:57:10 -0800 | [diff] [blame] | 164 | int nfssvc_encode_entry(void *, const char *name, |
| 165 | int namlen, loff_t offset, u64 ino, unsigned int); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 166 | |
Al Viro | 131a21c | 2006-10-19 23:28:56 -0700 | [diff] [blame] | 167 | int nfssvc_release_fhandle(struct svc_rqst *, __be32 *, struct nfsd_fhandle *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 168 | |
Andreas Gruenbacher | a257cdd | 2005-06-22 17:16:26 +0000 | [diff] [blame] | 169 | /* Helper functions for NFSv2 ACL code */ |
Al Viro | 131a21c | 2006-10-19 23:28:56 -0700 | [diff] [blame] | 170 | __be32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp); |
| 171 | __be32 *nfs2svc_decode_fh(__be32 *p, struct svc_fh *fhp); |
Andreas Gruenbacher | a257cdd | 2005-06-22 17:16:26 +0000 | [diff] [blame] | 172 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 173 | #endif /* LINUX_NFSD_H */ |