source: svn/newcon3bcm2_21bu/toolchain/mips-linux-uclibc/include/linux/nfsd/xdr4.h @ 76

Last change on this file since 76 was 76, checked in by megakiss, 10 years ago

1W 대기전력을 만족시키기 위하여 POWEROFF시 튜너를 Standby 상태로 함

  • Property svn:executable set to *
File size: 13.8 KB
Line 
1/*
2 *  include/linux/nfsd/xdr4.h
3 *
4 *  Server-side types for NFSv4.
5 *
6 *  Copyright (c) 2002 The Regents of the University of Michigan.
7 *  All rights reserved.
8 *
9 *  Kendrick Smith <kmsmith@umich.edu>
10 *  Andy Adamson   <andros@umich.edu>
11 *
12 *  Redistribution and use in source and binary forms, with or without
13 *  modification, are permitted provided that the following conditions
14 *  are met:
15 *
16 *  1. Redistributions of source code must retain the above copyright
17 *     notice, this list of conditions and the following disclaimer.
18 *  2. Redistributions in binary form must reproduce the above copyright
19 *     notice, this list of conditions and the following disclaimer in the
20 *     documentation and/or other materials provided with the distribution.
21 *  3. Neither the name of the University nor the names of its
22 *     contributors may be used to endorse or promote products derived
23 *     from this software without specific prior written permission.
24 *
25 *  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
26 *  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
27 *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28 *  DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29 *  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
32 *  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 *
37 */
38
39#ifndef _LINUX_NFSD_XDR4_H
40#define _LINUX_NFSD_XDR4_H
41
42#include <asm/types.h>
43
44#include <linux/nfs4.h>
45
46#define NFSD4_MAX_TAGLEN        128
47#define XDR_LEN(n)                     (((n) + 3) & ~3)
48
49struct nfsd4_change_info {
50        __u32           atomic;
51        __u32           before_ctime_sec;
52        __u32           before_ctime_nsec;
53        __u32           after_ctime_sec;
54        __u32           after_ctime_nsec;
55};
56
57struct nfsd4_access {
58        __u32           ac_req_access;      /* request */
59        __u32           ac_supported;       /* response */
60        __u32           ac_resp_access;     /* response */
61};
62
63struct nfsd4_close {
64        __u32           cl_seqid;           /* request */
65        stateid_t       cl_stateid;         /* request+response */
66        struct nfs4_stateowner * cl_stateowner; /* response */
67};
68
69struct nfsd4_commit {
70        __u64           co_offset;          /* request */
71        __u32           co_count;           /* request */
72        nfs4_verifier   co_verf;            /* response */
73};
74
75struct nfsd4_create {
76        __u32           cr_namelen;         /* request */
77        char *          cr_name;            /* request */
78        __u32           cr_type;            /* request */
79        union {                             /* request */
80                struct {
81                        __u32 namelen;
82                        char *name;
83                } link;   /* NF4LNK */
84                struct {
85                        __u32 specdata1;
86                        __u32 specdata2;
87                } dev;    /* NF4BLK, NF4CHR */
88        } u;
89        __u32           cr_bmval[2];        /* request */
90        struct iattr    cr_iattr;           /* request */
91        struct nfsd4_change_info  cr_cinfo; /* response */
92        struct nfs4_acl *cr_acl;
93};
94#define cr_linklen      u.link.namelen
95#define cr_linkname     u.link.name
96#define cr_specdata1    u.dev.specdata1
97#define cr_specdata2    u.dev.specdata2
98
99struct nfsd4_delegreturn {
100        stateid_t       dr_stateid;
101};
102
103struct nfsd4_getattr {
104        __u32           ga_bmval[2];        /* request */
105        struct svc_fh   *ga_fhp;            /* response */
106};
107
108struct nfsd4_link {
109        __u32           li_namelen;         /* request */
110        char *          li_name;            /* request */
111        struct nfsd4_change_info  li_cinfo; /* response */
112};
113
114struct nfsd4_lock_denied {
115        clientid_t      ld_clientid;
116        struct nfs4_stateowner   *ld_sop;
117        __u64             ld_start;
118        __u64             ld_length;
119        __u32             ld_type;
120};
121
122struct nfsd4_lock {
123        /* request */
124        __u32             lk_type;
125        __u32             lk_reclaim;         /* boolean */
126        __u64             lk_offset;
127        __u64             lk_length;
128        __u32             lk_is_new;
129        union {
130                struct {
131                        __u32             open_seqid;
132                        stateid_t       open_stateid;
133                        __u32             lock_seqid;
134                        clientid_t      clientid;
135                        struct xdr_netobj owner;
136                } new;
137                struct {
138                        stateid_t       lock_stateid;
139                        __u32             lock_seqid;
140                } old;
141        } v;
142
143        /* response */
144        union {
145                struct {
146                        stateid_t               stateid;
147                } ok;
148                struct nfsd4_lock_denied        denied;
149        } u;
150
151        struct nfs4_stateowner *lk_stateowner;
152};
153#define lk_new_open_seqid       v.new.open_seqid
154#define lk_new_open_stateid     v.new.open_stateid
155#define lk_new_lock_seqid       v.new.lock_seqid
156#define lk_new_clientid         v.new.clientid
157#define lk_new_owner            v.new.owner
158#define lk_old_lock_stateid     v.old.lock_stateid
159#define lk_old_lock_seqid       v.old.lock_seqid
160
161#define lk_rflags       u.ok.rflags
162#define lk_resp_stateid u.ok.stateid
163#define lk_denied       u.denied
164
165
166struct nfsd4_lockt {
167        __u32                           lt_type;
168        clientid_t                      lt_clientid;
169        struct xdr_netobj               lt_owner;
170        __u64                           lt_offset;
171        __u64                           lt_length;
172        struct nfs4_stateowner *        lt_stateowner;
173        struct nfsd4_lock_denied        lt_denied;
174};
175
176 
177struct nfsd4_locku {
178        __u32             lu_type;
179        __u32             lu_seqid;
180        stateid_t       lu_stateid;
181        __u64             lu_offset;
182        __u64             lu_length;
183        struct nfs4_stateowner  *lu_stateowner;
184};
185
186
187struct nfsd4_lookup {
188        __u32           lo_len;             /* request */
189        char *          lo_name;            /* request */
190};
191
192struct nfsd4_putfh {
193        __u32           pf_fhlen;           /* request */
194        char            *pf_fhval;          /* request */
195};
196
197struct nfsd4_open {
198        __u32           op_claim_type;      /* request */
199        struct xdr_netobj op_fname;         /* request - everything but CLAIM_PREV */
200        __u32           op_delegate_type;   /* request - CLAIM_PREV only */
201        stateid_t       op_delegate_stateid; /* request - response */
202        __u32           op_create;          /* request */
203        __u32           op_createmode;      /* request */
204        __u32           op_bmval[2];        /* request */
205        union {                             /* request */
206                struct iattr    iattr;                      /* UNCHECKED4,GUARDED4 */
207                nfs4_verifier   verf;                                /* EXCLUSIVE4 */
208        } u;
209        clientid_t      op_clientid;        /* request */
210        struct xdr_netobj op_owner;           /* request */
211        __u32           op_seqid;           /* request */
212        __u32           op_share_access;    /* request */
213        __u32           op_share_deny;      /* request */
214        stateid_t       op_stateid;         /* response */
215        struct nfsd4_change_info  op_cinfo; /* response */
216        __u32           op_rflags;          /* response */
217        int             op_truncate;        /* used during processing */
218        struct nfs4_stateowner *op_stateowner; /* used during processing */
219        struct nfs4_acl *op_acl;
220};
221#define op_iattr        u.iattr
222#define op_verf         u.verf
223
224struct nfsd4_open_confirm {
225        stateid_t       oc_req_stateid          /* request */;
226        __u32           oc_seqid                /* request */;
227        stateid_t       oc_resp_stateid         /* response */;
228        struct nfs4_stateowner * oc_stateowner; /* response */
229};
230
231struct nfsd4_open_downgrade {
232        stateid_t       od_stateid;
233        __u32             od_seqid;
234        __u32             od_share_access;
235        __u32             od_share_deny;
236        struct nfs4_stateowner *od_stateowner;
237};
238
239
240struct nfsd4_read {
241        stateid_t       rd_stateid;         /* request */
242        __u64           rd_offset;          /* request */
243        __u32           rd_length;          /* request */
244        struct kvec     rd_iov[RPCSVC_MAXPAGES];
245        int             rd_vlen;
246        struct file     *rd_filp;
247       
248        struct svc_rqst *rd_rqstp;          /* response */
249        struct svc_fh * rd_fhp;             /* response */
250};
251
252struct nfsd4_readdir {
253        __u64           rd_cookie;          /* request */
254        nfs4_verifier   rd_verf;            /* request */
255        __u32           rd_dircount;        /* request */
256        __u32           rd_maxcount;        /* request */
257        __u32           rd_bmval[2];        /* request */
258        struct svc_rqst *rd_rqstp;          /* response */
259        struct svc_fh * rd_fhp;             /* response */
260
261        struct readdir_cd       common;
262        __u32 *                 buffer;
263        int                     buflen;
264        __u32 *                 offset;
265};
266
267struct nfsd4_release_lockowner {
268        clientid_t        rl_clientid;
269        struct xdr_netobj rl_owner;
270};
271struct nfsd4_readlink {
272        struct svc_rqst *rl_rqstp;          /* request */
273        struct svc_fh * rl_fhp;             /* request */
274};
275
276struct nfsd4_remove {
277        __u32           rm_namelen;         /* request */
278        char *          rm_name;            /* request */
279        struct nfsd4_change_info  rm_cinfo; /* response */
280};
281
282struct nfsd4_rename {
283        __u32           rn_snamelen;        /* request */
284        char *          rn_sname;           /* request */
285        __u32           rn_tnamelen;        /* request */
286        char *          rn_tname;           /* request */
287        struct nfsd4_change_info  rn_sinfo; /* response */
288        struct nfsd4_change_info  rn_tinfo; /* response */
289};
290
291struct nfsd4_setattr {
292        stateid_t       sa_stateid;         /* request */
293        __u32           sa_bmval[2];        /* request */
294        struct iattr    sa_iattr;           /* request */
295        struct nfs4_acl *sa_acl;
296};
297
298struct nfsd4_setclientid {
299        nfs4_verifier   se_verf;            /* request */
300        __u32           se_namelen;         /* request */
301        char *          se_name;            /* request */
302        __u32           se_callback_prog;   /* request */
303        __u32           se_callback_netid_len;  /* request */
304        char *          se_callback_netid_val;  /* request */
305        __u32           se_callback_addr_len;   /* request */
306        char *          se_callback_addr_val;   /* request */
307        __u32           se_callback_ident;  /* request */
308        clientid_t      se_clientid;        /* response */
309        nfs4_verifier   se_confirm;         /* response */
310};
311
312struct nfsd4_setclientid_confirm {
313        clientid_t      sc_clientid;
314        nfs4_verifier   sc_confirm;
315};
316
317/* also used for NVERIFY */
318struct nfsd4_verify {
319        __u32           ve_bmval[2];        /* request */
320        __u32           ve_attrlen;         /* request */
321        char *          ve_attrval;         /* request */
322};
323
324struct nfsd4_write {
325        stateid_t       wr_stateid;         /* request */
326        __u64           wr_offset;          /* request */
327        __u32           wr_stable_how;      /* request */
328        __u32           wr_buflen;          /* request */
329        struct kvec     wr_vec[RPCSVC_MAXPAGES]; /* request */
330        int             wr_vlen;
331
332        __u32           wr_bytes_written;   /* response */
333        __u32           wr_how_written;     /* response */
334        nfs4_verifier   wr_verifier;        /* response */
335};
336
337struct nfsd4_op {
338        int                                     opnum;
339        int                                     status;
340        union {
341                struct nfsd4_access             access;
342                struct nfsd4_close              close;
343                struct nfsd4_commit             commit;
344                struct nfsd4_create             create;
345                struct nfsd4_delegreturn        delegreturn;
346                struct nfsd4_getattr            getattr;
347                struct svc_fh *                 getfh;
348                struct nfsd4_link               link;
349                struct nfsd4_lock               lock;
350                struct nfsd4_lockt              lockt;
351                struct nfsd4_locku              locku;
352                struct nfsd4_lookup             lookup;
353                struct nfsd4_verify             nverify;
354                struct nfsd4_open               open;
355                struct nfsd4_open_confirm       open_confirm;
356                struct nfsd4_open_downgrade     open_downgrade;
357                struct nfsd4_putfh              putfh;
358                struct nfsd4_read               read;
359                struct nfsd4_readdir            readdir;
360                struct nfsd4_readlink           readlink;
361                struct nfsd4_remove             remove;
362                struct nfsd4_rename             rename;
363                clientid_t                      renew;
364                struct nfsd4_setattr            setattr;
365                struct nfsd4_setclientid        setclientid;
366                struct nfsd4_setclientid_confirm setclientid_confirm;
367                struct nfsd4_verify             verify;
368                struct nfsd4_write              write;
369                struct nfsd4_release_lockowner  release_lockowner;
370        } u;
371        struct nfs4_replay *                    replay;
372};
373
374struct nfsd4_compoundargs {
375        /* scratch variables for XDR decode */
376        __u32 *                         p;
377        __u32 *                         end;
378        struct page **                  pagelist;
379        int                             pagelen;
380        __u32                           tmp[8];
381        __u32 *                         tmpp;
382        struct tmpbuf {
383                struct tmpbuf *next;
384                void (*release)(const void *);
385                void *buf;
386        }                               *to_free;
387
388        struct svc_rqst                 *rqstp;
389
390        __u32                           taglen;
391        char *                          tag;
392        __u32                           minorversion;
393        __u32                           opcnt;
394        struct nfsd4_op                 *ops;
395        struct nfsd4_op                 iops[8];
396};
397
398struct nfsd4_compoundres {
399        /* scratch variables for XDR encode */
400        __u32 *                         p;
401        __u32 *                         end;
402        struct xdr_buf *                xbuf;
403        struct svc_rqst *               rqstp;
404
405        __u32                           taglen;
406        char *                          tag;
407        __u32                           opcnt;
408        __u32 *                         tagp; /* where to encode tag and  opcount */
409};
410
411#define NFS4_SVC_XDRSIZE                sizeof(struct nfsd4_compoundargs)
412
413static inline void
414set_change_info(struct nfsd4_change_info *cinfo, struct svc_fh *fhp)
415{
416        BUG_ON(!fhp->fh_pre_saved || !fhp->fh_post_saved);
417        cinfo->atomic = 1;
418        cinfo->before_ctime_sec = fhp->fh_pre_ctime.tv_sec;
419        cinfo->before_ctime_nsec = fhp->fh_pre_ctime.tv_nsec;
420        cinfo->after_ctime_sec = fhp->fh_post_ctime.tv_sec;
421        cinfo->after_ctime_nsec = fhp->fh_post_ctime.tv_nsec;
422}
423
424int nfs4svc_encode_voidres(struct svc_rqst *, __u32 *, void *);
425int nfs4svc_decode_compoundargs(struct svc_rqst *, __u32 *, 
426                struct nfsd4_compoundargs *);
427int nfs4svc_encode_compoundres(struct svc_rqst *, __u32 *, 
428                struct nfsd4_compoundres *);
429void nfsd4_encode_operation(struct nfsd4_compoundres *, struct nfsd4_op *);
430void nfsd4_encode_replay(struct nfsd4_compoundres *resp, struct nfsd4_op *op);
431int nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
432                       struct dentry *dentry, __u32 *buffer, int *countp, 
433                       __u32 *bmval, struct svc_rqst *);
434extern int nfsd4_setclientid(struct svc_rqst *rqstp, 
435                struct nfsd4_setclientid *setclid);
436extern int nfsd4_setclientid_confirm(struct svc_rqst *rqstp, 
437                struct nfsd4_setclientid_confirm *setclientid_confirm);
438extern int nfsd4_process_open1(struct nfsd4_open *open);
439extern int nfsd4_process_open2(struct svc_rqst *rqstp, 
440                struct svc_fh *current_fh, struct nfsd4_open *open);
441extern int nfsd4_open_confirm(struct svc_rqst *rqstp, 
442                struct svc_fh *current_fh, struct nfsd4_open_confirm *oc);
443extern  int nfsd4_close(struct svc_rqst *rqstp, struct svc_fh *current_fh, 
444                struct nfsd4_close *close);
445extern int nfsd4_open_downgrade(struct svc_rqst *rqstp, 
446                struct svc_fh *current_fh, struct nfsd4_open_downgrade *od);
447extern int nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh, 
448                struct nfsd4_lock *lock);
449extern int nfsd4_lockt(struct svc_rqst *rqstp, struct svc_fh *current_fh, 
450                struct nfsd4_lockt *lockt);
451extern int nfsd4_locku(struct svc_rqst *rqstp, struct svc_fh *current_fh, 
452                struct nfsd4_locku *locku);
453extern int
454nfsd4_release_lockowner(struct svc_rqst *rqstp,
455                struct nfsd4_release_lockowner *rlockowner);
456extern void nfsd4_release_compoundargs(struct nfsd4_compoundargs *);
457extern int nfsd4_delegreturn(struct svc_rqst *rqstp,
458                struct svc_fh *current_fh, struct nfsd4_delegreturn *dr);
459#endif
460
461/*
462 * Local variables:
463 *  c-basic-offset: 8
464 * End:
465 */
Note: See TracBrowser for help on using the repository browser.