Annotation of XNU/bsd/vfs/vfs_conf.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
                      3:  *
                      4:  * @APPLE_LICENSE_HEADER_START@
                      5:  * 
                      6:  * The contents of this file constitute Original Code as defined in and
                      7:  * are subject to the Apple Public Source License Version 1.1 (the
                      8:  * "License").  You may not use this file except in compliance with the
                      9:  * License.  Please obtain a copy of the License at
                     10:  * http://www.apple.com/publicsource and read it before using this file.
                     11:  * 
                     12:  * This Original Code and all software distributed under the License are
                     13:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
                     14:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
                     15:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
                     16:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
                     17:  * License for the specific language governing rights and limitations
                     18:  * under the License.
                     19:  * 
                     20:  * @APPLE_LICENSE_HEADER_END@
                     21:  */
                     22: /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
                     23: /*
                     24:  * Copyright (c) 1989, 1993, 1995
                     25:  *     The Regents of the University of California.  All rights reserved.
                     26:  *
                     27:  * Redistribution and use in source and binary forms, with or without
                     28:  * modification, are permitted provided that the following conditions
                     29:  * are met:
                     30:  * 1. Redistributions of source code must retain the above copyright
                     31:  *    notice, this list of conditions and the following disclaimer.
                     32:  * 2. Redistributions in binary form must reproduce the above copyright
                     33:  *    notice, this list of conditions and the following disclaimer in the
                     34:  *    documentation and/or other materials provided with the distribution.
                     35:  * 3. All advertising materials mentioning features or use of this software
                     36:  *    must display the following acknowledgement:
                     37:  *     This product includes software developed by the University of
                     38:  *     California, Berkeley and its contributors.
                     39:  * 4. Neither the name of the University nor the names of its contributors
                     40:  *    may be used to endorse or promote products derived from this software
                     41:  *    without specific prior written permission.
                     42:  *
                     43:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     44:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     45:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     46:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     47:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     48:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     49:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     50:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     51:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     52:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     53:  * SUCH DAMAGE.
                     54:  *
                     55:  *     @(#)vfs_conf.c  8.11 (Berkeley) 5/10/95
                     56:  */
                     57: 
                     58: #include <sys/param.h>
                     59: #include <sys/systm.h>
                     60: #include <sys/mount.h>
                     61: #include <sys/vnode.h>
                     62: 
                     63: /*
                     64:  * These define the root filesystem, device, and root filesystem type.
                     65:  */
                     66: struct mount *rootfs;
                     67: struct vnode *rootvnode;
                     68: int (*mountroot)() = NULL;
                     69: 
                     70: /*
                     71:  * Set up the initial array of known filesystem types.
                     72:  */
                     73: extern struct vfsops ufs_vfsops;
                     74: extern int ffs_mountroot();
                     75: extern struct vfsops lfs_vfsops;
                     76: extern int lfs_mountroot();
                     77: extern struct vfsops mfs_vfsops;
                     78: extern int mfs_mountroot();
                     79: extern  struct vfsops hfs_vfsops;
                     80: extern int hfs_mountroot();
                     81: extern  struct vfsops volfs_vfsops;
                     82: extern struct vfsops cd9660_vfsops;
                     83: extern int cd9660_mountroot();
                     84: extern struct vfsops msdos_vfsops;
                     85: extern struct vfsops adosfs_vfsops;
                     86: extern struct vfsops nfs_vfsops;
                     87: extern int nfs_mountroot();
                     88: extern struct vfsops afs_vfsops;
                     89: extern struct vfsops procfs_vfsops;
                     90: extern struct vfsops null_vfsops;
                     91: extern struct vfsops union_vfsops;
                     92: extern struct vfsops umap_vfsops;
                     93: extern struct vfsops portal_vfsops;
                     94: extern struct vfsops fdesc_vfsops;
                     95: extern struct vfsops kernfs_vfsops;
                     96: extern struct vfsops devfs_vfsops;
                     97: 
                     98: /*
                     99:  * Set up the filesystem operations for vnodes.
                    100:  */
                    101: static struct vfsconf vfsconflist[] = {
                    102: 
                    103:        /* Fast Filesystem */
                    104: #if FFS
                    105:        { &ufs_vfsops, "ufs", 1, 0, MNT_LOCAL, ffs_mountroot, NULL },
                    106: #endif
                    107: 
                    108:        /* HFS/HFS+ Filesystem */
                    109: #if HFS
                    110:        { &hfs_vfsops, "hfs", 17, 0, MNT_LOCAL | MNT_DOVOLFS, hfs_mountroot, NULL },
                    111: #endif
                    112: 
                    113:        /* ISO9660 (aka CDROM) Filesystem */
                    114: #if CD9660
                    115:        { &cd9660_vfsops, "cd9660", 14, 0, MNT_LOCAL | MNT_DOVOLFS, cd9660_mountroot, NULL },
                    116: #endif
                    117: 
                    118:        /* Log-based Filesystem */
                    119: #if LFS
                    120:        { &lfs_vfsops, "lfs", 5, 0, MNT_LOCAL, lfs_mountroot, NULL },
                    121: #endif
                    122: 
                    123:        /* Memory-based Filesystem */
                    124: #if MFS
                    125:        { &mfs_vfsops, "mfs", 3, 0, MNT_LOCAL, mfs_mountroot, NULL },
                    126: #endif
                    127: 
                    128:        /* MSDOS Filesystem */
                    129: #if MSDOS
                    130:        { &msdos_vfsops, "msdos", 4, 0, MNT_LOCAL, NULL, NULL },
                    131: #endif
                    132: 
                    133:        /* AmigaDOS Filesystem */
                    134: #if ADOSFS
                    135:        { &adosfs_vfsops, "adosfs", 16, 0, MNT_LOCAL, NULL, NULL },
                    136: #endif
                    137: 
                    138:        /* Sun-compatible Network Filesystem */
                    139: #if NFSCLIENT
                    140:        { &nfs_vfsops, "nfs", 2, 0, 0, nfs_mountroot, NULL },
                    141: #endif
                    142: 
                    143:        /* Andrew Filesystem */
                    144: #if AFS
                    145:        { &afs_vfsops, "andrewfs", 13, 0, 0, afs_mountroot, NULL },
                    146: #endif
                    147: 
                    148:        /* /proc Filesystem */
                    149: #if PROCFS
                    150:        { &procfs_vfsops, "procfs", 12, 0, 0, NULL, NULL },
                    151: #endif
                    152: 
                    153:        /* Loopback (Minimal) Filesystem Layer */
                    154: #if NULLFS
                    155:        { &null_vfsops, "loopback", 9, 0, 0, NULL, NULL },
                    156: #endif
                    157: 
                    158:        /* Union (translucent) Filesystem */
                    159: #if UNION
                    160:        { &union_vfsops, "union", 15, 0, 0, NULL, NULL },
                    161: #endif
                    162: 
                    163:        /* User/Group Identifer Remapping Filesystem */
                    164: #if UMAPFS
                    165:        { &umap_vfsops, "umap", 10, 0, 0, NULL, NULL },
                    166: #endif
                    167: 
                    168:        /* Portal Filesystem */
                    169: #if PORTAL
                    170:        { &portal_vfsops, "portal", 8, 0, 0, NULL, NULL },
                    171: #endif
                    172: 
                    173:        /* File Descriptor Filesystem */
                    174: #if FDESC
                    175:        { &fdesc_vfsops, "fdesc", 7, 0, 0, NULL, NULL },
                    176: #endif
                    177: 
                    178:        /* Kernel Information Filesystem */
                    179: #if KERNFS
                    180:        { &kernfs_vfsops, "kernfs", 11, 0, 0, NULL, NULL },
                    181: #endif
                    182: 
                    183:        /* Volume ID Filesystem */
                    184: #if VOLFS
                    185:        { &volfs_vfsops, "volfs", 18, 0, 0, NULL, NULL },
                    186: #endif
                    187:        /* Device Filesystem */
                    188: #if DEVFS
                    189:        { &devfs_vfsops, "devfs", 19, 0, 0, NULL, NULL },
                    190: #endif
                    191:        {0},
                    192:        {0},
                    193:        {0},
                    194:        {0},
                    195:        {0},
                    196:        {0},
                    197:        {0},
                    198:        {0}
                    199: };
                    200: 
                    201: /*
                    202:  * Initially the size of the list, vfs_init will set maxvfsconf
                    203:  * to the highest defined type number.
                    204:  */
                    205: int maxvfsslots = sizeof(vfsconflist) / sizeof (struct vfsconf);
                    206: int numused_vfsslots = 0;
                    207: int maxvfsconf = sizeof(vfsconflist) / sizeof (struct vfsconf);
                    208: struct vfsconf *vfsconf = vfsconflist;
                    209: 
                    210: /*
                    211:  *
                    212:  * vfs_opv_descs enumerates the list of vnode classes, each with it's own
                    213:  * vnode operation vector.  It is consulted at system boot to build operation
                    214:  * vectors.  It is NULL terminated.
                    215:  *
                    216:  */
                    217: extern struct vnodeopv_desc ffs_vnodeop_opv_desc;
                    218: extern struct vnodeopv_desc ffs_specop_opv_desc;
                    219: extern struct vnodeopv_desc ffs_fifoop_opv_desc;
                    220: extern struct vnodeopv_desc lfs_vnodeop_opv_desc;
                    221: extern struct vnodeopv_desc lfs_specop_opv_desc;
                    222: extern struct vnodeopv_desc lfs_fifoop_opv_desc;
                    223: extern struct vnodeopv_desc mfs_vnodeop_opv_desc;
                    224: extern struct vnodeopv_desc dead_vnodeop_opv_desc;
                    225: extern struct vnodeopv_desc fifo_vnodeop_opv_desc;
                    226: extern struct vnodeopv_desc spec_vnodeop_opv_desc;
                    227: extern struct vnodeopv_desc nfsv2_vnodeop_opv_desc;
                    228: extern struct vnodeopv_desc spec_nfsv2nodeop_opv_desc;
                    229: extern struct vnodeopv_desc fifo_nfsv2nodeop_opv_desc;
                    230: extern struct vnodeopv_desc fdesc_vnodeop_opv_desc;
                    231: extern struct vnodeopv_desc portal_vnodeop_opv_desc;
                    232: extern struct vnodeopv_desc null_vnodeop_opv_desc;
                    233: extern struct vnodeopv_desc umap_vnodeop_opv_desc;
                    234: extern struct vnodeopv_desc kernfs_vnodeop_opv_desc;
                    235: extern struct vnodeopv_desc procfs_vnodeop_opv_desc;
                    236: extern struct vnodeopv_desc hfs_vnodeop_opv_desc;
                    237: extern struct vnodeopv_desc hfs_specop_opv_desc;
                    238: extern struct vnodeopv_desc hfs_fifoop_opv_desc;
                    239: extern struct vnodeopv_desc volfs_vnodeop_opv_desc;
                    240: extern struct vnodeopv_desc cd9660_vnodeop_opv_desc;
                    241: extern struct vnodeopv_desc cd9660_specop_opv_desc;
                    242: extern struct vnodeopv_desc cd9660_fifoop_opv_desc;
                    243: extern struct vnodeopv_desc union_vnodeop_opv_desc;
                    244: extern struct vnodeopv_desc procfs_vnodeop_opv_desc;
                    245: extern struct vnodeopv_desc devfs_vnodeop_opv_desc;
                    246: extern struct vnodeopv_desc devfs_spec_vnodeop_opv_desc;
                    247: 
                    248: struct vnodeopv_desc *vfs_opv_descs[] = {
                    249:        &ffs_vnodeop_opv_desc,
                    250:        &ffs_specop_opv_desc,
                    251: #if FIFO
                    252:        &ffs_fifoop_opv_desc,
                    253: #endif
                    254:        &dead_vnodeop_opv_desc,
                    255: #if FIFO
                    256:        &fifo_vnodeop_opv_desc,
                    257: #endif
                    258:        &spec_vnodeop_opv_desc,
                    259: #if LFS
                    260:        &lfs_vnodeop_opv_desc,
                    261:        &lfs_specop_opv_desc,
                    262: #if FIFO
                    263:        &lfs_fifoop_opv_desc,
                    264: #endif
                    265: #endif
                    266: #if MFS
                    267:        &mfs_vnodeop_opv_desc,
                    268: #endif
                    269: #if NFSCLIENT
                    270:        &nfsv2_vnodeop_opv_desc,
                    271:        &spec_nfsv2nodeop_opv_desc,
                    272: #if FIFO
                    273:        &fifo_nfsv2nodeop_opv_desc,
                    274: #endif
                    275: #endif
                    276: #if FDESC
                    277:        &fdesc_vnodeop_opv_desc,
                    278: #endif
                    279: #if PORTAL
                    280:        &portal_vnodeop_opv_desc,
                    281: #endif
                    282: #if NULLFS
                    283:        &null_vnodeop_opv_desc,
                    284: #endif
                    285: #if UMAPFS
                    286:        &umap_vnodeop_opv_desc,
                    287: #endif
                    288: #if KERNFS
                    289:        &kernfs_vnodeop_opv_desc,
                    290: #endif
                    291: #if PROCFS
                    292:        &procfs_vnodeop_opv_desc,
                    293: #endif
                    294: #if HFS
                    295:        &hfs_vnodeop_opv_desc,
                    296:        &hfs_specop_opv_desc,
                    297: #if FIFO
                    298:        &hfs_fifoop_opv_desc,
                    299: #endif
                    300: #endif
                    301: #if CD9660
                    302:        &cd9660_vnodeop_opv_desc,
                    303:        &cd9660_specop_opv_desc,
                    304: #if FIFO
                    305:        &cd9660_fifoop_opv_desc,
                    306: #endif
                    307: #endif
                    308: #if UNION
                    309:        &union_vnodeop_opv_desc,
                    310: #endif
                    311: #if VOLFS
                    312:        &volfs_vnodeop_opv_desc,
                    313: #endif
                    314: #if DEVFS
                    315:        &devfs_vnodeop_opv_desc,
                    316:        &devfs_spec_vnodeop_opv_desc,
                    317: #endif
                    318:        NULL
                    319: };

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.