nfs4xdr.c (87a15a8090c0e5284c0e53528d9defa5d9237866) nfs4xdr.c (24bab491220faa446d945624086d838af41d616c)
1/*
2 * Server-side XDR for NFSv4
3 *
4 * Copyright (c) 2002 The Regents of the University of Michigan.
5 * All rights reserved.
6 *
7 * Kendrick Smith <kmsmith@umich.edu>
8 * Andy Adamson <andros@umich.edu>

--- 1500 unchanged lines hidden (view full) ---

1509
1510 READ_BUF(4);
1511 rc->rca_one_fs = be32_to_cpup(p++);
1512
1513 DECODE_TAIL;
1514}
1515
1516static __be32
1/*
2 * Server-side XDR for NFSv4
3 *
4 * Copyright (c) 2002 The Regents of the University of Michigan.
5 * All rights reserved.
6 *
7 * Kendrick Smith <kmsmith@umich.edu>
8 * Andy Adamson <andros@umich.edu>

--- 1500 unchanged lines hidden (view full) ---

1509
1510 READ_BUF(4);
1511 rc->rca_one_fs = be32_to_cpup(p++);
1512
1513 DECODE_TAIL;
1514}
1515
1516static __be32
1517nfsd4_decode_seek(struct nfsd4_compoundargs *argp, struct nfsd4_seek *seek)
1518{
1519 DECODE_HEAD;
1520
1521 status = nfsd4_decode_stateid(argp, &seek->seek_stateid);
1522 if (status)
1523 return status;
1524
1525 READ_BUF(8 + 4);
1526 p = xdr_decode_hyper(p, &seek->seek_offset);
1527 seek->seek_whence = be32_to_cpup(p);
1528
1529 DECODE_TAIL;
1530}
1531
1532static __be32
1517nfsd4_decode_noop(struct nfsd4_compoundargs *argp, void *p)
1518{
1519 return nfs_ok;
1520}
1521
1522static __be32
1523nfsd4_decode_notsupp(struct nfsd4_compoundargs *argp, void *p)
1524{

--- 68 unchanged lines hidden (view full) ---

1593 [OP_COPY_NOTIFY] = (nfsd4_dec)nfsd4_decode_notsupp,
1594 [OP_DEALLOCATE] = (nfsd4_dec)nfsd4_decode_notsupp,
1595 [OP_IO_ADVISE] = (nfsd4_dec)nfsd4_decode_notsupp,
1596 [OP_LAYOUTERROR] = (nfsd4_dec)nfsd4_decode_notsupp,
1597 [OP_LAYOUTSTATS] = (nfsd4_dec)nfsd4_decode_notsupp,
1598 [OP_OFFLOAD_CANCEL] = (nfsd4_dec)nfsd4_decode_notsupp,
1599 [OP_OFFLOAD_STATUS] = (nfsd4_dec)nfsd4_decode_notsupp,
1600 [OP_READ_PLUS] = (nfsd4_dec)nfsd4_decode_notsupp,
1533nfsd4_decode_noop(struct nfsd4_compoundargs *argp, void *p)
1534{
1535 return nfs_ok;
1536}
1537
1538static __be32
1539nfsd4_decode_notsupp(struct nfsd4_compoundargs *argp, void *p)
1540{

--- 68 unchanged lines hidden (view full) ---

1609 [OP_COPY_NOTIFY] = (nfsd4_dec)nfsd4_decode_notsupp,
1610 [OP_DEALLOCATE] = (nfsd4_dec)nfsd4_decode_notsupp,
1611 [OP_IO_ADVISE] = (nfsd4_dec)nfsd4_decode_notsupp,
1612 [OP_LAYOUTERROR] = (nfsd4_dec)nfsd4_decode_notsupp,
1613 [OP_LAYOUTSTATS] = (nfsd4_dec)nfsd4_decode_notsupp,
1614 [OP_OFFLOAD_CANCEL] = (nfsd4_dec)nfsd4_decode_notsupp,
1615 [OP_OFFLOAD_STATUS] = (nfsd4_dec)nfsd4_decode_notsupp,
1616 [OP_READ_PLUS] = (nfsd4_dec)nfsd4_decode_notsupp,
1601 [OP_SEEK] = (nfsd4_dec)nfsd4_decode_notsupp,
1617 [OP_SEEK] = (nfsd4_dec)nfsd4_decode_seek,
1602 [OP_WRITE_SAME] = (nfsd4_dec)nfsd4_decode_notsupp,
1603};
1604
1605static inline bool
1606nfsd4_opnum_in_range(struct nfsd4_compoundargs *argp, struct nfsd4_op *op)
1607{
1608 if (op->opnum < FIRST_NFS4_OP)
1609 return false;

--- 2151 unchanged lines hidden (view full) ---

3761 list_for_each_entry_safe(stateid, next, &test_stateid->ts_stateid_list, ts_id_list) {
3762 *p++ = stateid->ts_id_status;
3763 }
3764
3765 return nfserr;
3766}
3767
3768static __be32
1618 [OP_WRITE_SAME] = (nfsd4_dec)nfsd4_decode_notsupp,
1619};
1620
1621static inline bool
1622nfsd4_opnum_in_range(struct nfsd4_compoundargs *argp, struct nfsd4_op *op)
1623{
1624 if (op->opnum < FIRST_NFS4_OP)
1625 return false;

--- 2151 unchanged lines hidden (view full) ---

3777 list_for_each_entry_safe(stateid, next, &test_stateid->ts_stateid_list, ts_id_list) {
3778 *p++ = stateid->ts_id_status;
3779 }
3780
3781 return nfserr;
3782}
3783
3784static __be32
3785nfsd4_encode_seek(struct nfsd4_compoundres *resp, __be32 nfserr,
3786 struct nfsd4_seek *seek)
3787{
3788 __be32 *p;
3789
3790 if (nfserr)
3791 return nfserr;
3792
3793 p = xdr_reserve_space(&resp->xdr, 4 + 8);
3794 *p++ = cpu_to_be32(seek->seek_eof);
3795 p = xdr_encode_hyper(p, seek->seek_pos);
3796
3797 return nfserr;
3798}
3799
3800static __be32
3769nfsd4_encode_noop(struct nfsd4_compoundres *resp, __be32 nfserr, void *p)
3770{
3771 return nfserr;
3772}
3773
3774typedef __be32(* nfsd4_enc)(struct nfsd4_compoundres *, __be32, void *);
3775
3776/*

--- 67 unchanged lines hidden (view full) ---

3844 [OP_COPY_NOTIFY] = (nfsd4_enc)nfsd4_encode_noop,
3845 [OP_DEALLOCATE] = (nfsd4_enc)nfsd4_encode_noop,
3846 [OP_IO_ADVISE] = (nfsd4_enc)nfsd4_encode_noop,
3847 [OP_LAYOUTERROR] = (nfsd4_enc)nfsd4_encode_noop,
3848 [OP_LAYOUTSTATS] = (nfsd4_enc)nfsd4_encode_noop,
3849 [OP_OFFLOAD_CANCEL] = (nfsd4_enc)nfsd4_encode_noop,
3850 [OP_OFFLOAD_STATUS] = (nfsd4_enc)nfsd4_encode_noop,
3851 [OP_READ_PLUS] = (nfsd4_enc)nfsd4_encode_noop,
3801nfsd4_encode_noop(struct nfsd4_compoundres *resp, __be32 nfserr, void *p)
3802{
3803 return nfserr;
3804}
3805
3806typedef __be32(* nfsd4_enc)(struct nfsd4_compoundres *, __be32, void *);
3807
3808/*

--- 67 unchanged lines hidden (view full) ---

3876 [OP_COPY_NOTIFY] = (nfsd4_enc)nfsd4_encode_noop,
3877 [OP_DEALLOCATE] = (nfsd4_enc)nfsd4_encode_noop,
3878 [OP_IO_ADVISE] = (nfsd4_enc)nfsd4_encode_noop,
3879 [OP_LAYOUTERROR] = (nfsd4_enc)nfsd4_encode_noop,
3880 [OP_LAYOUTSTATS] = (nfsd4_enc)nfsd4_encode_noop,
3881 [OP_OFFLOAD_CANCEL] = (nfsd4_enc)nfsd4_encode_noop,
3882 [OP_OFFLOAD_STATUS] = (nfsd4_enc)nfsd4_encode_noop,
3883 [OP_READ_PLUS] = (nfsd4_enc)nfsd4_encode_noop,
3852 [OP_SEEK] = (nfsd4_enc)nfsd4_encode_noop,
3884 [OP_SEEK] = (nfsd4_enc)nfsd4_encode_seek,
3853 [OP_WRITE_SAME] = (nfsd4_enc)nfsd4_encode_noop,
3854};
3855
3856/*
3857 * Calculate whether we still have space to encode repsize bytes.
3858 * There are two considerations:
3859 * - For NFS versions >=4.1, the size of the reply must stay within
3860 * session limits

--- 190 unchanged lines hidden ---
3885 [OP_WRITE_SAME] = (nfsd4_enc)nfsd4_encode_noop,
3886};
3887
3888/*
3889 * Calculate whether we still have space to encode repsize bytes.
3890 * There are two considerations:
3891 * - For NFS versions >=4.1, the size of the reply must stay within
3892 * session limits

--- 190 unchanged lines hidden ---