xref: /illumos-gate/usr/src/uts/common/os/vfs_conf.c (revision 2d6eb4a5)
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 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #include <sys/types.h>
27 #include <sys/param.h>
28 #include <sys/vfs.h>
29 #include <sys/t_lock.h>
30 
31 extern int swapinit(int fstype, char *name);
32 
33 /*
34  * WARNING: THE POSITIONS OF FILESYSTEM TYPES IN THIS TABLE SHOULD NOT
35  * BE CHANGED. These positions are used in generating fsids and
36  * fhandles.  Thus, changing positions will cause a server to change
37  * the fhandle it gives out for a file.  It is okay to reuse formerly
38  * used slots, just be sure that we're not going to start supporting
39  * the former owner of the slot again.
40  *
41  * Since there's been some question about whether the above comment is
42  * true, let's provide more detail.  Most filesystems call
43  * vfs_make_fsid with two arguments that go into making the fsid: the
44  * dev number, and the fs type number - which is the offset of the
45  * filesystem's entry in the below table.  If you would like to check
46  * if the position of the filesystem in this table still affects the
47  * fsid, just check what arguments filesystems are calling
48  * vfs_make_fsid with.
49  *
50  * The scenario we're trying to prevent here is:
51  *
52  * NFS server gets upgraded to new kernel version with different vfssw
53  * Clients are -not- rebooted, still retain filehandles
54  * NFS server boots up and now the fsid of an exported fs is different
55  *  --> Clients get stale file handle errors
56  */
57 
58 struct vfssw vfssw[] = {
59 	{ "BADVFS" },				/* invalid */
60 	{ "specfs" },				/* SPECFS */
61 	{ "ufs" },				/* UFS */
62 	{ "fifofs" },				/* FIFOFS */
63 	{ "namefs" },				/* NAMEFS */
64 	{ "proc" },				/* PROCFS */
65 	{ "samfs" },				/* QFS */
66 	{ "nfs" },				/* NFS Version 2 */
67 	{ "zfs" },				/* ZFS */
68 	{ "hsfs" },				/* HSFS */
69 	{ "lofs" },				/* LOFS */
70 	{ "tmpfs" },				/* TMPFS */
71 	{ "fd" },				/* FDFS */
72 	{ "pcfs" },				/* PCFS */
73 	{ "swapfs", swapinit },			/* SWAPFS */
74 	{ "mntfs" },				/* MNTFS */
75 	{ "devfs" },				/* DEVFS */
76 	{ "dev" },				/* DEV */
77 	{ "ctfs" },				/* CONTRACTFS */
78 	{ "objfs" },				/* OBJFS */
79 	{ "sharefs" },				/* SHAREFS */
80 	{ "dcfs" },				/* DCFS */
81 	{ "smbfs" },				/* SMBFS */
82 	{ "" },					/* reserved for loadable fs */
83 	{ "" },
84 	{ "" },
85 	{ "" },
86 	{ "" },
87 	{ "" },
88 	{ "" },
89 	{ "" },
90 	{ "" },
91 	{ "" },
92 	{ "" },
93 	{ "" },
94 	{ "" },
95 };
96 
97 const int nfstype = (sizeof (vfssw) / sizeof (vfssw[0]));
98