1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate /* 23*0Sstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 24*0Sstevel@tonic-gate * Use is subject to license terms. 25*0Sstevel@tonic-gate */ 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 28*0Sstevel@tonic-gate /* SunOS-4.1 1.16 */ 29*0Sstevel@tonic-gate 30*0Sstevel@tonic-gate #include <sys/types.h> 31*0Sstevel@tonic-gate #include <sys/param.h> 32*0Sstevel@tonic-gate #include <sys/vfs.h> 33*0Sstevel@tonic-gate #include <sys/t_lock.h> 34*0Sstevel@tonic-gate 35*0Sstevel@tonic-gate extern struct vfsops vfs_strayops; /* XXX move here from vfs.c ? */ 36*0Sstevel@tonic-gate 37*0Sstevel@tonic-gate extern int swapinit(int fstype, char *name); 38*0Sstevel@tonic-gate 39*0Sstevel@tonic-gate /* 40*0Sstevel@tonic-gate * WARNING: THE POSITIONS OF FILESYSTEM TYPES IN THIS TABLE SHOULD NOT 41*0Sstevel@tonic-gate * BE CHANGED. These positions are used in generating fsids and 42*0Sstevel@tonic-gate * fhandles. Thus, changing positions will cause a server to change 43*0Sstevel@tonic-gate * the fhandle it gives out for a file. It is okay to reuse formerly 44*0Sstevel@tonic-gate * used slots, just be sure that we're not going to start supporting 45*0Sstevel@tonic-gate * the former owner of the slot again. 46*0Sstevel@tonic-gate * 47*0Sstevel@tonic-gate * Since there's been some question about whether the above comment is 48*0Sstevel@tonic-gate * true, let's provide more detail. Most filesystems call 49*0Sstevel@tonic-gate * vfs_make_fsid with two arguments that go into making the fsid: the 50*0Sstevel@tonic-gate * dev number, and the fs type number - which is the offset of the 51*0Sstevel@tonic-gate * filesystem's entry in the below table. If you would like to check 52*0Sstevel@tonic-gate * if the position of the filesystem in this table still affects the 53*0Sstevel@tonic-gate * fsid, just check what arguments filesystems are calling 54*0Sstevel@tonic-gate * vfs_make_fsid with. 55*0Sstevel@tonic-gate * 56*0Sstevel@tonic-gate * The scenario we're trying to prevent here is: 57*0Sstevel@tonic-gate * 58*0Sstevel@tonic-gate * NFS server gets upgraded to new kernel version with different vfssw 59*0Sstevel@tonic-gate * Clients are -not- rebooted, still retain filehandles 60*0Sstevel@tonic-gate * NFS server boots up and now the fsid of an exported fs is different 61*0Sstevel@tonic-gate * --> Clients get stale file handle errors 62*0Sstevel@tonic-gate */ 63*0Sstevel@tonic-gate 64*0Sstevel@tonic-gate struct vfssw vfssw[] = { 65*0Sstevel@tonic-gate { "BADVFS" }, /* invalid */ 66*0Sstevel@tonic-gate { "specfs" }, /* SPECFS */ 67*0Sstevel@tonic-gate { "ufs" }, /* UFS */ 68*0Sstevel@tonic-gate { "fifofs" }, /* FIFOFS */ 69*0Sstevel@tonic-gate { "namefs" }, /* NAMEFS */ 70*0Sstevel@tonic-gate { "proc" }, /* PROCFS */ 71*0Sstevel@tonic-gate { "samfs" }, /* QFS */ 72*0Sstevel@tonic-gate { "nfs" }, /* NFS Version 2 */ 73*0Sstevel@tonic-gate { "zfs" }, /* ZFS */ 74*0Sstevel@tonic-gate { "hsfs" }, /* HSFS */ 75*0Sstevel@tonic-gate { "lofs" }, /* LOFS */ 76*0Sstevel@tonic-gate { "tmpfs" }, /* TMPFS */ 77*0Sstevel@tonic-gate { "fd" }, /* FDFS */ 78*0Sstevel@tonic-gate { "pcfs" }, /* PCFS */ 79*0Sstevel@tonic-gate { "swapfs", swapinit }, /* SWAPFS */ 80*0Sstevel@tonic-gate { "mntfs" }, /* MNTFS */ 81*0Sstevel@tonic-gate { "devfs" }, /* DEVFS */ 82*0Sstevel@tonic-gate { "ctfs" }, /* CONTRACTFS */ 83*0Sstevel@tonic-gate { "objfs" }, /* OBJFS */ 84*0Sstevel@tonic-gate { "" }, /* reserved for loadable fs */ 85*0Sstevel@tonic-gate { "" }, 86*0Sstevel@tonic-gate { "" }, 87*0Sstevel@tonic-gate { "" }, 88*0Sstevel@tonic-gate { "" }, 89*0Sstevel@tonic-gate { "" }, 90*0Sstevel@tonic-gate { "" }, 91*0Sstevel@tonic-gate { "" }, 92*0Sstevel@tonic-gate { "" }, 93*0Sstevel@tonic-gate { "" }, 94*0Sstevel@tonic-gate { "" }, 95*0Sstevel@tonic-gate { "" }, 96*0Sstevel@tonic-gate { "" }, 97*0Sstevel@tonic-gate { "" }, 98*0Sstevel@tonic-gate }; 99*0Sstevel@tonic-gate 100*0Sstevel@tonic-gate const int nfstype = (sizeof (vfssw) / sizeof (vfssw[0])); 101