xref: /original-bsd/sys/nfs/nfsdiskless.h (revision 27393bdf)
1 /*
2  * Copyright (c) 1991, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * This code is derived from software contributed to Berkeley by
6  * Rick Macklem at The University of Guelph.
7  *
8  * %sccs.include.redist.c%
9  *
10  *	@(#)nfsdiskless.h	8.2 (Berkeley) 03/30/95
11  */
12 
13 
14 #ifndef _NFS_NFSDISKLESS_H_
15 #define _NFS_NFSDISKLESS_H_
16 
17 /*
18  * Structure that must be initialized for a diskless nfs client.
19  * This structure is used by nfs_mountroot() to set up the root and swap
20  * vnodes plus do a partial ifconfig(8) and route(8) so that the critical net
21  * interface can communicate with the server.
22  * The primary bootstrap is expected to fill in the appropriate fields before
23  * starting the kernel. Whether or not the swap area is nfs mounted is
24  * determined by the value in swdevt[0]. (equal to NODEV --> swap over nfs)
25  * Currently only works for AF_INET protocols.
26  * NB: All fields are stored in net byte order to avoid hassles with
27  * client/server byte ordering differences.
28  */
29 
30 /*
31  * I have defined a new structure that can handle an NFS Version 3 file handle
32  * but the kernel still expects the old Version 2 one to be provided. The
33  * changes required in nfs_vfsops.c for using the new are documented there in
34  * comments. (I felt that breaking network booting code by changing this
35  * structure would not be prudent at this time, since almost all servers are
36  * still Version 2 anyhow.)
37  */
38 struct nfsv3_diskless {
39 	struct ifaliasreq myif;			/* Default interface */
40 	struct sockaddr_in mygateway;		/* Default gateway */
41 	struct nfs_args	swap_args;		/* Mount args for swap file */
42 	int		swap_fhsize;		/* Size of file handle */
43 	u_char		swap_fh[NFSX_V3FHMAX];	/* Swap file's file handle */
44 	struct sockaddr_in swap_saddr;		/* Address of swap server */
45 	char		swap_hostnam[MNAMELEN];	/* Host name for mount pt */
46 	int		swap_nblks;		/* Size of server swap file */
47 	struct ucred	swap_ucred;		/* Swap credentials */
48 	struct nfs_args	root_args;		/* Mount args for root fs */
49 	int		root_fhsize;		/* Size of root file handle */
50 	u_char		root_fh[NFSX_V3FHMAX];	/* File handle of root dir */
51 	struct sockaddr_in root_saddr;		/* Address of root server */
52 	char		root_hostnam[MNAMELEN];	/* Host name for mount pt */
53 	long		root_time;		/* Timestamp of root fs */
54 	char		my_hostnam[MAXHOSTNAMELEN]; /* Client host name */
55 };
56 
57 struct nfs_diskless {
58 	struct ifaliasreq myif;			/* Default interface */
59 	struct sockaddr_in mygateway;		/* Default gateway */
60 	struct nfs_args	swap_args;		/* Mount args for swap file */
61 	u_char		swap_fh[NFSX_V2FH];	/* Swap file's file handle */
62 	struct sockaddr_in swap_saddr;		/* Address of swap server */
63 	char		swap_hostnam[MNAMELEN];	/* Host name for mount pt */
64 	int		swap_nblks;		/* Size of server swap file */
65 	struct ucred	swap_ucred;		/* Swap credentials */
66 	struct nfs_args	root_args;		/* Mount args for root fs */
67 	u_char		root_fh[NFSX_V2FH];	/* File handle of root dir */
68 	struct sockaddr_in root_saddr;		/* Address of root server */
69 	char		root_hostnam[MNAMELEN];	/* Host name for mount pt */
70 	long		root_time;		/* Timestamp of root fs */
71 	char		my_hostnam[MAXHOSTNAMELEN]; /* Client host name */
72 };
73 
74 #endif
75