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