[BACK]Return to ramfs_vfsops.c CVS log [TXT][DIR] Up to [local] / prex-old / usr / server / fs / ramfs

Annotation of prex-old/usr/server/fs/ramfs/ramfs_vfsops.c, Revision 1.1

1.1     ! nbrk        1: /*
        !             2:  * Copyright (c) 2006-2007, Kohsuke Ohtani
        !             3:  * All rights reserved.
        !             4:  *
        !             5:  * Redistribution and use in source and binary forms, with or without
        !             6:  * modification, are permitted provided that the following conditions
        !             7:  * are met:
        !             8:  * 1. Redistributions of source code must retain the above copyright
        !             9:  *    notice, this list of conditions and the following disclaimer.
        !            10:  * 2. Redistributions in binary form must reproduce the above copyright
        !            11:  *    notice, this list of conditions and the following disclaimer in the
        !            12:  *    documentation and/or other materials provided with the distribution.
        !            13:  * 3. Neither the name of the author nor the names of any co-contributors
        !            14:  *    may be used to endorse or promote products derived from this software
        !            15:  *    without specific prior written permission.
        !            16:  *
        !            17:  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
        !            18:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        !            19:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
        !            20:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
        !            21:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        !            22:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
        !            23:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
        !            24:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
        !            25:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
        !            26:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
        !            27:  * SUCH DAMAGE.
        !            28:  */
        !            29:
        !            30: #include <sys/vnode.h>
        !            31: #include <sys/mount.h>
        !            32:
        !            33: #include <errno.h>
        !            34:
        !            35: #include "ramfs.h"
        !            36:
        !            37: extern struct vnops ramfs_vnops;
        !            38:
        !            39: static int ramfs_mount(mount_t mp, char *dev, int flags, void *data);
        !            40: static int ramfs_unmount(mount_t mp);
        !            41: #define ramfs_sync     ((vfsop_sync_t)vfs_nullop)
        !            42: #define ramfs_vget     ((vfsop_vget_t)vfs_nullop)
        !            43: #define ramfs_statfs   ((vfsop_statfs_t)vfs_nullop)
        !            44:
        !            45: /*
        !            46:  * File system operations
        !            47:  */
        !            48: struct vfsops ramfs_vfsops = {
        !            49:        ramfs_mount,            /* mount */
        !            50:        ramfs_unmount,          /* unmount */
        !            51:        ramfs_sync,             /* sync */
        !            52:        ramfs_vget,             /* vget */
        !            53:        ramfs_statfs,           /* statfs */
        !            54:        &ramfs_vnops,           /* vnops */
        !            55: };
        !            56:
        !            57: /*
        !            58:  * Mount a file system.
        !            59:  */
        !            60: static int
        !            61: ramfs_mount(mount_t mp, char *dev, int flags, void *data)
        !            62: {
        !            63:        struct ramfs_node *node;
        !            64:
        !            65:        dprintf("ramfs_mount: dev=%s\n", dev);
        !            66:
        !            67:        /* Create a root node */
        !            68:        node = ramfs_allocate_node("/", VDIR);
        !            69:        if (node == NULL)
        !            70:                return ENOMEM;
        !            71:        mp->m_root->v_data = node;
        !            72:        return 0;
        !            73: }
        !            74:
        !            75: /*
        !            76:  * Unmount a file system.
        !            77:  *
        !            78:  * NOTE: Currently, we don't support unmounting of the RAMFS. This is
        !            79:  *       because we have to deallocate all nodes included in all sub
        !            80:  *       directories, and it requires more work...
        !            81:  */
        !            82: static int
        !            83: ramfs_unmount(mount_t mp)
        !            84: {
        !            85:
        !            86:        return EBUSY;
        !            87: }

CVSweb