hjl / source-git / glibc

Forked from source-git/glibc 3 years ago
Clone

Blame sunrpc/rpcsvc/nfs_prot.x

Packit 6c4009
/* @(#)nfs_prot.x	2.1 88/08/01 4.0 RPCSRC */
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * nfs_prot.x 1.2 87/10/12
Packit 6c4009
 * Copyright (c) 2010, Oracle America, Inc.
Packit 6c4009
 *
Packit 6c4009
 * Redistribution and use in source and binary forms, with or without
Packit 6c4009
 * modification, are permitted provided that the following conditions are
Packit 6c4009
 * met:
Packit 6c4009
 *
Packit 6c4009
 *     * Redistributions of source code must retain the above copyright
Packit 6c4009
 *       notice, this list of conditions and the following disclaimer.
Packit 6c4009
 *     * Redistributions in binary form must reproduce the above
Packit 6c4009
 *       copyright notice, this list of conditions and the following
Packit 6c4009
 *       disclaimer in the documentation and/or other materials
Packit 6c4009
 *       provided with the distribution.
Packit 6c4009
 *     * Neither the name of the "Oracle America, Inc." nor the names of its
Packit 6c4009
 *       contributors may be used to endorse or promote products derived
Packit 6c4009
 *       from this software without specific prior written permission.
Packit 6c4009
 *
Packit 6c4009
 *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
Packit 6c4009
 *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
Packit 6c4009
 *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
Packit 6c4009
 *   FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
Packit 6c4009
 *   COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
Packit 6c4009
 *   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Packit 6c4009
 *   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
Packit 6c4009
 *   GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
Packit 6c4009
 *   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
Packit 6c4009
 *   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
Packit 6c4009
 *   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Packit 6c4009
 *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Packit 6c4009
 */
Packit 6c4009
const NFS_PORT          = 2049;
Packit 6c4009
const NFS_MAXDATA       = 8192;
Packit 6c4009
const NFS_MAXPATHLEN    = 1024;
Packit 6c4009
const NFS_MAXNAMLEN	= 255;
Packit 6c4009
const NFS_FHSIZE	= 32;
Packit 6c4009
const NFS_COOKIESIZE	= 4;
Packit 6c4009
const NFS_FIFO_DEV	= -1;	/* size kludge for named pipes */
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * File types
Packit 6c4009
 */
Packit 6c4009
const NFSMODE_FMT  = 0170000;	/* type of file */
Packit 6c4009
const NFSMODE_DIR  = 0040000;	/* directory */
Packit 6c4009
const NFSMODE_CHR  = 0020000;	/* character special */
Packit 6c4009
const NFSMODE_BLK  = 0060000;	/* block special */
Packit 6c4009
const NFSMODE_REG  = 0100000;	/* regular */
Packit 6c4009
const NFSMODE_LNK  = 0120000;	/* symbolic link */
Packit 6c4009
const NFSMODE_SOCK = 0140000;	/* socket */
Packit 6c4009
const NFSMODE_FIFO = 0010000;	/* fifo */
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * Error status
Packit 6c4009
 */
Packit 6c4009
enum nfsstat {
Packit 6c4009
	NFS_OK= 0,		/* no error */
Packit 6c4009
	NFSERR_PERM=1,		/* Not owner */
Packit 6c4009
	NFSERR_NOENT=2,		/* No such file or directory */
Packit 6c4009
	NFSERR_IO=5,		/* I/O error */
Packit 6c4009
	NFSERR_NXIO=6,		/* No such device or address */
Packit 6c4009
	NFSERR_ACCES=13,	/* Permission denied */
Packit 6c4009
	NFSERR_EXIST=17,	/* File exists */
Packit 6c4009
	NFSERR_NODEV=19,	/* No such device */
Packit 6c4009
	NFSERR_NOTDIR=20,	/* Not a directory*/
Packit 6c4009
	NFSERR_ISDIR=21,	/* Is a directory */
Packit 6c4009
	NFSERR_FBIG=27,		/* File too large */
Packit 6c4009
	NFSERR_NOSPC=28,	/* No space left on device */
Packit 6c4009
	NFSERR_ROFS=30,		/* Read-only file system */
Packit 6c4009
	NFSERR_NAMETOOLONG=63,	/* File name too long */
Packit 6c4009
	NFSERR_NOTEMPTY=66,	/* Directory not empty */
Packit 6c4009
	NFSERR_DQUOT=69,	/* Disc quota exceeded */
Packit 6c4009
	NFSERR_STALE=70,	/* Stale NFS file handle */
Packit 6c4009
	NFSERR_WFLUSH=99	/* write cache flushed */
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * File types
Packit 6c4009
 */
Packit 6c4009
enum ftype {
Packit 6c4009
	NFNON = 0,	/* non-file */
Packit 6c4009
	NFREG = 1,	/* regular file */
Packit 6c4009
	NFDIR = 2,	/* directory */
Packit 6c4009
	NFBLK = 3,	/* block special */
Packit 6c4009
	NFCHR = 4,	/* character special */
Packit 6c4009
	NFLNK = 5,	/* symbolic link */
Packit 6c4009
	NFSOCK = 6,	/* unix domain sockets */
Packit 6c4009
	NFBAD = 7,	/* unused */
Packit 6c4009
	NFFIFO = 8 	/* named pipe */
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * File access handle
Packit 6c4009
 */
Packit 6c4009
struct nfs_fh {
Packit 6c4009
	opaque data[NFS_FHSIZE];
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * Timeval
Packit 6c4009
 */
Packit 6c4009
struct nfstime {
Packit 6c4009
	unsigned seconds;
Packit 6c4009
	unsigned useconds;
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * File attributes
Packit 6c4009
 */
Packit 6c4009
struct fattr {
Packit 6c4009
	ftype type;		/* file type */
Packit 6c4009
	unsigned mode;		/* protection mode bits */
Packit 6c4009
	unsigned nlink;		/* # hard links */
Packit 6c4009
	unsigned uid;		/* owner user id */
Packit 6c4009
	unsigned gid;		/* owner group id */
Packit 6c4009
	unsigned size;		/* file size in bytes */
Packit 6c4009
	unsigned blocksize;	/* preferred block size */
Packit 6c4009
	unsigned rdev;		/* special device # */
Packit 6c4009
	unsigned blocks;	/* Kb of disk used by file */
Packit 6c4009
	unsigned fsid;		/* device # */
Packit 6c4009
	unsigned fileid;	/* inode # */
Packit 6c4009
	nfstime	atime;		/* time of last access */
Packit 6c4009
	nfstime	mtime;		/* time of last modification */
Packit 6c4009
	nfstime	ctime;		/* time of last change */
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * File attributes which can be set
Packit 6c4009
 */
Packit 6c4009
struct sattr {
Packit 6c4009
	unsigned mode;	/* protection mode bits */
Packit 6c4009
	unsigned uid;	/* owner user id */
Packit 6c4009
	unsigned gid;	/* owner group id */
Packit 6c4009
	unsigned size;	/* file size in bytes */
Packit 6c4009
	nfstime	atime;	/* time of last access */
Packit 6c4009
	nfstime	mtime;	/* time of last modification */
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
Packit 6c4009
typedef string filename<NFS_MAXNAMLEN>;
Packit 6c4009
typedef string nfspath<NFS_MAXPATHLEN>;
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * Reply status with file attributes
Packit 6c4009
 */
Packit 6c4009
union attrstat switch (nfsstat status) {
Packit 6c4009
case NFS_OK:
Packit 6c4009
	fattr attributes;
Packit 6c4009
default:
Packit 6c4009
	void;
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
struct sattrargs {
Packit 6c4009
	nfs_fh file;
Packit 6c4009
	sattr attributes;
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * Arguments for directory operations
Packit 6c4009
 */
Packit 6c4009
struct diropargs {
Packit 6c4009
	nfs_fh	dir;	/* directory file handle */
Packit 6c4009
	filename name;		/* name (up to NFS_MAXNAMLEN bytes) */
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
struct diropokres {
Packit 6c4009
	nfs_fh file;
Packit 6c4009
	fattr attributes;
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * Results from directory operation
Packit 6c4009
 */
Packit 6c4009
union diropres switch (nfsstat status) {
Packit 6c4009
case NFS_OK:
Packit 6c4009
	diropokres diropres;
Packit 6c4009
default:
Packit 6c4009
	void;
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
union readlinkres switch (nfsstat status) {
Packit 6c4009
case NFS_OK:
Packit 6c4009
	nfspath data;
Packit 6c4009
default:
Packit 6c4009
	void;
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * Arguments to remote read
Packit 6c4009
 */
Packit 6c4009
struct readargs {
Packit 6c4009
	nfs_fh file;		/* handle for file */
Packit 6c4009
	unsigned offset;	/* byte offset in file */
Packit 6c4009
	unsigned count;		/* immediate read count */
Packit 6c4009
	unsigned totalcount;	/* total read count (from this offset)*/
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * Status OK portion of remote read reply
Packit 6c4009
 */
Packit 6c4009
struct readokres {
Packit 6c4009
	fattr	attributes;	/* attributes, need for pagin*/
Packit 6c4009
	opaque data<NFS_MAXDATA>;
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
union readres switch (nfsstat status) {
Packit 6c4009
case NFS_OK:
Packit 6c4009
	readokres reply;
Packit 6c4009
default:
Packit 6c4009
	void;
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * Arguments to remote write
Packit 6c4009
 */
Packit 6c4009
struct writeargs {
Packit 6c4009
	nfs_fh	file;		/* handle for file */
Packit 6c4009
	unsigned beginoffset;	/* beginning byte offset in file */
Packit 6c4009
	unsigned offset;	/* current byte offset in file */
Packit 6c4009
	unsigned totalcount;	/* total write count (to this offset)*/
Packit 6c4009
	opaque data<NFS_MAXDATA>;
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
struct createargs {
Packit 6c4009
	diropargs where;
Packit 6c4009
	sattr attributes;
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
struct renameargs {
Packit 6c4009
	diropargs from;
Packit 6c4009
	diropargs to;
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
struct linkargs {
Packit 6c4009
	nfs_fh from;
Packit 6c4009
	diropargs to;
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
struct symlinkargs {
Packit 6c4009
	diropargs from;
Packit 6c4009
	nfspath to;
Packit 6c4009
	sattr attributes;
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
Packit 6c4009
typedef opaque nfscookie[NFS_COOKIESIZE];
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * Arguments to readdir
Packit 6c4009
 */
Packit 6c4009
struct readdirargs {
Packit 6c4009
	nfs_fh dir;		/* directory handle */
Packit 6c4009
	nfscookie cookie;
Packit 6c4009
	unsigned count;		/* number of directory bytes to read */
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
struct entry {
Packit 6c4009
	unsigned fileid;
Packit 6c4009
	filename name;
Packit 6c4009
	nfscookie cookie;
Packit 6c4009
	entry *nextentry;
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
struct dirlist {
Packit 6c4009
	entry *entries;
Packit 6c4009
	bool eof;
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
union readdirres switch (nfsstat status) {
Packit 6c4009
case NFS_OK:
Packit 6c4009
	dirlist reply;
Packit 6c4009
default:
Packit 6c4009
	void;
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
struct statfsokres {
Packit 6c4009
	unsigned tsize;	/* preferred transfer size in bytes */
Packit 6c4009
	unsigned bsize;	/* fundamental file system block size */
Packit 6c4009
	unsigned blocks;	/* total blocks in file system */
Packit 6c4009
	unsigned bfree;	/* free blocks in fs */
Packit 6c4009
	unsigned bavail;	/* free blocks avail to non-superuser */
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
union statfsres switch (nfsstat status) {
Packit 6c4009
case NFS_OK:
Packit 6c4009
	statfsokres reply;
Packit 6c4009
default:
Packit 6c4009
	void;
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * Remote file service routines
Packit 6c4009
 */
Packit 6c4009
program NFS_PROGRAM {
Packit 6c4009
	version NFS_VERSION {
Packit 6c4009
		void
Packit 6c4009
		NFSPROC_NULL(void) = 0;
Packit 6c4009
Packit 6c4009
		attrstat
Packit 6c4009
		NFSPROC_GETATTR(nfs_fh) =	1;
Packit 6c4009
Packit 6c4009
		attrstat
Packit 6c4009
		NFSPROC_SETATTR(sattrargs) = 2;
Packit 6c4009
Packit 6c4009
		void
Packit 6c4009
		NFSPROC_ROOT(void) = 3;
Packit 6c4009
Packit 6c4009
		diropres
Packit 6c4009
		NFSPROC_LOOKUP(diropargs) = 4;
Packit 6c4009
Packit 6c4009
		readlinkres
Packit 6c4009
		NFSPROC_READLINK(nfs_fh) = 5;
Packit 6c4009
Packit 6c4009
		readres
Packit 6c4009
		NFSPROC_READ(readargs) = 6;
Packit 6c4009
Packit 6c4009
		void
Packit 6c4009
		NFSPROC_WRITECACHE(void) = 7;
Packit 6c4009
Packit 6c4009
		attrstat
Packit 6c4009
		NFSPROC_WRITE(writeargs) = 8;
Packit 6c4009
Packit 6c4009
		diropres
Packit 6c4009
		NFSPROC_CREATE(createargs) = 9;
Packit 6c4009
Packit 6c4009
		nfsstat
Packit 6c4009
		NFSPROC_REMOVE(diropargs) = 10;
Packit 6c4009
Packit 6c4009
		nfsstat
Packit 6c4009
		NFSPROC_RENAME(renameargs) = 11;
Packit 6c4009
Packit 6c4009
		nfsstat
Packit 6c4009
		NFSPROC_LINK(linkargs) = 12;
Packit 6c4009
Packit 6c4009
		nfsstat
Packit 6c4009
		NFSPROC_SYMLINK(symlinkargs) = 13;
Packit 6c4009
Packit 6c4009
		diropres
Packit 6c4009
		NFSPROC_MKDIR(createargs) = 14;
Packit 6c4009
Packit 6c4009
		nfsstat
Packit 6c4009
		NFSPROC_RMDIR(diropargs) = 15;
Packit 6c4009
Packit 6c4009
		readdirres
Packit 6c4009
		NFSPROC_READDIR(readdirargs) = 16;
Packit 6c4009
Packit 6c4009
		statfsres
Packit 6c4009
		NFSPROC_STATFS(nfs_fh) = 17;
Packit 6c4009
	} = 2;
Packit 6c4009
} = 100003;