xref: /onnv-gate/usr/src/uts/common/os/vfs_conf.c (revision 6007:d57e38e8fdd1)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
52621Sllai1  * Common Development and Distribution License (the "License").
62621Sllai1  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*6007Sthurlow  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
270Sstevel@tonic-gate /* SunOS-4.1 1.16	*/
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #include <sys/types.h>
300Sstevel@tonic-gate #include <sys/param.h>
310Sstevel@tonic-gate #include <sys/vfs.h>
320Sstevel@tonic-gate #include <sys/t_lock.h>
330Sstevel@tonic-gate 
340Sstevel@tonic-gate extern int swapinit(int fstype, char *name);
350Sstevel@tonic-gate 
360Sstevel@tonic-gate /*
370Sstevel@tonic-gate  * WARNING: THE POSITIONS OF FILESYSTEM TYPES IN THIS TABLE SHOULD NOT
380Sstevel@tonic-gate  * BE CHANGED. These positions are used in generating fsids and
390Sstevel@tonic-gate  * fhandles.  Thus, changing positions will cause a server to change
400Sstevel@tonic-gate  * the fhandle it gives out for a file.  It is okay to reuse formerly
410Sstevel@tonic-gate  * used slots, just be sure that we're not going to start supporting
420Sstevel@tonic-gate  * the former owner of the slot again.
430Sstevel@tonic-gate  *
440Sstevel@tonic-gate  * Since there's been some question about whether the above comment is
450Sstevel@tonic-gate  * true, let's provide more detail.  Most filesystems call
460Sstevel@tonic-gate  * vfs_make_fsid with two arguments that go into making the fsid: the
470Sstevel@tonic-gate  * dev number, and the fs type number - which is the offset of the
480Sstevel@tonic-gate  * filesystem's entry in the below table.  If you would like to check
490Sstevel@tonic-gate  * if the position of the filesystem in this table still affects the
500Sstevel@tonic-gate  * fsid, just check what arguments filesystems are calling
510Sstevel@tonic-gate  * vfs_make_fsid with.
520Sstevel@tonic-gate  *
530Sstevel@tonic-gate  * The scenario we're trying to prevent here is:
540Sstevel@tonic-gate  *
550Sstevel@tonic-gate  * NFS server gets upgraded to new kernel version with different vfssw
560Sstevel@tonic-gate  * Clients are -not- rebooted, still retain filehandles
570Sstevel@tonic-gate  * NFS server boots up and now the fsid of an exported fs is different
580Sstevel@tonic-gate  *  --> Clients get stale file handle errors
590Sstevel@tonic-gate  */
600Sstevel@tonic-gate 
610Sstevel@tonic-gate struct vfssw vfssw[] = {
620Sstevel@tonic-gate 	{ "BADVFS" },				/* invalid */
630Sstevel@tonic-gate 	{ "specfs" },				/* SPECFS */
640Sstevel@tonic-gate 	{ "ufs" },				/* UFS */
650Sstevel@tonic-gate 	{ "fifofs" },				/* FIFOFS */
660Sstevel@tonic-gate 	{ "namefs" },				/* NAMEFS */
670Sstevel@tonic-gate 	{ "proc" },				/* PROCFS */
680Sstevel@tonic-gate 	{ "samfs" },				/* QFS */
690Sstevel@tonic-gate 	{ "nfs" },				/* NFS Version 2 */
700Sstevel@tonic-gate 	{ "zfs" },				/* ZFS */
710Sstevel@tonic-gate 	{ "hsfs" },				/* HSFS */
720Sstevel@tonic-gate 	{ "lofs" },				/* LOFS */
730Sstevel@tonic-gate 	{ "tmpfs" },				/* TMPFS */
740Sstevel@tonic-gate 	{ "fd" },				/* FDFS */
750Sstevel@tonic-gate 	{ "pcfs" },				/* PCFS */
760Sstevel@tonic-gate 	{ "swapfs", swapinit },			/* SWAPFS */
770Sstevel@tonic-gate 	{ "mntfs" },				/* MNTFS */
780Sstevel@tonic-gate 	{ "devfs" },				/* DEVFS */
792621Sllai1 	{ "dev" },				/* DEV */
800Sstevel@tonic-gate 	{ "ctfs" },				/* CONTRACTFS */
810Sstevel@tonic-gate 	{ "objfs" },				/* OBJFS */
823957Sth199096 	{ "sharefs" },				/* SHAREFS */
835648Ssetje 	{ "dcfs" },				/* DCFS */
84*6007Sthurlow 	{ "smbfs" },				/* SMBFS */
850Sstevel@tonic-gate 	{ "" },					/* reserved for loadable fs */
860Sstevel@tonic-gate 	{ "" },
870Sstevel@tonic-gate 	{ "" },
880Sstevel@tonic-gate 	{ "" },
890Sstevel@tonic-gate 	{ "" },
900Sstevel@tonic-gate 	{ "" },
910Sstevel@tonic-gate 	{ "" },
920Sstevel@tonic-gate 	{ "" },
930Sstevel@tonic-gate 	{ "" },
940Sstevel@tonic-gate 	{ "" },
950Sstevel@tonic-gate 	{ "" },
960Sstevel@tonic-gate 	{ "" },
970Sstevel@tonic-gate 	{ "" },
980Sstevel@tonic-gate };
990Sstevel@tonic-gate 
1000Sstevel@tonic-gate const int nfstype = (sizeof (vfssw) / sizeof (vfssw[0]));
101