1139823Simp/*-
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 * 4. Neither the name of the University nor the names of its contributors
171541Srgrimes *    may be used to endorse or promote products derived from this software
181541Srgrimes *    without specific prior written permission.
191541Srgrimes *
201541Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
211541Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
221541Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
231541Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
241541Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
251541Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
261541Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
271541Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
281541Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
291541Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
301541Srgrimes * SUCH DAMAGE.
311541Srgrimes *
3222521Sdyson *	@(#)nfsdiskless.h	8.2 (Berkeley) 3/30/95
3350477Speter * $FreeBSD$
341541Srgrimes */
351541Srgrimes
3683651Speter#ifndef _NFSCLIENT_NFSDISKLESS_H_
3783651Speter#define _NFSCLIENT_NFSDISKLESS_H_
3822521Sdyson
391541Srgrimes/*
401541Srgrimes * Structure that must be initialized for a diskless nfs client.
4129202Sbde * This structure is used by nfs_mountroot() to set up the root vnode,
4229202Sbde * and to do a partial ifconfig(8) and route(8) so that the critical net
431541Srgrimes * interface can communicate with the server.
441541Srgrimes * The primary bootstrap is expected to fill in the appropriate fields before
45118944Sphk * starting the kernel.
461541Srgrimes * Currently only works for AF_INET protocols.
471541Srgrimes * NB: All fields are stored in net byte order to avoid hassles with
481541Srgrimes * client/server byte ordering differences.
491541Srgrimes */
509336Sdfr
519336Sdfr/*
529336Sdfr * I have defined a new structure that can handle an NFS Version 3 file handle
539336Sdfr * but the kernel still expects the old Version 2 one to be provided. The
549336Sdfr * changes required in nfs_vfsops.c for using the new are documented there in
559336Sdfr * comments. (I felt that breaking network booting code by changing this
569336Sdfr * structure would not be prudent at this time, since almost all servers are
579336Sdfr * still Version 2 anyhow.)
589336Sdfr */
599336Sdfrstruct nfsv3_diskless {
609336Sdfr	struct ifaliasreq myif;			/* Default interface */
619336Sdfr	struct sockaddr_in mygateway;		/* Default gateway */
629336Sdfr	struct nfs_args	root_args;		/* Mount args for root fs */
639336Sdfr	int		root_fhsize;		/* Size of root file handle */
649336Sdfr	u_char		root_fh[NFSX_V3FHMAX];	/* File handle of root dir */
659336Sdfr	struct sockaddr_in root_saddr;		/* Address of root server */
669336Sdfr	char		root_hostnam[MNAMELEN];	/* Host name for mount pt */
679336Sdfr	long		root_time;		/* Timestamp of root fs */
689336Sdfr	char		my_hostnam[MAXHOSTNAMELEN]; /* Client host name */
699336Sdfr};
709336Sdfr
7125755Stegge/*
7225755Stegge * Old arguments to mount NFS
7325755Stegge */
7425755Steggestruct onfs_args {
7525755Stegge	struct sockaddr	*addr;		/* file server address */
7625755Stegge	int		addrlen;	/* length of address */
7725755Stegge	int		sotype;		/* Socket type */
7825755Stegge	int		proto;		/* and Protocol */
7925755Stegge	u_char		*fh;		/* File handle to be mounted */
8025755Stegge	int		fhsize;		/* Size, in bytes, of fh */
8125755Stegge	int		flags;		/* flags */
8225755Stegge	int		wsize;		/* write size in bytes */
8325755Stegge	int		rsize;		/* read size in bytes */
8425755Stegge	int		readdirsize;	/* readdir size in bytes */
8525755Stegge	int		timeo;		/* initial timeout in .1 secs */
8625755Stegge	int		retrans;	/* times to retry send */
8725755Stegge	int		maxgrouplist;	/* Max. size of group list */
8825755Stegge	int		readahead;	/* # of blocks to readahead */
8925755Stegge	int		leaseterm;	/* Term (sec) of lease */
9025755Stegge	int		deadthresh;	/* Retrans threshold */
9125755Stegge	char		*hostname;	/* server's name */
9225755Stegge};
9325755Stegge
941541Srgrimesstruct nfs_diskless {
951541Srgrimes	struct ifaliasreq myif;			/* Default interface */
961541Srgrimes	struct sockaddr_in mygateway;		/* Default gateway */
9725755Stegge	struct onfs_args root_args;		/* Mount args for root fs */
989336Sdfr	u_char		root_fh[NFSX_V2FH];	/* File handle of root dir */
991541Srgrimes	struct sockaddr_in root_saddr;		/* Address of root server */
1001541Srgrimes	char		root_hostnam[MNAMELEN];	/* Host name for mount pt */
1011541Srgrimes	long		root_time;		/* Timestamp of root fs */
1021541Srgrimes	char		my_hostnam[MAXHOSTNAMELEN]; /* Client host name */
1031541Srgrimes};
1042175Spaul
10583651Speter#ifdef _KERNEL
10683651Speterextern struct nfsv3_diskless nfsv3_diskless;
10783651Speterextern struct nfs_diskless nfs_diskless;
10883651Speterextern int	nfs_diskless_valid;
10991460Spetervoid bootpc_init(void);
110103770Sjakevoid nfs_setup_diskless(void);
111164934Ssamvoid nfs_parse_options(const char *, struct nfs_args *);
1122175Spaul#endif
11383651Speter
11483651Speter#endif
115