/*-1* SPDX-License-Identifier: BSD-3-Clause2*3* Copyright (c) 1991, 19934* The Regents of the University of California. All rights reserved.5*6* This code is derived from software contributed to Berkeley by7* Rick Macklem at The University of Guelph.8*9* Redistribution and use in source and binary forms, with or without10* modification, are permitted provided that the following conditions11* are met:12* 1. Redistributions of source code must retain the above copyright13* notice, this list of conditions and the following disclaimer.14* 2. Redistributions in binary form must reproduce the above copyright15* notice, this list of conditions and the following disclaimer in the16* documentation and/or other materials provided with the distribution.17* 3. Neither the name of the University nor the names of its contributors18* may be used to endorse or promote products derived from this software19* without specific prior written permission.20*21* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND22* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE23* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE24* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE25* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL26* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS27* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)28* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT29* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY30* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF31* SUCH DAMAGE.32*/3334#ifndef _NFSCLIENT_NFSDISKLESS_H_35#define _NFSCLIENT_NFSDISKLESS_H_3637/*38* Structure that must be initialized for a diskless nfs client.39* This structure is used by nfs_mountroot() to set up the root vnode,40* and to do a partial ifconfig(8) and route(8) so that the critical net41* interface can communicate with the server.42* The primary bootstrap is expected to fill in the appropriate fields before43* starting the kernel.44* Currently only works for AF_INET protocols.45* NB: All fields are stored in net byte order to avoid hassles with46* client/server byte ordering differences.47*/4849/*50* I have defined a new structure that can handle an NFS Version 3 file handle51* but the kernel still expects the old Version 2 one to be provided. The52* changes required in nfs_vfsops.c for using the new are documented there in53* comments. (I felt that breaking network booting code by changing this54* structure would not be prudent at this time, since almost all servers are55* still Version 2 anyhow.)56*/57struct nfsv3_diskless {58struct ifaliasreq myif; /* Default interface */59struct sockaddr_in mygateway; /* Default gateway */60struct nfs_args root_args; /* Mount args for root fs */61int root_fhsize; /* Size of root file handle */62u_char root_fh[NFSX_V3FHMAX]; /* File handle of root dir */63struct sockaddr_in root_saddr; /* Address of root server */64char root_hostnam[MNAMELEN]; /* Host name for mount pt */65long root_time; /* Timestamp of root fs */66char my_hostnam[MAXHOSTNAMELEN]; /* Client host name */67};6869/*70* Old arguments to mount NFS71*/72struct onfs_args {73struct sockaddr *addr; /* file server address */74int addrlen; /* length of address */75int sotype; /* Socket type */76int proto; /* and Protocol */77u_char *fh; /* File handle to be mounted */78int fhsize; /* Size, in bytes, of fh */79int flags; /* flags */80int wsize; /* write size in bytes */81int rsize; /* read size in bytes */82int readdirsize; /* readdir size in bytes */83int timeo; /* initial timeout in .1 secs */84int retrans; /* times to retry send */85int maxgrouplist; /* Max. size of group list */86int readahead; /* # of blocks to readahead */87int leaseterm; /* Term (sec) of lease */88int deadthresh; /* Retrans threshold */89char *hostname; /* server's name */90};9192struct nfs_diskless {93struct ifaliasreq myif; /* Default interface */94struct sockaddr_in mygateway; /* Default gateway */95struct onfs_args root_args; /* Mount args for root fs */96u_char root_fh[NFSX_V2FH]; /* File handle of root dir */97struct sockaddr_in root_saddr; /* Address of root server */98char root_hostnam[MNAMELEN]; /* Host name for mount pt */99long root_time; /* Timestamp of root fs */100char my_hostnam[MAXHOSTNAMELEN]; /* Client host name */101};102103#ifdef _KERNEL104extern struct nfsv3_diskless nfsv3_diskless;105extern struct nfs_diskless nfs_diskless;106extern int nfs_diskless_valid;107void bootpc_init(void);108void nfs_setup_diskless(void);109void nfs_parse_options(const char *, struct nfs_args *);110#endif111112#endif113114115