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

Annotation of src/sys/miscfs/kernfs/kernfs_vnops.c, Revision 1.3

1.1       cgd         1: /*
                      2:  * Copyright (c) 1990, 1992 Jan-Simon Pendry
                      3:  * All rights reserved.
                      4:  *
1.2       cgd         5:  * This code is derived from software contributed to Berkeley by
1.1       cgd         6:  * Jan-Simon Pendry.
                      7:  *
1.2       cgd         8:  * Redistribution and use in source and binary forms, with or without
                      9:  * modification, are permitted provided that the following conditions
                     10:  * are met:
                     11:  * 1. Redistributions of source code must retain the above copyright
                     12:  *    notice, this list of conditions and the following disclaimer.
                     13:  * 2. Redistributions in binary form must reproduce the above copyright
                     14:  *    notice, this list of conditions and the following disclaimer in the
                     15:  *    documentation and/or other materials provided with the distribution.
                     16:  * 3. All advertising materials mentioning features or use of this software
                     17:  *    must display the following acknowledgement:
                     18:  *      This product includes software developed by the University of
                     19:  *      California, Berkeley and its contributors.
                     20:  * 4. Neither the name of the University nor the names of its contributors
                     21:  *    may be used to endorse or promote products derived from this software
                     22:  *    without specific prior written permission.
1.1       cgd        23:  *
1.2       cgd        24:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     25:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     26:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     27:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     28:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     29:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     30:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     31:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     32:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     33:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     34:  * SUCH DAMAGE.
1.1       cgd        35:  *
1.3     ! cgd        36:  * $Id: kernfs_vnops.c,v 1.2 93/03/25 06:00:24 cgd Exp $
1.1       cgd        37:  */
                     38:
                     39: /*
                     40:  * Kernel parameter filesystem
                     41:  */
                     42:
                     43: #include "param.h"
                     44: #include "systm.h"
                     45: #include "kernel.h"
                     46: #include "types.h"
                     47: #include "time.h"
                     48: #include "proc.h"
                     49: #include "file.h"
                     50: #include "vnode.h"
                     51: #include "stat.h"
                     52: #include "mount.h"
                     53: #include "namei.h"
                     54: #include "buf.h"
                     55: #include "miscfs/kernfs/kernfs.h"
                     56:
                     57: #include "../ufs/dir.h"                /* For readdir() XXX */
                     58:
                     59: #define KSTRING        256             /* Largest I/O available via this filesystem */
                     60: #define        UIO_MX 32
                     61:
                     62: struct kern_target {
                     63:        char *kt_name;
                     64:        void *kt_data;
                     65: #define        KTT_NULL 1
                     66: #define        KTT_TIME 5
                     67: #define KTT_INT        17
                     68: #define        KTT_STRING 31
                     69: #define KTT_HOSTNAME 47
                     70: #define KTT_AVENRUN 53
                     71:        int kt_tag;
                     72: #define        KTM_RO  0
                     73: #define        KTM_RO_MODE             (S_IRUSR|S_IRGRP|S_IROTH)
                     74: #define        KTM_RW  43
                     75: #define        KTM_RW_MODE             (S_IWUSR|S_IRUSR|S_IRGRP|S_IROTH)
                     76: #define KTM_DIR_MODE (S_IRUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH)
                     77:        int kt_rw;
                     78:        int kt_vtype;
                     79: } kern_targets[] = {
                     80: /* NOTE: The name must be less than UIO_MX-16 chars in length */
                     81:        /* name         data            tag             ro/rw */
                     82:        { ".",          0,              KTT_NULL,       KTM_RO, VDIR },
                     83:        { "copyright",  copyright,      KTT_STRING,     KTM_RO, VREG },
                     84:        { "hostname",   0,              KTT_HOSTNAME,   KTM_RW, VREG },
                     85:        { "hz",         &hz,            KTT_INT,        KTM_RO, VREG },
                     86:        { "loadavg",    0,              KTT_AVENRUN,    KTM_RO, VREG },
                     87:        { "physmem",    &physmem,       KTT_INT,        KTM_RO, VREG },
                     88:        { "root",       0,              KTT_NULL,       KTM_RO, VDIR },
                     89:        { "rootdev",    0,              KTT_NULL,       KTM_RO, VBLK },
                     90:        { "time",       0,              KTT_TIME,       KTM_RO, VREG },
                     91:        { "version",    version,        KTT_STRING,     KTM_RO, VREG },
                     92: };
                     93:
                     94: static int nkern_targets = sizeof(kern_targets) / sizeof(kern_targets[0]);
                     95:
                     96: static int
                     97: kernfs_xread(kt, buf, len, lenp)
                     98:        struct kern_target *kt;
                     99:        char *buf;
                    100:        int len;
                    101:        int *lenp;
                    102: {
                    103:        int xlen;
                    104:
                    105:        switch (kt->kt_tag) {
                    106:        case KTT_TIME: {
                    107:                struct timeval tv;
                    108:                microtime(&tv);
                    109:                sprintf(buf, "%d %d\n", tv.tv_sec, tv.tv_usec);
                    110:                break;
                    111:        }
                    112:
                    113:        case KTT_INT: {
                    114:                int *ip = kt->kt_data;
                    115:                sprintf(buf, "%d\n", *ip);
                    116:                break;
                    117:        }
                    118:
                    119:        case KTT_STRING: {
                    120:                char *cp = kt->kt_data;
                    121:                int xlen = strlen(cp) + 1;
                    122:
                    123:                if (xlen >= len)
                    124:                        return (EINVAL);
                    125:
                    126:                bcopy(cp, buf, xlen);
                    127:                break;
                    128:        }
                    129:
                    130:        case KTT_HOSTNAME: {
                    131:                char *cp = hostname;
                    132:                int xlen = hostnamelen;
                    133:
                    134:                if (xlen >= len)
                    135:                        return (EINVAL);
                    136:
                    137:                sprintf(buf, "%s\n", cp);
                    138:                break;
                    139:        }
                    140:
                    141:        case KTT_AVENRUN:
                    142:                sprintf(buf, "%d %d %d %d\n",
                    143:                                averunnable[0],
                    144:                                averunnable[1],
                    145:                                averunnable[2],
                    146:                                FSCALE);
                    147:                break;
                    148:
                    149:        default:
                    150:                return (EINVAL);
                    151:        }
                    152:
                    153:        *lenp = strlen(buf);
                    154:        return (0);
                    155: }
                    156:
                    157: static int
                    158: kernfs_xwrite(kt, buf, len)
                    159:        struct kern_target *kt;
                    160:        char *buf;
                    161:        int len;
                    162: {
                    163:        switch (kt->kt_tag) {
                    164:        case KTT_HOSTNAME: {
                    165:                if (buf[len-1] == '\n')
                    166:                        --len;
                    167:                bcopy(buf, hostname, len);
                    168:                hostnamelen = len - 1;
                    169:                return (0);
                    170:        }
                    171:
                    172:        default:
                    173:                return (EIO);
                    174:        }
                    175: }
                    176:
                    177: /*
                    178:  * vp is the current namei directory
                    179:  * ndp is the name to locate in that directory...
                    180:  */
                    181: kernfs_lookup(dvp, ndp, p)
                    182:        struct vnode *dvp;
                    183:        struct nameidata *ndp;
                    184:        struct proc *p;
                    185: {
                    186:        char *pname = ndp->ni_ptr;
                    187:        int error = ENOENT;
                    188:        int i;
                    189:        struct vnode *fvp;
                    190:
                    191: #ifdef KERNFS_DIAGNOSTIC
                    192:        printf("kernfs_lookup(%s)\n", pname);
                    193: #endif
                    194:        if (ndp->ni_namelen == 1 && *pname == '.') {
                    195:                ndp->ni_dvp = dvp;
                    196:                ndp->ni_vp = dvp;
                    197:                VREF(dvp);
                    198:                /*VOP_LOCK(dvp);*/
                    199:                return (0);
                    200:        }
                    201:
                    202:        if (ndp->ni_namelen == 4 && bcmp(pname, "root", 4) == 0) {
1.3     ! cgd       203:                ndp->ni_dvp = dvp;
1.1       cgd       204:                ndp->ni_vp = rootdir;
                    205:                VREF(rootdir);
                    206:                VOP_LOCK(rootdir);
                    207:                return (0);
                    208:        }
                    209:
                    210:        /*
                    211:         * /kern/rootdev is the root device
                    212:         */
                    213:        if (ndp->ni_namelen == 7 && bcmp(pname, "rootdev", 7) == 0) {
                    214:                if (vfinddev(rootdev, VBLK, &fvp))
                    215:                        return (ENXIO);
                    216:                ndp->ni_dvp = dvp;
                    217:                ndp->ni_vp = fvp;
                    218:                VREF(fvp);
                    219:                VOP_LOCK(fvp);
                    220:                return (0);
                    221:        }
                    222:
                    223:        for (i = 0; i < nkern_targets; i++) {
                    224:                struct kern_target *kt = &kern_targets[i];
                    225:                if (ndp->ni_namelen == strlen(kt->kt_name) &&
                    226:                    bcmp(kt->kt_name, pname, ndp->ni_namelen) == 0) {
                    227:                        error = 0;
                    228:                        break;
                    229:                }
                    230:        }
                    231:
                    232: #ifdef KERNFS_DIAGNOSTIC
                    233:        printf("kernfs_lookup: i = %d, error = %d\n", i, error);
                    234: #endif
                    235:
                    236:        if (error)
                    237:                goto bad;
                    238:
                    239: #ifdef KERNFS_DIAGNOSTIC
                    240:        printf("kernfs_lookup: allocate new vnode\n");
                    241: #endif
                    242:        error = getnewvnode(VT_UFS, dvp->v_mount, &kernfs_vnodeops, &fvp);
                    243:        if (error)
                    244:                goto bad;
                    245:        VTOKERN(fvp)->kf_kt = &kern_targets[i];
                    246:        fvp->v_type = VTOKERN(fvp)->kf_kt->kt_vtype;
                    247:        ndp->ni_dvp = dvp;
                    248:        ndp->ni_vp = fvp;
                    249: #ifdef KERNFS_DIAGNOSTIC
                    250:        printf("kernfs_lookup: newvp = %x\n", fvp);
                    251: #endif
                    252:        return (0);
                    253:
                    254: bad:;
                    255:        ndp->ni_dvp = dvp;
                    256:        ndp->ni_vp = NULL;
                    257: #ifdef KERNFS_DIAGNOSTIC
                    258:        printf("kernfs_lookup: error = %d\n", error);
                    259: #endif
                    260:        return (error);
                    261: }
                    262:
                    263: kernfs_open(vp, mode, cred, p)
                    264:        struct vnode *vp;
                    265:        int mode;
                    266:        struct ucred *cred;
                    267:        struct proc *p;
                    268: {
                    269:        int error;
                    270:        struct filedesc *fdp;
                    271:        struct file *fp;
                    272:        int dfd;
                    273:        int fd;
                    274:
                    275: #ifdef KERNFS_DIAGNOSTIC
                    276:        printf("kernfs_open\n");
                    277: #endif
                    278:
                    279:        /*
                    280:         * Can always open the root (modulo perms)
                    281:         */
                    282:        if (vp->v_flag & VROOT)
                    283:                return (0);
                    284:
                    285: #ifdef KERNFS_DIAGNOSTIC
                    286:        printf("kernfs_open, mode = %x, file = %s\n",
                    287:                        mode, VTOKERN(vp)->kf_kt->kt_name);
                    288: #endif
                    289:
                    290:        if ((mode & FWRITE) && VTOKERN(vp)->kf_kt->kt_rw != KTM_RW)
                    291:                return (EBADF);
                    292:
                    293:        return (0);
                    294: }
                    295:
                    296: kernfs_getattr(vp, vap, cred, p)
                    297:        struct vnode *vp;
                    298:        struct vattr *vap;
                    299:        struct ucred *cred;
                    300:        struct proc *p;
                    301: {
                    302:        int error = 0;
                    303:        char strbuf[KSTRING];
                    304:        struct kern_target *kt = VTOKERN(vp)->kf_kt;
                    305:
                    306:        bzero((caddr_t) vap, sizeof(*vap));
                    307:        vattr_null(vap);
                    308:        vap->va_uid = 0;
                    309:        vap->va_gid = 0;
                    310:        vap->va_fsid = vp->v_mount->mnt_stat.f_fsid.val[0];
                    311:        /* vap->va_qsize = 0; */
                    312:        vap->va_blocksize = DEV_BSIZE;
                    313:        microtime(&vap->va_atime);
                    314:        vap->va_mtime = vap->va_atime;
                    315:        vap->va_ctime = vap->va_ctime;
                    316:        vap->va_gen = 0;
                    317:        vap->va_flags = 0;
                    318:        vap->va_rdev = 0;
                    319:        /* vap->va_qbytes = 0; */
                    320:        vap->va_bytes = 0;
                    321:
                    322:        if (vp->v_flag & VROOT) {
                    323: #ifdef KERNFS_DIAGNOSTIC
                    324:                printf("kernfs_getattr: stat rootdir\n");
                    325: #endif
                    326:                vap->va_type = VDIR;
                    327:                vap->va_mode = KTM_DIR_MODE;
                    328:                vap->va_nlink = 2;
                    329:                vap->va_fileid = 2;
                    330:                vap->va_size = DEV_BSIZE;
                    331:        } else {
                    332: #ifdef KERNFS_DIAGNOSTIC
                    333:                printf("kernfs_getattr: stat target %s\n", kt->kt_name);
                    334: #endif
                    335:                vap->va_type = kt->kt_vtype;
                    336:                vap->va_mode = (kt->kt_rw ? KTM_RW_MODE : KTM_RO_MODE);
                    337:                vap->va_nlink = 1;
                    338:                vap->va_fileid = 3 + (kt - kern_targets) / sizeof(*kt);
                    339:                error = kernfs_xread(kt, strbuf, sizeof(strbuf), &vap->va_size);
                    340:        }
                    341:
                    342:        vp->v_type = vap->va_type;
                    343: #ifdef KERNFS_DIAGNOSTIC
                    344:        printf("kernfs_getattr: return error %d\n", error);
                    345: #endif
                    346:        return (error);
                    347: }
                    348:
                    349: kernfs_setattr(vp, vap, cred, p)
                    350:        struct vnode *vp;
                    351:        struct vattr *vap;
                    352:        struct ucred *cred;
                    353:        struct proc *p;
                    354: {
                    355:
                    356:        /*
                    357:         * Silently ignore attribute changes.
                    358:         * This allows for open with truncate to have no
                    359:         * effect until some data is written.  I want to
                    360:         * do it this way because all writes are atomic.
                    361:         */
                    362:        return (0);
                    363: }
                    364:
                    365: static int
                    366: kernfs_read(vp, uio, ioflag, cred)
                    367:        struct vnode *vp;
                    368:        struct uio *uio;
                    369:        int ioflag;
                    370:        struct ucred *cred;
                    371: {
                    372:        struct kern_target *kt = VTOKERN(vp)->kf_kt;
                    373:        char strbuf[KSTRING];
                    374:        int off = uio->uio_offset;
                    375:        int len = 0;
                    376:        char *cp = strbuf;
                    377:        int error;
                    378: #ifdef KERNFS_DIAGNOSTIC
                    379:        printf("kern_read %s\n", kt->kt_name);
                    380: #endif
                    381:
                    382:        error = kernfs_xread(kt, strbuf, sizeof(strbuf), &len);
                    383:        if (error)
                    384:                return (error);
                    385:        cp = strbuf + off;
                    386:        len -= off;
                    387:        return (uiomove(cp, len, uio));
                    388: }
                    389:
                    390: static int
                    391: kernfs_write(vp, uio, ioflag, cred)
                    392:        struct vnode *vp;
                    393:        struct uio *uio;
                    394:        int ioflag;
                    395:        struct ucred *cred;
                    396: {
                    397:        struct kern_target *kt = VTOKERN(vp)->kf_kt;
                    398:        char strbuf[KSTRING];
                    399:        int len = uio->uio_resid;
                    400:        char *cp = strbuf;
                    401:        int xlen;
                    402:        int error;
                    403:
                    404:        if (uio->uio_offset != 0)
                    405:                return (EINVAL);
                    406:
                    407:        xlen = min(uio->uio_resid, KSTRING-1);
                    408:        error = uiomove(strbuf, xlen, uio);
                    409:        if (error)
                    410:                return (error);
                    411:
                    412:        if (uio->uio_resid != 0)
                    413:                return (EIO);
                    414:
                    415:        strbuf[xlen] = '\0';
                    416:        return (kernfs_xwrite(kt, strbuf, xlen));
                    417: }
                    418:
                    419: kernfs_readdir(vp, uio, cred, eofflagp)
                    420:        struct vnode *vp;
                    421:        struct uio *uio;
                    422:        struct ucred *cred;
                    423:        int *eofflagp;
                    424: {
                    425:        struct filedesc *fdp;
                    426:        int i;
                    427:        int error;
                    428:
                    429:        i = uio->uio_offset / UIO_MX;
                    430:        error = 0;
                    431:        while (uio->uio_resid > 0) {
                    432: #ifdef KERNFS_DIAGNOSTIC
                    433:                printf("kernfs_readdir: i = %d\n", i);
                    434: #endif
                    435:                if (i >= nkern_targets) {
                    436:                        *eofflagp = 1;
                    437:                        break;
                    438:                }
                    439:                {
                    440:                        struct direct d;
                    441:                        struct direct *dp = &d;
                    442:                        struct kern_target *kt = &kern_targets[i];
                    443:
                    444:                        bzero((caddr_t) dp, UIO_MX);
                    445:
                    446:                        dp->d_namlen = strlen(kt->kt_name);
                    447:                        bcopy(kt->kt_name, dp->d_name, dp->d_namlen+1);
                    448:
                    449: #ifdef KERNFS_DIAGNOSTIC
                    450:                        printf("kernfs_readdir: name = %s, len = %d\n",
                    451:                                        dp->d_name, dp->d_namlen);
                    452: #endif
                    453:                        /*
                    454:                         * Fill in the remaining fields
                    455:                         */
                    456:                        dp->d_reclen = UIO_MX;
                    457:                        dp->d_ino = i + 3;
                    458:                        /*
                    459:                         * And ship to userland
                    460:                         */
                    461:                        error = uiomove((caddr_t) dp, UIO_MX, uio);
                    462:                        if (error)
                    463:                                break;
                    464:                }
                    465:                i++;
                    466:        }
                    467:
                    468:        uio->uio_offset = i * UIO_MX;
                    469:
                    470:        return (error);
                    471: }
                    472:
                    473: kernfs_inactive(vp, p)
                    474:        struct vnode *vp;
                    475:        struct proc *p;
                    476: {
                    477:        /*
                    478:         * Clear out the v_type field to avoid
                    479:         * nasty things happening in vgone().
                    480:         */
                    481:        vp->v_type = VNON;
                    482: #ifdef KERNFS_DIAGNOSTIC
                    483:        printf("kernfs_inactive(%x)\n", vp);
                    484: #endif
                    485:        return (0);
                    486: }
                    487:
                    488: /*
                    489:  * Print out the contents of a kernfs vnode.
                    490:  */
                    491: /* ARGSUSED */
                    492: kernfs_print(vp)
                    493:        struct vnode *vp;
                    494: {
                    495:        printf("tag VT_NON, kernfs vnode\n");
                    496: }
                    497:
                    498: /*
                    499:  * kernfs vnode unsupported operation
                    500:  */
                    501: kernfs_enotsupp()
                    502: {
                    503:        return (EOPNOTSUPP);
                    504: }
                    505:
                    506: /*
                    507:  * kernfs "should never get here" operation
                    508:  */
                    509: kernfs_badop()
                    510: {
                    511:        panic("kernfs: bad op");
                    512:        /* NOTREACHED */
                    513: }
                    514:
                    515: /*
                    516:  * kernfs vnode null operation
                    517:  */
                    518: kernfs_nullop()
                    519: {
                    520:        return (0);
                    521: }
                    522:
                    523: #define kernfs_create ((int (*) __P(( \
                    524:                struct nameidata *ndp, \
                    525:                struct vattr *vap, \
                    526:                struct proc *p))) kernfs_enotsupp)
                    527: #define kernfs_mknod ((int (*) __P(( \
                    528:                struct nameidata *ndp, \
                    529:                struct vattr *vap, \
                    530:                struct ucred *cred, \
                    531:                struct proc *p))) kernfs_enotsupp)
                    532: #define kernfs_close ((int (*) __P(( \
                    533:                struct vnode *vp, \
                    534:                int fflag, \
                    535:                struct ucred *cred, \
                    536:                struct proc *p))) nullop)
                    537: #define kernfs_access ((int (*) __P(( \
                    538:                struct vnode *vp, \
                    539:                int mode, \
                    540:                struct ucred *cred, \
                    541:                struct proc *p))) nullop)
                    542: #define        kernfs_ioctl ((int (*) __P(( \
                    543:                struct vnode *vp, \
                    544:                int command, \
                    545:                caddr_t data, \
                    546:                int fflag, \
                    547:                struct ucred *cred, \
                    548:                struct proc *p))) kernfs_enotsupp)
                    549: #define        kernfs_select ((int (*) __P(( \
                    550:                struct vnode *vp, \
                    551:                int which, \
                    552:                int fflags, \
                    553:                struct ucred *cred, \
                    554:                struct proc *p))) kernfs_enotsupp)
                    555: #define kernfs_mmap ((int (*) __P(( \
                    556:                struct vnode *vp, \
                    557:                int fflags, \
                    558:                struct ucred *cred, \
                    559:                struct proc *p))) kernfs_enotsupp)
                    560: #define kernfs_fsync ((int (*) __P(( \
                    561:                struct vnode *vp, \
                    562:                int fflags, \
                    563:                struct ucred *cred, \
                    564:                int waitfor, \
                    565:                struct proc *p))) nullop)
                    566: #define kernfs_seek ((int (*) __P(( \
                    567:                struct vnode *vp, \
                    568:                off_t oldoff, \
                    569:                off_t newoff, \
                    570:                struct ucred *cred))) nullop)
                    571: #define kernfs_remove ((int (*) __P(( \
                    572:                struct nameidata *ndp, \
                    573:                struct proc *p))) kernfs_enotsupp)
                    574: #define kernfs_link ((int (*) __P(( \
                    575:                struct vnode *vp, \
                    576:                struct nameidata *ndp, \
                    577:                struct proc *p))) kernfs_enotsupp)
                    578: #define kernfs_rename ((int (*) __P(( \
                    579:                struct nameidata *fndp, \
                    580:                struct nameidata *tdnp, \
                    581:                struct proc *p))) kernfs_enotsupp)
                    582: #define kernfs_mkdir ((int (*) __P(( \
                    583:                struct nameidata *ndp, \
                    584:                struct vattr *vap, \
                    585:                struct proc *p))) kernfs_enotsupp)
                    586: #define kernfs_rmdir ((int (*) __P(( \
                    587:                struct nameidata *ndp, \
                    588:                struct proc *p))) kernfs_enotsupp)
                    589: #define kernfs_symlink ((int (*) __P(( \
                    590:                struct nameidata *ndp, \
                    591:                struct vattr *vap, \
                    592:                char *target, \
                    593:                struct proc *p))) kernfs_enotsupp)
                    594: #define kernfs_readlink ((int (*) __P(( \
                    595:                struct vnode *vp, \
                    596:                struct uio *uio, \
                    597:                struct ucred *cred))) kernfs_enotsupp)
                    598: #define kernfs_abortop ((int (*) __P(( \
                    599:                struct nameidata *ndp))) nullop)
                    600: #ifdef KERNFS_DIAGNOSTIC
                    601: int kernfs_reclaim(vp)
                    602: struct vnode *vp;
                    603: {
                    604:        printf("kernfs_reclaim(%x)\n", vp);
                    605:        return (0);
                    606: }
                    607: #else
                    608: #define kernfs_reclaim ((int (*) __P(( \
                    609:                struct vnode *vp))) nullop)
                    610: #endif
                    611: #define        kernfs_lock ((int (*) __P(( \
                    612:                struct vnode *vp))) nullop)
                    613: #define kernfs_unlock ((int (*) __P(( \
                    614:                struct vnode *vp))) nullop)
                    615: #define        kernfs_bmap ((int (*) __P(( \
                    616:                struct vnode *vp, \
                    617:                daddr_t bn, \
                    618:                struct vnode **vpp, \
                    619:                daddr_t *bnp))) kernfs_badop)
                    620: #define        kernfs_strategy ((int (*) __P(( \
                    621:                struct buf *bp))) kernfs_badop)
                    622: #define kernfs_islocked ((int (*) __P(( \
                    623:                struct vnode *vp))) nullop)
                    624: #define kernfs_advlock ((int (*) __P(( \
                    625:                struct vnode *vp, \
                    626:                caddr_t id, \
                    627:                int op, \
                    628:                struct flock *fl, \
                    629:                int flags))) kernfs_enotsupp)
                    630:
                    631: struct vnodeops kernfs_vnodeops = {
                    632:        kernfs_lookup,  /* lookup */
                    633:        kernfs_create,  /* create */
                    634:        kernfs_mknod,   /* mknod */
                    635:        kernfs_open,    /* open */
                    636:        kernfs_close,   /* close */
                    637:        kernfs_access,  /* access */
                    638:        kernfs_getattr, /* getattr */
                    639:        kernfs_setattr, /* setattr */
                    640:        kernfs_read,    /* read */
                    641:        kernfs_write,   /* write */
                    642:        kernfs_ioctl,   /* ioctl */
                    643:        kernfs_select,  /* select */
                    644:        kernfs_mmap,    /* mmap */
                    645:        kernfs_fsync,   /* fsync */
                    646:        kernfs_seek,    /* seek */
                    647:        kernfs_remove,  /* remove */
                    648:        kernfs_link,    /* link */
                    649:        kernfs_rename,  /* rename */
                    650:        kernfs_mkdir,   /* mkdir */
                    651:        kernfs_rmdir,   /* rmdir */
                    652:        kernfs_symlink, /* symlink */
                    653:        kernfs_readdir, /* readdir */
                    654:        kernfs_readlink,        /* readlink */
                    655:        kernfs_abortop, /* abortop */
                    656:        kernfs_inactive,        /* inactive */
                    657:        kernfs_reclaim, /* reclaim */
                    658:        kernfs_lock,    /* lock */
                    659:        kernfs_unlock,  /* unlock */
                    660:        kernfs_bmap,    /* bmap */
                    661:        kernfs_strategy,        /* strategy */
                    662:        kernfs_print,   /* print */
                    663:        kernfs_islocked,        /* islocked */
                    664:        kernfs_advlock, /* advlock */
                    665: };

CVSweb <webmaster@jp.NetBSD.org>