Linux kernel & device driver programming

Cross-Referenced Linux and Device Driver Code

[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ]
Version: [ 2.6.11.8 ] [ 2.6.25 ] [ 2.6.25.8 ] [ 2.6.31.13 ] Architecture: [ i386 ]

Diff markup

Differences between /linux/fs/nfsd/nfs3proc.c (Version 2.6.25.8) and /linux/fs/nfsd/nfs3proc.c (Version 2.6.31.13)


  1 /*                                                  1 /*
  2  * linux/fs/nfsd/nfs3proc.c                         2  * linux/fs/nfsd/nfs3proc.c
  3  *                                                  3  *
  4  * Process version 3 NFS requests.                  4  * Process version 3 NFS requests.
  5  *                                                  5  *
  6  * Copyright (C) 1996, 1997, 1998 Olaf Kirch <      6  * Copyright (C) 1996, 1997, 1998 Olaf Kirch <okir@monad.swb.de>
  7  */                                                 7  */
  8                                                     8 
  9 #include <linux/linkage.h>                          9 #include <linux/linkage.h>
 10 #include <linux/time.h>                            10 #include <linux/time.h>
 11 #include <linux/errno.h>                           11 #include <linux/errno.h>
 12 #include <linux/fs.h>                              12 #include <linux/fs.h>
 13 #include <linux/ext2_fs.h>                         13 #include <linux/ext2_fs.h>
 14 #include <linux/stat.h>                            14 #include <linux/stat.h>
 15 #include <linux/fcntl.h>                           15 #include <linux/fcntl.h>
 16 #include <linux/net.h>                             16 #include <linux/net.h>
 17 #include <linux/in.h>                              17 #include <linux/in.h>
 18 #include <linux/unistd.h>                          18 #include <linux/unistd.h>
 19 #include <linux/slab.h>                            19 #include <linux/slab.h>
 20 #include <linux/major.h>                           20 #include <linux/major.h>
                                                   >>  21 #include <linux/magic.h>
 21                                                    22 
 22 #include <linux/sunrpc/svc.h>                      23 #include <linux/sunrpc/svc.h>
 23 #include <linux/nfsd/nfsd.h>                       24 #include <linux/nfsd/nfsd.h>
 24 #include <linux/nfsd/cache.h>                      25 #include <linux/nfsd/cache.h>
 25 #include <linux/nfsd/xdr3.h>                       26 #include <linux/nfsd/xdr3.h>
 26 #include <linux/nfs3.h>                            27 #include <linux/nfs3.h>
 27                                                    28 
 28 #define NFSDDBG_FACILITY                NFSDDB     29 #define NFSDDBG_FACILITY                NFSDDBG_PROC
 29                                                    30 
 30 #define RETURN_STATUS(st)       { resp->status     31 #define RETURN_STATUS(st)       { resp->status = (st); return (st); }
 31                                                    32 
 32 static int      nfs3_ftypes[] = {                  33 static int      nfs3_ftypes[] = {
 33         0,                      /* NF3NON */       34         0,                      /* NF3NON */
 34         S_IFREG,                /* NF3REG */       35         S_IFREG,                /* NF3REG */
 35         S_IFDIR,                /* NF3DIR */       36         S_IFDIR,                /* NF3DIR */
 36         S_IFBLK,                /* NF3BLK */       37         S_IFBLK,                /* NF3BLK */
 37         S_IFCHR,                /* NF3CHR */       38         S_IFCHR,                /* NF3CHR */
 38         S_IFLNK,                /* NF3LNK */       39         S_IFLNK,                /* NF3LNK */
 39         S_IFSOCK,               /* NF3SOCK */      40         S_IFSOCK,               /* NF3SOCK */
 40         S_IFIFO,                /* NF3FIFO */      41         S_IFIFO,                /* NF3FIFO */
 41 };                                                 42 };
 42                                                    43 
 43 /*                                                 44 /*
 44  * NULL call.                                      45  * NULL call.
 45  */                                                46  */
 46 static __be32                                      47 static __be32
 47 nfsd3_proc_null(struct svc_rqst *rqstp, void *     48 nfsd3_proc_null(struct svc_rqst *rqstp, void *argp, void *resp)
 48 {                                                  49 {
 49         return nfs_ok;                             50         return nfs_ok;
 50 }                                                  51 }
 51                                                    52 
 52 /*                                                 53 /*
 53  * Get a file's attributes                         54  * Get a file's attributes
 54  */                                                55  */
 55 static __be32                                      56 static __be32
 56 nfsd3_proc_getattr(struct svc_rqst *rqstp, str     57 nfsd3_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle  *argp,
 57                                            str     58                                            struct nfsd3_attrstat *resp)
 58 {                                                  59 {
 59         int     err;                               60         int     err;
 60         __be32  nfserr;                            61         __be32  nfserr;
 61                                                    62 
 62         dprintk("nfsd: GETATTR(3)  %s\n",          63         dprintk("nfsd: GETATTR(3)  %s\n",
 63                 SVCFH_fmt(&argp->fh));             64                 SVCFH_fmt(&argp->fh));
 64                                                    65 
 65         fh_copy(&resp->fh, &argp->fh);             66         fh_copy(&resp->fh, &argp->fh);
 66         nfserr = fh_verify(rqstp, &resp->fh, 0 !!  67         nfserr = fh_verify(rqstp, &resp->fh, 0,
                                                   >>  68                         NFSD_MAY_NOP | NFSD_MAY_BYPASS_GSS_ON_ROOT);
 67         if (nfserr)                                69         if (nfserr)
 68                 RETURN_STATUS(nfserr);             70                 RETURN_STATUS(nfserr);
 69                                                    71 
 70         err = vfs_getattr(resp->fh.fh_export->     72         err = vfs_getattr(resp->fh.fh_export->ex_path.mnt,
 71                           resp->fh.fh_dentry,      73                           resp->fh.fh_dentry, &resp->stat);
 72         nfserr = nfserrno(err);                    74         nfserr = nfserrno(err);
 73                                                    75 
 74         RETURN_STATUS(nfserr);                     76         RETURN_STATUS(nfserr);
 75 }                                                  77 }
 76                                                    78 
 77 /*                                                 79 /*
 78  * Set a file's attributes                         80  * Set a file's attributes
 79  */                                                81  */
 80 static __be32                                      82 static __be32
 81 nfsd3_proc_setattr(struct svc_rqst *rqstp, str     83 nfsd3_proc_setattr(struct svc_rqst *rqstp, struct nfsd3_sattrargs *argp,
 82                                            str     84                                            struct nfsd3_attrstat  *resp)
 83 {                                                  85 {
 84         __be32  nfserr;                            86         __be32  nfserr;
 85                                                    87 
 86         dprintk("nfsd: SETATTR(3)  %s\n",          88         dprintk("nfsd: SETATTR(3)  %s\n",
 87                                 SVCFH_fmt(&arg     89                                 SVCFH_fmt(&argp->fh));
 88                                                    90 
 89         fh_copy(&resp->fh, &argp->fh);             91         fh_copy(&resp->fh, &argp->fh);
 90         nfserr = nfsd_setattr(rqstp, &resp->fh     92         nfserr = nfsd_setattr(rqstp, &resp->fh, &argp->attrs,
 91                               argp->check_guar     93                               argp->check_guard, argp->guardtime);
 92         RETURN_STATUS(nfserr);                     94         RETURN_STATUS(nfserr);
 93 }                                                  95 }
 94                                                    96 
 95 /*                                                 97 /*
 96  * Look up a path name component                   98  * Look up a path name component
 97  */                                                99  */
 98 static __be32                                     100 static __be32
 99 nfsd3_proc_lookup(struct svc_rqst *rqstp, stru    101 nfsd3_proc_lookup(struct svc_rqst *rqstp, struct nfsd3_diropargs *argp,
100                                           stru    102                                           struct nfsd3_diropres  *resp)
101 {                                                 103 {
102         __be32  nfserr;                           104         __be32  nfserr;
103                                                   105 
104         dprintk("nfsd: LOOKUP(3)   %s %.*s\n",    106         dprintk("nfsd: LOOKUP(3)   %s %.*s\n",
105                                 SVCFH_fmt(&arg    107                                 SVCFH_fmt(&argp->fh),
106                                 argp->len,        108                                 argp->len,
107                                 argp->name);      109                                 argp->name);
108                                                   110 
109         fh_copy(&resp->dirfh, &argp->fh);         111         fh_copy(&resp->dirfh, &argp->fh);
110         fh_init(&resp->fh, NFS3_FHSIZE);          112         fh_init(&resp->fh, NFS3_FHSIZE);
111                                                   113 
112         nfserr = nfsd_lookup(rqstp, &resp->dir    114         nfserr = nfsd_lookup(rqstp, &resp->dirfh,
113                                     argp->name    115                                     argp->name,
114                                     argp->len,    116                                     argp->len,
115                                     &resp->fh)    117                                     &resp->fh);
116         RETURN_STATUS(nfserr);                    118         RETURN_STATUS(nfserr);
117 }                                                 119 }
118                                                   120 
119 /*                                                121 /*
120  * Check file access                              122  * Check file access
121  */                                               123  */
122 static __be32                                     124 static __be32
123 nfsd3_proc_access(struct svc_rqst *rqstp, stru    125 nfsd3_proc_access(struct svc_rqst *rqstp, struct nfsd3_accessargs *argp,
124                                           stru    126                                           struct nfsd3_accessres *resp)
125 {                                                 127 {
126         __be32  nfserr;                           128         __be32  nfserr;
127                                                   129 
128         dprintk("nfsd: ACCESS(3)   %s 0x%x\n",    130         dprintk("nfsd: ACCESS(3)   %s 0x%x\n",
129                                 SVCFH_fmt(&arg    131                                 SVCFH_fmt(&argp->fh),
130                                 argp->access);    132                                 argp->access);
131                                                   133 
132         fh_copy(&resp->fh, &argp->fh);            134         fh_copy(&resp->fh, &argp->fh);
133         resp->access = argp->access;              135         resp->access = argp->access;
134         nfserr = nfsd_access(rqstp, &resp->fh,    136         nfserr = nfsd_access(rqstp, &resp->fh, &resp->access, NULL);
135         RETURN_STATUS(nfserr);                    137         RETURN_STATUS(nfserr);
136 }                                                 138 }
137                                                   139 
138 /*                                                140 /*
139  * Read a symlink.                                141  * Read a symlink.
140  */                                               142  */
141 static __be32                                     143 static __be32
142 nfsd3_proc_readlink(struct svc_rqst *rqstp, st    144 nfsd3_proc_readlink(struct svc_rqst *rqstp, struct nfsd3_readlinkargs *argp,
143                                            str    145                                            struct nfsd3_readlinkres *resp)
144 {                                                 146 {
145         __be32 nfserr;                            147         __be32 nfserr;
146                                                   148 
147         dprintk("nfsd: READLINK(3) %s\n", SVCF    149         dprintk("nfsd: READLINK(3) %s\n", SVCFH_fmt(&argp->fh));
148                                                   150 
149         /* Read the symlink. */                   151         /* Read the symlink. */
150         fh_copy(&resp->fh, &argp->fh);            152         fh_copy(&resp->fh, &argp->fh);
151         resp->len = NFS3_MAXPATHLEN;              153         resp->len = NFS3_MAXPATHLEN;
152         nfserr = nfsd_readlink(rqstp, &resp->f    154         nfserr = nfsd_readlink(rqstp, &resp->fh, argp->buffer, &resp->len);
153         RETURN_STATUS(nfserr);                    155         RETURN_STATUS(nfserr);
154 }                                                 156 }
155                                                   157 
156 /*                                                158 /*
157  * Read a portion of a file.                      159  * Read a portion of a file.
158  */                                               160  */
159 static __be32                                     161 static __be32
160 nfsd3_proc_read(struct svc_rqst *rqstp, struct    162 nfsd3_proc_read(struct svc_rqst *rqstp, struct nfsd3_readargs *argp,
161                                         struct    163                                         struct nfsd3_readres  *resp)
162 {                                                 164 {
163         __be32  nfserr;                           165         __be32  nfserr;
164         u32     max_blocksize = svc_max_payloa    166         u32     max_blocksize = svc_max_payload(rqstp);
165                                                   167 
166         dprintk("nfsd: READ(3) %s %lu bytes at    168         dprintk("nfsd: READ(3) %s %lu bytes at %lu\n",
167                                 SVCFH_fmt(&arg    169                                 SVCFH_fmt(&argp->fh),
168                                 (unsigned long    170                                 (unsigned long) argp->count,
169                                 (unsigned long    171                                 (unsigned long) argp->offset);
170                                                   172 
171         /* Obtain buffer pointer for payload.     173         /* Obtain buffer pointer for payload.
172          * 1 (status) + 22 (post_op_attr) + 1     174          * 1 (status) + 22 (post_op_attr) + 1 (count) + 1 (eof)
173          * + 1 (xdr opaque byte count) = 26       175          * + 1 (xdr opaque byte count) = 26
174          */                                       176          */
175                                                   177 
176         resp->count = argp->count;                178         resp->count = argp->count;
177         if (max_blocksize < resp->count)          179         if (max_blocksize < resp->count)
178                 resp->count = max_blocksize;      180                 resp->count = max_blocksize;
179                                                   181 
180         svc_reserve_auth(rqstp, ((1 + NFS3_POS    182         svc_reserve_auth(rqstp, ((1 + NFS3_POST_OP_ATTR_WORDS + 3)<<2) + resp->count +4);
181                                                   183 
182         fh_copy(&resp->fh, &argp->fh);            184         fh_copy(&resp->fh, &argp->fh);
183         nfserr = nfsd_read(rqstp, &resp->fh, N    185         nfserr = nfsd_read(rqstp, &resp->fh, NULL,
184                                   argp->offset    186                                   argp->offset,
185                                   rqstp->rq_ve    187                                   rqstp->rq_vec, argp->vlen,
186                                   &resp->count    188                                   &resp->count);
187         if (nfserr == 0) {                        189         if (nfserr == 0) {
188                 struct inode    *inode = resp-    190                 struct inode    *inode = resp->fh.fh_dentry->d_inode;
189                                                   191 
190                 resp->eof = (argp->offset + re    192                 resp->eof = (argp->offset + resp->count) >= inode->i_size;
191         }                                         193         }
192                                                   194 
193         RETURN_STATUS(nfserr);                    195         RETURN_STATUS(nfserr);
194 }                                                 196 }
195                                                   197 
196 /*                                                198 /*
197  * Write data to a file                           199  * Write data to a file
198  */                                               200  */
199 static __be32                                     201 static __be32
200 nfsd3_proc_write(struct svc_rqst *rqstp, struc    202 nfsd3_proc_write(struct svc_rqst *rqstp, struct nfsd3_writeargs *argp,
201                                          struc    203                                          struct nfsd3_writeres  *resp)
202 {                                                 204 {
203         __be32  nfserr;                           205         __be32  nfserr;
                                                   >> 206         unsigned long cnt = argp->len;
204                                                   207 
205         dprintk("nfsd: WRITE(3)    %s %d bytes    208         dprintk("nfsd: WRITE(3)    %s %d bytes at %ld%s\n",
206                                 SVCFH_fmt(&arg    209                                 SVCFH_fmt(&argp->fh),
207                                 argp->len,        210                                 argp->len,
208                                 (unsigned long    211                                 (unsigned long) argp->offset,
209                                 argp->stable?     212                                 argp->stable? " stable" : "");
210                                                   213 
211         fh_copy(&resp->fh, &argp->fh);            214         fh_copy(&resp->fh, &argp->fh);
212         resp->committed = argp->stable;           215         resp->committed = argp->stable;
213         nfserr = nfsd_write(rqstp, &resp->fh,     216         nfserr = nfsd_write(rqstp, &resp->fh, NULL,
214                                    argp->offse    217                                    argp->offset,
215                                    rqstp->rq_v    218                                    rqstp->rq_vec, argp->vlen,
216                                    argp->len,  !! 219                                    &cnt,
217                                    &resp->comm    220                                    &resp->committed);
218         resp->count = argp->count;             !! 221         resp->count = cnt;
219         RETURN_STATUS(nfserr);                    222         RETURN_STATUS(nfserr);
220 }                                                 223 }
221                                                   224 
222 /*                                                225 /*
223  * With NFSv3, CREATE processing is a lot easi    226  * With NFSv3, CREATE processing is a lot easier than with NFSv2.
224  * At least in theory; we'll see how it fares     227  * At least in theory; we'll see how it fares in practice when the
225  * first reports about SunOS compatibility pro    228  * first reports about SunOS compatibility problems start to pour in...
226  */                                               229  */
227 static __be32                                     230 static __be32
228 nfsd3_proc_create(struct svc_rqst *rqstp, stru    231 nfsd3_proc_create(struct svc_rqst *rqstp, struct nfsd3_createargs *argp,
229                                           stru    232                                           struct nfsd3_diropres   *resp)
230 {                                                 233 {
231         svc_fh          *dirfhp, *newfhp = NUL    234         svc_fh          *dirfhp, *newfhp = NULL;
232         struct iattr    *attr;                    235         struct iattr    *attr;
233         __be32          nfserr;                   236         __be32          nfserr;
234                                                   237 
235         dprintk("nfsd: CREATE(3)   %s %.*s\n",    238         dprintk("nfsd: CREATE(3)   %s %.*s\n",
236                                 SVCFH_fmt(&arg    239                                 SVCFH_fmt(&argp->fh),
237                                 argp->len,        240                                 argp->len,
238                                 argp->name);      241                                 argp->name);
239                                                   242 
240         dirfhp = fh_copy(&resp->dirfh, &argp->    243         dirfhp = fh_copy(&resp->dirfh, &argp->fh);
241         newfhp = fh_init(&resp->fh, NFS3_FHSIZ    244         newfhp = fh_init(&resp->fh, NFS3_FHSIZE);
242         attr   = &argp->attrs;                    245         attr   = &argp->attrs;
243                                                   246 
244         /* Get the directory inode */             247         /* Get the directory inode */
245         nfserr = fh_verify(rqstp, dirfhp, S_IF !! 248         nfserr = fh_verify(rqstp, dirfhp, S_IFDIR, NFSD_MAY_CREATE);
246         if (nfserr)                               249         if (nfserr)
247                 RETURN_STATUS(nfserr);            250                 RETURN_STATUS(nfserr);
248                                                   251 
249         /* Unfudge the mode bits */               252         /* Unfudge the mode bits */
250         attr->ia_mode &= ~S_IFMT;                 253         attr->ia_mode &= ~S_IFMT;
251         if (!(attr->ia_valid & ATTR_MODE)) {      254         if (!(attr->ia_valid & ATTR_MODE)) { 
252                 attr->ia_valid |= ATTR_MODE;      255                 attr->ia_valid |= ATTR_MODE;
253                 attr->ia_mode = S_IFREG;          256                 attr->ia_mode = S_IFREG;
254         } else {                                  257         } else {
255                 attr->ia_mode = (attr->ia_mode    258                 attr->ia_mode = (attr->ia_mode & ~S_IFMT) | S_IFREG;
256         }                                         259         }
257                                                   260 
258         /* Now create the file and set attribu    261         /* Now create the file and set attributes */
259         nfserr = nfsd_create_v3(rqstp, dirfhp,    262         nfserr = nfsd_create_v3(rqstp, dirfhp, argp->name, argp->len,
260                                 attr, newfhp,     263                                 attr, newfhp,
261                                 argp->createmo    264                                 argp->createmode, argp->verf, NULL, NULL);
262                                                   265 
263         RETURN_STATUS(nfserr);                    266         RETURN_STATUS(nfserr);
264 }                                                 267 }
265                                                   268 
266 /*                                                269 /*
267  * Make directory. This operation is not idemp    270  * Make directory. This operation is not idempotent.
268  */                                               271  */
269 static __be32                                     272 static __be32
270 nfsd3_proc_mkdir(struct svc_rqst *rqstp, struc    273 nfsd3_proc_mkdir(struct svc_rqst *rqstp, struct nfsd3_createargs *argp,
271                                          struc    274                                          struct nfsd3_diropres   *resp)
272 {                                                 275 {
273         __be32  nfserr;                           276         __be32  nfserr;
274                                                   277 
275         dprintk("nfsd: MKDIR(3)    %s %.*s\n",    278         dprintk("nfsd: MKDIR(3)    %s %.*s\n",
276                                 SVCFH_fmt(&arg    279                                 SVCFH_fmt(&argp->fh),
277                                 argp->len,        280                                 argp->len,
278                                 argp->name);      281                                 argp->name);
279                                                   282 
280         argp->attrs.ia_valid &= ~ATTR_SIZE;       283         argp->attrs.ia_valid &= ~ATTR_SIZE;
281         fh_copy(&resp->dirfh, &argp->fh);         284         fh_copy(&resp->dirfh, &argp->fh);
282         fh_init(&resp->fh, NFS3_FHSIZE);          285         fh_init(&resp->fh, NFS3_FHSIZE);
283         nfserr = nfsd_create(rqstp, &resp->dir    286         nfserr = nfsd_create(rqstp, &resp->dirfh, argp->name, argp->len,
284                                     &argp->att    287                                     &argp->attrs, S_IFDIR, 0, &resp->fh);
285                                                   288 
286         RETURN_STATUS(nfserr);                    289         RETURN_STATUS(nfserr);
287 }                                                 290 }
288                                                   291 
289 static __be32                                     292 static __be32
290 nfsd3_proc_symlink(struct svc_rqst *rqstp, str    293 nfsd3_proc_symlink(struct svc_rqst *rqstp, struct nfsd3_symlinkargs *argp,
291                                            str    294                                            struct nfsd3_diropres    *resp)
292 {                                                 295 {
293         __be32  nfserr;                           296         __be32  nfserr;
294                                                   297 
295         dprintk("nfsd: SYMLINK(3)  %s %.*s ->     298         dprintk("nfsd: SYMLINK(3)  %s %.*s -> %.*s\n",
296                                 SVCFH_fmt(&arg    299                                 SVCFH_fmt(&argp->ffh),
297                                 argp->flen, ar    300                                 argp->flen, argp->fname,
298                                 argp->tlen, ar    301                                 argp->tlen, argp->tname);
299                                                   302 
300         fh_copy(&resp->dirfh, &argp->ffh);        303         fh_copy(&resp->dirfh, &argp->ffh);
301         fh_init(&resp->fh, NFS3_FHSIZE);          304         fh_init(&resp->fh, NFS3_FHSIZE);
302         nfserr = nfsd_symlink(rqstp, &resp->di    305         nfserr = nfsd_symlink(rqstp, &resp->dirfh, argp->fname, argp->flen,
303                                                   306                                                    argp->tname, argp->tlen,
304                                                   307                                                    &resp->fh, &argp->attrs);
305         RETURN_STATUS(nfserr);                    308         RETURN_STATUS(nfserr);
306 }                                                 309 }
307                                                   310 
308 /*                                                311 /*
309  * Make socket/fifo/device.                       312  * Make socket/fifo/device.
310  */                                               313  */
311 static __be32                                     314 static __be32
312 nfsd3_proc_mknod(struct svc_rqst *rqstp, struc    315 nfsd3_proc_mknod(struct svc_rqst *rqstp, struct nfsd3_mknodargs *argp,
313                                          struc    316                                          struct nfsd3_diropres  *resp)
314 {                                                 317 {
315         __be32  nfserr;                           318         __be32  nfserr;
316         int type;                                 319         int type;
317         dev_t   rdev = 0;                         320         dev_t   rdev = 0;
318                                                   321 
319         dprintk("nfsd: MKNOD(3)    %s %.*s\n",    322         dprintk("nfsd: MKNOD(3)    %s %.*s\n",
320                                 SVCFH_fmt(&arg    323                                 SVCFH_fmt(&argp->fh),
321                                 argp->len,        324                                 argp->len,
322                                 argp->name);      325                                 argp->name);
323                                                   326 
324         fh_copy(&resp->dirfh, &argp->fh);         327         fh_copy(&resp->dirfh, &argp->fh);
325         fh_init(&resp->fh, NFS3_FHSIZE);          328         fh_init(&resp->fh, NFS3_FHSIZE);
326                                                   329 
327         if (argp->ftype == 0 || argp->ftype >=    330         if (argp->ftype == 0 || argp->ftype >= NF3BAD)
328                 RETURN_STATUS(nfserr_inval);      331                 RETURN_STATUS(nfserr_inval);
329         if (argp->ftype == NF3CHR || argp->fty    332         if (argp->ftype == NF3CHR || argp->ftype == NF3BLK) {
330                 rdev = MKDEV(argp->major, argp    333                 rdev = MKDEV(argp->major, argp->minor);
331                 if (MAJOR(rdev) != argp->major    334                 if (MAJOR(rdev) != argp->major ||
332                     MINOR(rdev) != argp->minor    335                     MINOR(rdev) != argp->minor)
333                         RETURN_STATUS(nfserr_i    336                         RETURN_STATUS(nfserr_inval);
334         } else                                    337         } else
335                 if (argp->ftype != NF3SOCK &&     338                 if (argp->ftype != NF3SOCK && argp->ftype != NF3FIFO)
336                         RETURN_STATUS(nfserr_i    339                         RETURN_STATUS(nfserr_inval);
337                                                   340 
338         type = nfs3_ftypes[argp->ftype];          341         type = nfs3_ftypes[argp->ftype];
339         nfserr = nfsd_create(rqstp, &resp->dir    342         nfserr = nfsd_create(rqstp, &resp->dirfh, argp->name, argp->len,
340                                     &argp->att    343                                     &argp->attrs, type, rdev, &resp->fh);
341                                                   344 
342         RETURN_STATUS(nfserr);                    345         RETURN_STATUS(nfserr);
343 }                                                 346 }
344                                                   347 
345 /*                                                348 /*
346  * Remove file/fifo/socket etc.                   349  * Remove file/fifo/socket etc.
347  */                                               350  */
348 static __be32                                     351 static __be32
349 nfsd3_proc_remove(struct svc_rqst *rqstp, stru    352 nfsd3_proc_remove(struct svc_rqst *rqstp, struct nfsd3_diropargs *argp,
350                                           stru    353                                           struct nfsd3_attrstat  *resp)
351 {                                                 354 {
352         __be32  nfserr;                           355         __be32  nfserr;
353                                                   356 
354         dprintk("nfsd: REMOVE(3)   %s %.*s\n",    357         dprintk("nfsd: REMOVE(3)   %s %.*s\n",
355                                 SVCFH_fmt(&arg    358                                 SVCFH_fmt(&argp->fh),
356                                 argp->len,        359                                 argp->len,
357                                 argp->name);      360                                 argp->name);
358                                                   361 
359         /* Unlink. -S_IFDIR means file must no    362         /* Unlink. -S_IFDIR means file must not be a directory */
360         fh_copy(&resp->fh, &argp->fh);            363         fh_copy(&resp->fh, &argp->fh);
361         nfserr = nfsd_unlink(rqstp, &resp->fh,    364         nfserr = nfsd_unlink(rqstp, &resp->fh, -S_IFDIR, argp->name, argp->len);
362         RETURN_STATUS(nfserr);                    365         RETURN_STATUS(nfserr);
363 }                                                 366 }
364                                                   367 
365 /*                                                368 /*
366  * Remove a directory                             369  * Remove a directory
367  */                                               370  */
368 static __be32                                     371 static __be32
369 nfsd3_proc_rmdir(struct svc_rqst *rqstp, struc    372 nfsd3_proc_rmdir(struct svc_rqst *rqstp, struct nfsd3_diropargs *argp,
370                                          struc    373                                          struct nfsd3_attrstat  *resp)
371 {                                                 374 {
372         __be32  nfserr;                           375         __be32  nfserr;
373                                                   376 
374         dprintk("nfsd: RMDIR(3)    %s %.*s\n",    377         dprintk("nfsd: RMDIR(3)    %s %.*s\n",
375                                 SVCFH_fmt(&arg    378                                 SVCFH_fmt(&argp->fh),
376                                 argp->len,        379                                 argp->len,
377                                 argp->name);      380                                 argp->name);
378                                                   381 
379         fh_copy(&resp->fh, &argp->fh);            382         fh_copy(&resp->fh, &argp->fh);
380         nfserr = nfsd_unlink(rqstp, &resp->fh,    383         nfserr = nfsd_unlink(rqstp, &resp->fh, S_IFDIR, argp->name, argp->len);
381         RETURN_STATUS(nfserr);                    384         RETURN_STATUS(nfserr);
382 }                                                 385 }
383                                                   386 
384 static __be32                                     387 static __be32
385 nfsd3_proc_rename(struct svc_rqst *rqstp, stru    388 nfsd3_proc_rename(struct svc_rqst *rqstp, struct nfsd3_renameargs *argp,
386                                           stru    389                                           struct nfsd3_renameres  *resp)
387 {                                                 390 {
388         __be32  nfserr;                           391         __be32  nfserr;
389                                                   392 
390         dprintk("nfsd: RENAME(3)   %s %.*s ->\    393         dprintk("nfsd: RENAME(3)   %s %.*s ->\n",
391                                 SVCFH_fmt(&arg    394                                 SVCFH_fmt(&argp->ffh),
392                                 argp->flen,       395                                 argp->flen,
393                                 argp->fname);     396                                 argp->fname);
394         dprintk("nfsd: -> %s %.*s\n",             397         dprintk("nfsd: -> %s %.*s\n",
395                                 SVCFH_fmt(&arg    398                                 SVCFH_fmt(&argp->tfh),
396                                 argp->tlen,       399                                 argp->tlen,
397                                 argp->tname);     400                                 argp->tname);
398                                                   401 
399         fh_copy(&resp->ffh, &argp->ffh);          402         fh_copy(&resp->ffh, &argp->ffh);
400         fh_copy(&resp->tfh, &argp->tfh);          403         fh_copy(&resp->tfh, &argp->tfh);
401         nfserr = nfsd_rename(rqstp, &resp->ffh    404         nfserr = nfsd_rename(rqstp, &resp->ffh, argp->fname, argp->flen,
402                                     &resp->tfh    405                                     &resp->tfh, argp->tname, argp->tlen);
403         RETURN_STATUS(nfserr);                    406         RETURN_STATUS(nfserr);
404 }                                                 407 }
405                                                   408 
406 static __be32                                     409 static __be32
407 nfsd3_proc_link(struct svc_rqst *rqstp, struct    410 nfsd3_proc_link(struct svc_rqst *rqstp, struct nfsd3_linkargs *argp,
408                                         struct    411                                         struct nfsd3_linkres  *resp)
409 {                                                 412 {
410         __be32  nfserr;                           413         __be32  nfserr;
411                                                   414 
412         dprintk("nfsd: LINK(3)     %s ->\n",      415         dprintk("nfsd: LINK(3)     %s ->\n",
413                                 SVCFH_fmt(&arg    416                                 SVCFH_fmt(&argp->ffh));
414         dprintk("nfsd:   -> %s %.*s\n",           417         dprintk("nfsd:   -> %s %.*s\n",
415                                 SVCFH_fmt(&arg    418                                 SVCFH_fmt(&argp->tfh),
416                                 argp->tlen,       419                                 argp->tlen,
417                                 argp->tname);     420                                 argp->tname);
418                                                   421 
419         fh_copy(&resp->fh,  &argp->ffh);          422         fh_copy(&resp->fh,  &argp->ffh);
420         fh_copy(&resp->tfh, &argp->tfh);          423         fh_copy(&resp->tfh, &argp->tfh);
421         nfserr = nfsd_link(rqstp, &resp->tfh,     424         nfserr = nfsd_link(rqstp, &resp->tfh, argp->tname, argp->tlen,
422                                   &resp->fh);     425                                   &resp->fh);
423         RETURN_STATUS(nfserr);                    426         RETURN_STATUS(nfserr);
424 }                                                 427 }
425                                                   428 
426 /*                                                429 /*
427  * Read a portion of a directory.                 430  * Read a portion of a directory.
428  */                                               431  */
429 static __be32                                     432 static __be32
430 nfsd3_proc_readdir(struct svc_rqst *rqstp, str    433 nfsd3_proc_readdir(struct svc_rqst *rqstp, struct nfsd3_readdirargs *argp,
431                                            str    434                                            struct nfsd3_readdirres  *resp)
432 {                                                 435 {
433         __be32          nfserr;                   436         __be32          nfserr;
434         int             count;                    437         int             count;
435                                                   438 
436         dprintk("nfsd: READDIR(3)  %s %d bytes    439         dprintk("nfsd: READDIR(3)  %s %d bytes at %d\n",
437                                 SVCFH_fmt(&arg    440                                 SVCFH_fmt(&argp->fh),
438                                 argp->count, (    441                                 argp->count, (u32) argp->cookie);
439                                                   442 
440         /* Make sure we've room for the NULL p    443         /* Make sure we've room for the NULL ptr & eof flag, and shrink to
441          * client read size */                    444          * client read size */
442         count = (argp->count >> 2) - 2;           445         count = (argp->count >> 2) - 2;
443                                                   446 
444         /* Read directory and encode entries o    447         /* Read directory and encode entries on the fly */
445         fh_copy(&resp->fh, &argp->fh);            448         fh_copy(&resp->fh, &argp->fh);
446                                                   449 
447         resp->buflen = count;                     450         resp->buflen = count;
448         resp->common.err = nfs_ok;                451         resp->common.err = nfs_ok;
449         resp->buffer = argp->buffer;              452         resp->buffer = argp->buffer;
450         resp->rqstp = rqstp;                      453         resp->rqstp = rqstp;
451         nfserr = nfsd_readdir(rqstp, &resp->fh    454         nfserr = nfsd_readdir(rqstp, &resp->fh, (loff_t*) &argp->cookie, 
452                                         &resp-    455                                         &resp->common, nfs3svc_encode_entry);
453         memcpy(resp->verf, argp->verf, 8);        456         memcpy(resp->verf, argp->verf, 8);
454         resp->count = resp->buffer - argp->buf    457         resp->count = resp->buffer - argp->buffer;
455         if (resp->offset)                         458         if (resp->offset)
456                 xdr_encode_hyper(resp->offset,    459                 xdr_encode_hyper(resp->offset, argp->cookie);
457                                                   460 
458         RETURN_STATUS(nfserr);                    461         RETURN_STATUS(nfserr);
459 }                                                 462 }
460                                                   463 
461 /*                                                464 /*
462  * Read a portion of a directory, including fi    465  * Read a portion of a directory, including file handles and attrs.
463  * For now, we choose to ignore the dircount p    466  * For now, we choose to ignore the dircount parameter.
464  */                                               467  */
465 static __be32                                     468 static __be32
466 nfsd3_proc_readdirplus(struct svc_rqst *rqstp,    469 nfsd3_proc_readdirplus(struct svc_rqst *rqstp, struct nfsd3_readdirargs *argp,
467                                                   470                                                struct nfsd3_readdirres  *resp)
468 {                                                 471 {
469         __be32  nfserr;                           472         __be32  nfserr;
470         int     count = 0;                        473         int     count = 0;
471         loff_t  offset;                           474         loff_t  offset;
472         int     i;                                475         int     i;
473         caddr_t page_addr = NULL;                 476         caddr_t page_addr = NULL;
474                                                   477 
475         dprintk("nfsd: READDIR+(3) %s %d bytes    478         dprintk("nfsd: READDIR+(3) %s %d bytes at %d\n",
476                                 SVCFH_fmt(&arg    479                                 SVCFH_fmt(&argp->fh),
477                                 argp->count, (    480                                 argp->count, (u32) argp->cookie);
478                                                   481 
479         /* Convert byte count to number of wor    482         /* Convert byte count to number of words (i.e. >> 2),
480          * and reserve room for the NULL ptr &    483          * and reserve room for the NULL ptr & eof flag (-2 words) */
481         resp->count = (argp->count >> 2) - 2;     484         resp->count = (argp->count >> 2) - 2;
482                                                   485 
483         /* Read directory and encode entries o    486         /* Read directory and encode entries on the fly */
484         fh_copy(&resp->fh, &argp->fh);            487         fh_copy(&resp->fh, &argp->fh);
485                                                   488 
486         resp->common.err = nfs_ok;                489         resp->common.err = nfs_ok;
487         resp->buffer = argp->buffer;              490         resp->buffer = argp->buffer;
488         resp->buflen = resp->count;               491         resp->buflen = resp->count;
489         resp->rqstp = rqstp;                      492         resp->rqstp = rqstp;
490         offset = argp->cookie;                    493         offset = argp->cookie;
491         nfserr = nfsd_readdir(rqstp, &resp->fh    494         nfserr = nfsd_readdir(rqstp, &resp->fh,
492                                      &offset,     495                                      &offset,
493                                      &resp->co    496                                      &resp->common,
494                                      nfs3svc_e    497                                      nfs3svc_encode_entry_plus);
495         memcpy(resp->verf, argp->verf, 8);        498         memcpy(resp->verf, argp->verf, 8);
496         for (i=1; i<rqstp->rq_resused ; i++) {    499         for (i=1; i<rqstp->rq_resused ; i++) {
497                 page_addr = page_address(rqstp    500                 page_addr = page_address(rqstp->rq_respages[i]);
498                                                   501 
499                 if (((caddr_t)resp->buffer >=     502                 if (((caddr_t)resp->buffer >= page_addr) &&
500                     ((caddr_t)resp->buffer < p    503                     ((caddr_t)resp->buffer < page_addr + PAGE_SIZE)) {
501                         count += (caddr_t)resp    504                         count += (caddr_t)resp->buffer - page_addr;
502                         break;                    505                         break;
503                 }                                 506                 }
504                 count += PAGE_SIZE;               507                 count += PAGE_SIZE;
505         }                                         508         }
506         resp->count = count >> 2;                 509         resp->count = count >> 2;
507         if (resp->offset) {                       510         if (resp->offset) {
508                 if (unlikely(resp->offset1)) {    511                 if (unlikely(resp->offset1)) {
509                         /* we ended up with of    512                         /* we ended up with offset on a page boundary */
510                         *resp->offset = htonl(    513                         *resp->offset = htonl(offset >> 32);
511                         *resp->offset1 = htonl    514                         *resp->offset1 = htonl(offset & 0xffffffff);
512                         resp->offset1 = NULL;     515                         resp->offset1 = NULL;
513                 } else {                          516                 } else {
514                         xdr_encode_hyper(resp-    517                         xdr_encode_hyper(resp->offset, offset);
515                 }                                 518                 }
516         }                                         519         }
517                                                   520 
518         RETURN_STATUS(nfserr);                    521         RETURN_STATUS(nfserr);
519 }                                                 522 }
520                                                   523 
521 /*                                                524 /*
522  * Get file system stats                          525  * Get file system stats
523  */                                               526  */
524 static __be32                                     527 static __be32
525 nfsd3_proc_fsstat(struct svc_rqst * rqstp, str    528 nfsd3_proc_fsstat(struct svc_rqst * rqstp, struct nfsd_fhandle    *argp,
526                                            str    529                                            struct nfsd3_fsstatres *resp)
527 {                                                 530 {
528         __be32  nfserr;                           531         __be32  nfserr;
529                                                   532 
530         dprintk("nfsd: FSSTAT(3)   %s\n",         533         dprintk("nfsd: FSSTAT(3)   %s\n",
531                                 SVCFH_fmt(&arg    534                                 SVCFH_fmt(&argp->fh));
532                                                   535 
533         nfserr = nfsd_statfs(rqstp, &argp->fh, !! 536         nfserr = nfsd_statfs(rqstp, &argp->fh, &resp->stats, 0);
534         fh_put(&argp->fh);                        537         fh_put(&argp->fh);
535         RETURN_STATUS(nfserr);                    538         RETURN_STATUS(nfserr);
536 }                                                 539 }
537                                                   540 
538 /*                                                541 /*
539  * Get file system info                           542  * Get file system info
540  */                                               543  */
541 static __be32                                     544 static __be32
542 nfsd3_proc_fsinfo(struct svc_rqst * rqstp, str    545 nfsd3_proc_fsinfo(struct svc_rqst * rqstp, struct nfsd_fhandle    *argp,
543                                            str    546                                            struct nfsd3_fsinfores *resp)
544 {                                                 547 {
545         __be32  nfserr;                           548         __be32  nfserr;
546         u32     max_blocksize = svc_max_payloa    549         u32     max_blocksize = svc_max_payload(rqstp);
547                                                   550 
548         dprintk("nfsd: FSINFO(3)   %s\n",         551         dprintk("nfsd: FSINFO(3)   %s\n",
549                                 SVCFH_fmt(&arg    552                                 SVCFH_fmt(&argp->fh));
550                                                   553 
551         resp->f_rtmax  = max_blocksize;           554         resp->f_rtmax  = max_blocksize;
552         resp->f_rtpref = max_blocksize;           555         resp->f_rtpref = max_blocksize;
553         resp->f_rtmult = PAGE_SIZE;               556         resp->f_rtmult = PAGE_SIZE;
554         resp->f_wtmax  = max_blocksize;           557         resp->f_wtmax  = max_blocksize;
555         resp->f_wtpref = max_blocksize;           558         resp->f_wtpref = max_blocksize;
556         resp->f_wtmult = PAGE_SIZE;               559         resp->f_wtmult = PAGE_SIZE;
557         resp->f_dtpref = PAGE_SIZE;               560         resp->f_dtpref = PAGE_SIZE;
558         resp->f_maxfilesize = ~(u32) 0;           561         resp->f_maxfilesize = ~(u32) 0;
559         resp->f_properties = NFS3_FSF_DEFAULT;    562         resp->f_properties = NFS3_FSF_DEFAULT;
560                                                   563 
561         nfserr = fh_verify(rqstp, &argp->fh, 0 !! 564         nfserr = fh_verify(rqstp, &argp->fh, 0,
                                                   >> 565                         NFSD_MAY_NOP | NFSD_MAY_BYPASS_GSS_ON_ROOT);
562                                                   566 
563         /* Check special features of the file     567         /* Check special features of the file system. May request
564          * different read/write sizes for file    568          * different read/write sizes for file systems known to have
565          * problems with large blocks */          569          * problems with large blocks */
566         if (nfserr == 0) {                        570         if (nfserr == 0) {
567                 struct super_block *sb = argp-    571                 struct super_block *sb = argp->fh.fh_dentry->d_inode->i_sb;
568                                                   572 
569                 /* Note that we don't care for    573                 /* Note that we don't care for remote fs's here */
570                 if (sb->s_magic == 0x4d44 /* M !! 574                 if (sb->s_magic == MSDOS_SUPER_MAGIC) {
571                         resp->f_properties = N    575                         resp->f_properties = NFS3_FSF_BILLYBOY;
572                 }                                 576                 }
573                 resp->f_maxfilesize = sb->s_ma    577                 resp->f_maxfilesize = sb->s_maxbytes;
574         }                                         578         }
575                                                   579 
576         fh_put(&argp->fh);                        580         fh_put(&argp->fh);
577         RETURN_STATUS(nfserr);                    581         RETURN_STATUS(nfserr);
578 }                                                 582 }
579                                                   583 
580 /*                                                584 /*
581  * Get pathconf info for the specified file       585  * Get pathconf info for the specified file
582  */                                               586  */
583 static __be32                                     587 static __be32
584 nfsd3_proc_pathconf(struct svc_rqst * rqstp, s    588 nfsd3_proc_pathconf(struct svc_rqst * rqstp, struct nfsd_fhandle      *argp,
585                                              s    589                                              struct nfsd3_pathconfres *resp)
586 {                                                 590 {
587         __be32  nfserr;                           591         __be32  nfserr;
588                                                   592 
589         dprintk("nfsd: PATHCONF(3) %s\n",         593         dprintk("nfsd: PATHCONF(3) %s\n",
590                                 SVCFH_fmt(&arg    594                                 SVCFH_fmt(&argp->fh));
591                                                   595 
592         /* Set default pathconf */                596         /* Set default pathconf */
593         resp->p_link_max = 255;         /* at     597         resp->p_link_max = 255;         /* at least */
594         resp->p_name_max = 255;         /* at     598         resp->p_name_max = 255;         /* at least */
595         resp->p_no_trunc = 0;                     599         resp->p_no_trunc = 0;
596         resp->p_chown_restricted = 1;             600         resp->p_chown_restricted = 1;
597         resp->p_case_insensitive = 0;             601         resp->p_case_insensitive = 0;
598         resp->p_case_preserving = 1;              602         resp->p_case_preserving = 1;
599                                                   603 
600         nfserr = fh_verify(rqstp, &argp->fh, 0 !! 604         nfserr = fh_verify(rqstp, &argp->fh, 0, NFSD_MAY_NOP);
601                                                   605 
602         if (nfserr == 0) {                        606         if (nfserr == 0) {
603                 struct super_block *sb = argp-    607                 struct super_block *sb = argp->fh.fh_dentry->d_inode->i_sb;
604                                                   608 
605                 /* Note that we don't care for    609                 /* Note that we don't care for remote fs's here */
606                 switch (sb->s_magic) {            610                 switch (sb->s_magic) {
607                 case EXT2_SUPER_MAGIC:            611                 case EXT2_SUPER_MAGIC:
608                         resp->p_link_max = EXT    612                         resp->p_link_max = EXT2_LINK_MAX;
609                         resp->p_name_max = EXT    613                         resp->p_name_max = EXT2_NAME_LEN;
610                         break;                    614                         break;
611                 case 0x4d44:    /* MSDOS_SUPER !! 615                 case MSDOS_SUPER_MAGIC:
612                         resp->p_case_insensiti    616                         resp->p_case_insensitive = 1;
613                         resp->p_case_preservin    617                         resp->p_case_preserving  = 0;
614                         break;                    618                         break;
615                 }                                 619                 }
616         }                                         620         }
617                                                   621 
618         fh_put(&argp->fh);                        622         fh_put(&argp->fh);
619         RETURN_STATUS(nfserr);                    623         RETURN_STATUS(nfserr);
620 }                                                 624 }
621                                                   625 
622                                                   626 
623 /*                                                627 /*
624  * Commit a file (range) to stable storage.       628  * Commit a file (range) to stable storage.
625  */                                               629  */
626 static __be32                                     630 static __be32
627 nfsd3_proc_commit(struct svc_rqst * rqstp, str    631 nfsd3_proc_commit(struct svc_rqst * rqstp, struct nfsd3_commitargs *argp,
628                                            str    632                                            struct nfsd3_commitres  *resp)
629 {                                                 633 {
630         __be32  nfserr;                           634         __be32  nfserr;
631                                                   635 
632         dprintk("nfsd: COMMIT(3)   %s %u@%Lu\n    636         dprintk("nfsd: COMMIT(3)   %s %u@%Lu\n",
633                                 SVCFH_fmt(&arg    637                                 SVCFH_fmt(&argp->fh),
634                                 argp->count,      638                                 argp->count,
635                                 (unsigned long    639                                 (unsigned long long) argp->offset);
636                                                   640 
637         if (argp->offset > NFS_OFFSET_MAX)        641         if (argp->offset > NFS_OFFSET_MAX)
638                 RETURN_STATUS(nfserr_inval);      642                 RETURN_STATUS(nfserr_inval);
639                                                   643 
640         fh_copy(&resp->fh, &argp->fh);            644         fh_copy(&resp->fh, &argp->fh);
641         nfserr = nfsd_commit(rqstp, &resp->fh,    645         nfserr = nfsd_commit(rqstp, &resp->fh, argp->offset, argp->count);
642                                                   646 
643         RETURN_STATUS(nfserr);                    647         RETURN_STATUS(nfserr);
644 }                                                 648 }
645                                                   649 
646                                                   650 
647 /*                                                651 /*
648  * NFSv3 Server procedures.                       652  * NFSv3 Server procedures.
649  * Only the results of non-idempotent operatio    653  * Only the results of non-idempotent operations are cached.
650  */                                               654  */
651 #define nfs3svc_decode_voidargs         NULL   << 
652 #define nfs3svc_release_void            NULL   << 
653 #define nfs3svc_decode_fhandleargs      nfs3sv    655 #define nfs3svc_decode_fhandleargs      nfs3svc_decode_fhandle
654 #define nfs3svc_encode_attrstatres      nfs3sv    656 #define nfs3svc_encode_attrstatres      nfs3svc_encode_attrstat
655 #define nfs3svc_encode_wccstatres       nfs3sv    657 #define nfs3svc_encode_wccstatres       nfs3svc_encode_wccstat
656 #define nfsd3_mkdirargs                 nfsd3_    658 #define nfsd3_mkdirargs                 nfsd3_createargs
657 #define nfsd3_readdirplusargs           nfsd3_    659 #define nfsd3_readdirplusargs           nfsd3_readdirargs
658 #define nfsd3_fhandleargs               nfsd_f    660 #define nfsd3_fhandleargs               nfsd_fhandle
659 #define nfsd3_fhandleres                nfsd3_    661 #define nfsd3_fhandleres                nfsd3_attrstat
660 #define nfsd3_attrstatres               nfsd3_    662 #define nfsd3_attrstatres               nfsd3_attrstat
661 #define nfsd3_wccstatres                nfsd3_    663 #define nfsd3_wccstatres                nfsd3_attrstat
662 #define nfsd3_createres                 nfsd3_    664 #define nfsd3_createres                 nfsd3_diropres
663 #define nfsd3_voidres                   nfsd3_    665 #define nfsd3_voidres                   nfsd3_voidargs
664 struct nfsd3_voidargs { int dummy; };             666 struct nfsd3_voidargs { int dummy; };
665                                                   667 
666 #define PROC(name, argt, rest, relt, cache, re    668 #define PROC(name, argt, rest, relt, cache, respsize)   \
667  { (svc_procfunc) nfsd3_proc_##name,              669  { (svc_procfunc) nfsd3_proc_##name,            \
668    (kxdrproc_t) nfs3svc_decode_##argt##args,      670    (kxdrproc_t) nfs3svc_decode_##argt##args,    \
669    (kxdrproc_t) nfs3svc_encode_##rest##res,       671    (kxdrproc_t) nfs3svc_encode_##rest##res,     \
670    (kxdrproc_t) nfs3svc_release_##relt,           672    (kxdrproc_t) nfs3svc_release_##relt,         \
671    sizeof(struct nfsd3_##argt##args),             673    sizeof(struct nfsd3_##argt##args),           \
672    sizeof(struct nfsd3_##rest##res),              674    sizeof(struct nfsd3_##rest##res),            \
673    0,                                             675    0,                                           \
674    cache,                                         676    cache,                                       \
675    respsize,                                      677    respsize,                                    \
676  }                                                678  }
677                                                   679 
678 #define ST 1            /* status*/               680 #define ST 1            /* status*/
679 #define FH 17           /* filehandle with len    681 #define FH 17           /* filehandle with length */
680 #define AT 21           /* attributes */          682 #define AT 21           /* attributes */
681 #define pAT (1+AT)      /* post attributes - c    683 #define pAT (1+AT)      /* post attributes - conditional */
682 #define WC (7+pAT)      /* WCC attributes */      684 #define WC (7+pAT)      /* WCC attributes */
683                                                   685 
684 static struct svc_procedure             nfsd_p    686 static struct svc_procedure             nfsd_procedures3[22] = {
685   PROC(null,     void,          void,          !! 687         [NFS3PROC_NULL] = {
686   PROC(getattr,  fhandle,       attrstat,      !! 688                 .pc_func = (svc_procfunc) nfsd3_proc_null,
687   PROC(setattr,  sattr,         wccstat,       !! 689                 .pc_encode = (kxdrproc_t) nfs3svc_encode_voidres,
688   PROC(lookup,   dirop,         dirop,         !! 690                 .pc_argsize = sizeof(struct nfsd3_voidargs),
689   PROC(access,   access,        access,        !! 691                 .pc_ressize = sizeof(struct nfsd3_voidres),
690   PROC(readlink, readlink,      readlink,      !! 692                 .pc_cachetype = RC_NOCACHE,
691   PROC(read,     read,          read,          !! 693                 .pc_xdrressize = ST,
692   PROC(write,    write,         write,         !! 694         },
693   PROC(create,   create,        create,        !! 695         [NFS3PROC_GETATTR] = {
694   PROC(mkdir,    mkdir,         create,        !! 696                 .pc_func = (svc_procfunc) nfsd3_proc_getattr,
695   PROC(symlink,  symlink,       create,        !! 697                 .pc_decode = (kxdrproc_t) nfs3svc_decode_fhandleargs,
696   PROC(mknod,    mknod,         create,        !! 698                 .pc_encode = (kxdrproc_t) nfs3svc_encode_attrstatres,
697   PROC(remove,   dirop,         wccstat,       !! 699                 .pc_release = (kxdrproc_t) nfs3svc_release_fhandle,
698   PROC(rmdir,    dirop,         wccstat,       !! 700                 .pc_argsize = sizeof(struct nfsd3_fhandleargs),
699   PROC(rename,   rename,        rename,        !! 701                 .pc_ressize = sizeof(struct nfsd3_attrstatres),
700   PROC(link,     link,          link,          !! 702                 .pc_cachetype = RC_NOCACHE,
701   PROC(readdir,  readdir,       readdir,       !! 703                 .pc_xdrressize = ST+AT,
702   PROC(readdirplus,readdirplus, readdir,       !! 704         },
703   PROC(fsstat,   fhandle,       fsstat,        !! 705         [NFS3PROC_SETATTR] = {
704   PROC(fsinfo,   fhandle,       fsinfo,        !! 706                 .pc_func = (svc_procfunc) nfsd3_proc_setattr,
705   PROC(pathconf, fhandle,       pathconf,      !! 707                 .pc_decode = (kxdrproc_t) nfs3svc_decode_sattrargs,
706   PROC(commit,   commit,        commit,        !! 708                 .pc_encode = (kxdrproc_t) nfs3svc_encode_wccstatres,
                                                   >> 709                 .pc_release = (kxdrproc_t) nfs3svc_release_fhandle,
                                                   >> 710                 .pc_argsize = sizeof(struct nfsd3_sattrargs),
                                                   >> 711                 .pc_ressize = sizeof(struct nfsd3_wccstatres),
                                                   >> 712                 .pc_cachetype = RC_REPLBUFF,
                                                   >> 713                 .pc_xdrressize = ST+WC,
                                                   >> 714         },
                                                   >> 715         [NFS3PROC_LOOKUP] = {
                                                   >> 716                 .pc_func = (svc_procfunc) nfsd3_proc_lookup,
                                                   >> 717                 .pc_decode = (kxdrproc_t) nfs3svc_decode_diropargs,
                                                   >> 718                 .pc_encode = (kxdrproc_t) nfs3svc_encode_diropres,
                                                   >> 719                 .pc_release = (kxdrproc_t) nfs3svc_release_fhandle2,
                                                   >> 720                 .pc_argsize = sizeof(struct nfsd3_diropargs),
                                                   >> 721                 .pc_ressize = sizeof(struct nfsd3_diropres),
                                                   >> 722                 .pc_cachetype = RC_NOCACHE,
                                                   >> 723                 .pc_xdrressize = ST+FH+pAT+pAT,
                                                   >> 724         },
                                                   >> 725         [NFS3PROC_ACCESS] = {
                                                   >> 726                 .pc_func = (svc_procfunc) nfsd3_proc_access,
                                                   >> 727                 .pc_decode = (kxdrproc_t) nfs3svc_decode_accessargs,
                                                   >> 728                 .pc_encode = (kxdrproc_t) nfs3svc_encode_accessres,
                                                   >> 729                 .pc_release = (kxdrproc_t) nfs3svc_release_fhandle,
                                                   >> 730                 .pc_argsize = sizeof(struct nfsd3_accessargs),
                                                   >> 731                 .pc_ressize = sizeof(struct nfsd3_accessres),
                                                   >> 732                 .pc_cachetype = RC_NOCACHE,
                                                   >> 733                 .pc_xdrressize = ST+pAT+1,
                                                   >> 734         },
                                                   >> 735         [NFS3PROC_READLINK] = {
                                                   >> 736                 .pc_func = (svc_procfunc) nfsd3_proc_readlink,
                                                   >> 737                 .pc_decode = (kxdrproc_t) nfs3svc_decode_readlinkargs,
                                                   >> 738                 .pc_encode = (kxdrproc_t) nfs3svc_encode_readlinkres,
                                                   >> 739                 .pc_release = (kxdrproc_t) nfs3svc_release_fhandle,
                                                   >> 740                 .pc_argsize = sizeof(struct nfsd3_readlinkargs),
                                                   >> 741                 .pc_ressize = sizeof(struct nfsd3_readlinkres),
                                                   >> 742                 .pc_cachetype = RC_NOCACHE,
                                                   >> 743                 .pc_xdrressize = ST+pAT+1+NFS3_MAXPATHLEN/4,
                                                   >> 744         },
                                                   >> 745         [NFS3PROC_READ] = {
                                                   >> 746                 .pc_func = (svc_procfunc) nfsd3_proc_read,
                                                   >> 747                 .pc_decode = (kxdrproc_t) nfs3svc_decode_readargs,
                                                   >> 748                 .pc_encode = (kxdrproc_t) nfs3svc_encode_readres,
                                                   >> 749                 .pc_release = (kxdrproc_t) nfs3svc_release_fhandle,
                                                   >> 750                 .pc_argsize = sizeof(struct nfsd3_readargs),
                                                   >> 751                 .pc_ressize = sizeof(struct nfsd3_readres),
                                                   >> 752                 .pc_cachetype = RC_NOCACHE,
                                                   >> 753                 .pc_xdrressize = ST+pAT+4+NFSSVC_MAXBLKSIZE/4,
                                                   >> 754         },
                                                   >> 755         [NFS3PROC_WRITE] = {
                                                   >> 756                 .pc_func = (svc_procfunc) nfsd3_proc_write,
                                                   >> 757                 .pc_decode = (kxdrproc_t) nfs3svc_decode_writeargs,
                                                   >> 758                 .pc_encode = (kxdrproc_t) nfs3svc_encode_writeres,
                                                   >> 759                 .pc_release = (kxdrproc_t) nfs3svc_release_fhandle,
                                                   >> 760                 .pc_argsize = sizeof(struct nfsd3_writeargs),
                                                   >> 761                 .pc_ressize = sizeof(struct nfsd3_writeres),
                                                   >> 762                 .pc_cachetype = RC_REPLBUFF,
                                                   >> 763                 .pc_xdrressize = ST+WC+4,
                                                   >> 764         },
                                                   >> 765         [NFS3PROC_CREATE] = {
                                                   >> 766                 .pc_func = (svc_procfunc) nfsd3_proc_create,
                                                   >> 767                 .pc_decode = (kxdrproc_t) nfs3svc_decode_createargs,
                                                   >> 768                 .pc_encode = (kxdrproc_t) nfs3svc_encode_createres,
                                                   >> 769                 .pc_release = (kxdrproc_t) nfs3svc_release_fhandle2,
                                                   >> 770                 .pc_argsize = sizeof(struct nfsd3_createargs),
                                                   >> 771                 .pc_ressize = sizeof(struct nfsd3_createres),
                                                   >> 772                 .pc_cachetype = RC_REPLBUFF,
                                                   >> 773                 .pc_xdrressize = ST+(1+FH+pAT)+WC,
                                                   >> 774         },
                                                   >> 775         [NFS3PROC_MKDIR] = {
                                                   >> 776                 .pc_func = (svc_procfunc) nfsd3_proc_mkdir,
                                                   >> 777                 .pc_decode = (kxdrproc_t) nfs3svc_decode_mkdirargs,
                                                   >> 778                 .pc_encode = (kxdrproc_t) nfs3svc_encode_createres,
                                                   >> 779                 .pc_release = (kxdrproc_t) nfs3svc_release_fhandle2,
                                                   >> 780                 .pc_argsize = sizeof(struct nfsd3_mkdirargs),
                                                   >> 781                 .pc_ressize = sizeof(struct nfsd3_createres),
                                                   >> 782                 .pc_cachetype = RC_REPLBUFF,
                                                   >> 783                 .pc_xdrressize = ST+(1+FH+pAT)+WC,
                                                   >> 784         },
                                                   >> 785         [NFS3PROC_SYMLINK] = {
                                                   >> 786                 .pc_func = (svc_procfunc) nfsd3_proc_symlink,
                                                   >> 787                 .pc_decode = (kxdrproc_t) nfs3svc_decode_symlinkargs,
                                                   >> 788                 .pc_encode = (kxdrproc_t) nfs3svc_encode_createres,
                                                   >> 789                 .pc_release = (kxdrproc_t) nfs3svc_release_fhandle2,
                                                   >> 790                 .pc_argsize = sizeof(struct nfsd3_symlinkargs),
                                                   >> 791                 .pc_ressize = sizeof(struct nfsd3_createres),
                                                   >> 792                 .pc_cachetype = RC_REPLBUFF,
                                                   >> 793                 .pc_xdrressize = ST+(1+FH+pAT)+WC,
                                                   >> 794         },
                                                   >> 795         [NFS3PROC_MKNOD] = {
                                                   >> 796                 .pc_func = (svc_procfunc) nfsd3_proc_mknod,
                                                   >> 797                 .pc_decode = (kxdrproc_t) nfs3svc_decode_mknodargs,
                                                   >> 798                 .pc_encode = (kxdrproc_t) nfs3svc_encode_createres,
                                                   >> 799                 .pc_release = (kxdrproc_t) nfs3svc_release_fhandle2,
                                                   >> 800                 .pc_argsize = sizeof(struct nfsd3_mknodargs),
                                                   >> 801                 .pc_ressize = sizeof(struct nfsd3_createres),
                                                   >> 802                 .pc_cachetype = RC_REPLBUFF,
                                                   >> 803                 .pc_xdrressize = ST+(1+FH+pAT)+WC,
                                                   >> 804         },
                                                   >> 805         [NFS3PROC_REMOVE] = {
                                                   >> 806                 .pc_func = (svc_procfunc) nfsd3_proc_remove,
                                                   >> 807                 .pc_decode = (kxdrproc_t) nfs3svc_decode_diropargs,
                                                   >> 808                 .pc_encode = (kxdrproc_t) nfs3svc_encode_wccstatres,
                                                   >> 809                 .pc_release = (kxdrproc_t) nfs3svc_release_fhandle,
                                                   >> 810                 .pc_argsize = sizeof(struct nfsd3_diropargs),
                                                   >> 811                 .pc_ressize = sizeof(struct nfsd3_wccstatres),
                                                   >> 812                 .pc_cachetype = RC_REPLBUFF,
                                                   >> 813                 .pc_xdrressize = ST+WC,
                                                   >> 814         },
                                                   >> 815         [NFS3PROC_RMDIR] = {
                                                   >> 816                 .pc_func = (svc_procfunc) nfsd3_proc_rmdir,
                                                   >> 817                 .pc_decode = (kxdrproc_t) nfs3svc_decode_diropargs,
                                                   >> 818                 .pc_encode = (kxdrproc_t) nfs3svc_encode_wccstatres,
                                                   >> 819                 .pc_release = (kxdrproc_t) nfs3svc_release_fhandle,
                                                   >> 820                 .pc_argsize = sizeof(struct nfsd3_diropargs),
                                                   >> 821                 .pc_ressize = sizeof(struct nfsd3_wccstatres),
                                                   >> 822                 .pc_cachetype = RC_REPLBUFF,
                                                   >> 823                 .pc_xdrressize = ST+WC,
                                                   >> 824         },
                                                   >> 825         [NFS3PROC_RENAME] = {
                                                   >> 826                 .pc_func = (svc_procfunc) nfsd3_proc_rename,
                                                   >> 827                 .pc_decode = (kxdrproc_t) nfs3svc_decode_renameargs,
                                                   >> 828                 .pc_encode = (kxdrproc_t) nfs3svc_encode_renameres,
                                                   >> 829                 .pc_release = (kxdrproc_t) nfs3svc_release_fhandle2,
                                                   >> 830                 .pc_argsize = sizeof(struct nfsd3_renameargs),
                                                   >> 831                 .pc_ressize = sizeof(struct nfsd3_renameres),
                                                   >> 832                 .pc_cachetype = RC_REPLBUFF,
                                                   >> 833                 .pc_xdrressize = ST+WC+WC,
                                                   >> 834         },
                                                   >> 835         [NFS3PROC_LINK] = {
                                                   >> 836                 .pc_func = (svc_procfunc) nfsd3_proc_link,
                                                   >> 837                 .pc_decode = (kxdrproc_t) nfs3svc_decode_linkargs,
                                                   >> 838                 .pc_encode = (kxdrproc_t) nfs3svc_encode_linkres,
                                                   >> 839                 .pc_release = (kxdrproc_t) nfs3svc_release_fhandle2,
                                                   >> 840                 .pc_argsize = sizeof(struct nfsd3_linkargs),
                                                   >> 841                 .pc_ressize = sizeof(struct nfsd3_linkres),
                                                   >> 842                 .pc_cachetype = RC_REPLBUFF,
                                                   >> 843                 .pc_xdrressize = ST+pAT+WC,
                                                   >> 844         },
                                                   >> 845         [NFS3PROC_READDIR] = {
                                                   >> 846                 .pc_func = (svc_procfunc) nfsd3_proc_readdir,
                                                   >> 847                 .pc_decode = (kxdrproc_t) nfs3svc_decode_readdirargs,
                                                   >> 848                 .pc_encode = (kxdrproc_t) nfs3svc_encode_readdirres,
                                                   >> 849                 .pc_release = (kxdrproc_t) nfs3svc_release_fhandle,
                                                   >> 850                 .pc_argsize = sizeof(struct nfsd3_readdirargs),
                                                   >> 851                 .pc_ressize = sizeof(struct nfsd3_readdirres),
                                                   >> 852                 .pc_cachetype = RC_NOCACHE,
                                                   >> 853         },
                                                   >> 854         [NFS3PROC_READDIRPLUS] = {
                                                   >> 855                 .pc_func = (svc_procfunc) nfsd3_proc_readdirplus,
                                                   >> 856                 .pc_decode = (kxdrproc_t) nfs3svc_decode_readdirplusargs,
                                                   >> 857                 .pc_encode = (kxdrproc_t) nfs3svc_encode_readdirres,
                                                   >> 858                 .pc_release = (kxdrproc_t) nfs3svc_release_fhandle,
                                                   >> 859                 .pc_argsize = sizeof(struct nfsd3_readdirplusargs),
                                                   >> 860                 .pc_ressize = sizeof(struct nfsd3_readdirres),
                                                   >> 861                 .pc_cachetype = RC_NOCACHE,
                                                   >> 862         },
                                                   >> 863         [NFS3PROC_FSSTAT] = {
                                                   >> 864                 .pc_func = (svc_procfunc) nfsd3_proc_fsstat,
                                                   >> 865                 .pc_decode = (kxdrproc_t) nfs3svc_decode_fhandleargs,
                                                   >> 866                 .pc_encode = (kxdrproc_t) nfs3svc_encode_fsstatres,
                                                   >> 867                 .pc_argsize = sizeof(struct nfsd3_fhandleargs),
                                                   >> 868                 .pc_ressize = sizeof(struct nfsd3_fsstatres),
                                                   >> 869                 .pc_cachetype = RC_NOCACHE,
                                                   >> 870                 .pc_xdrressize = ST+pAT+2*6+1,
                                                   >> 871         },
                                                   >> 872         [NFS3PROC_FSINFO] = {
                                                   >> 873                 .pc_func = (svc_procfunc) nfsd3_proc_fsinfo,
                                                   >> 874                 .pc_decode = (kxdrproc_t) nfs3svc_decode_fhandleargs,
                                                   >> 875                 .pc_encode = (kxdrproc_t) nfs3svc_encode_fsinfores,
                                                   >> 876                 .pc_argsize = sizeof(struct nfsd3_fhandleargs),
                                                   >> 877                 .pc_ressize = sizeof(struct nfsd3_fsinfores),
                                                   >> 878                 .pc_cachetype = RC_NOCACHE,
                                                   >> 879                 .pc_xdrressize = ST+pAT+12,
                                                   >> 880         },
                                                   >> 881         [NFS3PROC_PATHCONF] = {
                                                   >> 882                 .pc_func = (svc_procfunc) nfsd3_proc_pathconf,
                                                   >> 883                 .pc_decode = (kxdrproc_t) nfs3svc_decode_fhandleargs,
                                                   >> 884                 .pc_encode = (kxdrproc_t) nfs3svc_encode_pathconfres,
                                                   >> 885                 .pc_argsize = sizeof(struct nfsd3_fhandleargs),
                                                   >> 886                 .pc_ressize = sizeof(struct nfsd3_pathconfres),
                                                   >> 887                 .pc_cachetype = RC_NOCACHE,
                                                   >> 888                 .pc_xdrressize = ST+pAT+6,
                                                   >> 889         },
                                                   >> 890         [NFS3PROC_COMMIT] = {
                                                   >> 891                 .pc_func = (svc_procfunc) nfsd3_proc_commit,
                                                   >> 892                 .pc_decode = (kxdrproc_t) nfs3svc_decode_commitargs,
                                                   >> 893                 .pc_encode = (kxdrproc_t) nfs3svc_encode_commitres,
                                                   >> 894                 .pc_release = (kxdrproc_t) nfs3svc_release_fhandle,
                                                   >> 895                 .pc_argsize = sizeof(struct nfsd3_commitargs),
                                                   >> 896                 .pc_ressize = sizeof(struct nfsd3_commitres),
                                                   >> 897                 .pc_cachetype = RC_NOCACHE,
                                                   >> 898                 .pc_xdrressize = ST+WC+2,
                                                   >> 899         },
707 };                                                900 };
708                                                   901 
709 struct svc_version      nfsd_version3 = {         902 struct svc_version      nfsd_version3 = {
710                 .vs_vers        = 3,              903                 .vs_vers        = 3,
711                 .vs_nproc       = 22,             904                 .vs_nproc       = 22,
712                 .vs_proc        = nfsd_procedu    905                 .vs_proc        = nfsd_procedures3,
713                 .vs_dispatch    = nfsd_dispatc    906                 .vs_dispatch    = nfsd_dispatch,
714                 .vs_xdrsize     = NFS3_SVC_XDR    907                 .vs_xdrsize     = NFS3_SVC_XDRSIZE,
715 };                                                908 };
716                                                   909 
  This page was automatically generated by the LXR engine.