[BACK]Return to slides.t CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / share / doc / papers / fsinterface

Annotation of src/share/doc/papers/fsinterface/slides.t, Revision 1.3

1.3     ! agc         1: .\"    $NetBSD: slides.t,v 1.2 1998/01/09 06:41:07 perry Exp $
1.2       perry       2: .\"
1.1       cgd         3: .\" Copyright (c) 1986 The Regents of the University of California.
                      4: .\" All rights reserved.
                      5: .\"
                      6: .\" Redistribution and use in source and binary forms, with or without
                      7: .\" modification, are permitted provided that the following conditions
                      8: .\" are met:
                      9: .\" 1. Redistributions of source code must retain the above copyright
                     10: .\"    notice, this list of conditions and the following disclaimer.
                     11: .\" 2. Redistributions in binary form must reproduce the above copyright
                     12: .\"    notice, this list of conditions and the following disclaimer in the
                     13: .\"    documentation and/or other materials provided with the distribution.
1.3     ! agc        14: .\" 3. Neither the name of the University nor the names of its contributors
1.1       cgd        15: .\"    may be used to endorse or promote products derived from this software
                     16: .\"    without specific prior written permission.
                     17: .\"
                     18: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     19: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     20: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     21: .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     22: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     23: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     24: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     25: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     26: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     27: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     28: .\" SUCH DAMAGE.
                     29: .\"
                     30: .\"    @(#)slides.t    5.2 (Berkeley) 4/16/91
                     31: .\"
                     32: .so macros
                     33: .nf
                     34: .LL
                     35: Encapsulation of namei parameters
                     36: .NP 0
                     37: .ta .5i +\w'caddr_t\0\0'u +\w'struct\0\0'u +\w'vnode *nc_prevdir;\0\0\0\0\0'u
                     38: struct nameidata {
                     39:    /* arguments and context: */
                     40:        caddr_t ni_dirp;
                     41:        enum    uio_seg ni_seg;
                     42:        short   ni_nameiop;
                     43:        struct  vnode *ni_cdir;
                     44:        struct  vnode *ni_rdir;
                     45:        struct  ucred *ni_cred;
                     46: .sp .2
                     47:    /* shared with lookup and commit: */
                     48:        caddr_t ni_pnbuf;
                     49:        char    *ni_ptr;
                     50:        int     ni_pathlen;
                     51:        short   ni_more;
                     52:        short   ni_loopcnt;
                     53: .sp .2
                     54:    /* results: */
                     55:        struct  vnode *ni_vp;
                     56:        struct  vnode *ni_dvp;
                     57: .sp .2
                     58: /* BEGIN UFS SPECIFIC */
                     59:        struct diroffcache {
                     60:                struct  vnode *nc_prevdir;
                     61:                long    nc_id;
                     62:                off_t   nc_prevoffset;
                     63:        } ni_nc;
                     64: /* END UFS SPECIFIC */
                     65: };
                     66: .bp
                     67:
                     68:
                     69: .LL
                     70: Namei operations and modifiers
                     71:
                     72: .NP 0
                     73: .ta \w'#define\0\0'u +\w'WANTPARENT\0\0'u +\w'0x40\0\0\0\0\0\0\0'u
                     74: #define        LOOKUP  0       /* name lookup only */
                     75: #define        CREATE  1       /* setup for creation */
                     76: #define        DELETE  2       /* setup for deletion */
                     77: #define        WANTPARENT      0x10    /* return parent vnode also */
                     78: #define        NOCACHE 0x20    /* remove name from cache */
                     79: #define        FOLLOW  0x40    /* follow symbolic links */
                     80: .bp
                     81:
                     82: .LL
                     83: Namei operations and modifiers
                     84:
                     85: .NP 0
                     86: .ta \w'#define\0\0'u +\w'WANTPARENT\0\0'u +\w'0x40\0\0\0\0\0\0\0'u
                     87: #define        LOOKUP  0
                     88: #define        CREATE  1
                     89: #define        DELETE  2
                     90: #define        WANTPARENT      0x10
                     91: #define        NOCACHE 0x20
                     92: #define        FOLLOW  0x40
                     93: .bp
                     94:
                     95:
                     96: .LL
                     97: Credentials
                     98:
                     99: .NP 0
                    100: .ta .5i +\w'caddr_t\0\0\0'u +\w'struct\0\0'u +\w'vnode *nc_prevdir;\0\0\0\0\0'u
                    101: struct ucred {
                    102:        u_short cr_ref;
                    103:        uid_t   cr_uid;
                    104:        short   cr_ngroups;
                    105:        gid_t   cr_groups[NGROUPS];
                    106:        /*
                    107:         * The following either should not be here,
                    108:         * or should be treated as opaque.
                    109:         */
                    110:        uid_t   cr_ruid;
                    111:        gid_t   cr_svgid;
                    112: };
                    113: .bp
                    114: .LL
                    115: Scatter-gather I/O
                    116: .NP 0
                    117: .ta .5i +\w'caddr_t\0\0\0'u +\w'struct\0\0'u +\w'vnode *nc_prevdir;\0\0\0\0\0'u
                    118: struct uio {
                    119:        struct  iovec *uio_iov;
                    120:        int     uio_iovcnt;
                    121:        off_t   uio_offset;
                    122:        int     uio_resid;
                    123:        enum    uio_rw uio_rw;
                    124: };
                    125:
                    126: enum   uio_rw { UIO_READ, UIO_WRITE };
                    127:
                    128:
                    129:
                    130: .ta .5i +\w'caddr_t\0\0\0'u +\w'vnode *nc_prevdir;\0\0\0\0\0'u
                    131: struct iovec {
                    132:        caddr_t iov_base;
                    133:        int     iov_len;
                    134:        enum    uio_seg iov_segflg;
                    135:        int     (*iov_op)();
                    136: };
                    137: .bp
                    138: .LL
                    139: Per-filesystem information
                    140: .NP 0
                    141: .ta .25i +\w'struct vfsops\0\0\0'u +\w'*vfs_vnodecovered;\0\0\0\0\0'u
                    142: struct vfs {
                    143:        struct vfs      *vfs_next;
                    144: \fB+\fP        struct vfs      *vfs_prev;
                    145:        struct vfsops   *vfs_op;
                    146:        struct vnode    *vfs_vnodecovered;
                    147:        int     vfs_flag;
                    148: \fB!\fP        int     vfs_fsize;
                    149: \fB+\fP        int     vfs_bsize;
                    150: \fB!\fP        uid_t   vfs_exroot;
                    151:        short   vfs_exflags;
                    152:        caddr_t vfs_data;
                    153: };
                    154:
                    155: .NP 0
                    156: .ta \w'\fB+\fP 'u +\w'#define\0\0'u +\w'VFS_EXPORTED\0\0'u +\w'0x40\0\0\0\0\0'u
                    157:        /* vfs flags: */
                    158:        #define VFS_RDONLY      0x01
                    159: \fB+\fP        #define VFS_NOEXEC      0x02
                    160:        #define VFS_MLOCK       0x04
                    161:        #define VFS_MWAIT       0x08
                    162:        #define VFS_NOSUID      0x10
                    163:        #define VFS_EXPORTED    0x20
                    164:
                    165:        /* exported vfs flags: */
                    166:        #define EX_RDONLY       0x01
                    167: .bp
                    168:
                    169:
                    170: .LL
                    171: Operations supported on virtual file system.
                    172:
                    173: .NP 0
                    174: .ta .25i +\w'int\0\0'u +\w'*vfs_mountroot();\0'u
                    175: struct vfsops {
                    176: \fB!\fP        int     (*vfs_mount)(vfs, path, data, len);
                    177: \fB!\fP        int     (*vfs_unmount)(vfs, forcibly);
                    178: \fB+\fP        int     (*vfs_mountroot)();
                    179:        int     (*vfs_root)(vfs, vpp);
                    180:        int     (*vfs_statfs)(vfs, sbp);
                    181: \fB!\fP        int     (*vfs_sync)(vfs, waitfor);
                    182: \fB+\fP        int     (*vfs_fhtovp)(vfs, fhp, vpp);
                    183: \fB+\fP        int     (*vfs_vptofh)(vp, fhp);
                    184: };
                    185: .bp
                    186:
                    187:
                    188: .LL
                    189: Dynamic file system information
                    190:
                    191: .NP 0
                    192: .ta .5i +\w'struct\0\0\0'u +\w'*vfs_vnodecovered;\0\0\0\0\0'u
                    193: struct statfs {
                    194: \fB!\fP        short   f_type;
                    195: \fB+\fP        short   f_flags;
                    196: \fB!\fP        long    f_fsize;
                    197: \fB+\fP        long    f_bsize;
                    198:        long    f_blocks;
                    199:        long    f_bfree;
                    200:        long    f_bavail;
                    201:        long    f_files;
                    202:        long    f_ffree;
                    203:        fsid_t  f_fsid;
                    204: \fB+\fP        char    *f_mntonname;
                    205: \fB+\fP        char    *f_mntfromname;
                    206:        long    f_spare[7];
                    207: };
                    208:
                    209: typedef long fsid_t[2];
                    210: .bp
                    211: .LL
                    212: Filesystem objects (vnodes)
                    213: .NP 0
                    214: .ta .25i +\w'struct vnodeops\0\0'u +\w'*v_vfsmountedhere;\0\0\0'u
                    215: enum vtype     { VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK };
                    216:
                    217: struct vnode {
                    218:        u_short v_flag;
                    219:        u_short v_count;
                    220:        u_short v_shlockc;
                    221:        u_short v_exlockc;
                    222:        struct vfs      *v_vfsmountedhere;
                    223:        struct vfs      *v_vfsp;
                    224:        struct vnodeops *v_op;
                    225: \fB+\fP        struct text     *v_text;
                    226:        enum vtype      v_type;
                    227:        caddr_t v_data;
                    228: };
                    229: .ta \w'#define\0\0'u +\w'NOFOLLOW\0\0'u +\w'0x40\0\0\0\0\0\0\0'u
                    230:
                    231: /* vnode flags */
                    232: #define        VROOT   0x01
                    233: #define        VTEXT   0x02
                    234: #define        VEXLOCK 0x10
                    235: #define        VSHLOCK 0x20
                    236: #define        VLWAIT  0x40
                    237: .bp
                    238: .LL
                    239: Operations on vnodes
                    240:
                    241: .NP 0
                    242: .ta .25i +\w'int\0\0'u  +\w'(*vn_getattr)(\0\0\0\0\0'u
                    243: struct vnodeops {
                    244: \fB!\fP        int     (*vn_lookup)(ndp);
                    245: \fB!\fP        int     (*vn_create)(ndp, vap, fflags);
                    246: \fB+\fP        int     (*vn_mknod)(ndp, vap, fflags);
                    247: \fB!\fP        int     (*vn_open)(vp, fflags, cred);
                    248:        int     (*vn_close)(vp, fflags, cred);
                    249:        int     (*vn_access)(vp, fflags, cred);
                    250:        int     (*vn_getattr)(vp, vap, cred);
                    251:        int     (*vn_setattr)(vp, vap, cred);
                    252: .sp .5
                    253: \fB+\fP        int     (*vn_read)(vp, uiop,
                    254:                        offp, ioflag, cred);
                    255: \fB+\fP        int     (*vn_write)(vp, uiop,
                    256:                        offp, ioflag, cred);
                    257: \fB!\fP        int     (*vn_ioctl)(vp, com,
                    258:                        data, fflag, cred);
                    259:        int     (*vn_select)(vp, which, cred);
                    260: \fB+\fP        int     (*vn_mmap)(vp, ..., cred);
                    261:        int     (*vn_fsync)(vp, cred);
                    262: \fB+\fP        int     (*vn_seek)(vp, offp, off,
                    263:                        whence);
                    264: .bp
                    265: .LL
                    266: Operations on vnodes (cont)
                    267:
                    268: .NP 0
                    269: .ta .25i +\w'int\0\0'u  +\w'(*vn_getattr)(\0\0\0\0\0'u
                    270:
                    271: \fB!\fP        int     (*vn_remove)(ndp);
                    272: \fB!\fP        int     (*vn_link)(vp, ndp);
                    273: \fB!\fP        int     (*vn_rename)(sndp, tndp);
                    274: \fB!\fP        int     (*vn_mkdir)(ndp, vap);
                    275: \fB!\fP        int     (*vn_rmdir)(ndp);
                    276: \fB!\fP        int     (*vn_symlink)(ndp, vap, nm);
                    277: \fB!\fP        int     (*vn_readdir)(vp, uiop,
                    278:                        offp, ioflag, cred);
                    279: \fB!\fP        int     (*vn_readlink)(vp, uiop,
                    280:                        offp, ioflag, cred);
                    281: .sp .5
                    282: \fB+\fP        int     (*vn_abortop)(ndp);
                    283: \fB!\fP        int     (*vn_inactive)(vp);
                    284: };
                    285:
                    286: .NP 0
                    287: .ta \w'#define\0\0'u +\w'NOFOLLOW\0\0'u +\w'0x40\0\0\0\0\0'u
                    288: /* flags for ioflag */
                    289: #define        IO_UNIT 0x01
                    290: #define        IO_APPEND       0x02
                    291: #define        IO_SYNC 0x04
                    292: .bp
                    293:
                    294: .LL
                    295: Vnode attributes
                    296:
                    297: .NP 0
                    298: .ta .5i +\w'struct timeval\0\0'u +\w'*v_vfsmountedhere;\0\0\0'u
                    299: struct vattr {
                    300:        enum vtype      va_type;
                    301:        u_short va_mode;
                    302: \fB!\fP        uid_t   va_uid;
                    303: \fB!\fP        gid_t   va_gid;
                    304:        long    va_fsid;
                    305: \fB!\fP        long    va_fileid;
                    306:        short   va_nlink;
                    307:        u_long  va_size;
                    308: \fB+\fP        u_long  va_size1;
                    309:        long    va_blocksize;
                    310:        struct timeval  va_atime;
                    311:        struct timeval  va_mtime;
                    312:        struct timeval  va_ctime;
                    313:        dev_t   va_rdev;
                    314: \fB!\fP        u_long  va_bytes;
                    315: \fB+\fP        u_long  va_bytes1;
                    316: };

CVSweb <webmaster@jp.NetBSD.org>