Home | History | Annotate | Line # | Download | only in common
nfsdiskless.h revision 1.1
      1  1.1  dholland /*	$NetBSD: nfsdiskless.h,v 1.1 2013/09/30 07:19:34 dholland Exp $	*/
      2  1.1  dholland /*-
      3  1.1  dholland  * Copyright (c) 1991, 1993
      4  1.1  dholland  *	The Regents of the University of California.  All rights reserved.
      5  1.1  dholland  *
      6  1.1  dholland  * This code is derived from software contributed to Berkeley by
      7  1.1  dholland  * Rick Macklem at The University of Guelph.
      8  1.1  dholland  *
      9  1.1  dholland  * Redistribution and use in source and binary forms, with or without
     10  1.1  dholland  * modification, are permitted provided that the following conditions
     11  1.1  dholland  * are met:
     12  1.1  dholland  * 1. Redistributions of source code must retain the above copyright
     13  1.1  dholland  *    notice, this list of conditions and the following disclaimer.
     14  1.1  dholland  * 2. Redistributions in binary form must reproduce the above copyright
     15  1.1  dholland  *    notice, this list of conditions and the following disclaimer in the
     16  1.1  dholland  *    documentation and/or other materials provided with the distribution.
     17  1.1  dholland  * 4. Neither the name of the University nor the names of its contributors
     18  1.1  dholland  *    may be used to endorse or promote products derived from this software
     19  1.1  dholland  *    without specific prior written permission.
     20  1.1  dholland  *
     21  1.1  dholland  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     22  1.1  dholland  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     23  1.1  dholland  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     24  1.1  dholland  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     25  1.1  dholland  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     26  1.1  dholland  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     27  1.1  dholland  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     28  1.1  dholland  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     29  1.1  dholland  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     30  1.1  dholland  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     31  1.1  dholland  * SUCH DAMAGE.
     32  1.1  dholland  *
     33  1.1  dholland  *	@(#)nfsdiskless.h	8.2 (Berkeley) 3/30/95
     34  1.1  dholland  * FreeBSD: head/sys/nfs/nfsdiskless.h 221032 2011-04-25 22:22:51Z rmacklem
     35  1.1  dholland  * $NetBSD: nfsdiskless.h,v 1.1 2013/09/30 07:19:34 dholland Exp $
     36  1.1  dholland  */
     37  1.1  dholland 
     38  1.1  dholland #ifndef _NFSCLIENT_NFSDISKLESS_H_
     39  1.1  dholland #define _NFSCLIENT_NFSDISKLESS_H_
     40  1.1  dholland 
     41  1.1  dholland /*
     42  1.1  dholland  * Structure that must be initialized for a diskless nfs client.
     43  1.1  dholland  * This structure is used by nfs_mountroot() to set up the root vnode,
     44  1.1  dholland  * and to do a partial ifconfig(8) and route(8) so that the critical net
     45  1.1  dholland  * interface can communicate with the server.
     46  1.1  dholland  * The primary bootstrap is expected to fill in the appropriate fields before
     47  1.1  dholland  * starting the kernel.
     48  1.1  dholland  * Currently only works for AF_INET protocols.
     49  1.1  dholland  * NB: All fields are stored in net byte order to avoid hassles with
     50  1.1  dholland  * client/server byte ordering differences.
     51  1.1  dholland  */
     52  1.1  dholland 
     53  1.1  dholland /*
     54  1.1  dholland  * I have defined a new structure that can handle an NFS Version 3 file handle
     55  1.1  dholland  * but the kernel still expects the old Version 2 one to be provided. The
     56  1.1  dholland  * changes required in nfs_vfsops.c for using the new are documented there in
     57  1.1  dholland  * comments. (I felt that breaking network booting code by changing this
     58  1.1  dholland  * structure would not be prudent at this time, since almost all servers are
     59  1.1  dholland  * still Version 2 anyhow.)
     60  1.1  dholland  */
     61  1.1  dholland struct nfsv3_diskless {
     62  1.1  dholland 	struct ifaliasreq myif;			/* Default interface */
     63  1.1  dholland 	struct sockaddr_in mygateway;		/* Default gateway */
     64  1.1  dholland 	struct nfs_args	root_args;		/* Mount args for root fs */
     65  1.1  dholland 	int		root_fhsize;		/* Size of root file handle */
     66  1.1  dholland 	u_char		root_fh[NFSX_V3FHMAX];	/* File handle of root dir */
     67  1.1  dholland 	struct sockaddr_in root_saddr;		/* Address of root server */
     68  1.1  dholland 	char		root_hostnam[MNAMELEN];	/* Host name for mount pt */
     69  1.1  dholland 	long		root_time;		/* Timestamp of root fs */
     70  1.1  dholland 	char		my_hostnam[MAXHOSTNAMELEN]; /* Client host name */
     71  1.1  dholland };
     72  1.1  dholland 
     73  1.1  dholland /*
     74  1.1  dholland  * Old arguments to mount NFS
     75  1.1  dholland  */
     76  1.1  dholland struct onfs_args {
     77  1.1  dholland 	struct sockaddr	*addr;		/* file server address */
     78  1.1  dholland 	int		addrlen;	/* length of address */
     79  1.1  dholland 	int		sotype;		/* Socket type */
     80  1.1  dholland 	int		proto;		/* and Protocol */
     81  1.1  dholland 	u_char		*fh;		/* File handle to be mounted */
     82  1.1  dholland 	int		fhsize;		/* Size, in bytes, of fh */
     83  1.1  dholland 	int		flags;		/* flags */
     84  1.1  dholland 	int		wsize;		/* write size in bytes */
     85  1.1  dholland 	int		rsize;		/* read size in bytes */
     86  1.1  dholland 	int		readdirsize;	/* readdir size in bytes */
     87  1.1  dholland 	int		timeo;		/* initial timeout in .1 secs */
     88  1.1  dholland 	int		retrans;	/* times to retry send */
     89  1.1  dholland 	int		maxgrouplist;	/* Max. size of group list */
     90  1.1  dholland 	int		readahead;	/* # of blocks to readahead */
     91  1.1  dholland 	int		leaseterm;	/* Term (sec) of lease */
     92  1.1  dholland 	int		deadthresh;	/* Retrans threshold */
     93  1.1  dholland 	char		*hostname;	/* server's name */
     94  1.1  dholland };
     95  1.1  dholland 
     96  1.1  dholland struct nfs_diskless {
     97  1.1  dholland 	struct ifaliasreq myif;			/* Default interface */
     98  1.1  dholland 	struct sockaddr_in mygateway;		/* Default gateway */
     99  1.1  dholland 	struct onfs_args root_args;		/* Mount args for root fs */
    100  1.1  dholland 	u_char		root_fh[NFSX_V2FH];	/* File handle of root dir */
    101  1.1  dholland 	struct sockaddr_in root_saddr;		/* Address of root server */
    102  1.1  dholland 	char		root_hostnam[MNAMELEN];	/* Host name for mount pt */
    103  1.1  dholland 	long		root_time;		/* Timestamp of root fs */
    104  1.1  dholland 	char		my_hostnam[MAXHOSTNAMELEN]; /* Client host name */
    105  1.1  dholland };
    106  1.1  dholland 
    107  1.1  dholland #ifdef _KERNEL
    108  1.1  dholland extern struct nfsv3_diskless nfsv3_diskless;
    109  1.1  dholland extern struct nfs_diskless nfs_diskless;
    110  1.1  dholland extern int	nfs_diskless_valid;
    111  1.1  dholland void bootpc_init(void);
    112  1.1  dholland void nfs_setup_diskless(void);
    113  1.1  dholland void nfs_parse_options(const char *, struct nfs_args *);
    114  1.1  dholland #endif
    115  1.1  dholland 
    116  1.1  dholland #endif
    117