Linux Audio

Check our new training course

Loading...
v3.5.6
 
  1/* XDR types for nfsd. This is mainly a typing exercise. */
  2
  3#ifndef LINUX_NFSD_H
  4#define LINUX_NFSD_H
  5
  6#include <linux/vfs.h>
  7#include "nfsd.h"
  8#include "nfsfh.h"
  9
 10struct nfsd_fhandle {
 11	struct svc_fh		fh;
 12};
 13
 14struct nfsd_sattrargs {
 15	struct svc_fh		fh;
 16	struct iattr		attrs;
 17};
 18
 19struct nfsd_diropargs {
 20	struct svc_fh		fh;
 21	char *			name;
 22	unsigned int		len;
 23};
 24
 25struct nfsd_readargs {
 26	struct svc_fh		fh;
 27	__u32			offset;
 28	__u32			count;
 29	int			vlen;
 30};
 31
 32struct nfsd_writeargs {
 33	svc_fh			fh;
 34	__u32			offset;
 35	int			len;
 36	int			vlen;
 37};
 38
 39struct nfsd_createargs {
 40	struct svc_fh		fh;
 41	char *			name;
 42	unsigned int		len;
 43	struct iattr		attrs;
 44};
 45
 46struct nfsd_renameargs {
 47	struct svc_fh		ffh;
 48	char *			fname;
 49	unsigned int		flen;
 50	struct svc_fh		tfh;
 51	char *			tname;
 52	unsigned int		tlen;
 53};
 54
 55struct nfsd_readlinkargs {
 56	struct svc_fh		fh;
 57	char *			buffer;
 58};
 59	
 60struct nfsd_linkargs {
 61	struct svc_fh		ffh;
 62	struct svc_fh		tfh;
 63	char *			tname;
 64	unsigned int		tlen;
 65};
 66
 67struct nfsd_symlinkargs {
 68	struct svc_fh		ffh;
 69	char *			fname;
 70	unsigned int		flen;
 71	char *			tname;
 72	unsigned int		tlen;
 73	struct iattr		attrs;
 
 74};
 75
 76struct nfsd_readdirargs {
 77	struct svc_fh		fh;
 78	__u32			cookie;
 79	__u32			count;
 80	__be32 *		buffer;
 
 
 
 81};
 82
 83struct nfsd_attrstat {
 
 84	struct svc_fh		fh;
 85	struct kstat		stat;
 86};
 87
 88struct nfsd_diropres  {
 
 89	struct svc_fh		fh;
 90	struct kstat		stat;
 91};
 92
 93struct nfsd_readlinkres {
 
 94	int			len;
 
 95};
 96
 97struct nfsd_readres {
 
 98	struct svc_fh		fh;
 99	unsigned long		count;
100	struct kstat		stat;
 
101};
102
103struct nfsd_readdirres {
 
 
 
104	int			count;
105
 
 
 
106	struct readdir_cd	common;
107	__be32 *		buffer;
108	int			buflen;
109	__be32 *		offset;
110};
111
112struct nfsd_statfsres {
 
113	struct kstatfs		stats;
114};
115
116/*
117 * Storage requirements for XDR arguments and results.
118 */
119union nfsd_xdrstore {
120	struct nfsd_sattrargs	sattr;
121	struct nfsd_diropargs	dirop;
122	struct nfsd_readargs	read;
123	struct nfsd_writeargs	write;
124	struct nfsd_createargs	create;
125	struct nfsd_renameargs	rename;
126	struct nfsd_linkargs	link;
127	struct nfsd_symlinkargs	symlink;
128	struct nfsd_readdirargs	readdir;
129};
130
131#define NFS2_SVC_XDRSIZE	sizeof(union nfsd_xdrstore)
132
133
134int nfssvc_decode_void(struct svc_rqst *, __be32 *, void *);
135int nfssvc_decode_fhandle(struct svc_rqst *, __be32 *, struct nfsd_fhandle *);
136int nfssvc_decode_sattrargs(struct svc_rqst *, __be32 *,
137				struct nfsd_sattrargs *);
138int nfssvc_decode_diropargs(struct svc_rqst *, __be32 *,
139				struct nfsd_diropargs *);
140int nfssvc_decode_readargs(struct svc_rqst *, __be32 *,
141				struct nfsd_readargs *);
142int nfssvc_decode_writeargs(struct svc_rqst *, __be32 *,
143				struct nfsd_writeargs *);
144int nfssvc_decode_createargs(struct svc_rqst *, __be32 *,
145				struct nfsd_createargs *);
146int nfssvc_decode_renameargs(struct svc_rqst *, __be32 *,
147				struct nfsd_renameargs *);
148int nfssvc_decode_readlinkargs(struct svc_rqst *, __be32 *,
149				struct nfsd_readlinkargs *);
150int nfssvc_decode_linkargs(struct svc_rqst *, __be32 *,
151				struct nfsd_linkargs *);
152int nfssvc_decode_symlinkargs(struct svc_rqst *, __be32 *,
153				struct nfsd_symlinkargs *);
154int nfssvc_decode_readdirargs(struct svc_rqst *, __be32 *,
155				struct nfsd_readdirargs *);
156int nfssvc_encode_void(struct svc_rqst *, __be32 *, void *);
157int nfssvc_encode_attrstat(struct svc_rqst *, __be32 *, struct nfsd_attrstat *);
158int nfssvc_encode_diropres(struct svc_rqst *, __be32 *, struct nfsd_diropres *);
159int nfssvc_encode_readlinkres(struct svc_rqst *, __be32 *, struct nfsd_readlinkres *);
160int nfssvc_encode_readres(struct svc_rqst *, __be32 *, struct nfsd_readres *);
161int nfssvc_encode_statfsres(struct svc_rqst *, __be32 *, struct nfsd_statfsres *);
162int nfssvc_encode_readdirres(struct svc_rqst *, __be32 *, struct nfsd_readdirres *);
163
164int nfssvc_encode_entry(void *, const char *name,
165			int namlen, loff_t offset, u64 ino, unsigned int);
166
167int nfssvc_release_fhandle(struct svc_rqst *, __be32 *, struct nfsd_fhandle *);
168
169/* Helper functions for NFSv2 ACL code */
170__be32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp);
171__be32 *nfs2svc_decode_fh(__be32 *p, struct svc_fh *fhp);
 
 
172
173#endif /* LINUX_NFSD_H */
v6.2
  1/* SPDX-License-Identifier: GPL-2.0 */
  2/* XDR types for nfsd. This is mainly a typing exercise. */
  3
  4#ifndef LINUX_NFSD_H
  5#define LINUX_NFSD_H
  6
  7#include <linux/vfs.h>
  8#include "nfsd.h"
  9#include "nfsfh.h"
 10
 11struct nfsd_fhandle {
 12	struct svc_fh		fh;
 13};
 14
 15struct nfsd_sattrargs {
 16	struct svc_fh		fh;
 17	struct iattr		attrs;
 18};
 19
 20struct nfsd_diropargs {
 21	struct svc_fh		fh;
 22	char *			name;
 23	unsigned int		len;
 24};
 25
 26struct nfsd_readargs {
 27	struct svc_fh		fh;
 28	__u32			offset;
 29	__u32			count;
 
 30};
 31
 32struct nfsd_writeargs {
 33	svc_fh			fh;
 34	__u32			offset;
 35	__u32			len;
 36	struct xdr_buf		payload;
 37};
 38
 39struct nfsd_createargs {
 40	struct svc_fh		fh;
 41	char *			name;
 42	unsigned int		len;
 43	struct iattr		attrs;
 44};
 45
 46struct nfsd_renameargs {
 47	struct svc_fh		ffh;
 48	char *			fname;
 49	unsigned int		flen;
 50	struct svc_fh		tfh;
 51	char *			tname;
 52	unsigned int		tlen;
 53};
 54
 
 
 
 
 
 55struct nfsd_linkargs {
 56	struct svc_fh		ffh;
 57	struct svc_fh		tfh;
 58	char *			tname;
 59	unsigned int		tlen;
 60};
 61
 62struct nfsd_symlinkargs {
 63	struct svc_fh		ffh;
 64	char *			fname;
 65	unsigned int		flen;
 66	char *			tname;
 67	unsigned int		tlen;
 68	struct iattr		attrs;
 69	struct kvec		first;
 70};
 71
 72struct nfsd_readdirargs {
 73	struct svc_fh		fh;
 74	__u32			cookie;
 75	__u32			count;
 76};
 77
 78struct nfsd_stat {
 79	__be32			status;
 80};
 81
 82struct nfsd_attrstat {
 83	__be32			status;
 84	struct svc_fh		fh;
 85	struct kstat		stat;
 86};
 87
 88struct nfsd_diropres  {
 89	__be32			status;
 90	struct svc_fh		fh;
 91	struct kstat		stat;
 92};
 93
 94struct nfsd_readlinkres {
 95	__be32			status;
 96	int			len;
 97	struct page		*page;
 98};
 99
100struct nfsd_readres {
101	__be32			status;
102	struct svc_fh		fh;
103	unsigned long		count;
104	struct kstat		stat;
105	struct page		**pages;
106};
107
108struct nfsd_readdirres {
109	/* Components of the reply */
110	__be32			status;
111
112	int			count;
113
114	/* Used to encode the reply's entry list */
115	struct xdr_stream	xdr;
116	struct xdr_buf		dirlist;
117	struct readdir_cd	common;
118	unsigned int		cookie_offset;
 
 
119};
120
121struct nfsd_statfsres {
122	__be32			status;
123	struct kstatfs		stats;
124};
125
126/*
127 * Storage requirements for XDR arguments and results.
128 */
129union nfsd_xdrstore {
130	struct nfsd_sattrargs	sattr;
131	struct nfsd_diropargs	dirop;
132	struct nfsd_readargs	read;
133	struct nfsd_writeargs	write;
134	struct nfsd_createargs	create;
135	struct nfsd_renameargs	rename;
136	struct nfsd_linkargs	link;
137	struct nfsd_symlinkargs	symlink;
138	struct nfsd_readdirargs	readdir;
139};
140
141#define NFS2_SVC_XDRSIZE	sizeof(union nfsd_xdrstore)
142
143
144bool nfssvc_decode_fhandleargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
145bool nfssvc_decode_sattrargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
146bool nfssvc_decode_diropargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
147bool nfssvc_decode_readargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
148bool nfssvc_decode_writeargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
149bool nfssvc_decode_createargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
150bool nfssvc_decode_renameargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
151bool nfssvc_decode_linkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
152bool nfssvc_decode_symlinkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
153bool nfssvc_decode_readdirargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
154
155bool nfssvc_encode_statres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
156bool nfssvc_encode_attrstatres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
157bool nfssvc_encode_diropres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
158bool nfssvc_encode_readlinkres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
159bool nfssvc_encode_readres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
160bool nfssvc_encode_statfsres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
161bool nfssvc_encode_readdirres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
162
163void nfssvc_encode_nfscookie(struct nfsd_readdirres *resp, u32 offset);
164int nfssvc_encode_entry(void *data, const char *name, int namlen,
165			loff_t offset, u64 ino, unsigned int d_type);
166
167void nfssvc_release_attrstat(struct svc_rqst *rqstp);
168void nfssvc_release_diropres(struct svc_rqst *rqstp);
169void nfssvc_release_readres(struct svc_rqst *rqstp);
 
 
 
 
 
 
 
 
170
171/* Helper functions for NFSv2 ACL code */
172bool svcxdr_decode_fhandle(struct xdr_stream *xdr, struct svc_fh *fhp);
173bool svcxdr_encode_stat(struct xdr_stream *xdr, __be32 status);
174bool svcxdr_encode_fattr(struct svc_rqst *rqstp, struct xdr_stream *xdr,
175			 const struct svc_fh *fhp, const struct kstat *stat);
176
177#endif /* LINUX_NFSD_H */