nfsdiskless.h revision 103770
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 103770 2002-09-22 00:59:02Z jake $ 381541Srgrimes */ 391541Srgrimes 4083651Speter#ifndef _NFSCLIENT_NFSDISKLESS_H_ 4183651Speter#define _NFSCLIENT_NFSDISKLESS_H_ 4222521Sdyson 431541Srgrimes/* 441541Srgrimes * Structure that must be initialized for a diskless nfs client. 4529202Sbde * This structure is used by nfs_mountroot() to set up the root vnode, 4629202Sbde * and to do a partial ifconfig(8) and route(8) so that the critical net 471541Srgrimes * interface can communicate with the server. 481541Srgrimes * The primary bootstrap is expected to fill in the appropriate fields before 4922521Sdyson * starting the kernel. Whether or not the swap area is nfs mounted is 5022521Sdyson * determined by the value in swdevt[0]. (equal to NODEV --> swap over nfs) 511541Srgrimes * Currently only works for AF_INET protocols. 521541Srgrimes * NB: All fields are stored in net byte order to avoid hassles with 531541Srgrimes * client/server byte ordering differences. 541541Srgrimes */ 559336Sdfr 569336Sdfr/* 579336Sdfr * I have defined a new structure that can handle an NFS Version 3 file handle 589336Sdfr * but the kernel still expects the old Version 2 one to be provided. The 599336Sdfr * changes required in nfs_vfsops.c for using the new are documented there in 609336Sdfr * comments. (I felt that breaking network booting code by changing this 619336Sdfr * structure would not be prudent at this time, since almost all servers are 629336Sdfr * still Version 2 anyhow.) 639336Sdfr */ 649336Sdfrstruct nfsv3_diskless { 659336Sdfr struct ifaliasreq myif; /* Default interface */ 669336Sdfr struct sockaddr_in mygateway; /* Default gateway */ 679336Sdfr struct nfs_args swap_args; /* Mount args for swap file */ 689336Sdfr int swap_fhsize; /* Size of file handle */ 699336Sdfr u_char swap_fh[NFSX_V3FHMAX]; /* Swap file's file handle */ 709336Sdfr struct sockaddr_in swap_saddr; /* Address of swap server */ 719336Sdfr char swap_hostnam[MNAMELEN]; /* Host name for mount pt */ 729336Sdfr int swap_nblks; /* Size of server swap file */ 739336Sdfr struct ucred swap_ucred; /* Swap credentials */ 749336Sdfr struct nfs_args root_args; /* Mount args for root fs */ 759336Sdfr int root_fhsize; /* Size of root file handle */ 769336Sdfr u_char root_fh[NFSX_V3FHMAX]; /* File handle of root dir */ 779336Sdfr struct sockaddr_in root_saddr; /* Address of root server */ 789336Sdfr char root_hostnam[MNAMELEN]; /* Host name for mount pt */ 799336Sdfr long root_time; /* Timestamp of root fs */ 809336Sdfr char my_hostnam[MAXHOSTNAMELEN]; /* Client host name */ 819336Sdfr}; 829336Sdfr 8325755Stegge/* 8425755Stegge * Old arguments to mount NFS 8525755Stegge */ 8625755Steggestruct onfs_args { 8725755Stegge struct sockaddr *addr; /* file server address */ 8825755Stegge int addrlen; /* length of address */ 8925755Stegge int sotype; /* Socket type */ 9025755Stegge int proto; /* and Protocol */ 9125755Stegge u_char *fh; /* File handle to be mounted */ 9225755Stegge int fhsize; /* Size, in bytes, of fh */ 9325755Stegge int flags; /* flags */ 9425755Stegge int wsize; /* write size in bytes */ 9525755Stegge int rsize; /* read size in bytes */ 9625755Stegge int readdirsize; /* readdir size in bytes */ 9725755Stegge int timeo; /* initial timeout in .1 secs */ 9825755Stegge int retrans; /* times to retry send */ 9925755Stegge int maxgrouplist; /* Max. size of group list */ 10025755Stegge int readahead; /* # of blocks to readahead */ 10125755Stegge int leaseterm; /* Term (sec) of lease */ 10225755Stegge int deadthresh; /* Retrans threshold */ 10325755Stegge char *hostname; /* server's name */ 10425755Stegge}; 10525755Stegge 1061541Srgrimesstruct nfs_diskless { 1071541Srgrimes struct ifaliasreq myif; /* Default interface */ 1081541Srgrimes struct sockaddr_in mygateway; /* Default gateway */ 10925755Stegge struct onfs_args swap_args; /* Mount args for swap file */ 1109336Sdfr u_char swap_fh[NFSX_V2FH]; /* Swap file's file handle */ 1111541Srgrimes struct sockaddr_in swap_saddr; /* Address of swap server */ 1121541Srgrimes char swap_hostnam[MNAMELEN]; /* Host name for mount pt */ 1131541Srgrimes int swap_nblks; /* Size of server swap file */ 1141541Srgrimes struct ucred swap_ucred; /* Swap credentials */ 11525755Stegge struct onfs_args root_args; /* Mount args for root fs */ 1169336Sdfr u_char root_fh[NFSX_V2FH]; /* File handle of root dir */ 1171541Srgrimes struct sockaddr_in root_saddr; /* Address of root server */ 1181541Srgrimes char root_hostnam[MNAMELEN]; /* Host name for mount pt */ 1191541Srgrimes long root_time; /* Timestamp of root fs */ 1201541Srgrimes char my_hostnam[MAXHOSTNAMELEN]; /* Client host name */ 1211541Srgrimes}; 1222175Spaul 12383651Speter#ifdef _KERNEL 12483651Speterextern struct nfsv3_diskless nfsv3_diskless; 12583651Speterextern struct nfs_diskless nfs_diskless; 12683651Speterextern int nfs_diskless_valid; 12791460Spetervoid bootpc_init(void); 128103770Sjakevoid nfs_setup_diskless(void); 1292175Spaul#endif 13083651Speter 13183651Speter#endif 132