nfs_vfsops.c (41514) | nfs_vfsops.c (43311) |
---|---|
1/* 2 * Copyright (c) 1989, 1993, 1995 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Rick Macklem at The University of Guelph. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 20 unchanged lines hidden (view full) --- 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * 36 * @(#)nfs_vfsops.c 8.12 (Berkeley) 5/20/95 | 1/* 2 * Copyright (c) 1989, 1993, 1995 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Rick Macklem at The University of Guelph. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 20 unchanged lines hidden (view full) --- 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * 36 * @(#)nfs_vfsops.c 8.12 (Berkeley) 5/20/95 |
37 * $Id: nfs_vfsops.c,v 1.78 1998/10/31 15:31:26 peter Exp $ | 37 * $Id: nfs_vfsops.c,v 1.79 1998/12/04 22:54:54 archie Exp $ |
38 */ 39 40#include <sys/param.h> 41#include <sys/sockio.h> 42#include <sys/proc.h> 43#include <sys/vnode.h> 44#include <sys/kernel.h> 45#include <sys/sysctl.h> --- 91 unchanged lines hidden (view full) --- 137}; 138VFS_SET(nfs_vfsops, nfs, VFCF_NETWORK); 139 140/* 141 * This structure must be filled in by a primary bootstrap or bootstrap 142 * server for a diskless/dataless machine. It is initialized below just 143 * to ensure that it is allocated to initialized data (.data not .bss). 144 */ | 38 */ 39 40#include <sys/param.h> 41#include <sys/sockio.h> 42#include <sys/proc.h> 43#include <sys/vnode.h> 44#include <sys/kernel.h> 45#include <sys/sysctl.h> --- 91 unchanged lines hidden (view full) --- 137}; 138VFS_SET(nfs_vfsops, nfs, VFCF_NETWORK); 139 140/* 141 * This structure must be filled in by a primary bootstrap or bootstrap 142 * server for a diskless/dataless machine. It is initialized below just 143 * to ensure that it is allocated to initialized data (.data not .bss). 144 */ |
145struct nfs_diskless nfs_diskless = { 0 }; 146struct nfsv3_diskless nfsv3_diskless = { 0 }; | 145struct nfs_diskless nfs_diskless = { { 0 } }; 146struct nfsv3_diskless nfsv3_diskless = { { 0 } }; |
147int nfs_diskless_valid = 0; 148 149SYSCTL_INT(_vfs_nfs, OID_AUTO, diskless_valid, CTLFLAG_RD, 150 &nfs_diskless_valid, 0, ""); 151 152SYSCTL_STRING(_vfs_nfs, OID_AUTO, diskless_rootpath, CTLFLAG_RD, 153 nfsv3_diskless.root_hostnam, 0, ""); 154 --- 330 unchanged lines hidden (view full) --- 485 */ 486 nd->root_args.fh = nd->root_fh; 487 nd->root_args.fhsize = nd->root_fhsize; 488 l = ntohl(nd->root_saddr.sin_addr.s_addr); 489 snprintf(buf, sizeof(buf), "%ld.%ld.%ld.%ld:%s", 490 (l >> 24) & 0xff, (l >> 16) & 0xff, 491 (l >> 8) & 0xff, (l >> 0) & 0xff,nd->root_hostnam); 492 printf("NFS ROOT: %s\n",buf); | 147int nfs_diskless_valid = 0; 148 149SYSCTL_INT(_vfs_nfs, OID_AUTO, diskless_valid, CTLFLAG_RD, 150 &nfs_diskless_valid, 0, ""); 151 152SYSCTL_STRING(_vfs_nfs, OID_AUTO, diskless_rootpath, CTLFLAG_RD, 153 nfsv3_diskless.root_hostnam, 0, ""); 154 --- 330 unchanged lines hidden (view full) --- 485 */ 486 nd->root_args.fh = nd->root_fh; 487 nd->root_args.fhsize = nd->root_fhsize; 488 l = ntohl(nd->root_saddr.sin_addr.s_addr); 489 snprintf(buf, sizeof(buf), "%ld.%ld.%ld.%ld:%s", 490 (l >> 24) & 0xff, (l >> 16) & 0xff, 491 (l >> 8) & 0xff, (l >> 0) & 0xff,nd->root_hostnam); 492 printf("NFS ROOT: %s\n",buf); |
493 if (error = nfs_mountdiskless(buf, "/", MNT_RDONLY, 494 &nd->root_saddr, &nd->root_args, p, &vp, &mp)) { | 493 if ((error = nfs_mountdiskless(buf, "/", MNT_RDONLY, 494 &nd->root_saddr, &nd->root_args, p, &vp, &mp)) != 0) { |
495 if (swap_mp) { 496 mp->mnt_vfc->vfc_refcount--; 497 free(swap_mp, M_MOUNT); 498 } 499 return (error); 500 } 501 502 swap_mp = NULL; --- 8 unchanged lines hidden (view full) --- 511 */ 512 nd->swap_args.fh = nd->swap_fh; 513 nd->swap_args.fhsize = nd->swap_fhsize; 514 l = ntohl(nd->swap_saddr.sin_addr.s_addr); 515 snprintf(buf, sizeof(buf), "%ld.%ld.%ld.%ld:%s", 516 (l >> 24) & 0xff, (l >> 16) & 0xff, 517 (l >> 8) & 0xff, (l >> 0) & 0xff,nd->swap_hostnam); 518 printf("NFS SWAP: %s\n",buf); | 495 if (swap_mp) { 496 mp->mnt_vfc->vfc_refcount--; 497 free(swap_mp, M_MOUNT); 498 } 499 return (error); 500 } 501 502 swap_mp = NULL; --- 8 unchanged lines hidden (view full) --- 511 */ 512 nd->swap_args.fh = nd->swap_fh; 513 nd->swap_args.fhsize = nd->swap_fhsize; 514 l = ntohl(nd->swap_saddr.sin_addr.s_addr); 515 snprintf(buf, sizeof(buf), "%ld.%ld.%ld.%ld:%s", 516 (l >> 24) & 0xff, (l >> 16) & 0xff, 517 (l >> 8) & 0xff, (l >> 0) & 0xff,nd->swap_hostnam); 518 printf("NFS SWAP: %s\n",buf); |
519 if (error = nfs_mountdiskless(buf, "/swap", 0, 520 &nd->swap_saddr, &nd->swap_args, p, &vp, &swap_mp)) | 519 if ((error = nfs_mountdiskless(buf, "/swap", 0, 520 &nd->swap_saddr, &nd->swap_args, p, &vp, &swap_mp)) != 0) |
521 return (error); 522 vfs_unbusy(swap_mp, p); 523 524 VTONFS(vp)->n_size = VTONFS(vp)->n_vattr.va_size = 525 nd->swap_nblks * DEV_BSIZE ; 526 527 /* 528 * Since the swap file is not the root dir of a file system, --- 47 unchanged lines hidden (view full) --- 576 if (!mp && (error = vfs_rootmountalloc("nfs", path, &mp))) { 577 printf("nfs_mountroot: NFS not configured"); 578 return (error); 579 } 580 581 mp->mnt_kern_flag = 0; 582 mp->mnt_flag = mountflag; 583 nam = dup_sockaddr((struct sockaddr *)sin, 1); | 521 return (error); 522 vfs_unbusy(swap_mp, p); 523 524 VTONFS(vp)->n_size = VTONFS(vp)->n_vattr.va_size = 525 nd->swap_nblks * DEV_BSIZE ; 526 527 /* 528 * Since the swap file is not the root dir of a file system, --- 47 unchanged lines hidden (view full) --- 576 if (!mp && (error = vfs_rootmountalloc("nfs", path, &mp))) { 577 printf("nfs_mountroot: NFS not configured"); 578 return (error); 579 } 580 581 mp->mnt_kern_flag = 0; 582 mp->mnt_flag = mountflag; 583 nam = dup_sockaddr((struct sockaddr *)sin, 1); |
584 if (error = mountnfs(args, mp, nam, which, path, vpp)) { | 584 if ((error = mountnfs(args, mp, nam, which, path, vpp)) != 0) { |
585 printf("nfs_mountroot: mount %s on %s: %d", path, which, error); 586 mp->mnt_vfc->vfc_refcount--; 587 vfs_unbusy(mp, p); 588 free(mp, M_MOUNT); 589 FREE(nam, M_SONAME); 590 return (error); 591 } 592 (void) copystr(which, mp->mnt_stat.f_mntonname, MNAMELEN - 1, 0); --- 563 unchanged lines hidden --- | 585 printf("nfs_mountroot: mount %s on %s: %d", path, which, error); 586 mp->mnt_vfc->vfc_refcount--; 587 vfs_unbusy(mp, p); 588 free(mp, M_MOUNT); 589 FREE(nam, M_SONAME); 590 return (error); 591 } 592 (void) copystr(which, mp->mnt_stat.f_mntonname, MNAMELEN - 1, 0); --- 563 unchanged lines hidden --- |