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