⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nfs_prot.x

📁 RTEMS (Real-Time Executive for Multiprocessor Systems) is a free open source real-time operating sys
💻 X
📖 第 1 页 / 共 2 页
字号:
/* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape * media and as a part of the software program in whole or part.  Users * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. *  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. *  * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. *  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. *  * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. *  * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California  94043 */#ifndef RPC_HDR%#ifndef lint%/*static char sccsid[] = "from: @(#)nfs_prot.x 1.2 87/10/12 Copyr 1987 Sun Micro";*/%/*static char sccsid[] = "from: @(#)nfs_prot.x	2.1 88/08/01 4.0 RPCSRC";*/%static const char rcsid[] =%  "$FreeBSD: src/include/rpcsvc/nfs_prot.x,v 1.7 1999/08/27 23:45:08 peter Exp $";%#endif /* not lint */#endifconst NFS_PORT          = 2049;const NFS_MAXDATA       = 8192;const NFS_MAXPATHLEN    = 1024;const NFS_MAXNAMLEN	= 255;const NFS_FHSIZE	= 32;const NFS_COOKIESIZE	= 4;const NFS_FIFO_DEV	= -1;	/* size kludge for named pipes *//* * File types */const NFSMODE_FMT  = 0170000;	/* type of file */const NFSMODE_DIR  = 0040000;	/* directory */const NFSMODE_CHR  = 0020000;	/* character special */const NFSMODE_BLK  = 0060000;	/* block special */const NFSMODE_REG  = 0100000;	/* regular */const NFSMODE_LNK  = 0120000;	/* symbolic link */const NFSMODE_SOCK = 0140000;	/* socket */const NFSMODE_FIFO = 0010000;	/* fifo *//* * Error status */enum nfsstat {	NFS_OK= 0,		/* no error */	NFSERR_PERM=1,		/* Not owner */	NFSERR_NOENT=2,		/* No such file or directory */	NFSERR_IO=5,		/* I/O error */	NFSERR_NXIO=6,		/* No such device or address */	NFSERR_ACCES=13,	/* Permission denied */	NFSERR_EXIST=17,	/* File exists */	NFSERR_NODEV=19,	/* No such device */	NFSERR_NOTDIR=20,	/* Not a directory*/	NFSERR_ISDIR=21,	/* Is a directory */	NFSERR_FBIG=27,		/* File too large */	NFSERR_NOSPC=28,	/* No space left on device */	NFSERR_ROFS=30,		/* Read-only file system */	NFSERR_NAMETOOLONG=63,	/* File name too long */	NFSERR_NOTEMPTY=66,	/* Directory not empty */	NFSERR_DQUOT=69,	/* Disc quota exceeded */	NFSERR_STALE=70,	/* Stale NFS file handle */	NFSERR_WFLUSH=99	/* write cache flushed */};/* * File types */enum ftype {	NFNON = 0,	/* non-file */	NFREG = 1,	/* regular file */	NFDIR = 2,	/* directory */	NFBLK = 3,	/* block special */	NFCHR = 4,	/* character special */	NFLNK = 5,	/* symbolic link */	NFSOCK = 6,	/* unix domain sockets */	NFBAD = 7,	/* unused */	NFFIFO = 8 	/* named pipe */};/* * File access handle */struct nfs_fh {	opaque data[NFS_FHSIZE];};/*  * Timeval */struct nfstime {	unsigned seconds;	unsigned useconds;};/* * File attributes */struct fattr {	ftype type;		/* file type */	unsigned mode;		/* protection mode bits */	unsigned nlink;		/* # hard links */	unsigned uid;		/* owner user id */	unsigned gid;		/* owner group id */	unsigned size;		/* file size in bytes */	unsigned blocksize;	/* prefered block size */	unsigned rdev;		/* special device # */	unsigned blocks;	/* Kb of disk used by file */	unsigned fsid;		/* device # */	unsigned fileid;	/* inode # */	nfstime	atime;		/* time of last access */	nfstime	mtime;		/* time of last modification */	nfstime	ctime;		/* time of last change */};/* * File attributes which can be set */struct sattr {	unsigned mode;	/* protection mode bits */	unsigned uid;	/* owner user id */	unsigned gid;	/* owner group id */	unsigned size;	/* file size in bytes */	nfstime	atime;	/* time of last access */	nfstime	mtime;	/* time of last modification */};typedef string filename<NFS_MAXNAMLEN>; typedef string nfspath<NFS_MAXPATHLEN>;/* * Reply status with file attributes */union attrstat switch (nfsstat status) {case NFS_OK:	fattr attributes;default:	void;};struct sattrargs {	nfs_fh file;	sattr attributes;};/* * Arguments for directory operations */struct diropargs {	nfs_fh	dir;	/* directory file handle */	filename name;		/* name (up to NFS_MAXNAMLEN bytes) */};struct diropokres {	nfs_fh file;	fattr attributes;};/* * Results from directory operation */union diropres switch (nfsstat status) {case NFS_OK:	diropokres diropres;default:	void;};union readlinkres switch (nfsstat status) {case NFS_OK:	nfspath data;default:	void;};/* * Arguments to remote read */struct readargs {	nfs_fh file;		/* handle for file */	unsigned offset;	/* byte offset in file */	unsigned count;		/* immediate read count */	unsigned totalcount;	/* total read count (from this offset)*/};/* * Status OK portion of remote read reply */struct readokres {	fattr	attributes;	/* attributes, need for pagin*/	opaque data<NFS_MAXDATA>;};union readres switch (nfsstat status) {case NFS_OK:	readokres reply;default:	void;};/* * Arguments to remote write  */struct writeargs {	nfs_fh	file;		/* handle for file */	unsigned beginoffset;	/* beginning byte offset in file */	unsigned offset;	/* current byte offset in file */	unsigned totalcount;	/* total write count (to this offset)*/	opaque data<NFS_MAXDATA>;};struct createargs {	diropargs where;	sattr attributes;};struct renameargs {	diropargs from;	diropargs to;};struct linkargs {	nfs_fh from;	diropargs to;};struct symlinkargs {	diropargs from;	nfspath to;	sattr attributes;};typedef opaque nfscookie[NFS_COOKIESIZE];/* * Arguments to readdir */struct readdirargs {	nfs_fh dir;		/* directory handle */	nfscookie cookie;	unsigned count;		/* number of directory bytes to read */};struct entry {	unsigned fileid;	filename name;	nfscookie cookie;	entry *nextentry;};struct dirlist {	entry *entries;	bool eof;};union readdirres switch (nfsstat status) {case NFS_OK:	dirlist reply;default:	void;};struct statfsokres {	unsigned tsize;	/* preferred transfer size in bytes */	unsigned bsize;	/* fundamental file system block size */	unsigned blocks;	/* total blocks in file system */	unsigned bfree;	/* free blocks in fs */	unsigned bavail;	/* free blocks avail to non-superuser */};union statfsres switch (nfsstat status) {case NFS_OK:	statfsokres reply;default:	void;};#ifdef WANT_NFS3/* * NFSv3 constants and types */const NFS3_FHSIZE	= 64;	/* maximum size in bytes of a file handle */const NFS3_COOKIEVERFSIZE = 8;	/* size of a cookie verifier for READDIR */const NFS3_CREATEVERFSIZE = 8;	/* size of the verifier used for CREATE */const NFS3_WRITEVERFSIZE = 8;	/* size of the verifier used for WRITE */typedef unsigned hyper uint64;typedef hyper int64;typedef unsigned long uint32;typedef long int32;typedef string filename3<>;typedef string nfspath3<>;typedef uint64 fileid3;typedef uint64 cookie3;typedef opaque cookieverf3[NFS3_COOKIEVERFSIZE];typedef opaque createverf3[NFS3_CREATEVERFSIZE];typedef opaque writeverf3[NFS3_WRITEVERFSIZE];typedef uint32 uid3;typedef uint32 gid3;typedef uint64 size3;typedef uint64 offset3;typedef uint32 mode3;typedef uint32 count3;/* * Error status (v3) */enum nfsstat3 {	NFS3_OK	= 0,	NFS3ERR_PERM		= 1,	NFS3ERR_NOENT		= 2,	NFS3ERR_IO		= 5,	NFS3ERR_NXIO		= 6,	NFS3ERR_ACCES		= 13,	NFS3ERR_EXIST		= 17,	NFS3ERR_XDEV		= 18,	NFS3ERR_NODEV		= 19,	NFS3ERR_NOTDIR		= 20,	NFS3ERR_ISDIR		= 21,	NFS3ERR_INVAL		= 22,	NFS3ERR_FBIG		= 27,	NFS3ERR_NOSPC		= 28,	NFS3ERR_ROFS		= 30,	NFS3ERR_MLINK		= 31,	NFS3ERR_NAMETOOLONG	= 63,	NFS3ERR_NOTEMPTY	= 66,	NFS3ERR_DQUOT		= 69,	NFS3ERR_STALE		= 70,	NFS3ERR_REMOTE		= 71,	NFS3ERR_BADHANDLE	= 10001,	NFS3ERR_NOT_SYNC	= 10002,	NFS3ERR_BAD_COOKIE	= 10003,	NFS3ERR_NOTSUPP		= 10004,	NFS3ERR_TOOSMALL	= 10005,	NFS3ERR_SERVERFAULT	= 10006,	NFS3ERR_BADTYPE		= 10007,	NFS3ERR_JUKEBOX		= 10008};/* * File types (v3) */enum ftype3 {	NF3REG	= 1,		/* regular file */	NF3DIR	= 2,		/* directory */	NF3BLK	= 3,		/* block special */	NF3CHR	= 4,		/* character special */	NF3LNK	= 5,		/* symbolic link */	NF3SOCK	= 6,		/* unix domain sockets */	NF3FIFO	= 7		/* named pipe */};struct specdata3 {	uint32	specdata1;	uint32	specdata2;};/* * File access handle (v3) */struct nfs_fh3 {	opaque data<NFS3_FHSIZE>;};/*  * Timeval (v3) */struct nfstime3 {	uint32	seconds;	uint32	nseconds;};/* * File attributes (v3) */struct fattr3 {	ftype3	type;		/* file type */	mode3	mode;		/* protection mode bits */	uint32	nlink;		/* # hard links */	uid3	uid;		/* owner user id */	gid3	gid;		/* owner group id */	size3	size;		/* file size in bytes */	size3	used;		/* prefered block size */	specdata3 rdev;		/* special device # */	uint64 fsid;		/* device # */	fileid3	fileid;		/* inode # */	nfstime3 atime;		/* time of last access */	nfstime3 mtime;		/* time of last modification */	nfstime3 ctime;		/* time of last change */};union post_op_attr switch (bool attributes_follow) {case TRUE:	fattr3	attributes;case FALSE:	void;};struct wcc_attr {	size3	size;	nfstime3 mtime;	nfstime3 ctime;};union pre_op_attr switch (bool attributes_follow) {case TRUE:	wcc_attr attributes;case FALSE:	void;};struct wcc_data {	pre_op_attr before;	post_op_attr after;};union post_op_fh3 switch (bool handle_follows) {case TRUE:	nfs_fh3	handle;case FALSE:	void;};/* * File attributes which can be set (v3) */enum time_how {	DONT_CHANGE		= 0,	SET_TO_SERVER_TIME	= 1,	SET_TO_CLIENT_TIME	= 2};union set_mode3 switch (bool set_it) {case TRUE:	mode3	mode;default:	void;};union set_uid3 switch (bool set_it) {case TRUE:	uid3	uid;default:	void;};union set_gid3 switch (bool set_it) {case TRUE:	gid3	gid;default:	void;};union set_size3 switch (bool set_it) {case TRUE:	size3	size;default:	void;};union set_atime switch (time_how set_it) {case SET_TO_CLIENT_TIME:	nfstime3	atime;default:	void;};union set_mtime switch (time_how set_it) {case SET_TO_CLIENT_TIME:	nfstime3	mtime;default:	void;};struct sattr3 {	set_mode3	mode;	set_uid3	uid;	set_gid3	gid;	set_size3	size;	set_atime	atime;	set_mtime	mtime;};/* * Arguments for directory operations (v3) */struct diropargs3 {	nfs_fh3	dir;		/* directory file handle */	filename3 name;		/* name (up to NFS_MAXNAMLEN bytes) */};/* * Arguments to getattr (v3). */struct GETATTR3args {	nfs_fh3		object;};struct GETATTR3resok {	fattr3		obj_attributes;};union GETATTR3res switch (nfsstat3 status) {case NFS3_OK:	GETATTR3resok	resok;default:	void;};/* * Arguments to setattr (v3). */union sattrguard3 switch (bool check) {case TRUE:	nfstime3	obj_ctime;case FALSE:	void;};struct SETATTR3args {	nfs_fh3		object;	sattr3		new_attributes;	sattrguard3	guard;};struct SETATTR3resok {	wcc_data	obj_wcc;};struct SETATTR3resfail {	wcc_data	obj_wcc;};union SETATTR3res switch (nfsstat3 status) {case NFS3_OK:	SETATTR3resok	resok;default:	SETATTR3resfail	resfail;};/* * Arguments to lookup (v3). */struct LOOKUP3args {	diropargs3	what;};struct LOOKUP3resok {	nfs_fh3		object;	post_op_attr	obj_attributes;	post_op_attr	dir_attributes;};struct LOOKUP3resfail {	post_op_attr	dir_attributes;};union LOOKUP3res switch (nfsstat3 status) {case NFS3_OK:	LOOKUP3resok	resok;default:	LOOKUP3resfail	resfail;};/* * Arguments to access (v3). */const ACCESS3_READ	= 0x0001;const ACCESS3_LOOKUP	= 0x0002;const ACCESS3_MODIFY	= 0x0004;const ACCESS3_EXTEND	= 0x0008;const ACCESS3_DELETE	= 0x0010;const ACCESS3_EXECUTE	= 0x0020;struct ACCESS3args {	nfs_fh3		object;	uint32		access;};struct ACCESS3resok {	post_op_attr	obj_attributes;	uint32		access;};struct ACCESS3resfail {	post_op_attr	obj_attributes;};union ACCESS3res switch (nfsstat3 status) {case NFS3_OK:	ACCESS3resok	resok;default:	ACCESS3resfail	resfail;};/* * Arguments to readlink (v3). */struct READLINK3args {	nfs_fh3		symlink;};struct READLINK3resok {	post_op_attr	symlink_attributes;	nfspath3	data;};struct READLINK3resfail {	post_op_attr	symlink_attributes;};union READLINK3res switch (nfsstat3 status) {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -