Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * XDR types for NFSv3 in nfsd.
0004  *
0005  * Copyright (C) 1996-1998, Olaf Kirch <okir@monad.swb.de>
0006  */
0007 
0008 #ifndef _LINUX_NFSD_XDR3_H
0009 #define _LINUX_NFSD_XDR3_H
0010 
0011 #include "xdr.h"
0012 
0013 struct nfsd3_sattrargs {
0014     struct svc_fh       fh;
0015     struct iattr        attrs;
0016     int         check_guard;
0017     time64_t        guardtime;
0018 };
0019 
0020 struct nfsd3_diropargs {
0021     struct svc_fh       fh;
0022     char *          name;
0023     unsigned int        len;
0024 };
0025 
0026 struct nfsd3_accessargs {
0027     struct svc_fh       fh;
0028     __u32           access;
0029 };
0030 
0031 struct nfsd3_readargs {
0032     struct svc_fh       fh;
0033     __u64           offset;
0034     __u32           count;
0035 };
0036 
0037 struct nfsd3_writeargs {
0038     svc_fh          fh;
0039     __u64           offset;
0040     __u32           count;
0041     int         stable;
0042     __u32           len;
0043     struct xdr_buf      payload;
0044 };
0045 
0046 struct nfsd3_createargs {
0047     struct svc_fh       fh;
0048     char *          name;
0049     unsigned int        len;
0050     int         createmode;
0051     struct iattr        attrs;
0052     __be32 *        verf;
0053 };
0054 
0055 struct nfsd3_mknodargs {
0056     struct svc_fh       fh;
0057     char *          name;
0058     unsigned int        len;
0059     __u32           ftype;
0060     __u32           major, minor;
0061     struct iattr        attrs;
0062 };
0063 
0064 struct nfsd3_renameargs {
0065     struct svc_fh       ffh;
0066     char *          fname;
0067     unsigned int        flen;
0068     struct svc_fh       tfh;
0069     char *          tname;
0070     unsigned int        tlen;
0071 };
0072 
0073 struct nfsd3_linkargs {
0074     struct svc_fh       ffh;
0075     struct svc_fh       tfh;
0076     char *          tname;
0077     unsigned int        tlen;
0078 };
0079 
0080 struct nfsd3_symlinkargs {
0081     struct svc_fh       ffh;
0082     char *          fname;
0083     unsigned int        flen;
0084     char *          tname;
0085     unsigned int        tlen;
0086     struct iattr        attrs;
0087     struct kvec     first;
0088 };
0089 
0090 struct nfsd3_readdirargs {
0091     struct svc_fh       fh;
0092     __u64           cookie;
0093     __u32           count;
0094     __be32 *        verf;
0095 };
0096 
0097 struct nfsd3_commitargs {
0098     struct svc_fh       fh;
0099     __u64           offset;
0100     __u32           count;
0101 };
0102 
0103 struct nfsd3_getaclargs {
0104     struct svc_fh       fh;
0105     __u32           mask;
0106 };
0107 
0108 struct posix_acl;
0109 struct nfsd3_setaclargs {
0110     struct svc_fh       fh;
0111     __u32           mask;
0112     struct posix_acl    *acl_access;
0113     struct posix_acl    *acl_default;
0114 };
0115 
0116 struct nfsd3_attrstat {
0117     __be32          status;
0118     struct svc_fh       fh;
0119     struct kstat            stat;
0120 };
0121 
0122 /* LOOKUP, CREATE, MKDIR, SYMLINK, MKNOD */
0123 struct nfsd3_diropres  {
0124     __be32          status;
0125     struct svc_fh       dirfh;
0126     struct svc_fh       fh;
0127 };
0128 
0129 struct nfsd3_accessres {
0130     __be32          status;
0131     struct svc_fh       fh;
0132     __u32           access;
0133     struct kstat        stat;
0134 };
0135 
0136 struct nfsd3_readlinkres {
0137     __be32          status;
0138     struct svc_fh       fh;
0139     __u32           len;
0140     struct page     **pages;
0141 };
0142 
0143 struct nfsd3_readres {
0144     __be32          status;
0145     struct svc_fh       fh;
0146     unsigned long       count;
0147     __u32           eof;
0148     struct page     **pages;
0149 };
0150 
0151 struct nfsd3_writeres {
0152     __be32          status;
0153     struct svc_fh       fh;
0154     unsigned long       count;
0155     int         committed;
0156     __be32          verf[2];
0157 };
0158 
0159 struct nfsd3_renameres {
0160     __be32          status;
0161     struct svc_fh       ffh;
0162     struct svc_fh       tfh;
0163 };
0164 
0165 struct nfsd3_linkres {
0166     __be32          status;
0167     struct svc_fh       tfh;
0168     struct svc_fh       fh;
0169 };
0170 
0171 struct nfsd3_readdirres {
0172     /* Components of the reply */
0173     __be32          status;
0174     struct svc_fh       fh;
0175     __be32          verf[2];
0176 
0177     /* Used to encode the reply's entry list */
0178     struct xdr_stream   xdr;
0179     struct xdr_buf      dirlist;
0180     struct svc_fh       scratch;
0181     struct readdir_cd   common;
0182     unsigned int        cookie_offset;
0183     struct svc_rqst *   rqstp;
0184 
0185 };
0186 
0187 struct nfsd3_fsstatres {
0188     __be32          status;
0189     struct kstatfs      stats;
0190     __u32           invarsec;
0191 };
0192 
0193 struct nfsd3_fsinfores {
0194     __be32          status;
0195     __u32           f_rtmax;
0196     __u32           f_rtpref;
0197     __u32           f_rtmult;
0198     __u32           f_wtmax;
0199     __u32           f_wtpref;
0200     __u32           f_wtmult;
0201     __u32           f_dtpref;
0202     __u64           f_maxfilesize;
0203     __u32           f_properties;
0204 };
0205 
0206 struct nfsd3_pathconfres {
0207     __be32          status;
0208     __u32           p_link_max;
0209     __u32           p_name_max;
0210     __u32           p_no_trunc;
0211     __u32           p_chown_restricted;
0212     __u32           p_case_insensitive;
0213     __u32           p_case_preserving;
0214 };
0215 
0216 struct nfsd3_commitres {
0217     __be32          status;
0218     struct svc_fh       fh;
0219     __be32          verf[2];
0220 };
0221 
0222 struct nfsd3_getaclres {
0223     __be32          status;
0224     struct svc_fh       fh;
0225     int         mask;
0226     struct posix_acl    *acl_access;
0227     struct posix_acl    *acl_default;
0228     struct kstat        stat;
0229 };
0230 
0231 /* dummy type for release */
0232 struct nfsd3_fhandle_pair {
0233     __u32           dummy;
0234     struct svc_fh       fh1;
0235     struct svc_fh       fh2;
0236 };
0237 
0238 /*
0239  * Storage requirements for XDR arguments and results.
0240  */
0241 union nfsd3_xdrstore {
0242     struct nfsd3_sattrargs      sattrargs;
0243     struct nfsd3_diropargs      diropargs;
0244     struct nfsd3_readargs       readargs;
0245     struct nfsd3_writeargs      writeargs;
0246     struct nfsd3_createargs     createargs;
0247     struct nfsd3_renameargs     renameargs;
0248     struct nfsd3_linkargs       linkargs;
0249     struct nfsd3_symlinkargs    symlinkargs;
0250     struct nfsd3_readdirargs    readdirargs;
0251     struct nfsd3_diropres       diropres;
0252     struct nfsd3_accessres      accessres;
0253     struct nfsd3_readlinkres    readlinkres;
0254     struct nfsd3_readres        readres;
0255     struct nfsd3_writeres       writeres;
0256     struct nfsd3_renameres      renameres;
0257     struct nfsd3_linkres        linkres;
0258     struct nfsd3_readdirres     readdirres;
0259     struct nfsd3_fsstatres      fsstatres;
0260     struct nfsd3_fsinfores      fsinfores;
0261     struct nfsd3_pathconfres    pathconfres;
0262     struct nfsd3_commitres      commitres;
0263     struct nfsd3_getaclres      getaclres;
0264 };
0265 
0266 #define NFS3_SVC_XDRSIZE        sizeof(union nfsd3_xdrstore)
0267 
0268 bool nfs3svc_decode_fhandleargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
0269 bool nfs3svc_decode_sattrargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
0270 bool nfs3svc_decode_diropargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
0271 bool nfs3svc_decode_accessargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
0272 bool nfs3svc_decode_readargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
0273 bool nfs3svc_decode_writeargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
0274 bool nfs3svc_decode_createargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
0275 bool nfs3svc_decode_mkdirargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
0276 bool nfs3svc_decode_mknodargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
0277 bool nfs3svc_decode_renameargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
0278 bool nfs3svc_decode_linkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
0279 bool nfs3svc_decode_symlinkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
0280 bool nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
0281 bool nfs3svc_decode_readdirplusargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
0282 bool nfs3svc_decode_commitargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
0283 
0284 bool nfs3svc_encode_getattrres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
0285 bool nfs3svc_encode_wccstat(struct svc_rqst *rqstp, struct xdr_stream *xdr);
0286 bool nfs3svc_encode_lookupres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
0287 bool nfs3svc_encode_accessres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
0288 bool nfs3svc_encode_readlinkres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
0289 bool nfs3svc_encode_readres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
0290 bool nfs3svc_encode_writeres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
0291 bool nfs3svc_encode_createres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
0292 bool nfs3svc_encode_renameres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
0293 bool nfs3svc_encode_linkres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
0294 bool nfs3svc_encode_readdirres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
0295 bool nfs3svc_encode_fsstatres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
0296 bool nfs3svc_encode_fsinfores(struct svc_rqst *rqstp, struct xdr_stream *xdr);
0297 bool nfs3svc_encode_pathconfres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
0298 bool nfs3svc_encode_commitres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
0299 
0300 void nfs3svc_release_fhandle(struct svc_rqst *);
0301 void nfs3svc_release_fhandle2(struct svc_rqst *);
0302 
0303 void nfs3svc_encode_cookie3(struct nfsd3_readdirres *resp, u64 offset);
0304 int nfs3svc_encode_entry3(void *data, const char *name, int namlen,
0305               loff_t offset, u64 ino, unsigned int d_type);
0306 int nfs3svc_encode_entryplus3(void *data, const char *name, int namlen,
0307                   loff_t offset, u64 ino, unsigned int d_type);
0308 /* Helper functions for NFSv3 ACL code */
0309 bool svcxdr_decode_nfs_fh3(struct xdr_stream *xdr, struct svc_fh *fhp);
0310 bool svcxdr_encode_nfsstat3(struct xdr_stream *xdr, __be32 status);
0311 bool svcxdr_encode_post_op_attr(struct svc_rqst *rqstp, struct xdr_stream *xdr,
0312                 const struct svc_fh *fhp);
0313 
0314 #endif /* _LINUX_NFSD_XDR3_H */