]> git.saurik.com Git - apple/xnu.git/blob - bsd/nfs/nfsdiskless.h
b04ee1dd455e8cbe17df65ab29a54482ddea7e4f
[apple/xnu.git] / bsd / nfs / nfsdiskless.h
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22 /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
23 /*
24 * Copyright (c) 1991, 1993
25 * The Regents of the University of California. All rights reserved.
26 *
27 * This code is derived from software contributed to Berkeley by
28 * Rick Macklem at The University of Guelph.
29 *
30 * Redistribution and use in source and binary forms, with or without
31 * modification, are permitted provided that the following conditions
32 * are met:
33 * 1. Redistributions of source code must retain the above copyright
34 * notice, this list of conditions and the following disclaimer.
35 * 2. Redistributions in binary form must reproduce the above copyright
36 * notice, this list of conditions and the following disclaimer in the
37 * documentation and/or other materials provided with the distribution.
38 * 3. All advertising materials mentioning features or use of this software
39 * must display the following acknowledgement:
40 * This product includes software developed by the University of
41 * California, Berkeley and its contributors.
42 * 4. Neither the name of the University nor the names of its contributors
43 * may be used to endorse or promote products derived from this software
44 * without specific prior written permission.
45 *
46 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
47 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
48 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
49 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
50 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
51 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
52 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
53 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
54 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
55 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
56 * SUCH DAMAGE.
57 *
58 * @(#)nfsdiskless.h 8.2 (Berkeley) 3/30/95
59 * FreeBSD-Id: nfsdiskless.h,v 1.10 1997/09/07 12:56:46 bde Exp $
60 */
61
62
63 #ifndef _NFS_NFSDISKLESS_H_
64 #define _NFS_NFSDISKLESS_H_
65
66 /*
67 * Structure that must be initialized for a diskless nfs client.
68 * This structure is used by nfs_mountroot() to set up the root and swap
69 * vnodes plus do a partial ifconfig(8) and route(8) so that the critical net
70 * interface can communicate with the server.
71 * The primary bootstrap is expected to fill in the appropriate fields before
72 * starting the kernel. Whether or not the swap area is nfs mounted is
73 * determined by the value in swdevt[0]. (equal to NODEV --> swap over nfs)
74 * Currently only works for AF_INET protocols.
75 * NB: All fields are stored in net byte order to avoid hassles with
76 * client/server byte ordering differences.
77 */
78
79 /*
80 * I have defined a new structure that can handle an NFS Version 3 file handle
81 * but the kernel still expects the old Version 2 one to be provided. The
82 * changes required in nfs_vfsops.c for using the new are documented there in
83 * comments. (I felt that breaking network booting code by changing this
84 * structure would not be prudent at this time, since almost all servers are
85 * still Version 2 anyhow.)
86 */
87 struct nfsv3_diskless {
88 struct ifaliasreq myif; /* Default interface */
89 struct sockaddr_in mygateway; /* Default gateway */
90 struct nfs_args swap_args; /* Mount args for swap file */
91 int swap_fhsize; /* Size of file handle */
92 u_char swap_fh[NFSX_V3FHMAX]; /* Swap file's file handle */
93 struct sockaddr_in swap_saddr; /* Address of swap server */
94 char swap_hostnam[MNAMELEN]; /* Host name for mount pt */
95 int swap_nblks; /* Size of server swap file */
96 struct ucred swap_ucred; /* Swap credentials */
97 struct nfs_args root_args; /* Mount args for root fs */
98 int root_fhsize; /* Size of root file handle */
99 u_char root_fh[NFSX_V3FHMAX]; /* File handle of root dir */
100 struct sockaddr_in root_saddr; /* Address of root server */
101 char root_hostnam[MNAMELEN]; /* Host name for mount pt */
102 long root_time; /* Timestamp of root fs */
103 char my_hostnam[MAXHOSTNAMELEN]; /* Client host name */
104 };
105
106 struct nfs_dlmount {
107 struct sockaddr_in ndm_saddr; /* Address of file server */
108 char ndm_host[MNAMELEN]; /* Host name for mount pt */
109 u_char ndm_fh[NFSX_V2FH]; /* The file's file handle */
110 };
111
112 /*
113 * Old arguments to mount NFS
114 */
115 struct onfs_args {
116 struct sockaddr *addr; /* file server address */
117 int addrlen; /* length of address */
118 int sotype; /* Socket type */
119 int proto; /* and Protocol */
120 u_char *fh; /* File handle to be mounted */
121 int fhsize; /* Size, in bytes, of fh */
122 int flags; /* flags */
123 int wsize; /* write size in bytes */
124 int rsize; /* read size in bytes */
125 int readdirsize; /* readdir size in bytes */
126 int timeo; /* initial timeout in .1 secs */
127 int retrans; /* times to retry send */
128 int maxgrouplist; /* Max. size of group list */
129 int readahead; /* # of blocks to readahead */
130 int leaseterm; /* Term (sec) of lease */
131 int deadthresh; /* Retrans threshold */
132 char *hostname; /* server's name */
133 };
134
135 struct nfs_diskless {
136 struct nfs_dlmount nd_root; /* Mount info for root */
137 struct nfs_dlmount nd_private; /* Mount info for private */
138 };
139
140 #endif