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