[BACK]Return to kernfs.h CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / miscfs / kernfs

Annotation of src/sys/miscfs/kernfs/kernfs.h, Revision 1.18

1.18    ! itojun      1: /*     $NetBSD: kernfs.h,v 1.17 2003/08/07 16:32:37 agc Exp $  */
1.8       cgd         2:
1.1       cgd         3: /*
1.6       mycroft     4:  * Copyright (c) 1992, 1993
                      5:  *     The Regents of the University of California.  All rights reserved.
1.1       cgd         6:  *
1.5       cgd         7:  * This code is derived from software donated to Berkeley by
1.1       cgd         8:  * Jan-Simon Pendry.
                      9:  *
1.2       cgd        10:  * Redistribution and use in source and binary forms, with or without
                     11:  * modification, are permitted provided that the following conditions
                     12:  * are met:
                     13:  * 1. Redistributions of source code must retain the above copyright
                     14:  *    notice, this list of conditions and the following disclaimer.
                     15:  * 2. Redistributions in binary form must reproduce the above copyright
                     16:  *    notice, this list of conditions and the following disclaimer in the
                     17:  *    documentation and/or other materials provided with the distribution.
1.17      agc        18:  * 3. Neither the name of the University nor the names of its contributors
1.2       cgd        19:  *    may be used to endorse or promote products derived from this software
                     20:  *    without specific prior written permission.
1.1       cgd        21:  *
1.2       cgd        22:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     23:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     24:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     25:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     26:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     27:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     28:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     29:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     30:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     31:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     32:  * SUCH DAMAGE.
1.1       cgd        33:  *
1.12      fvdl       34:  *     @(#)kernfs.h    8.6 (Berkeley) 3/29/95
1.1       cgd        35:  */
                     36:
1.6       mycroft    37: #define        _PATH_KERNFS    "/kern"         /* Default mountpoint */
                     38:
1.9       briggs     39: #ifdef _KERNEL
1.18    ! itojun     40: #include <sys/queue.h>
        !            41:
        !            42: /*
        !            43:  * The different types of node in a kernfs filesystem
        !            44:  */
        !            45: typedef enum {
        !            46:        Pkern,          /* the filesystem itself (.) */
        !            47:        Proot,          /* the filesystem root (..) */
        !            48:        Pnull,          /* none aplicable */
        !            49:        Ptime,          /* boottime */
        !            50:        Pint,           /* integer */
        !            51:        Pstring,        /* string */
        !            52:        Phostname,      /* hostname */
        !            53:        Pavenrun,       /* loadavg */
        !            54:        Pdevice,        /* device file (rootdev/rrootdev) */
        !            55:        Pmsgbuf,        /* msgbuf */
        !            56:        Pipsecsadir,    /* ipsec security association (top dir) */
        !            57:        Pipsecspdir,    /* ipsec security policy (top dir) */
        !            58:        Pipsecsa,       /* ipsec security association entry */
        !            59:        Pipsecsp,       /* ipsec security policy entry */
        !            60: } kfstype;
1.11      pk         61:
1.18    ! itojun     62: /*
        !            63:  * control data for the kern file system.
        !            64:  */
1.11      pk         65: struct kern_target {
1.18    ! itojun     66:        u_char          kt_type;
        !            67:        u_char          kt_namlen;
        !            68:        const char      *kt_name;
        !            69:        void            *kt_data;
        !            70:        kfstype         kt_tag;
        !            71:        u_char          kt_vtype;
        !            72:        mode_t          kt_mode;
1.1       cgd        73: };
                     74:
                     75: struct kernfs_node {
1.18    ! itojun     76:        LIST_ENTRY(kernfs_node) kfs_hash; /* hash chain */
        !            77:        TAILQ_ENTRY(kernfs_node) kfs_list; /* flat list */
        !            78:        struct vnode    *kfs_vnode;     /* vnode associated with this pfsnode */
        !            79:        kfstype         kfs_type;       /* type of procfs node */
        !            80:        mode_t          kfs_mode;       /* mode bits for stat() */
        !            81:        long            kfs_fileno;     /* unique file id */
        !            82:        u_int32_t       kfs_value;      /* SA id or SP id (Pint) */
        !            83:        const struct kern_target *kfs_kt;
        !            84:        void            *kfs_v;         /* pointer to secasvar/secpolicy/mbuf */
        !            85:        long            kfs_cookie;     /* fileno cookie */
        !            86: };
        !            87:
        !            88: struct kernfs_mount {
        !            89:        TAILQ_HEAD(, kernfs_node) nodelist;
        !            90:        long fileno_cookie;
1.1       cgd        91: };
                     92:
1.18    ! itojun     93: #define UIO_MX 32
        !            94:
        !            95: #define KERNFS_FILENO(kt, typ, cookie) \
        !            96:        ((kt) ? 2 + ((kt) - &kern_targets[0]) \
        !            97:              : (((cookie) << 6) | ((typ) + nkern_targets)))
        !            98:
1.1       cgd        99: #define VFSTOKERNFS(mp)        ((struct kernfs_mount *)((mp)->mnt_data))
1.18    ! itojun    100: #define        VTOKERN(vp)     ((struct kernfs_node *)(vp)->v_data)
        !           101: #define KERNFSTOV(kfs) ((kfs)->kfs_vnode)
1.1       cgd       102:
1.18    ! itojun    103: extern const struct kern_target kern_targets[];
        !           104: extern int nkern_targets;
1.10      christos  105: extern int (**kernfs_vnodeop_p) __P((void *));
1.1       cgd       106: extern struct vfsops kernfs_vfsops;
1.6       mycroft   107: extern dev_t rrootdev;
1.18    ! itojun    108:
        !           109: struct secasvar;
        !           110: struct secpolicy;
        !           111:
        !           112: int kernfs_root __P((struct mount *, struct vnode **));
        !           113:
        !           114: void kernfs_hashinit __P((void));
        !           115: void kernfs_hashreinit __P((void));
        !           116: void kernfs_hashdone __P((void));
        !           117: int kernfs_freevp __P((struct vnode *));
        !           118: int kernfs_allocvp __P((struct mount *, struct vnode **, kfstype,
        !           119:        const struct kern_target *, u_int32_t));
        !           120:
        !           121: void kernfs_revoke_sa __P((struct secasvar *));
        !           122: void kernfs_revoke_sp __P((struct secpolicy *));
1.9       briggs    123: #endif /* _KERNEL */

CVSweb <webmaster@jp.NetBSD.org>