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