17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5facf4a8dSllai1 * Common Development and Distribution License (the "License"). 6facf4a8dSllai1 * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 22*4bff34e3Sthurlow * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 277c478bd9Sstevel@tonic-gate /* SunOS-4.1 1.16 */ 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #include <sys/types.h> 307c478bd9Sstevel@tonic-gate #include <sys/param.h> 317c478bd9Sstevel@tonic-gate #include <sys/vfs.h> 327c478bd9Sstevel@tonic-gate #include <sys/t_lock.h> 337c478bd9Sstevel@tonic-gate 347c478bd9Sstevel@tonic-gate extern int swapinit(int fstype, char *name); 357c478bd9Sstevel@tonic-gate 367c478bd9Sstevel@tonic-gate /* 377c478bd9Sstevel@tonic-gate * WARNING: THE POSITIONS OF FILESYSTEM TYPES IN THIS TABLE SHOULD NOT 387c478bd9Sstevel@tonic-gate * BE CHANGED. These positions are used in generating fsids and 397c478bd9Sstevel@tonic-gate * fhandles. Thus, changing positions will cause a server to change 407c478bd9Sstevel@tonic-gate * the fhandle it gives out for a file. It is okay to reuse formerly 417c478bd9Sstevel@tonic-gate * used slots, just be sure that we're not going to start supporting 427c478bd9Sstevel@tonic-gate * the former owner of the slot again. 437c478bd9Sstevel@tonic-gate * 447c478bd9Sstevel@tonic-gate * Since there's been some question about whether the above comment is 457c478bd9Sstevel@tonic-gate * true, let's provide more detail. Most filesystems call 467c478bd9Sstevel@tonic-gate * vfs_make_fsid with two arguments that go into making the fsid: the 477c478bd9Sstevel@tonic-gate * dev number, and the fs type number - which is the offset of the 487c478bd9Sstevel@tonic-gate * filesystem's entry in the below table. If you would like to check 497c478bd9Sstevel@tonic-gate * if the position of the filesystem in this table still affects the 507c478bd9Sstevel@tonic-gate * fsid, just check what arguments filesystems are calling 517c478bd9Sstevel@tonic-gate * vfs_make_fsid with. 527c478bd9Sstevel@tonic-gate * 537c478bd9Sstevel@tonic-gate * The scenario we're trying to prevent here is: 547c478bd9Sstevel@tonic-gate * 557c478bd9Sstevel@tonic-gate * NFS server gets upgraded to new kernel version with different vfssw 567c478bd9Sstevel@tonic-gate * Clients are -not- rebooted, still retain filehandles 577c478bd9Sstevel@tonic-gate * NFS server boots up and now the fsid of an exported fs is different 587c478bd9Sstevel@tonic-gate * --> Clients get stale file handle errors 597c478bd9Sstevel@tonic-gate */ 607c478bd9Sstevel@tonic-gate 617c478bd9Sstevel@tonic-gate struct vfssw vfssw[] = { 627c478bd9Sstevel@tonic-gate { "BADVFS" }, /* invalid */ 637c478bd9Sstevel@tonic-gate { "specfs" }, /* SPECFS */ 647c478bd9Sstevel@tonic-gate { "ufs" }, /* UFS */ 657c478bd9Sstevel@tonic-gate { "fifofs" }, /* FIFOFS */ 667c478bd9Sstevel@tonic-gate { "namefs" }, /* NAMEFS */ 677c478bd9Sstevel@tonic-gate { "proc" }, /* PROCFS */ 687c478bd9Sstevel@tonic-gate { "samfs" }, /* QFS */ 697c478bd9Sstevel@tonic-gate { "nfs" }, /* NFS Version 2 */ 707c478bd9Sstevel@tonic-gate { "zfs" }, /* ZFS */ 717c478bd9Sstevel@tonic-gate { "hsfs" }, /* HSFS */ 727c478bd9Sstevel@tonic-gate { "lofs" }, /* LOFS */ 737c478bd9Sstevel@tonic-gate { "tmpfs" }, /* TMPFS */ 747c478bd9Sstevel@tonic-gate { "fd" }, /* FDFS */ 757c478bd9Sstevel@tonic-gate { "pcfs" }, /* PCFS */ 767c478bd9Sstevel@tonic-gate { "swapfs", swapinit }, /* SWAPFS */ 777c478bd9Sstevel@tonic-gate { "mntfs" }, /* MNTFS */ 787c478bd9Sstevel@tonic-gate { "devfs" }, /* DEVFS */ 79facf4a8dSllai1 { "dev" }, /* DEV */ 807c478bd9Sstevel@tonic-gate { "ctfs" }, /* CONTRACTFS */ 817c478bd9Sstevel@tonic-gate { "objfs" }, /* OBJFS */ 82a237e38eSth199096 { "sharefs" }, /* SHAREFS */ 83986fd29aSsetje { "dcfs" }, /* DCFS */ 84*4bff34e3Sthurlow { "smbfs" }, /* SMBFS */ 857c478bd9Sstevel@tonic-gate { "" }, /* reserved for loadable fs */ 867c478bd9Sstevel@tonic-gate { "" }, 877c478bd9Sstevel@tonic-gate { "" }, 887c478bd9Sstevel@tonic-gate { "" }, 897c478bd9Sstevel@tonic-gate { "" }, 907c478bd9Sstevel@tonic-gate { "" }, 917c478bd9Sstevel@tonic-gate { "" }, 927c478bd9Sstevel@tonic-gate { "" }, 937c478bd9Sstevel@tonic-gate { "" }, 947c478bd9Sstevel@tonic-gate { "" }, 957c478bd9Sstevel@tonic-gate { "" }, 967c478bd9Sstevel@tonic-gate { "" }, 977c478bd9Sstevel@tonic-gate { "" }, 987c478bd9Sstevel@tonic-gate }; 997c478bd9Sstevel@tonic-gate 1007c478bd9Sstevel@tonic-gate const int nfstype = (sizeof (vfssw) / sizeof (vfssw[0])); 101