]> git.saurik.com Git - apple/xnu.git/blob - bsd/nfs/nfsdiskless.h
3fa123d7fbb054e9890afa247e4d85f30b1cd58e
[apple/xnu.git] / bsd / nfs / nfsdiskless.h
1 /*
2 * Copyright (c) 2000-2002 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 #include <sys/appleapiopts.h>
67
68 #ifdef __APPLE_API_PRIVATE
69 /*
70 * Structure that must be initialized for a diskless nfs client.
71 * This structure is used by nfs_mountroot() to set up the root and swap
72 * vnodes plus do a partial ifconfig(8) and route(8) so that the critical net
73 * interface can communicate with the server.
74 * The primary bootstrap is expected to fill in the appropriate fields before
75 * starting the kernel. Whether or not the swap area is nfs mounted is
76 * determined by the value in swdevt[0]. (equal to NODEV --> swap over nfs)
77 * Currently only works for AF_INET protocols.
78 * NB: All fields are stored in net byte order to avoid hassles with
79 * client/server byte ordering differences.
80 */
81
82 /*
83 * I have defined a new structure that can handle an NFS Version 3 file handle
84 * but the kernel still expects the old Version 2 one to be provided. The
85 * changes required in nfs_vfsops.c for using the new are documented there in
86 * comments. (I felt that breaking network booting code by changing this
87 * structure would not be prudent at this time, since almost all servers are
88 * still Version 2 anyhow.)
89 */
90 struct nfsv3_diskless {
91 struct ifaliasreq myif; /* Default interface */
92 struct sockaddr_in mygateway; /* Default gateway */
93 struct nfs_args swap_args; /* Mount args for swap file */
94 int swap_fhsize; /* Size of file handle */
95 u_char swap_fh[NFSX_V3FHMAX]; /* Swap file's file handle */
96 struct sockaddr_in swap_saddr; /* Address of swap server */
97 char swap_hostnam[MNAMELEN]; /* Host name for mount pt */
98 int swap_nblks; /* Size of server swap file */
99 struct ucred swap_ucred; /* Swap credentials */
100 struct nfs_args root_args; /* Mount args for root fs */
101 int root_fhsize; /* Size of root file handle */
102 u_char root_fh[NFSX_V3FHMAX]; /* File handle of root dir */
103 struct sockaddr_in root_saddr; /* Address of root server */
104 char root_hostnam[MNAMELEN]; /* Host name for mount pt */
105 long root_time; /* Timestamp of root fs */
106 char my_hostnam[MAXHOSTNAMELEN]; /* Client host name */
107 };
108
109 struct nfs_dlmount {
110 struct sockaddr_in ndm_saddr; /* Address of file server */
111 char ndm_host[MNAMELEN]; /* Host name for mount pt */
112 char *ndm_path; /* path name for mount pt */
113 u_long ndm_nfsv3; /* NFSv3 or NFSv2? */
114 u_long ndm_fhlen; /* length of file handle */
115 u_char ndm_fh[NFSX_V3FHMAX]; /* The file's file handle */
116 };
117
118 /*
119 * Old arguments to mount NFS
120 */
121 struct onfs_args {
122 struct sockaddr *addr; /* file server address */
123 int addrlen; /* length of address */
124 int sotype; /* Socket type */
125 int proto; /* and Protocol */
126 u_char *fh; /* File handle to be mounted */
127 int fhsize; /* Size, in bytes, of fh */
128 int flags; /* flags */
129 int wsize; /* write size in bytes */
130 int rsize; /* read size in bytes */
131 int readdirsize; /* readdir size in bytes */
132 int timeo; /* initial timeout in .1 secs */
133 int retrans; /* times to retry send */
134 int maxgrouplist; /* Max. size of group list */
135 int readahead; /* # of blocks to readahead */
136 int leaseterm; /* Term (sec) of lease */
137 int deadthresh; /* Retrans threshold */
138 char *hostname; /* server's name */
139 };
140
141 struct nfs_diskless {
142 struct nfs_dlmount nd_root; /* Mount info for root */
143 struct nfs_dlmount nd_private; /* Mount info for private */
144 };
145
146 #endif /* __APPLE_API_PRIVATE */
147 #endif /* _NFS_NFSDISKLESS_H_ */