NFSD: provide encode routine for OP_OPENATTR
[safe/jmp/linux-2.6] / fs / nfsd / nfs4xdr.c
index 9b6a9ba..9250067 100644 (file)
@@ -1,6 +1,4 @@
 /*
- *  fs/nfs/nfs4xdr.c
- *
  *  Server-side XDR for NFSv4
  *
  *  Copyright (c) 2002 The Regents of the University of Michigan.
@@ -413,6 +411,18 @@ out_nfserr:
 }
 
 static __be32
+nfsd4_decode_stateid(struct nfsd4_compoundargs *argp, stateid_t *sid)
+{
+       DECODE_HEAD;
+
+       READ_BUF(sizeof(stateid_t));
+       READ32(sid->si_generation);
+       COPYMEM(&sid->si_opaque, sizeof(stateid_opaque_t));
+
+       DECODE_TAIL;
+}
+
+static __be32
 nfsd4_decode_access(struct nfsd4_compoundargs *argp, struct nfsd4_access *access)
 {
        DECODE_HEAD;
@@ -429,10 +439,9 @@ nfsd4_decode_close(struct nfsd4_compoundargs *argp, struct nfsd4_close *close)
        DECODE_HEAD;
 
        close->cl_stateowner = NULL;
-       READ_BUF(4 + sizeof(stateid_t));
+       READ_BUF(4);
        READ32(close->cl_seqid);
-       READ32(close->cl_stateid.si_generation);
-       COPYMEM(&close->cl_stateid.si_opaque, sizeof(stateid_opaque_t));
+       return nfsd4_decode_stateid(argp, &close->cl_stateid);
 
        DECODE_TAIL;
 }
@@ -493,13 +502,7 @@ nfsd4_decode_create(struct nfsd4_compoundargs *argp, struct nfsd4_create *create
 static inline __be32
 nfsd4_decode_delegreturn(struct nfsd4_compoundargs *argp, struct nfsd4_delegreturn *dr)
 {
-       DECODE_HEAD;
-
-       READ_BUF(sizeof(stateid_t));
-       READ32(dr->dr_stateid.si_generation);
-       COPYMEM(&dr->dr_stateid.si_opaque, sizeof(stateid_opaque_t));
-
-       DECODE_TAIL;
+       return nfsd4_decode_stateid(argp, &dr->dr_stateid);
 }
 
 static inline __be32
@@ -542,20 +545,22 @@ nfsd4_decode_lock(struct nfsd4_compoundargs *argp, struct nfsd4_lock *lock)
        READ32(lock->lk_is_new);
 
        if (lock->lk_is_new) {
-               READ_BUF(36);
+               READ_BUF(4);
                READ32(lock->lk_new_open_seqid);
-               READ32(lock->lk_new_open_stateid.si_generation);
-
-               COPYMEM(&lock->lk_new_open_stateid.si_opaque, sizeof(stateid_opaque_t));
+               status = nfsd4_decode_stateid(argp, &lock->lk_new_open_stateid);
+               if (status)
+                       return status;
+               READ_BUF(8 + sizeof(clientid_t));
                READ32(lock->lk_new_lock_seqid);
                COPYMEM(&lock->lk_new_clientid, sizeof(clientid_t));
                READ32(lock->lk_new_owner.len);
                READ_BUF(lock->lk_new_owner.len);
                READMEM(lock->lk_new_owner.data, lock->lk_new_owner.len);
        } else {
-               READ_BUF(20);
-               READ32(lock->lk_old_lock_stateid.si_generation);
-               COPYMEM(&lock->lk_old_lock_stateid.si_opaque, sizeof(stateid_opaque_t));
+               status = nfsd4_decode_stateid(argp, &lock->lk_old_lock_stateid);
+               if (status)
+                       return status;
+               READ_BUF(4);
                READ32(lock->lk_old_lock_seqid);
        }
 
@@ -587,13 +592,15 @@ nfsd4_decode_locku(struct nfsd4_compoundargs *argp, struct nfsd4_locku *locku)
        DECODE_HEAD;
 
        locku->lu_stateowner = NULL;
-       READ_BUF(24 + sizeof(stateid_t));
+       READ_BUF(8);
        READ32(locku->lu_type);
        if ((locku->lu_type < NFS4_READ_LT) || (locku->lu_type > NFS4_WRITEW_LT))
                goto xdr_error;
        READ32(locku->lu_seqid);
-       READ32(locku->lu_stateid.si_generation);
-       COPYMEM(&locku->lu_stateid.si_opaque, sizeof(stateid_opaque_t));
+       status = nfsd4_decode_stateid(argp, &locku->lu_stateid);
+       if (status)
+               return status;
+       READ_BUF(16);
        READ64(locku->lu_offset);
        READ64(locku->lu_length);
 
@@ -678,8 +685,10 @@ nfsd4_decode_open(struct nfsd4_compoundargs *argp, struct nfsd4_open *open)
                READ32(open->op_delegate_type);
                break;
        case NFS4_OPEN_CLAIM_DELEGATE_CUR:
-               READ_BUF(sizeof(stateid_t) + 4);
-               COPYMEM(&open->op_delegate_stateid, sizeof(stateid_t));
+               status = nfsd4_decode_stateid(argp, &open->op_delegate_stateid);
+               if (status)
+                       return status;
+               READ_BUF(4);
                READ32(open->op_fname.len);
                READ_BUF(open->op_fname.len);
                SAVEMEM(open->op_fname.data, open->op_fname.len);
@@ -699,9 +708,10 @@ nfsd4_decode_open_confirm(struct nfsd4_compoundargs *argp, struct nfsd4_open_con
        DECODE_HEAD;
                    
        open_conf->oc_stateowner = NULL;
-       READ_BUF(4 + sizeof(stateid_t));
-       READ32(open_conf->oc_req_stateid.si_generation);
-       COPYMEM(&open_conf->oc_req_stateid.si_opaque, sizeof(stateid_opaque_t));
+       status = nfsd4_decode_stateid(argp, &open_conf->oc_req_stateid);
+       if (status)
+               return status;
+       READ_BUF(4);
        READ32(open_conf->oc_seqid);
                                                        
        DECODE_TAIL;
@@ -713,9 +723,10 @@ nfsd4_decode_open_downgrade(struct nfsd4_compoundargs *argp, struct nfsd4_open_d
        DECODE_HEAD;
                    
        open_down->od_stateowner = NULL;
-       READ_BUF(12 + sizeof(stateid_t));
-       READ32(open_down->od_stateid.si_generation);
-       COPYMEM(&open_down->od_stateid.si_opaque, sizeof(stateid_opaque_t));
+       status = nfsd4_decode_stateid(argp, &open_down->od_stateid);
+       if (status)
+               return status;
+       READ_BUF(12);
        READ32(open_down->od_seqid);
        READ32(open_down->od_share_access);
        READ32(open_down->od_share_deny);
@@ -743,9 +754,10 @@ nfsd4_decode_read(struct nfsd4_compoundargs *argp, struct nfsd4_read *read)
 {
        DECODE_HEAD;
 
-       READ_BUF(sizeof(stateid_t) + 12);
-       READ32(read->rd_stateid.si_generation);
-       COPYMEM(&read->rd_stateid.si_opaque, sizeof(stateid_opaque_t));
+       status = nfsd4_decode_stateid(argp, &read->rd_stateid);
+       if (status)
+               return status;
+       READ_BUF(12);
        READ64(read->rd_offset);
        READ32(read->rd_length);
 
@@ -834,15 +846,13 @@ nfsd4_decode_secinfo(struct nfsd4_compoundargs *argp,
 static __be32
 nfsd4_decode_setattr(struct nfsd4_compoundargs *argp, struct nfsd4_setattr *setattr)
 {
-       DECODE_HEAD;
-
-       READ_BUF(sizeof(stateid_t));
-       READ32(setattr->sa_stateid.si_generation);
-       COPYMEM(&setattr->sa_stateid.si_opaque, sizeof(stateid_opaque_t));
-       if ((status = nfsd4_decode_fattr(argp, setattr->sa_bmval, &setattr->sa_iattr, &setattr->sa_acl)))
-               goto out;
+       __be32 status;
 
-       DECODE_TAIL;
+       status = nfsd4_decode_stateid(argp, &setattr->sa_stateid);
+       if (status)
+               return status;
+       return nfsd4_decode_fattr(argp, setattr->sa_bmval,
+                                 &setattr->sa_iattr, &setattr->sa_acl);
 }
 
 static __be32
@@ -927,9 +937,10 @@ nfsd4_decode_write(struct nfsd4_compoundargs *argp, struct nfsd4_write *write)
        int len;
        DECODE_HEAD;
 
-       READ_BUF(sizeof(stateid_opaque_t) + 20);
-       READ32(write->wr_stateid.si_generation);
-       COPYMEM(&write->wr_stateid.si_opaque, sizeof(stateid_opaque_t));
+       status = nfsd4_decode_stateid(argp, &write->wr_stateid);
+       if (status)
+               return status;
+       READ_BUF(16);
        READ64(write->wr_offset);
        READ32(write->wr_stable_how);
        if (write->wr_stable_how > 2)
@@ -1000,43 +1011,43 @@ nfsd4_decode_notsupp(struct nfsd4_compoundargs *argp, void *p)
 typedef __be32(*nfsd4_dec)(struct nfsd4_compoundargs *argp, void *);
 
 static nfsd4_dec nfsd4_dec_ops[] = {
-       [OP_ACCESS]             (nfsd4_dec)nfsd4_decode_access,
-       [OP_CLOSE]              (nfsd4_dec)nfsd4_decode_close,
-       [OP_COMMIT]             (nfsd4_dec)nfsd4_decode_commit,
-       [OP_CREATE]             (nfsd4_dec)nfsd4_decode_create,
-       [OP_DELEGPURGE]         (nfsd4_dec)nfsd4_decode_notsupp,
-       [OP_DELEGRETURN]        (nfsd4_dec)nfsd4_decode_delegreturn,
-       [OP_GETATTR]            (nfsd4_dec)nfsd4_decode_getattr,
-       [OP_GETFH]              (nfsd4_dec)nfsd4_decode_noop,
-       [OP_LINK]               (nfsd4_dec)nfsd4_decode_link,
-       [OP_LOCK]               (nfsd4_dec)nfsd4_decode_lock,
-       [OP_LOCKT]              (nfsd4_dec)nfsd4_decode_lockt,
-       [OP_LOCKU]              (nfsd4_dec)nfsd4_decode_locku,
-       [OP_LOOKUP]             (nfsd4_dec)nfsd4_decode_lookup,
-       [OP_LOOKUPP]            (nfsd4_dec)nfsd4_decode_noop,
-       [OP_NVERIFY]            (nfsd4_dec)nfsd4_decode_verify,
-       [OP_OPEN]               (nfsd4_dec)nfsd4_decode_open,
-       [OP_OPENATTR]           (nfsd4_dec)nfsd4_decode_notsupp,
-       [OP_OPEN_CONFIRM]       (nfsd4_dec)nfsd4_decode_open_confirm,
-       [OP_OPEN_DOWNGRADE]     (nfsd4_dec)nfsd4_decode_open_downgrade,
-       [OP_PUTFH]              (nfsd4_dec)nfsd4_decode_putfh,
-       [OP_PUTPUBFH]           (nfsd4_dec)nfsd4_decode_notsupp,
-       [OP_PUTROOTFH]          (nfsd4_dec)nfsd4_decode_noop,
-       [OP_READ]               (nfsd4_dec)nfsd4_decode_read,
-       [OP_READDIR]            (nfsd4_dec)nfsd4_decode_readdir,
-       [OP_READLINK]           (nfsd4_dec)nfsd4_decode_noop,
-       [OP_REMOVE]             (nfsd4_dec)nfsd4_decode_remove,
-       [OP_RENAME]             (nfsd4_dec)nfsd4_decode_rename,
-       [OP_RENEW]              (nfsd4_dec)nfsd4_decode_renew,
-       [OP_RESTOREFH]          (nfsd4_dec)nfsd4_decode_noop,
-       [OP_SAVEFH]             (nfsd4_dec)nfsd4_decode_noop,
-       [OP_SECINFO]            (nfsd4_dec)nfsd4_decode_secinfo,
-       [OP_SETATTR]            (nfsd4_dec)nfsd4_decode_setattr,
-       [OP_SETCLIENTID]        (nfsd4_dec)nfsd4_decode_setclientid,
-       [OP_SETCLIENTID_CONFIRM](nfsd4_dec)nfsd4_decode_setclientid_confirm,
-       [OP_VERIFY]             (nfsd4_dec)nfsd4_decode_verify,
-       [OP_WRITE]              (nfsd4_dec)nfsd4_decode_write,
-       [OP_RELEASE_LOCKOWNER]  (nfsd4_dec)nfsd4_decode_release_lockowner,
+       [OP_ACCESS]             (nfsd4_dec)nfsd4_decode_access,
+       [OP_CLOSE]              (nfsd4_dec)nfsd4_decode_close,
+       [OP_COMMIT]             (nfsd4_dec)nfsd4_decode_commit,
+       [OP_CREATE]             (nfsd4_dec)nfsd4_decode_create,
+       [OP_DELEGPURGE]         (nfsd4_dec)nfsd4_decode_notsupp,
+       [OP_DELEGRETURN]        (nfsd4_dec)nfsd4_decode_delegreturn,
+       [OP_GETATTR]            (nfsd4_dec)nfsd4_decode_getattr,
+       [OP_GETFH]              (nfsd4_dec)nfsd4_decode_noop,
+       [OP_LINK]               (nfsd4_dec)nfsd4_decode_link,
+       [OP_LOCK]               (nfsd4_dec)nfsd4_decode_lock,
+       [OP_LOCKT]              (nfsd4_dec)nfsd4_decode_lockt,
+       [OP_LOCKU]              (nfsd4_dec)nfsd4_decode_locku,
+       [OP_LOOKUP]             (nfsd4_dec)nfsd4_decode_lookup,
+       [OP_LOOKUPP]            (nfsd4_dec)nfsd4_decode_noop,
+       [OP_NVERIFY]            (nfsd4_dec)nfsd4_decode_verify,
+       [OP_OPEN]               (nfsd4_dec)nfsd4_decode_open,
+       [OP_OPENATTR]           (nfsd4_dec)nfsd4_decode_notsupp,
+       [OP_OPEN_CONFIRM]       (nfsd4_dec)nfsd4_decode_open_confirm,
+       [OP_OPEN_DOWNGRADE]     (nfsd4_dec)nfsd4_decode_open_downgrade,
+       [OP_PUTFH]              (nfsd4_dec)nfsd4_decode_putfh,
+       [OP_PUTPUBFH]           (nfsd4_dec)nfsd4_decode_notsupp,
+       [OP_PUTROOTFH]          (nfsd4_dec)nfsd4_decode_noop,
+       [OP_READ]               (nfsd4_dec)nfsd4_decode_read,
+       [OP_READDIR]            (nfsd4_dec)nfsd4_decode_readdir,
+       [OP_READLINK]           (nfsd4_dec)nfsd4_decode_noop,
+       [OP_REMOVE]             (nfsd4_dec)nfsd4_decode_remove,
+       [OP_RENAME]             (nfsd4_dec)nfsd4_decode_rename,
+       [OP_RENEW]              (nfsd4_dec)nfsd4_decode_renew,
+       [OP_RESTOREFH]          (nfsd4_dec)nfsd4_decode_noop,
+       [OP_SAVEFH]             (nfsd4_dec)nfsd4_decode_noop,
+       [OP_SECINFO]            (nfsd4_dec)nfsd4_decode_secinfo,
+       [OP_SETATTR]            (nfsd4_dec)nfsd4_decode_setattr,
+       [OP_SETCLIENTID]        (nfsd4_dec)nfsd4_decode_setclientid,
+       [OP_SETCLIENTID_CONFIRM] = (nfsd4_dec)nfsd4_decode_setclientid_confirm,
+       [OP_VERIFY]             (nfsd4_dec)nfsd4_decode_verify,
+       [OP_WRITE]              (nfsd4_dec)nfsd4_decode_write,
+       [OP_RELEASE_LOCKOWNER]  (nfsd4_dec)nfsd4_decode_release_lockowner,
 };
 
 struct nfsd4_minorversion_ops {
@@ -1045,7 +1056,7 @@ struct nfsd4_minorversion_ops {
 };
 
 static struct nfsd4_minorversion_ops nfsd4_minorversion[] = {
-       [0] { nfsd4_dec_ops, ARRAY_SIZE(nfsd4_dec_ops) },
+       [0] { nfsd4_dec_ops, ARRAY_SIZE(nfsd4_dec_ops) },
 };
 
 static __be32
@@ -1160,11 +1171,11 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
        *p++ = htonl((u32)((n) >> 32));                         \
        *p++ = htonl((u32)(n));                                 \
 } while (0)
-#define WRITEMEM(ptr,nbytes)     do if (nbytes > 0) {          \
+#define WRITEMEM(ptr,nbytes)     do { if (nbytes > 0) {                \
        *(p + XDR_QUADLEN(nbytes) -1) = 0;                      \
        memcpy(p, ptr, nbytes);                                 \
        p += XDR_QUADLEN(nbytes);                               \
-} while (0)
+}} while (0)
 #define WRITECINFO(c)          do {                            \
        *p++ = htonl(c.atomic);                                 \
        *p++ = htonl(c.before_ctime_sec);                               \
@@ -1183,7 +1194,6 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
  * Header routine to setup seqid operation replay cache
  */
 #define ENCODE_SEQID_OP_HEAD                                   \
-       __be32 *p;                                              \
        __be32 *save;                                           \
                                                                \
        save = resp->p;
@@ -1950,6 +1960,17 @@ fail:
        return -EINVAL;
 }
 
+static void
+nfsd4_encode_stateid(struct nfsd4_compoundres *resp, stateid_t *sid)
+{
+       ENCODE_HEAD;
+
+       RESERVE_SPACE(sizeof(stateid_t));
+       WRITE32(sid->si_generation);
+       WRITEMEM(&sid->si_opaque, sizeof(stateid_opaque_t));
+       ADJUST_ARGS();
+}
+
 static __be32
 nfsd4_encode_access(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_access *access)
 {
@@ -1969,12 +1990,9 @@ nfsd4_encode_close(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_c
 {
        ENCODE_SEQID_OP_HEAD;
 
-       if (!nfserr) {
-               RESERVE_SPACE(sizeof(stateid_t));
-               WRITE32(close->cl_stateid.si_generation);
-               WRITEMEM(&close->cl_stateid.si_opaque, sizeof(stateid_opaque_t));
-               ADJUST_ARGS();
-       }
+       if (!nfserr)
+               nfsd4_encode_stateid(resp, &close->cl_stateid);
+
        ENCODE_SEQID_OP_TAIL(close->cl_stateowner);
        return nfserr;
 }
@@ -2074,12 +2092,9 @@ nfsd4_encode_lock(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_lo
 {
        ENCODE_SEQID_OP_HEAD;
 
-       if (!nfserr) {
-               RESERVE_SPACE(4 + sizeof(stateid_t));
-               WRITE32(lock->lk_resp_stateid.si_generation);
-               WRITEMEM(&lock->lk_resp_stateid.si_opaque, sizeof(stateid_opaque_t));
-               ADJUST_ARGS();
-       } else if (nfserr == nfserr_denied)
+       if (!nfserr)
+               nfsd4_encode_stateid(resp, &lock->lk_resp_stateid);
+       else if (nfserr == nfserr_denied)
                nfsd4_encode_lock_denied(resp, &lock->lk_denied);
 
        ENCODE_SEQID_OP_TAIL(lock->lk_replay_owner);
@@ -2099,13 +2114,9 @@ nfsd4_encode_locku(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_l
 {
        ENCODE_SEQID_OP_HEAD;
 
-       if (!nfserr) {
-               RESERVE_SPACE(sizeof(stateid_t));
-               WRITE32(locku->lu_stateid.si_generation);
-               WRITEMEM(&locku->lu_stateid.si_opaque, sizeof(stateid_opaque_t));
-               ADJUST_ARGS();
-       }
-                                       
+       if (!nfserr)
+               nfsd4_encode_stateid(resp, &locku->lu_stateid);
+
        ENCODE_SEQID_OP_TAIL(locku->lu_stateowner);
        return nfserr;
 }
@@ -2128,14 +2139,14 @@ nfsd4_encode_link(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_li
 static __be32
 nfsd4_encode_open(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_open *open)
 {
+       ENCODE_HEAD;
        ENCODE_SEQID_OP_HEAD;
 
        if (nfserr)
                goto out;
 
-       RESERVE_SPACE(36 + sizeof(stateid_t));
-       WRITE32(open->op_stateid.si_generation);
-       WRITEMEM(&open->op_stateid.si_opaque, sizeof(stateid_opaque_t));
+       nfsd4_encode_stateid(resp, &open->op_stateid);
+       RESERVE_SPACE(40);
        WRITECINFO(open->op_cinfo);
        WRITE32(open->op_rflags);
        WRITE32(2);
@@ -2148,8 +2159,8 @@ nfsd4_encode_open(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_op
        case NFS4_OPEN_DELEGATE_NONE:
                break;
        case NFS4_OPEN_DELEGATE_READ:
-               RESERVE_SPACE(20 + sizeof(stateid_t));
-               WRITEMEM(&open->op_delegate_stateid, sizeof(stateid_t));
+               nfsd4_encode_stateid(resp, &open->op_delegate_stateid);
+               RESERVE_SPACE(20);
                WRITE32(open->op_recall);
 
                /*
@@ -2162,8 +2173,8 @@ nfsd4_encode_open(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_op
                ADJUST_ARGS();
                break;
        case NFS4_OPEN_DELEGATE_WRITE:
-               RESERVE_SPACE(32 + sizeof(stateid_t));
-               WRITEMEM(&open->op_delegate_stateid, sizeof(stateid_t));
+               nfsd4_encode_stateid(resp, &open->op_delegate_stateid);
+               RESERVE_SPACE(32);
                WRITE32(0);
 
                /*
@@ -2195,13 +2206,9 @@ static __be32
 nfsd4_encode_open_confirm(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_open_confirm *oc)
 {
        ENCODE_SEQID_OP_HEAD;
-                                       
-       if (!nfserr) {
-               RESERVE_SPACE(sizeof(stateid_t));
-               WRITE32(oc->oc_resp_stateid.si_generation);
-               WRITEMEM(&oc->oc_resp_stateid.si_opaque, sizeof(stateid_opaque_t));
-               ADJUST_ARGS();
-       }
+
+       if (!nfserr)
+               nfsd4_encode_stateid(resp, &oc->oc_resp_stateid);
 
        ENCODE_SEQID_OP_TAIL(oc->oc_stateowner);
        return nfserr;
@@ -2211,13 +2218,9 @@ static __be32
 nfsd4_encode_open_downgrade(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_open_downgrade *od)
 {
        ENCODE_SEQID_OP_HEAD;
-                                       
-       if (!nfserr) {
-               RESERVE_SPACE(sizeof(stateid_t));
-               WRITE32(od->od_stateid.si_generation);
-               WRITEMEM(&od->od_stateid.si_opaque, sizeof(stateid_opaque_t));
-               ADJUST_ARGS();
-       }
+
+       if (!nfserr)
+               nfsd4_encode_stateid(resp, &od->od_stateid);
 
        ENCODE_SEQID_OP_TAIL(od->od_stateowner);
        return nfserr;
@@ -2577,42 +2580,43 @@ nfsd4_encode_noop(struct nfsd4_compoundres *resp, __be32 nfserr, void *p)
 typedef __be32(* nfsd4_enc)(struct nfsd4_compoundres *, __be32, void *);
 
 static nfsd4_enc nfsd4_enc_ops[] = {
-       [OP_ACCESS]             (nfsd4_enc)nfsd4_encode_access,
-       [OP_CLOSE]              (nfsd4_enc)nfsd4_encode_close,
-       [OP_COMMIT]             (nfsd4_enc)nfsd4_encode_commit,
-       [OP_CREATE]             (nfsd4_enc)nfsd4_encode_create,
-       [OP_DELEGPURGE]         (nfsd4_enc)nfsd4_encode_noop,
-       [OP_DELEGRETURN]        (nfsd4_enc)nfsd4_encode_noop,
-       [OP_GETATTR]            (nfsd4_enc)nfsd4_encode_getattr,
-       [OP_GETFH]              (nfsd4_enc)nfsd4_encode_getfh,
-       [OP_LINK]               (nfsd4_enc)nfsd4_encode_link,
-       [OP_LOCK]               (nfsd4_enc)nfsd4_encode_lock,
-       [OP_LOCKT]              (nfsd4_enc)nfsd4_encode_lockt,
-       [OP_LOCKU]              (nfsd4_enc)nfsd4_encode_locku,
-       [OP_LOOKUP]             (nfsd4_enc)nfsd4_encode_noop,
-       [OP_LOOKUPP]            (nfsd4_enc)nfsd4_encode_noop,
-       [OP_NVERIFY]            (nfsd4_enc)nfsd4_encode_noop,
-       [OP_OPEN]               (nfsd4_enc)nfsd4_encode_open,
-       [OP_OPEN_CONFIRM]       (nfsd4_enc)nfsd4_encode_open_confirm,
-       [OP_OPEN_DOWNGRADE]     (nfsd4_enc)nfsd4_encode_open_downgrade,
-       [OP_PUTFH]              (nfsd4_enc)nfsd4_encode_noop,
-       [OP_PUTPUBFH]           (nfsd4_enc)nfsd4_encode_noop,
-       [OP_PUTROOTFH]          (nfsd4_enc)nfsd4_encode_noop,
-       [OP_READ]               (nfsd4_enc)nfsd4_encode_read,
-       [OP_READDIR]            (nfsd4_enc)nfsd4_encode_readdir,
-       [OP_READLINK]           (nfsd4_enc)nfsd4_encode_readlink,
-       [OP_REMOVE]             (nfsd4_enc)nfsd4_encode_remove,
-       [OP_RENAME]             (nfsd4_enc)nfsd4_encode_rename,
-       [OP_RENEW]              (nfsd4_enc)nfsd4_encode_noop,
-       [OP_RESTOREFH]          (nfsd4_enc)nfsd4_encode_noop,
-       [OP_SAVEFH]             (nfsd4_enc)nfsd4_encode_noop,
-       [OP_SECINFO]            (nfsd4_enc)nfsd4_encode_secinfo,
-       [OP_SETATTR]            (nfsd4_enc)nfsd4_encode_setattr,
-       [OP_SETCLIENTID]        (nfsd4_enc)nfsd4_encode_setclientid,
-       [OP_SETCLIENTID_CONFIRM](nfsd4_enc)nfsd4_encode_noop,
-       [OP_VERIFY]             (nfsd4_enc)nfsd4_encode_noop,
-       [OP_WRITE]              (nfsd4_enc)nfsd4_encode_write,
-       [OP_RELEASE_LOCKOWNER]  (nfsd4_enc)nfsd4_encode_noop,
+       [OP_ACCESS]             = (nfsd4_enc)nfsd4_encode_access,
+       [OP_CLOSE]              = (nfsd4_enc)nfsd4_encode_close,
+       [OP_COMMIT]             = (nfsd4_enc)nfsd4_encode_commit,
+       [OP_CREATE]             = (nfsd4_enc)nfsd4_encode_create,
+       [OP_DELEGPURGE]         = (nfsd4_enc)nfsd4_encode_noop,
+       [OP_DELEGRETURN]        = (nfsd4_enc)nfsd4_encode_noop,
+       [OP_GETATTR]            = (nfsd4_enc)nfsd4_encode_getattr,
+       [OP_GETFH]              = (nfsd4_enc)nfsd4_encode_getfh,
+       [OP_LINK]               = (nfsd4_enc)nfsd4_encode_link,
+       [OP_LOCK]               = (nfsd4_enc)nfsd4_encode_lock,
+       [OP_LOCKT]              = (nfsd4_enc)nfsd4_encode_lockt,
+       [OP_LOCKU]              = (nfsd4_enc)nfsd4_encode_locku,
+       [OP_LOOKUP]             = (nfsd4_enc)nfsd4_encode_noop,
+       [OP_LOOKUPP]            = (nfsd4_enc)nfsd4_encode_noop,
+       [OP_NVERIFY]            = (nfsd4_enc)nfsd4_encode_noop,
+       [OP_OPEN]               = (nfsd4_enc)nfsd4_encode_open,
+       [OP_OPENATTR]           = (nfsd4_enc)nfsd4_encode_noop,
+       [OP_OPEN_CONFIRM]       = (nfsd4_enc)nfsd4_encode_open_confirm,
+       [OP_OPEN_DOWNGRADE]     = (nfsd4_enc)nfsd4_encode_open_downgrade,
+       [OP_PUTFH]              = (nfsd4_enc)nfsd4_encode_noop,
+       [OP_PUTPUBFH]           = (nfsd4_enc)nfsd4_encode_noop,
+       [OP_PUTROOTFH]          = (nfsd4_enc)nfsd4_encode_noop,
+       [OP_READ]               = (nfsd4_enc)nfsd4_encode_read,
+       [OP_READDIR]            = (nfsd4_enc)nfsd4_encode_readdir,
+       [OP_READLINK]           = (nfsd4_enc)nfsd4_encode_readlink,
+       [OP_REMOVE]             = (nfsd4_enc)nfsd4_encode_remove,
+       [OP_RENAME]             = (nfsd4_enc)nfsd4_encode_rename,
+       [OP_RENEW]              = (nfsd4_enc)nfsd4_encode_noop,
+       [OP_RESTOREFH]          = (nfsd4_enc)nfsd4_encode_noop,
+       [OP_SAVEFH]             = (nfsd4_enc)nfsd4_encode_noop,
+       [OP_SECINFO]            = (nfsd4_enc)nfsd4_encode_secinfo,
+       [OP_SETATTR]            = (nfsd4_enc)nfsd4_encode_setattr,
+       [OP_SETCLIENTID]        = (nfsd4_enc)nfsd4_encode_setclientid,
+       [OP_SETCLIENTID_CONFIRM] = (nfsd4_enc)nfsd4_encode_noop,
+       [OP_VERIFY]             = (nfsd4_enc)nfsd4_encode_noop,
+       [OP_WRITE]              = (nfsd4_enc)nfsd4_encode_write,
+       [OP_RELEASE_LOCKOWNER]  = (nfsd4_enc)nfsd4_encode_noop,
 };
 
 void