nfsdiskless.h revision 50477
11541Srgrimes/*
21541Srgrimes * Copyright (c) 1991, 1993
31541Srgrimes *	The Regents of the University of California.  All rights reserved.
41541Srgrimes *
51541Srgrimes * This code is derived from software contributed to Berkeley by
61541Srgrimes * Rick Macklem at The University of Guelph.
71541Srgrimes *
81541Srgrimes * Redistribution and use in source and binary forms, with or without
91541Srgrimes * modification, are permitted provided that the following conditions
101541Srgrimes * are met:
111541Srgrimes * 1. Redistributions of source code must retain the above copyright
121541Srgrimes *    notice, this list of conditions and the following disclaimer.
131541Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
141541Srgrimes *    notice, this list of conditions and the following disclaimer in the
151541Srgrimes *    documentation and/or other materials provided with the distribution.
161541Srgrimes * 3. All advertising materials mentioning features or use of this software
171541Srgrimes *    must display the following acknowledgement:
181541Srgrimes *	This product includes software developed by the University of
191541Srgrimes *	California, Berkeley and its contributors.
201541Srgrimes * 4. Neither the name of the University nor the names of its contributors
211541Srgrimes *    may be used to endorse or promote products derived from this software
221541Srgrimes *    without specific prior written permission.
231541Srgrimes *
241541Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
251541Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
261541Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
271541Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
281541Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
291541Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
301541Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
311541Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
321541Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
331541Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
341541Srgrimes * SUCH DAMAGE.
351541Srgrimes *
3622521Sdyson *	@(#)nfsdiskless.h	8.2 (Berkeley) 3/30/95
3750477Speter * $FreeBSD: head/sys/nfsclient/nfsdiskless.h 50477 1999-08-28 01:08:13Z peter $
381541Srgrimes */
391541Srgrimes
4022521Sdyson
412175Spaul#ifndef _NFS_NFSDISKLESS_H_
422175Spaul#define _NFS_NFSDISKLESS_H_
432175Spaul
441541Srgrimes/*
451541Srgrimes * Structure that must be initialized for a diskless nfs client.
4629202Sbde * This structure is used by nfs_mountroot() to set up the root vnode,
4729202Sbde * and to do a partial ifconfig(8) and route(8) so that the critical net
481541Srgrimes * interface can communicate with the server.
491541Srgrimes * The primary bootstrap is expected to fill in the appropriate fields before
5022521Sdyson * starting the kernel. Whether or not the swap area is nfs mounted is
5122521Sdyson * determined by the value in swdevt[0]. (equal to NODEV --> swap over nfs)
521541Srgrimes * Currently only works for AF_INET protocols.
531541Srgrimes * NB: All fields are stored in net byte order to avoid hassles with
541541Srgrimes * client/server byte ordering differences.
551541Srgrimes */
569336Sdfr
579336Sdfr/*
589336Sdfr * I have defined a new structure that can handle an NFS Version 3 file handle
599336Sdfr * but the kernel still expects the old Version 2 one to be provided. The
609336Sdfr * changes required in nfs_vfsops.c for using the new are documented there in
619336Sdfr * comments. (I felt that breaking network booting code by changing this
629336Sdfr * structure would not be prudent at this time, since almost all servers are
639336Sdfr * still Version 2 anyhow.)
649336Sdfr */
659336Sdfrstruct nfsv3_diskless {
669336Sdfr	struct ifaliasreq myif;			/* Default interface */
679336Sdfr	struct sockaddr_in mygateway;		/* Default gateway */
689336Sdfr	struct nfs_args	swap_args;		/* Mount args for swap file */
699336Sdfr	int		swap_fhsize;		/* Size of file handle */
709336Sdfr	u_char		swap_fh[NFSX_V3FHMAX];	/* Swap file's file handle */
719336Sdfr	struct sockaddr_in swap_saddr;		/* Address of swap server */
729336Sdfr	char		swap_hostnam[MNAMELEN];	/* Host name for mount pt */
739336Sdfr	int		swap_nblks;		/* Size of server swap file */
749336Sdfr	struct ucred	swap_ucred;		/* Swap credentials */
759336Sdfr	struct nfs_args	root_args;		/* Mount args for root fs */
769336Sdfr	int		root_fhsize;		/* Size of root file handle */
779336Sdfr	u_char		root_fh[NFSX_V3FHMAX];	/* File handle of root dir */
789336Sdfr	struct sockaddr_in root_saddr;		/* Address of root server */
799336Sdfr	char		root_hostnam[MNAMELEN];	/* Host name for mount pt */
809336Sdfr	long		root_time;		/* Timestamp of root fs */
819336Sdfr	char		my_hostnam[MAXHOSTNAMELEN]; /* Client host name */
829336Sdfr};
839336Sdfr
8425755Stegge/*
8525755Stegge * Old arguments to mount NFS
8625755Stegge */
8725755Steggestruct onfs_args {
8825755Stegge	struct sockaddr	*addr;		/* file server address */
8925755Stegge	int		addrlen;	/* length of address */
9025755Stegge	int		sotype;		/* Socket type */
9125755Stegge	int		proto;		/* and Protocol */
9225755Stegge	u_char		*fh;		/* File handle to be mounted */
9325755Stegge	int		fhsize;		/* Size, in bytes, of fh */
9425755Stegge	int		flags;		/* flags */
9525755Stegge	int		wsize;		/* write size in bytes */
9625755Stegge	int		rsize;		/* read size in bytes */
9725755Stegge	int		readdirsize;	/* readdir size in bytes */
9825755Stegge	int		timeo;		/* initial timeout in .1 secs */
9925755Stegge	int		retrans;	/* times to retry send */
10025755Stegge	int		maxgrouplist;	/* Max. size of group list */
10125755Stegge	int		readahead;	/* # of blocks to readahead */
10225755Stegge	int		leaseterm;	/* Term (sec) of lease */
10325755Stegge	int		deadthresh;	/* Retrans threshold */
10425755Stegge	char		*hostname;	/* server's name */
10525755Stegge};
10625755Stegge
1071541Srgrimesstruct nfs_diskless {
1081541Srgrimes	struct ifaliasreq myif;			/* Default interface */
1091541Srgrimes	struct sockaddr_in mygateway;		/* Default gateway */
11025755Stegge	struct onfs_args swap_args;		/* Mount args for swap file */
1119336Sdfr	u_char		swap_fh[NFSX_V2FH];	/* Swap file's file handle */
1121541Srgrimes	struct sockaddr_in swap_saddr;		/* Address of swap server */
1131541Srgrimes	char		swap_hostnam[MNAMELEN];	/* Host name for mount pt */
1141541Srgrimes	int		swap_nblks;		/* Size of server swap file */
1151541Srgrimes	struct ucred	swap_ucred;		/* Swap credentials */
11625755Stegge	struct onfs_args root_args;		/* Mount args for root fs */
1179336Sdfr	u_char		root_fh[NFSX_V2FH];	/* File handle of root dir */
1181541Srgrimes	struct sockaddr_in root_saddr;		/* Address of root server */
1191541Srgrimes	char		root_hostnam[MNAMELEN];	/* Host name for mount pt */
1201541Srgrimes	long		root_time;		/* Timestamp of root fs */
1211541Srgrimes	char		my_hostnam[MAXHOSTNAMELEN]; /* Client host name */
1221541Srgrimes};
1232175Spaul
1242175Spaul#endif
125