17c478bd9Sstevel@tonic-gate #ifndef	_NFS_H
27c478bd9Sstevel@tonic-gate #define	_NFS_H
37c478bd9Sstevel@tonic-gate 
47c478bd9Sstevel@tonic-gate #define SUNRPC_PORT	111
57c478bd9Sstevel@tonic-gate 
67c478bd9Sstevel@tonic-gate #define PROG_PORTMAP	100000
77c478bd9Sstevel@tonic-gate #define PROG_NFS	100003
87c478bd9Sstevel@tonic-gate #define PROG_MOUNT	100005
97c478bd9Sstevel@tonic-gate 
107c478bd9Sstevel@tonic-gate #define MSG_CALL	0
117c478bd9Sstevel@tonic-gate #define MSG_REPLY	1
127c478bd9Sstevel@tonic-gate 
137c478bd9Sstevel@tonic-gate #define PORTMAP_GETPORT	3
147c478bd9Sstevel@tonic-gate 
157c478bd9Sstevel@tonic-gate #define MOUNT_ADDENTRY	1
167c478bd9Sstevel@tonic-gate #define MOUNT_UMOUNTALL	4
177c478bd9Sstevel@tonic-gate 
187c478bd9Sstevel@tonic-gate #define NFS_LOOKUP	4
197c478bd9Sstevel@tonic-gate #define	NFS_READLINK	5
207c478bd9Sstevel@tonic-gate #define NFS_READ	6
217c478bd9Sstevel@tonic-gate 
227c478bd9Sstevel@tonic-gate #define NFS_FHSIZE	32
237c478bd9Sstevel@tonic-gate 
247c478bd9Sstevel@tonic-gate #define NFSERR_PERM	1
257c478bd9Sstevel@tonic-gate #define NFSERR_NOENT	2
267c478bd9Sstevel@tonic-gate #define NFSERR_ACCES	13
277c478bd9Sstevel@tonic-gate #define	NFSERR_ISDIR	21
287c478bd9Sstevel@tonic-gate #define	NFSERR_INVAL	22
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate /* Block size used for NFS read accesses.  A RPC reply packet (including  all
317c478bd9Sstevel@tonic-gate  * headers) must fit within a single Ethernet frame to avoid fragmentation.
327c478bd9Sstevel@tonic-gate  * Chosen to be a power of two, as most NFS servers are optimized for this.  */
337c478bd9Sstevel@tonic-gate #define NFS_READ_SIZE	1024
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate #define NFS_MAXLINKDEPTH 16
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate struct rpc_t {
387c478bd9Sstevel@tonic-gate 	struct iphdr ip;
397c478bd9Sstevel@tonic-gate 	struct udphdr udp;
407c478bd9Sstevel@tonic-gate 	union {
417c478bd9Sstevel@tonic-gate 		uint8_t  data[300];		/* longest RPC call must fit!!!! */
427c478bd9Sstevel@tonic-gate 		struct {
437c478bd9Sstevel@tonic-gate 			uint32_t id;
447c478bd9Sstevel@tonic-gate 			uint32_t type;
457c478bd9Sstevel@tonic-gate 			uint32_t rpcvers;
467c478bd9Sstevel@tonic-gate 			uint32_t prog;
477c478bd9Sstevel@tonic-gate 			uint32_t vers;
487c478bd9Sstevel@tonic-gate 			uint32_t proc;
497c478bd9Sstevel@tonic-gate 			uint32_t data[1];
507c478bd9Sstevel@tonic-gate 		} call;
517c478bd9Sstevel@tonic-gate 		struct {
527c478bd9Sstevel@tonic-gate 			uint32_t id;
537c478bd9Sstevel@tonic-gate 			uint32_t type;
547c478bd9Sstevel@tonic-gate 			uint32_t rstatus;
557c478bd9Sstevel@tonic-gate 			uint32_t verifier;
567c478bd9Sstevel@tonic-gate 			uint32_t v2;
577c478bd9Sstevel@tonic-gate 			uint32_t astatus;
587c478bd9Sstevel@tonic-gate 			uint32_t data[1];
597c478bd9Sstevel@tonic-gate 		} reply;
607c478bd9Sstevel@tonic-gate 	} u;
617c478bd9Sstevel@tonic-gate };
627c478bd9Sstevel@tonic-gate 
637c478bd9Sstevel@tonic-gate #endif	/* _NFS_H */
64