[BACK]Return to filecore_vnops.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / fs / filecorefs

Annotation of src/sys/fs/filecorefs/filecore_vnops.c, Revision 1.48

1.48    ! dholland    1: /*     $NetBSD: filecore_vnops.c,v 1.47 2020/06/27 17:29:18 christos Exp $     */
1.1       jdolecek    2:
                      3: /*-
                      4:  * Copyright (c) 1994 The Regents of the University of California.
                      5:  * All rights reserved.
                      6:  *
                      7:  * Redistribution and use in source and binary forms, with or without
                      8:  * modification, are permitted provided that the following conditions
                      9:  * are met:
                     10:  * 1. Redistributions of source code must retain the above copyright
                     11:  *    notice, this list of conditions and the following disclaimer.
                     12:  * 2. Redistributions in binary form must reproduce the above copyright
                     13:  *    notice, this list of conditions and the following disclaimer in the
                     14:  *    documentation and/or other materials provided with the distribution.
1.6       agc        15:  * 3. Neither the name of the University nor the names of its contributors
                     16:  *    may be used to endorse or promote products derived from this software
                     17:  *    without specific prior written permission.
                     18:  *
                     19:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     20:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     21:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     22:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     23:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     24:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     25:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     26:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     27:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     28:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     29:  * SUCH DAMAGE.
                     30:  *
                     31:  *     filecore_vnops.c        1.2     1998/8/18
                     32:  */
                     33:
                     34: /*-
                     35:  * Copyright (c) 1998 Andrew McMurry
                     36:  *
                     37:  * Redistribution and use in source and binary forms, with or without
                     38:  * modification, are permitted provided that the following conditions
                     39:  * are met:
                     40:  * 1. Redistributions of source code must retain the above copyright
                     41:  *    notice, this list of conditions and the following disclaimer.
                     42:  * 2. Redistributions in binary form must reproduce the above copyright
                     43:  *    notice, this list of conditions and the following disclaimer in the
                     44:  *    documentation and/or other materials provided with the distribution.
1.1       jdolecek   45:  * 3. All advertising materials mentioning features or use of this software
                     46:  *    must display the following acknowledgement:
                     47:  *     This product includes software developed by the University of
                     48:  *     California, Berkeley and its contributors.
                     49:  * 4. Neither the name of the University nor the names of its contributors
                     50:  *    may be used to endorse or promote products derived from this software
                     51:  *    without specific prior written permission.
                     52:  *
                     53:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     54:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     55:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     56:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     57:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     58:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     59:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     60:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     61:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     62:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     63:  * SUCH DAMAGE.
                     64:  *
                     65:  *     filecore_vnops.c        1.2     1998/8/18
                     66:  */
                     67:
                     68: #include <sys/cdefs.h>
1.48    ! dholland   69: __KERNEL_RCSID(0, "$NetBSD: filecore_vnops.c,v 1.47 2020/06/27 17:29:18 christos Exp $");
1.1       jdolecek   70:
                     71: #include <sys/param.h>
                     72: #include <sys/systm.h>
                     73: #include <sys/namei.h>
                     74: #include <sys/resourcevar.h>
                     75: #include <sys/kernel.h>
                     76: #include <sys/file.h>
                     77: #include <sys/stat.h>
                     78: #include <sys/buf.h>
                     79: #include <sys/proc.h>
                     80: #include <sys/conf.h>
                     81: #include <sys/mount.h>
                     82: #include <sys/vnode.h>
                     83: #include <sys/malloc.h>
                     84: #include <sys/dirent.h>
1.18      christos   85: #include <sys/kauth.h>
1.1       jdolecek   86:
                     87: #include <miscfs/genfs/genfs.h>
                     88: #include <miscfs/specfs/specdev.h>
                     89:
                     90: #include <fs/filecorefs/filecore.h>
                     91: #include <fs/filecorefs/filecore_extern.h>
                     92: #include <fs/filecorefs/filecore_node.h>
                     93:
1.32      elad       94: static int
                     95: filecore_check_possible(struct vnode *vp, struct filecore_node *ip,
                     96:     mode_t mode)
                     97: {
                     98:
                     99:        /*
                    100:         * Disallow write attempts unless the file is a socket,
                    101:         * fifo, or a block or character device resident on the
                    102:         * file system.
                    103:         */
                    104:        if (mode & VWRITE) {
                    105:                switch (vp->v_type) {
                    106:                case VDIR:
                    107:                case VLNK:
                    108:                case VREG:
                    109:                        return (EROFS);
                    110:                default:
                    111:                        break;
                    112:                }
                    113:        }
                    114:
                    115:        return 0;
                    116: }
                    117:
1.1       jdolecek  118: /*
                    119:  * Check mode permission on inode pointer. Mode is READ, WRITE or EXEC.
                    120:  * The mode is shifted to select the owner/group/other fields. The
                    121:  * super user is granted all permissions.
                    122:  */
1.32      elad      123: static int
                    124: filecore_check_permitted(struct vnode *vp, struct filecore_node *ip,
1.46      christos  125:     accmode_t accmode, kauth_cred_t cred)
1.32      elad      126: {
                    127:        struct filecore_mnt *fcmp = ip->i_mnt;
                    128:
1.46      christos  129:        return kauth_authorize_vnode(cred, KAUTH_ACCESS_ACTION(accmode,
1.34      elad      130:            vp->v_type, filecore_mode(ip)), vp, NULL,
1.46      christos  131:            genfs_can_access(vp, cred, fcmp->fc_uid, fcmp->fc_gid,
                    132:            filecore_mode(ip), NULL, accmode));
1.32      elad      133: }
                    134:
1.1       jdolecek  135: int
1.30      dsl       136: filecore_access(void *v)
1.1       jdolecek  137: {
                    138:        struct vop_access_args /* {
                    139:                struct vnode *a_vp;
1.46      christos  140:                accmode_t  a_accmode;
1.17      elad      141:                kauth_cred_t a_cred;
1.1       jdolecek  142:        } */ *ap = v;
                    143:        struct vnode *vp = ap->a_vp;
                    144:        struct filecore_node *ip = VTOI(vp);
1.32      elad      145:        int error;
                    146:
1.46      christos  147:        error = filecore_check_possible(vp, ip, ap->a_accmode);
1.32      elad      148:        if (error)
                    149:                return error;
1.1       jdolecek  150:
1.46      christos  151:        error = filecore_check_permitted(vp, ip, ap->a_accmode, ap->a_cred);
1.1       jdolecek  152:
1.32      elad      153:        return error;
1.1       jdolecek  154: }
                    155:
                    156: int
1.30      dsl       157: filecore_getattr(void *v)
1.1       jdolecek  158: {
                    159:        struct vop_getattr_args /* {
                    160:                struct vnode *a_vp;
                    161:                struct vattr *a_vap;
1.17      elad      162:                kauth_cred_t a_cred;
1.1       jdolecek  163:        } */ *ap = v;
                    164:        struct vnode *vp = ap->a_vp;
                    165:        struct filecore_node *ip = VTOI(vp);
                    166:        struct vattr *vap = ap->a_vap;
                    167:        struct filecore_mnt *fcmp = ip->i_mnt;
                    168:
                    169:        vap->va_fsid    = ip->i_dev;
                    170:        vap->va_fileid  = ip->i_number;
                    171:
                    172:        vap->va_mode    = filecore_mode(ip);
                    173:        vap->va_nlink   = 1;
                    174:        vap->va_uid     = fcmp->fc_uid;
                    175:        vap->va_gid     = fcmp->fc_gid;
                    176:        vap->va_atime   = filecore_time(ip);
                    177:        vap->va_mtime   = filecore_time(ip);
                    178:        vap->va_ctime   = filecore_time(ip);
                    179:        vap->va_rdev    = 0;  /* We don't support specials */
                    180:
                    181:        vap->va_size    = (u_quad_t) ip->i_size;
                    182:        vap->va_flags   = 0;
                    183:        vap->va_gen     = 1;
                    184:        vap->va_blocksize = fcmp->blksize;
                    185:        vap->va_bytes   = vap->va_size;
                    186:        vap->va_type    = vp->v_type;
                    187:        return (0);
                    188: }
                    189:
                    190: /*
                    191:  * Vnode op for reading.
                    192:  */
                    193: int
1.30      dsl       194: filecore_read(void *v)
1.1       jdolecek  195: {
                    196:        struct vop_read_args /* {
                    197:                struct vnode *a_vp;
                    198:                struct uio *a_uio;
                    199:                int a_ioflag;
1.17      elad      200:                kauth_cred_t a_cred;
1.1       jdolecek  201:        } */ *ap = v;
                    202:        struct vnode *vp = ap->a_vp;
                    203:        struct uio *uio = ap->a_uio;
                    204:        struct filecore_node *ip = VTOI(vp);
                    205:        struct filecore_mnt *fcmp;
                    206:        struct buf *bp;
1.39      christos  207:        daddr_t lbn;
1.1       jdolecek  208:        off_t diff;
                    209:        int error = 0;
                    210:        long size, n, on;
                    211:
                    212:        if (uio->uio_resid == 0)
                    213:                return (0);
                    214:        if (uio->uio_offset < 0)
                    215:                return (EINVAL);
                    216:        if (uio->uio_offset >= ip->i_size)
                    217:                return (0);
                    218:        ip->i_flag |= IN_ACCESS;
                    219:        fcmp = ip->i_mnt;
                    220:
                    221:        if (vp->v_type == VREG) {
1.15      yamt      222:                const int advice = IO_ADV_DECODE(ap->a_ioflag);
1.1       jdolecek  223:                error = 0;
1.15      yamt      224:
1.1       jdolecek  225:                while (uio->uio_resid > 0) {
                    226:                        vsize_t bytelen = MIN(ip->i_size - uio->uio_offset,
                    227:                                              uio->uio_resid);
                    228:
                    229:                        if (bytelen == 0) {
                    230:                                break;
                    231:                        }
1.28      pooka     232:                        error = ubc_uiomove(&vp->v_uobj, uio, bytelen, advice,
1.45      ad        233:                            UBC_READ | UBC_PARTIALOK | UBC_VNODE_FLAGS(vp));
1.1       jdolecek  234:                        if (error) {
                    235:                                break;
                    236:                        }
                    237:                }
                    238:                goto out;
                    239:        }
                    240:
                    241:        do {
1.38      dholland  242:                lbn = filecore_lblkno(fcmp, uio->uio_offset);
1.37      dholland  243:                on = filecore_blkoff(fcmp, uio->uio_offset);
                    244:                n = MIN(filecore_blksize(fcmp, ip, lbn) - on, uio->uio_resid);
1.1       jdolecek  245:                diff = (off_t)ip->i_size - uio->uio_offset;
                    246:                if (diff <= 0)
                    247:                        return (0);
                    248:                if (diff < n)
                    249:                        n = diff;
1.37      dholland  250:                size = filecore_blksize(fcmp, ip, lbn);
1.1       jdolecek  251:                if (ip->i_dirent.attr & FILECORE_ATTR_DIR) {
                    252:                        error = filecore_dbread(ip, &bp);
                    253:                        on = uio->uio_offset;
                    254:                        n = MIN(FILECORE_DIR_SIZE - on, uio->uio_resid);
                    255:                        size = FILECORE_DIR_SIZE;
                    256:                } else {
1.43      maxv      257:                        error = bread(vp, lbn, size, 0, &bp);
1.1       jdolecek  258: #ifdef FILECORE_DEBUG_BR
1.26      ad        259:                        printf("bread(%p, %llx, %ld, CRED, %p)=%d\n",
                    260:                            vp, (long long)lbn, size, bp, error);
1.1       jdolecek  261: #endif
                    262:                }
                    263:                if (error) {
                    264:                        return (error);
                    265:                }
1.35      hannken   266:                n = MIN(n, size - bp->b_resid);
1.1       jdolecek  267:
1.19      jnemeth   268:                error = uiomove((char *)(bp->b_data) + on, (int)n, uio);
1.1       jdolecek  269: #ifdef FILECORE_DEBUG_BR
                    270:                printf("brelse(%p) vn2\n", bp);
                    271: #endif
1.23      ad        272:                brelse(bp, 0);
1.1       jdolecek  273:        } while (error == 0 && uio->uio_resid > 0 && n != 0);
                    274:
                    275: out:
                    276:        return (error);
                    277: }
                    278:
                    279: /*
                    280:  * Vnode op for readdir
                    281:  */
                    282: int
1.30      dsl       283: filecore_readdir(void *v)
1.1       jdolecek  284: {
                    285:        struct vop_readdir_args /* {
                    286:                struct vnode *a_vp;
                    287:                struct uio *a_uio;
1.17      elad      288:                kauth_cred_t a_cred;
1.1       jdolecek  289:                int *a_eofflag;
                    290:                off_t **a_cookies;
                    291:                int *a_ncookies;
                    292:        } */ *ap = v;
                    293:        struct uio *uio = ap->a_uio;
                    294:        struct vnode *vdp = ap->a_vp;
                    295:        struct filecore_node *dp;
                    296:        struct buf *bp = NULL;
1.22      rumble    297:        struct dirent *de;
1.1       jdolecek  298:        struct filecore_direntry *dep = NULL;
                    299:        int error = 0;
                    300:        off_t *cookies = NULL;
                    301:        int ncookies = 0;
                    302:        int i;
                    303:        off_t uiooff;
                    304:
                    305:        dp = VTOI(vdp);
                    306:
                    307:        if ((dp->i_dirent.attr & FILECORE_ATTR_DIR) == 0)
                    308:                return (ENOTDIR);
                    309:
                    310:        if (uio->uio_offset % FILECORE_DIRENT_SIZE != 0)
                    311:                return (EINVAL);
                    312:        i = uio->uio_offset / FILECORE_DIRENT_SIZE;
                    313:        uiooff = uio->uio_offset;
                    314:
                    315:        *ap->a_eofflag = 0;
                    316:
                    317:        error = filecore_dbread(dp, &bp);
                    318:        if (error) {
                    319:                return error;
                    320:        }
                    321:
                    322:        if (ap->a_ncookies == NULL)
                    323:                cookies = NULL;
                    324:        else {
                    325:                *ap->a_ncookies = 0;
1.21      rumble    326:                ncookies = uio->uio_resid / _DIRENT_MINSIZE((struct dirent *)0);
1.1       jdolecek  327:                cookies = malloc(ncookies * sizeof(off_t), M_TEMP, M_WAITOK);
                    328:        }
                    329:
1.33      rmind     330:        de = kmem_zalloc(sizeof(struct dirent), KM_SLEEP);
1.22      rumble    331:
1.1       jdolecek  332:        for (; ; i++) {
                    333:                switch (i) {
                    334:                case 0:
                    335:                        /* Fake the '.' entry */
1.22      rumble    336:                        de->d_fileno = dp->i_number;
                    337:                        de->d_type = DT_DIR;
                    338:                        de->d_namlen = 1;
                    339:                        strlcpy(de->d_name, ".", sizeof(de->d_name));
1.1       jdolecek  340:                        break;
                    341:                case 1:
                    342:                        /* Fake the '..' entry */
1.22      rumble    343:                        de->d_fileno = filecore_getparent(dp);
                    344:                        de->d_type = DT_DIR;
                    345:                        de->d_namlen = 2;
                    346:                        strlcpy(de->d_name, "..", sizeof(de->d_name));
1.1       jdolecek  347:                        break;
                    348:                default:
1.22      rumble    349:                        de->d_fileno = dp->i_dirent.addr +
1.1       jdolecek  350:                                        ((i - 2) << FILECORE_INO_INDEX);
                    351:                        dep = fcdirentry(bp->b_data, i - 2);
                    352:                        if (dep->attr & FILECORE_ATTR_DIR)
1.22      rumble    353:                                de->d_type = DT_DIR;
1.1       jdolecek  354:                        else
1.22      rumble    355:                                de->d_type = DT_REG;
                    356:                        if (filecore_fn2unix(dep->name, de->d_name,
1.13      christos  357: /*###346 [cc] warning: passing arg 3 of `filecore_fn2unix' from incompatible pointer type%%%*/
1.22      rumble    358:                            &de->d_namlen)) {
1.1       jdolecek  359:                                *ap->a_eofflag = 1;
                    360:                                goto out;
                    361:                        }
                    362:                        break;
                    363:                }
1.22      rumble    364:                de->d_reclen = _DIRENT_SIZE(de);
                    365:                if (uio->uio_resid < de->d_reclen)
1.1       jdolecek  366:                        goto out;
1.22      rumble    367:                error = uiomove(de, de->d_reclen, uio);
1.1       jdolecek  368:                if (error)
                    369:                        goto out;
                    370:                uiooff += FILECORE_DIRENT_SIZE;
                    371:
                    372:                if (cookies) {
                    373:                        *cookies++ = i*FILECORE_DIRENT_SIZE;
                    374:                        (*ap->a_ncookies)++;
                    375:                        if (--ncookies == 0) goto out;
                    376:                }
                    377:        }
                    378: out:
                    379:        if (cookies) {
                    380:                *ap->a_cookies = cookies;
                    381:                if (error) {
                    382:                        free(cookies, M_TEMP);
                    383:                        *ap->a_ncookies = 0;
                    384:                        *ap->a_cookies = NULL;
                    385:                }
                    386:        }
                    387:        uio->uio_offset = uiooff;
                    388:
                    389: #ifdef FILECORE_DEBUG_BR
                    390:        printf("brelse(%p) vn3\n", bp);
                    391: #endif
1.23      ad        392:        brelse (bp, 0);
1.1       jdolecek  393:
1.33      rmind     394:        kmem_free(de, sizeof(*de));
1.22      rumble    395:
1.1       jdolecek  396:        return (error);
                    397: }
                    398:
                    399: /*
                    400:  * Return target name of a symbolic link
                    401:  * Shouldn't we get the parent vnode and read the data from there?
                    402:  * This could eventually result in deadlocks in filecore_lookup.
                    403:  * But otherwise the block read here is in the block buffer two times.
                    404:  */
                    405: int
1.30      dsl       406: filecore_readlink(void *v)
1.1       jdolecek  407: {
                    408: #if 0
                    409:        struct vop_readlink_args /* {
                    410:                struct vnode *a_vp;
                    411:                struct uio *a_uio;
1.17      elad      412:                kauth_cred_t a_cred;
1.1       jdolecek  413:        } */ *ap = v;
                    414: #endif
                    415:
                    416:        return (EINVAL);
                    417: }
                    418:
                    419: int
1.30      dsl       420: filecore_link(void *v)
1.1       jdolecek  421: {
1.44      riastrad  422:        struct vop_link_v2_args /* {
1.1       jdolecek  423:                struct vnode *a_dvp;
                    424:                struct vnode *a_vp;
                    425:                struct componentname *a_cnp;
                    426:        } */ *ap = v;
                    427:
                    428:        VOP_ABORTOP(ap->a_dvp, ap->a_cnp);
                    429:        return (EROFS);
                    430: }
                    431:
                    432: int
1.30      dsl       433: filecore_symlink(void *v)
1.1       jdolecek  434: {
1.41      hannken   435:        struct vop_symlink_v3_args /* {
1.1       jdolecek  436:                struct vnode *a_dvp;
                    437:                struct vnode **a_vpp;
                    438:                struct componentname *a_cnp;
                    439:                struct vattr *a_vap;
                    440:                char *a_target;
                    441:        } */ *ap = v;
                    442:
                    443:        VOP_ABORTOP(ap->a_dvp, ap->a_cnp);
                    444:        return (EROFS);
                    445: }
                    446:
                    447: /*
                    448:  * Calculate the logical to physical mapping if not done already,
                    449:  * then call the device strategy routine.
                    450:  */
                    451: int
1.30      dsl       452: filecore_strategy(void *v)
1.1       jdolecek  453: {
                    454:        struct vop_strategy_args /* {
1.8       hannken   455:                struct vnode *a_vp;
1.1       jdolecek  456:                struct buf *a_bp;
                    457:        } */ *ap = v;
                    458:        struct buf *bp = ap->a_bp;
1.8       hannken   459:        struct vnode *vp = ap->a_vp;
1.1       jdolecek  460:        struct filecore_node *ip;
                    461:        int error;
                    462:
                    463:        ip = VTOI(vp);
                    464:        if (bp->b_blkno == bp->b_lblkno) {
                    465:                error = VOP_BMAP(vp, bp->b_lblkno, NULL, &bp->b_blkno, NULL);
                    466:                if (error) {
                    467:                        bp->b_error = error;
                    468:                        biodone(bp);
                    469:                        return (error);
                    470:                }
                    471:                if ((long)bp->b_blkno == -1)
                    472:                        clrbuf(bp);
                    473:        }
                    474:        if ((long)bp->b_blkno == -1) {
                    475:                biodone(bp);
                    476:                return (0);
                    477:        }
                    478:        vp = ip->i_devvp;
1.7       hannken   479:        return (VOP_STRATEGY(vp, bp));
1.1       jdolecek  480: }
                    481:
                    482: /*
                    483:  * Print out the contents of an inode.
                    484:  */
                    485: /*ARGSUSED*/
                    486: int
1.30      dsl       487: filecore_print(void *v)
1.1       jdolecek  488: {
                    489:
                    490:        printf("tag VT_FILECORE, filecore vnode\n");
                    491:        return (0);
                    492: }
                    493:
                    494: /*
                    495:  * Return POSIX pathconf information applicable to filecore filesystems.
                    496:  */
                    497: int
1.30      dsl       498: filecore_pathconf(void *v)
1.1       jdolecek  499: {
                    500:        struct vop_pathconf_args /* {
                    501:                struct vnode *a_vp;
                    502:                int a_name;
                    503:                register_t *a_retval;
                    504:        } */ *ap = v;
                    505:        switch (ap->a_name) {
                    506:        case _PC_LINK_MAX:
                    507:                *ap->a_retval = 1;
                    508:                return (0);
                    509:        case _PC_NAME_MAX:
1.10      jdolecek  510:                *ap->a_retval = ap->a_vp->v_mount->mnt_stat.f_namemax;
1.1       jdolecek  511:                return (0);
                    512:        case _PC_PATH_MAX:
                    513:                *ap->a_retval = 256;
                    514:                return (0);
                    515:        case _PC_CHOWN_RESTRICTED:
                    516:                *ap->a_retval = 1;
                    517:                return (0);
                    518:        case _PC_NO_TRUNC:
                    519:                *ap->a_retval = 1;
                    520:                return (0);
                    521:        case _PC_SYNC_IO:
                    522:                *ap->a_retval = 1;
                    523:                return (0);
                    524:        case _PC_FILESIZEBITS:
                    525:                *ap->a_retval = 32;
                    526:                return (0);
                    527:        default:
1.47      christos  528:                return genfs_pathconf(ap);
1.1       jdolecek  529:        }
                    530:        /* NOTREACHED */
                    531: }
                    532:
                    533: /*
                    534:  * Global vfs data structures for isofs
                    535:  */
                    536: #define        filecore_create genfs_eopnotsupp
                    537: #define        filecore_mknod  genfs_eopnotsupp
                    538: #define        filecore_write  genfs_eopnotsupp
                    539: #define        filecore_setattr        genfs_eopnotsupp
                    540: #define        filecore_fcntl  genfs_fcntl
                    541: #define        filecore_ioctl  genfs_enoioctl
                    542: #define        filecore_fsync  genfs_nullop
                    543: #define        filecore_remove genfs_eopnotsupp
                    544: #define        filecore_rename genfs_eopnotsupp
                    545: #define        filecore_mkdir  genfs_eopnotsupp
                    546: #define        filecore_rmdir  genfs_eopnotsupp
                    547: #define        filecore_advlock        genfs_eopnotsupp
                    548: #define        filecore_bwrite genfs_eopnotsupp
                    549: #define filecore_revoke        genfs_revoke
                    550:
                    551: /*
                    552:  * Global vfs data structures for filecore
                    553:  */
1.29      dsl       554: int (**filecore_vnodeop_p)(void *);
1.1       jdolecek  555: const struct vnodeopv_entry_desc filecore_vnodeop_entries[] = {
                    556:        { &vop_default_desc, vn_default_error },
1.48    ! dholland  557:        { &vop_parsepath_desc, genfs_parsepath },       /* parsepath */
1.1       jdolecek  558:        { &vop_lookup_desc, filecore_lookup },          /* lookup */
                    559:        { &vop_create_desc, filecore_create },          /* create */
                    560:        { &vop_mknod_desc, filecore_mknod },            /* mknod */
                    561:        { &vop_open_desc, filecore_open },              /* open */
                    562:        { &vop_close_desc, filecore_close },            /* close */
                    563:        { &vop_access_desc, filecore_access },          /* access */
1.46      christos  564:        { &vop_accessx_desc, genfs_accessx },           /* accessx */
1.1       jdolecek  565:        { &vop_getattr_desc, filecore_getattr },        /* getattr */
                    566:        { &vop_setattr_desc, filecore_setattr },        /* setattr */
                    567:        { &vop_read_desc, filecore_read },              /* read */
                    568:        { &vop_write_desc, filecore_write },            /* write */
1.42      dholland  569:        { &vop_fallocate_desc, genfs_eopnotsupp },      /* fallocate */
                    570:        { &vop_fdiscard_desc, genfs_eopnotsupp },       /* fdiscard */
1.1       jdolecek  571:        { &vop_fcntl_desc, filecore_fcntl },            /* fcntl */
                    572:        { &vop_ioctl_desc, filecore_ioctl },            /* ioctl */
                    573:        { &vop_poll_desc, filecore_poll },              /* poll */
                    574:        { &vop_kqfilter_desc, genfs_kqfilter },         /* kqfilter */
                    575:        { &vop_revoke_desc, filecore_revoke },          /* revoke */
                    576:        { &vop_mmap_desc, filecore_mmap },              /* mmap */
                    577:        { &vop_fsync_desc, filecore_fsync },            /* fsync */
                    578:        { &vop_seek_desc, filecore_seek },              /* seek */
                    579:        { &vop_remove_desc, filecore_remove },          /* remove */
                    580:        { &vop_link_desc, filecore_link },              /* link */
                    581:        { &vop_rename_desc, filecore_rename },          /* rename */
                    582:        { &vop_mkdir_desc, filecore_mkdir },            /* mkdir */
                    583:        { &vop_rmdir_desc, filecore_rmdir },            /* rmdir */
                    584:        { &vop_symlink_desc, filecore_symlink },        /* symlink */
                    585:        { &vop_readdir_desc, filecore_readdir },        /* readdir */
                    586:        { &vop_readlink_desc, filecore_readlink },      /* readlink */
                    587:        { &vop_abortop_desc, filecore_abortop },        /* abortop */
                    588:        { &vop_inactive_desc, filecore_inactive },      /* inactive */
                    589:        { &vop_reclaim_desc, filecore_reclaim },        /* reclaim */
                    590:        { &vop_lock_desc, genfs_lock },                 /* lock */
                    591:        { &vop_unlock_desc, genfs_unlock },             /* unlock */
                    592:        { &vop_bmap_desc, filecore_bmap },              /* bmap */
                    593:        { &vop_strategy_desc, filecore_strategy },      /* strategy */
                    594:        { &vop_print_desc, filecore_print },            /* print */
                    595:        { &vop_islocked_desc, genfs_islocked },         /* islocked */
                    596:        { &vop_pathconf_desc, filecore_pathconf },      /* pathconf */
                    597:        { &vop_advlock_desc, filecore_advlock },        /* advlock */
                    598:        { &vop_bwrite_desc, vn_bwrite },                /* bwrite */
                    599:        { &vop_getpages_desc, genfs_getpages },         /* getpages */
                    600:        { &vop_putpages_desc, genfs_putpages },         /* putpages */
                    601:        { NULL, NULL }
                    602: };
                    603: const struct vnodeopv_desc filecore_vnodeop_opv_desc =
                    604:        { &filecore_vnodeop_p, filecore_vnodeop_entries };

CVSweb <webmaster@jp.NetBSD.org>