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