| 1 | /* |
|---|
| 2 | * linux/inxlude/linux/nfsd/xdr.h |
|---|
| 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 <asm/types.h> |
|---|
| 11 | |
|---|
| 12 | #include <linux/fs.h> |
|---|
| 13 | #include <linux/vfs.h> |
|---|
| 14 | #include <linux/nfs.h> |
|---|
| 15 | |
|---|
| 16 | struct nfsd_fhandle { |
|---|
| 17 | struct svc_fh fh; |
|---|
| 18 | }; |
|---|
| 19 | |
|---|
| 20 | struct nfsd_sattrargs { |
|---|
| 21 | struct svc_fh fh; |
|---|
| 22 | struct iattr attrs; |
|---|
| 23 | }; |
|---|
| 24 | |
|---|
| 25 | struct nfsd_diropargs { |
|---|
| 26 | struct svc_fh fh; |
|---|
| 27 | char * name; |
|---|
| 28 | int len; |
|---|
| 29 | }; |
|---|
| 30 | |
|---|
| 31 | struct nfsd_readargs { |
|---|
| 32 | struct svc_fh fh; |
|---|
| 33 | __u32 offset; |
|---|
| 34 | __u32 count; |
|---|
| 35 | struct kvec vec[RPCSVC_MAXPAGES]; |
|---|
| 36 | int vlen; |
|---|
| 37 | }; |
|---|
| 38 | |
|---|
| 39 | struct nfsd_writeargs { |
|---|
| 40 | svc_fh fh; |
|---|
| 41 | __u32 offset; |
|---|
| 42 | int len; |
|---|
| 43 | struct kvec vec[RPCSVC_MAXPAGES]; |
|---|
| 44 | int vlen; |
|---|
| 45 | }; |
|---|
| 46 | |
|---|
| 47 | struct nfsd_createargs { |
|---|
| 48 | struct svc_fh fh; |
|---|
| 49 | char * name; |
|---|
| 50 | int len; |
|---|
| 51 | struct iattr attrs; |
|---|
| 52 | }; |
|---|
| 53 | |
|---|
| 54 | struct nfsd_renameargs { |
|---|
| 55 | struct svc_fh ffh; |
|---|
| 56 | char * fname; |
|---|
| 57 | int flen; |
|---|
| 58 | struct svc_fh tfh; |
|---|
| 59 | char * tname; |
|---|
| 60 | int tlen; |
|---|
| 61 | }; |
|---|
| 62 | |
|---|
| 63 | struct nfsd_readlinkargs { |
|---|
| 64 | struct svc_fh fh; |
|---|
| 65 | char * buffer; |
|---|
| 66 | }; |
|---|
| 67 | |
|---|
| 68 | struct nfsd_linkargs { |
|---|
| 69 | struct svc_fh ffh; |
|---|
| 70 | struct svc_fh tfh; |
|---|
| 71 | char * tname; |
|---|
| 72 | int tlen; |
|---|
| 73 | }; |
|---|
| 74 | |
|---|
| 75 | struct nfsd_symlinkargs { |
|---|
| 76 | struct svc_fh ffh; |
|---|
| 77 | char * fname; |
|---|
| 78 | int flen; |
|---|
| 79 | char * tname; |
|---|
| 80 | int tlen; |
|---|
| 81 | struct iattr attrs; |
|---|
| 82 | }; |
|---|
| 83 | |
|---|
| 84 | struct nfsd_readdirargs { |
|---|
| 85 | struct svc_fh fh; |
|---|
| 86 | __u32 cookie; |
|---|
| 87 | __u32 count; |
|---|
| 88 | __u32 * buffer; |
|---|
| 89 | }; |
|---|
| 90 | |
|---|
| 91 | struct nfsd_attrstat { |
|---|
| 92 | struct svc_fh fh; |
|---|
| 93 | }; |
|---|
| 94 | |
|---|
| 95 | struct nfsd_diropres { |
|---|
| 96 | struct svc_fh fh; |
|---|
| 97 | }; |
|---|
| 98 | |
|---|
| 99 | struct nfsd_readlinkres { |
|---|
| 100 | int len; |
|---|
| 101 | }; |
|---|
| 102 | |
|---|
| 103 | struct nfsd_readres { |
|---|
| 104 | struct svc_fh fh; |
|---|
| 105 | unsigned long count; |
|---|
| 106 | }; |
|---|
| 107 | |
|---|
| 108 | struct nfsd_readdirres { |
|---|
| 109 | int count; |
|---|
| 110 | |
|---|
| 111 | struct readdir_cd common; |
|---|
| 112 | __u32 * buffer; |
|---|
| 113 | int buflen; |
|---|
| 114 | __u32 * offset; |
|---|
| 115 | }; |
|---|
| 116 | |
|---|
| 117 | struct nfsd_statfsres { |
|---|
| 118 | struct kstatfs stats; |
|---|
| 119 | }; |
|---|
| 120 | |
|---|
| 121 | /* |
|---|
| 122 | * Storage requirements for XDR arguments and results. |
|---|
| 123 | */ |
|---|
| 124 | union nfsd_xdrstore { |
|---|
| 125 | struct nfsd_sattrargs sattr; |
|---|
| 126 | struct nfsd_diropargs dirop; |
|---|
| 127 | struct nfsd_readargs read; |
|---|
| 128 | struct nfsd_writeargs write; |
|---|
| 129 | struct nfsd_createargs create; |
|---|
| 130 | struct nfsd_renameargs rename; |
|---|
| 131 | struct nfsd_linkargs link; |
|---|
| 132 | struct nfsd_symlinkargs symlink; |
|---|
| 133 | struct nfsd_readdirargs readdir; |
|---|
| 134 | }; |
|---|
| 135 | |
|---|
| 136 | #define NFS2_SVC_XDRSIZE sizeof(union nfsd_xdrstore) |
|---|
| 137 | |
|---|
| 138 | |
|---|
| 139 | int nfssvc_decode_void(struct svc_rqst *, __u32 *, void *); |
|---|
| 140 | int nfssvc_decode_fhandle(struct svc_rqst *, __u32 *, struct nfsd_fhandle *); |
|---|
| 141 | int nfssvc_decode_sattrargs(struct svc_rqst *, __u32 *, |
|---|
| 142 | struct nfsd_sattrargs *); |
|---|
| 143 | int nfssvc_decode_diropargs(struct svc_rqst *, __u32 *, |
|---|
| 144 | struct nfsd_diropargs *); |
|---|
| 145 | int nfssvc_decode_readargs(struct svc_rqst *, __u32 *, |
|---|
| 146 | struct nfsd_readargs *); |
|---|
| 147 | int nfssvc_decode_writeargs(struct svc_rqst *, __u32 *, |
|---|
| 148 | struct nfsd_writeargs *); |
|---|
| 149 | int nfssvc_decode_createargs(struct svc_rqst *, __u32 *, |
|---|
| 150 | struct nfsd_createargs *); |
|---|
| 151 | int nfssvc_decode_renameargs(struct svc_rqst *, __u32 *, |
|---|
| 152 | struct nfsd_renameargs *); |
|---|
| 153 | int nfssvc_decode_readlinkargs(struct svc_rqst *, __u32 *, |
|---|
| 154 | struct nfsd_readlinkargs *); |
|---|
| 155 | int nfssvc_decode_linkargs(struct svc_rqst *, __u32 *, |
|---|
| 156 | struct nfsd_linkargs *); |
|---|
| 157 | int nfssvc_decode_symlinkargs(struct svc_rqst *, __u32 *, |
|---|
| 158 | struct nfsd_symlinkargs *); |
|---|
| 159 | int nfssvc_decode_readdirargs(struct svc_rqst *, __u32 *, |
|---|
| 160 | struct nfsd_readdirargs *); |
|---|
| 161 | int nfssvc_encode_void(struct svc_rqst *, __u32 *, void *); |
|---|
| 162 | int nfssvc_encode_attrstat(struct svc_rqst *, __u32 *, struct nfsd_attrstat *); |
|---|
| 163 | int nfssvc_encode_diropres(struct svc_rqst *, __u32 *, struct nfsd_diropres *); |
|---|
| 164 | int nfssvc_encode_readlinkres(struct svc_rqst *, __u32 *, struct nfsd_readlinkres *); |
|---|
| 165 | int nfssvc_encode_readres(struct svc_rqst *, __u32 *, struct nfsd_readres *); |
|---|
| 166 | int nfssvc_encode_statfsres(struct svc_rqst *, __u32 *, struct nfsd_statfsres *); |
|---|
| 167 | int nfssvc_encode_readdirres(struct svc_rqst *, __u32 *, struct nfsd_readdirres *); |
|---|
| 168 | |
|---|
| 169 | int nfssvc_encode_entry(struct readdir_cd *, const char *name, |
|---|
| 170 | int namlen, loff_t offset, ino_t ino, unsigned int); |
|---|
| 171 | |
|---|
| 172 | int nfssvc_release_fhandle(struct svc_rqst *, __u32 *, struct nfsd_fhandle *); |
|---|
| 173 | |
|---|
| 174 | #endif /* LINUX_NFSD_H */ |
|---|