Annotation of kernel/bsd/miscfs/portal/portal_vnops.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
                      3:  *
                      4:  * @APPLE_LICENSE_HEADER_START@
                      5:  * 
                      6:  * Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
                      7:  * Reserved.  This file contains Original Code and/or Modifications of
                      8:  * Original Code as defined in and that are subject to the Apple Public
                      9:  * Source License Version 1.1 (the "License").  You may not use this file
                     10:  * except in compliance with the License.  Please obtain a copy of the
                     11:  * License at http://www.apple.com/publicsource and read it before using
                     12:  * this file.
                     13:  * 
                     14:  * The Original Code and all software distributed under the License are
                     15:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
                     16:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
                     17:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
                     18:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
                     19:  * License for the specific language governing rights and limitations
                     20:  * under the License.
                     21:  * 
                     22:  * @APPLE_LICENSE_HEADER_END@
                     23:  */
                     24: 
                     25: /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
                     26: /*
                     27:  * Copyright (c) 1992, 1993
                     28:  *     The Regents of the University of California.  All rights reserved.
                     29:  *
                     30:  * This code is derived from software donated to Berkeley by
                     31:  * Jan-Simon Pendry.
                     32:  *
                     33:  * Redistribution and use in source and binary forms, with or without
                     34:  * modification, are permitted provided that the following conditions
                     35:  * are met:
                     36:  * 1. Redistributions of source code must retain the above copyright
                     37:  *    notice, this list of conditions and the following disclaimer.
                     38:  * 2. Redistributions in binary form must reproduce the above copyright
                     39:  *    notice, this list of conditions and the following disclaimer in the
                     40:  *    documentation and/or other materials provided with the distribution.
                     41:  * 3. All advertising materials mentioning features or use of this software
                     42:  *    must display the following acknowledgement:
                     43:  *     This product includes software developed by the University of
                     44:  *     California, Berkeley and its contributors.
                     45:  * 4. Neither the name of the University nor the names of its contributors
                     46:  *    may be used to endorse or promote products derived from this software
                     47:  *    without specific prior written permission.
                     48:  *
                     49:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     50:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     51:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     52:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     53:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     54:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     55:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     56:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     57:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     58:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     59:  * SUCH DAMAGE.
                     60:  *
                     61:  *     @(#)portal_vnops.c      8.14 (Berkeley) 5/21/95
                     62:  *
                     63:  *     @(#)portal_vnops.c      8.8 (Berkeley) 1/21/94
                     64:  */
                     65: 
                     66: /*
                     67:  * Portal Filesystem
                     68:  */
                     69: 
                     70: #include <sys/param.h>
                     71: #include <sys/systm.h>
                     72: #include <sys/kernel.h>
                     73: #include <sys/types.h>
                     74: #include <sys/time.h>
                     75: #include <sys/proc.h>
                     76: #include <sys/filedesc.h>
                     77: #include <sys/vnode.h>
                     78: #include <sys/file.h>
                     79: #include <sys/stat.h>
                     80: #include <sys/mount.h>
                     81: #include <sys/malloc.h>
                     82: #include <sys/namei.h>
                     83: #include <sys/mbuf.h>
                     84: #include <sys/socket.h>
                     85: #include <sys/socketvar.h>
                     86: #include <sys/un.h>
                     87: #include <sys/unpcb.h>
                     88: #include <miscfs/portal/portal.h>
                     89: 
                     90: static int portal_fileid = PORTAL_ROOTFILEID+1;
                     91: 
                     92: static void
                     93: portal_closefd(p, fd)
                     94:        struct proc *p;
                     95:        int fd;
                     96: {
                     97:        int error;
                     98:        struct {
                     99:                int fd;
                    100:        } ua;
                    101:        int rc;
                    102: 
                    103:        ua.fd = fd;
                    104:        error = close(p, &ua, &rc);
                    105:        /*
                    106:         * We should never get an error, and there isn't anything
                    107:         * we could do if we got one, so just print a message.
                    108:         */
                    109:        if (error)
                    110:                printf("portal_closefd: error = %d\n", error);
                    111: }
                    112: 
                    113: /*
                    114:  * vp is the current namei directory
                    115:  * cnp is the name to locate in that directory...
                    116:  */
                    117: int
                    118: portal_lookup(ap)
                    119:        struct vop_lookup_args /* {
                    120:                struct vnode * a_dvp;
                    121:                struct vnode ** a_vpp;
                    122:                struct componentname * a_cnp;
                    123:        } */ *ap;
                    124: {
                    125:        struct componentname *cnp = ap->a_cnp;
                    126:        struct vnode **vpp = ap->a_vpp;
                    127:        struct vnode *dvp = ap->a_dvp;
                    128:        char *pname = cnp->cn_nameptr;
                    129:        struct portalnode *pt;
                    130:        int error;
                    131:        struct vnode *fvp = 0;
                    132:        char *path;
                    133:        int size;
                    134: 
                    135:        *vpp = NULLVP;
                    136: 
                    137:        if (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME)
                    138:                return (EROFS);
                    139: 
                    140:        if (cnp->cn_namelen == 1 && *pname == '.') {
                    141:                *vpp = dvp;
                    142:                VREF(dvp);
                    143:                /*VOP_LOCK(dvp);*/
                    144:                return (0);
                    145:        }
                    146: 
                    147:        error = getnewvnode(VT_PORTAL, dvp->v_mount, portal_vnodeop_p, &fvp);
                    148:        if (error)
                    149:                goto bad;
                    150:        fvp->v_type = VREG;
                    151:        MALLOC(fvp->v_data, void *, sizeof(struct portalnode), M_TEMP,
                    152:            M_WAITOK);
                    153: 
                    154:        pt = VTOPORTAL(fvp);
                    155:        /*
                    156:         * Save all of the remaining pathname and
                    157:         * advance the namei next pointer to the end
                    158:         * of the string.
                    159:         */
                    160:        for (size = 0, path = pname; *path; path++)
                    161:                size++;
                    162:        cnp->cn_consume = size - cnp->cn_namelen;
                    163: 
                    164: //     pt->pt_arg = malloc(size+1, M_TEMP, M_WAITOK);
                    165:        MALLOC(pt->pt_arg, caddr_t, size+1, M_TEMP, M_WAITOK);
                    166:        pt->pt_size = size+1;
                    167:        bcopy(pname, pt->pt_arg, pt->pt_size);
                    168:        pt->pt_fileid = portal_fileid++;
                    169: 
                    170:        *vpp = fvp;
                    171:        /*VOP_LOCK(fvp);*/
                    172:        return (0);
                    173: 
                    174: bad:;
                    175:        if (fvp)
                    176:                vrele(fvp);
                    177:        return (error);
                    178: }
                    179: 
                    180: static int
                    181: portal_connect(so, so2)
                    182:        struct socket *so;
                    183:        struct socket *so2;
                    184: {
                    185:        /* from unp_connect, bypassing the namei stuff... */
                    186:        struct socket *so3;
                    187:        struct unpcb *unp2;
                    188:        struct unpcb *unp3;
                    189: 
                    190:        if (so2 == 0)
                    191:                return (ECONNREFUSED);
                    192: 
                    193:        if (so->so_type != so2->so_type)
                    194:                return (EPROTOTYPE);
                    195: 
                    196:        if ((so2->so_options & SO_ACCEPTCONN) == 0)
                    197:                return (ECONNREFUSED);
                    198: 
                    199:        if ((so3 = sonewconn(so2, 0)) == 0)
                    200:                return (ECONNREFUSED);
                    201: 
                    202:        unp2 = sotounpcb(so2);
                    203:        unp3 = sotounpcb(so3);
                    204:        if (unp2->unp_addr)
                    205:                unp3->unp_addr = m_copy(unp2->unp_addr, 0, (int)M_COPYALL);
                    206: 
                    207:        so2 = so3;
                    208: 
                    209: 
                    210:        return (unp_connect2(so, so2));
                    211: }
                    212: 
                    213: int
                    214: portal_open(ap)
                    215:        struct vop_open_args /* {
                    216:                struct vnode *a_vp;
                    217:                int  a_mode;
                    218:                struct ucred *a_cred;
                    219:                struct proc *a_p;
                    220:        } */ *ap;
                    221: {
                    222:        struct socket *so = 0;
                    223:        struct portalnode *pt;
                    224:        struct proc *p = ap->a_p;
                    225:        struct vnode *vp = ap->a_vp;
                    226:        int s;
                    227:        struct uio auio;
                    228:        struct iovec aiov[2];
                    229:        int res;
                    230:        struct mbuf *cm = 0;
                    231:        struct cmsghdr *cmsg;
                    232:        int newfds;
                    233:        int *ip;
                    234:        int fd;
                    235:        int error;
                    236:        int len;
                    237:        struct portalmount *fmp;
                    238:        struct file *fp;
                    239:        struct portal_cred pcred;
                    240: 
                    241:        /*
                    242:         * Nothing to do when opening the root node.
                    243:         */
                    244:        if (vp->v_flag & VROOT)
                    245:                return (0);
                    246: 
                    247:        /*
                    248:         * Can't be opened unless the caller is set up
                    249:         * to deal with the side effects.  Check for this
                    250:         * by testing whether the p_dupfd has been set.
                    251:         */
                    252:        if (p->p_dupfd >= 0)
                    253:                return (ENODEV);
                    254: 
                    255:        pt = VTOPORTAL(vp);
                    256:        fmp = VFSTOPORTAL(vp->v_mount);
                    257: 
                    258:        /*
                    259:         * Create a new socket.
                    260:         */
                    261:        error = socreate(AF_UNIX, &so, SOCK_STREAM, 0);
                    262:        if (error)
                    263:                goto bad;
                    264: 
                    265:        /*
                    266:         * Reserve some buffer space
                    267:         */
                    268:        res = pt->pt_size + sizeof(pcred) + 512;        /* XXX */
                    269:        error = soreserve(so, res, res);
                    270:        if (error)
                    271:                goto bad;
                    272: 
                    273:        /*
                    274:         * Kick off connection
                    275:         */
                    276:        error = portal_connect(so, (struct socket *)fmp->pm_server->f_data);
                    277:        if (error)
                    278:                goto bad;
                    279: 
                    280:        /*
                    281:         * Wait for connection to complete
                    282:         */
                    283:        /*
                    284:         * XXX: Since the mount point is holding a reference on the
                    285:         * underlying server socket, it is not easy to find out whether
                    286:         * the server process is still running.  To handle this problem
                    287:         * we loop waiting for the new socket to be connected (something
                    288:         * which will only happen if the server is still running) or for
                    289:         * the reference count on the server socket to drop to 1, which
                    290:         * will happen if the server dies.  Sleep for 5 second intervals
                    291:         * and keep polling the reference count.   XXX.
                    292:         */
                    293:        s = splnet();
                    294:        while ((so->so_state & SS_ISCONNECTING) && so->so_error == 0) {
                    295:                if (fmp->pm_server->f_count == 1) {
                    296:                        error = ECONNREFUSED;
                    297:                        splx(s);
                    298:                        goto bad;
                    299:                }
                    300:                (void) tsleep((caddr_t) &so->so_timeo, PSOCK, "portalcon", 5 * hz);
                    301:        }
                    302:        splx(s);
                    303: 
                    304:        if (so->so_error) {
                    305:                error = so->so_error;
                    306:                goto bad;
                    307:        }
                    308:                
                    309:        /*
                    310:         * Set miscellaneous flags
                    311:         */
                    312:        so->so_rcv.sb_timeo = 0;
                    313:        so->so_snd.sb_timeo = 0;
                    314:        so->so_rcv.sb_flags |= SB_NOINTR;
                    315:        so->so_snd.sb_flags |= SB_NOINTR;
                    316: 
                    317: 
                    318:        pcred.pcr_flag = ap->a_mode;
                    319:        pcred.pcr_uid = ap->a_cred->cr_uid;
                    320:        pcred.pcr_ngroups = ap->a_cred->cr_ngroups;
                    321:        bcopy(ap->a_cred->cr_groups, pcred.pcr_groups, NGROUPS * sizeof(gid_t));
                    322:        aiov[0].iov_base = (caddr_t) &pcred;
                    323:        aiov[0].iov_len = sizeof(pcred);
                    324:        aiov[1].iov_base = pt->pt_arg;
                    325:        aiov[1].iov_len = pt->pt_size;
                    326:        auio.uio_iov = aiov;
                    327:        auio.uio_iovcnt = 2;
                    328:        auio.uio_rw = UIO_WRITE;
                    329:        auio.uio_segflg = UIO_SYSSPACE;
                    330:        auio.uio_procp = p;
                    331:        auio.uio_offset = 0;
                    332:        auio.uio_resid = aiov[0].iov_len + aiov[1].iov_len;
                    333: 
                    334:        error = sosend(so, (struct mbuf *) 0, &auio,
                    335:                        (struct mbuf *) 0, (struct mbuf *) 0, 0);
                    336:        if (error)
                    337:                goto bad;
                    338: 
                    339:        len = auio.uio_resid = sizeof(int);
                    340:        do {
                    341:                struct mbuf *m = 0;
                    342:                int flags = MSG_WAITALL;
                    343:                error = soreceive(so, (struct mbuf **) 0, &auio,
                    344:                                        &m, &cm, &flags);
                    345:                if (error)
                    346:                        goto bad;
                    347: 
                    348:                /*
                    349:                 * Grab an error code from the mbuf.
                    350:                 */
                    351:                if (m) {
                    352:                        m = m_pullup(m, sizeof(int));   /* Needed? */
                    353:                        if (m) {
                    354:                                error = *(mtod(m, int *));
                    355:                                m_freem(m);
                    356:                        } else {
                    357:                                error = EINVAL;
                    358:                        }
                    359:                } else {
                    360:                        if (cm == 0) {
                    361:                                error = ECONNRESET;      /* XXX */
                    362: #ifdef notdef
                    363:                                break;
                    364: #endif
                    365:                        }
                    366:                }
                    367:        } while (cm == 0 && auio.uio_resid == len && !error);
                    368: 
                    369:        if (cm == 0)
                    370:                goto bad;
                    371: 
                    372:        if (auio.uio_resid) {
                    373:                error = 0;
                    374: #ifdef notdef
                    375:                error = EMSGSIZE;
                    376:                goto bad;
                    377: #endif
                    378:        }
                    379: 
                    380:        /*
                    381:         * XXX: Break apart the control message, and retrieve the
                    382:         * received file descriptor.  Note that more than one descriptor
                    383:         * may have been received, or that the rights chain may have more
                    384:         * than a single mbuf in it.  What to do?
                    385:         */
                    386:        cmsg = mtod(cm, struct cmsghdr *);
                    387:        newfds = (cmsg->cmsg_len - sizeof(*cmsg)) / sizeof (int);
                    388:        if (newfds == 0) {
                    389:                error = ECONNREFUSED;
                    390:                goto bad;
                    391:        }
                    392:        /*
                    393:         * At this point the rights message consists of a control message
                    394:         * header, followed by a data region containing a vector of
                    395:         * integer file descriptors.  The fds were allocated by the action
                    396:         * of receiving the control message.
                    397:         */
                    398:        ip = (int *) (cmsg + 1);
                    399:        fd = *ip++;
                    400:        if (newfds > 1) {
                    401:                /*
                    402:                 * Close extra fds.
                    403:                 */
                    404:                int i;
                    405:                printf("portal_open: %d extra fds\n", newfds - 1);
                    406:                for (i = 1; i < newfds; i++) {
                    407:                        portal_closefd(p, *ip);
                    408:                        ip++;
                    409:                }
                    410:        }
                    411: 
                    412:        /*
                    413:         * Check that the mode the file is being opened for is a subset 
                    414:         * of the mode of the existing descriptor.
                    415:         */
                    416:        fp = *fdfile(p, fd);
                    417:        if (((ap->a_mode & (FREAD|FWRITE)) | fp->f_flag) != fp->f_flag) {
                    418:                portal_closefd(p, fd);
                    419:                error = EACCES;
                    420:                goto bad;
                    421:        }
                    422: 
                    423:        /*
                    424:         * Save the dup fd in the proc structure then return the
                    425:         * special error code (ENXIO) which causes magic things to
                    426:         * happen in vn_open.  The whole concept is, well, hmmm.
                    427:         */
                    428:        p->p_dupfd = fd;
                    429:        error = ENXIO;
                    430: 
                    431: bad:;
                    432:        /*
                    433:         * And discard the control message.
                    434:         */
                    435:        if (cm) { 
                    436:                m_freem(cm);
                    437:        }
                    438: 
                    439:        if (so) {
                    440:                soshutdown(so, 2);
                    441:                soclose(so);
                    442:        }
                    443:        return (error);
                    444: }
                    445: 
                    446: int
                    447: portal_getattr(ap)
                    448:        struct vop_getattr_args /* {
                    449:                struct vnode *a_vp;
                    450:                struct vattr *a_vap;
                    451:                struct ucred *a_cred;
                    452:                struct proc *a_p;
                    453:        } */ *ap;
                    454: {
                    455:        struct vnode *vp = ap->a_vp;
                    456:        struct vattr *vap = ap->a_vap;
                    457:        struct timeval tv;
                    458: 
                    459:        bzero(vap, sizeof(*vap));
                    460:        vattr_null(vap);
                    461:        vap->va_uid = 0;
                    462:        vap->va_gid = 0;
                    463:        vap->va_fsid = vp->v_mount->mnt_stat.f_fsid.val[0];
                    464:        vap->va_size = DEV_BSIZE;
                    465:        vap->va_blocksize = DEV_BSIZE;
                    466:        microtime(&tv);
                    467:        TIMEVAL_TO_TIMESPEC(&tv, &vap->va_atime);
                    468:        vap->va_mtime = vap->va_atime;
                    469:        vap->va_ctime = vap->va_ctime;
                    470:        vap->va_gen = 0;
                    471:        vap->va_flags = 0;
                    472:        vap->va_rdev = 0;
                    473:        /* vap->va_qbytes = 0; */
                    474:        vap->va_bytes = 0;
                    475:        /* vap->va_qsize = 0; */
                    476:        if (vp->v_flag & VROOT) {
                    477:                vap->va_type = VDIR;
                    478:                vap->va_mode = S_IRUSR|S_IWUSR|S_IXUSR|
                    479:                                S_IRGRP|S_IWGRP|S_IXGRP|
                    480:                                S_IROTH|S_IWOTH|S_IXOTH;
                    481:                vap->va_nlink = 2;
                    482:                vap->va_fileid = 2;
                    483:        } else {
                    484:                vap->va_type = VREG;
                    485:                vap->va_mode = S_IRUSR|S_IWUSR|
                    486:                                S_IRGRP|S_IWGRP|
                    487:                                S_IROTH|S_IWOTH;
                    488:                vap->va_nlink = 1;
                    489:                vap->va_fileid = VTOPORTAL(vp)->pt_fileid;
                    490:        }
                    491:        return (0);
                    492: }
                    493: 
                    494: int
                    495: portal_setattr(ap)
                    496:        struct vop_setattr_args /* {
                    497:                struct vnode *a_vp;
                    498:                struct vattr *a_vap;
                    499:                struct ucred *a_cred;
                    500:                struct proc *a_p;
                    501:        } */ *ap;
                    502: {
                    503: 
                    504:        /*
                    505:         * Can't mess with the root vnode
                    506:         */
                    507:        if (ap->a_vp->v_flag & VROOT)
                    508:                return (EACCES);
                    509: 
                    510:        return (0);
                    511: }
                    512: 
                    513: /*
                    514:  * Fake readdir, just return empty directory.
                    515:  * It is hard to deal with '.' and '..' so don't bother.
                    516:  */
                    517: int
                    518: portal_readdir(ap)
                    519:        struct vop_readdir_args /* {
                    520:                struct vnode *a_vp;
                    521:                struct uio *a_uio;
                    522:                struct ucred *a_cred;
                    523:                int *a_eofflag;
                    524:                u_long *a_cookies;
                    525:                int a_ncookies;
                    526:        } */ *ap;
                    527: {
                    528: 
                    529:        /*
                    530:         * We don't allow exporting portal mounts, and currently local
                    531:         * requests do not need cookies.
                    532:         */
                    533:        if (ap->a_ncookies)
                    534:                panic("portal_readdir: not hungry");
                    535: 
                    536:        return (0);
                    537: }
                    538: 
                    539: int
                    540: portal_inactive(ap)
                    541:        struct vop_inactive_args /* {
                    542:                struct vnode *a_vp;
                    543:                struct proc *a_p;
                    544:        } */ *ap;
                    545: {
                    546: 
                    547:        VOP_UNLOCK(ap->a_vp, 0, ap->a_p);
                    548:        return (0);
                    549: }
                    550: 
                    551: int
                    552: portal_reclaim(ap)
                    553:        struct vop_reclaim_args /* {
                    554:                struct vnode *a_vp;
                    555:        } */ *ap;
                    556: {
                    557:        struct portalnode *pt = VTOPORTAL(ap->a_vp);
                    558: 
                    559:        if (pt->pt_arg) {
                    560:                _FREE((caddr_t) pt->pt_arg, M_TEMP);
                    561:                pt->pt_arg = 0;
                    562:        }
                    563:        FREE(ap->a_vp->v_data, M_TEMP);
                    564:        ap->a_vp->v_data = 0;
                    565: 
                    566:        return (0);
                    567: }
                    568: 
                    569: /*
                    570:  * Return POSIX pathconf information applicable to special devices.
                    571:  */
                    572: portal_pathconf(ap)
                    573:        struct vop_pathconf_args /* {
                    574:                struct vnode *a_vp;
                    575:                int a_name;
                    576:                int *a_retval;
                    577:        } */ *ap;
                    578: {
                    579: 
                    580:        switch (ap->a_name) {
                    581:        case _PC_LINK_MAX:
                    582:                *ap->a_retval = LINK_MAX;
                    583:                return (0);
                    584:        case _PC_MAX_CANON:
                    585:                *ap->a_retval = MAX_CANON;
                    586:                return (0);
                    587:        case _PC_MAX_INPUT:
                    588:                *ap->a_retval = MAX_INPUT;
                    589:                return (0);
                    590:        case _PC_PIPE_BUF:
                    591:                *ap->a_retval = PIPE_BUF;
                    592:                return (0);
                    593:        case _PC_CHOWN_RESTRICTED:
                    594:                *ap->a_retval = 1;
                    595:                return (0);
                    596:        case _PC_VDISABLE:
                    597:                *ap->a_retval = _POSIX_VDISABLE;
                    598:                return (0);
                    599:        default:
                    600:                return (EINVAL);
                    601:        }
                    602:        /* NOTREACHED */
                    603: }
                    604: 
                    605: /*
                    606:  * Print out the contents of a Portal vnode.
                    607:  */
                    608: /* ARGSUSED */
                    609: int
                    610: portal_print(ap)
                    611:        struct vop_print_args /* {
                    612:                struct vnode *a_vp;
                    613:        } */ *ap;
                    614: {
                    615: 
                    616:        printf("tag VT_PORTAL, portal vnode\n");
                    617:        return (0);
                    618: }
                    619: 
                    620: /*void*/
                    621: int
                    622: portal_vfree(ap)
                    623:        struct vop_vfree_args /* {
                    624:                struct vnode *a_pvp;
                    625:                ino_t a_ino;
                    626:                int a_mode;
                    627:        } */ *ap;
                    628: {
                    629: 
                    630:        return (0);
                    631: }
                    632: 
                    633: 
                    634: /*
                    635:  * Portal vnode unsupported operation
                    636:  */
                    637: int
                    638: portal_enotsupp()
                    639: {
                    640: 
                    641:        return (EOPNOTSUPP);
                    642: }
                    643: 
                    644: /*
                    645:  * Portal "should never get here" operation
                    646:  */
                    647: int
                    648: portal_badop()
                    649: {
                    650: 
                    651:        panic("portal: bad op");
                    652:        /* NOTREACHED */
                    653: }
                    654: 
                    655: /*
                    656:  * Portal vnode null operation
                    657:  */
                    658: int
                    659: portal_nullop()
                    660: {
                    661: 
                    662:        return (0);
                    663: }
                    664: 
                    665: #define portal_create ((int (*) __P((struct vop_create_args *)))portal_enotsupp)
                    666: #define portal_mknod ((int (*) __P((struct  vop_mknod_args *)))portal_enotsupp)
                    667: #define portal_close ((int (*) __P((struct  vop_close_args *)))nullop)
                    668: #define portal_access ((int (*) __P((struct  vop_access_args *)))nullop)
                    669: #define portal_read ((int (*) __P((struct  vop_read_args *)))portal_enotsupp)
                    670: #define portal_write ((int (*) __P((struct  vop_write_args *)))portal_enotsupp)
                    671: #define portal_pagein ((int (*) __P((struct  vop_pagein_args *)))portal_enotsupp)
                    672: #define portal_pageout ((int (*) __P((struct  vop_pageout_args *)))portal_enotsupp)
                    673: #define portal_ioctl ((int (*) __P((struct  vop_ioctl_args *)))portal_enotsupp)
                    674: #define portal_select ((int (*) __P((struct vop_select_args *)))portal_enotsupp)
                    675: #define portal_mmap ((int (*) __P((struct  vop_mmap_args *)))portal_enotsupp)
                    676: #define        portal_revoke vop_revoke
                    677: #define portal_fsync ((int (*) __P((struct  vop_fsync_args *)))nullop)
                    678: #define portal_seek ((int (*) __P((struct  vop_seek_args *)))nullop)
                    679: #define portal_remove ((int (*) __P((struct vop_remove_args *)))portal_enotsupp)
                    680: #define portal_link ((int (*) __P((struct  vop_link_args *)))portal_enotsupp)
                    681: #define portal_rename ((int (*) __P((struct vop_rename_args *)))portal_enotsupp)
                    682: #define portal_mkdir ((int (*) __P((struct  vop_mkdir_args *)))portal_enotsupp)
                    683: #define portal_rmdir ((int (*) __P((struct  vop_rmdir_args *)))portal_enotsupp)
                    684: #define portal_symlink \
                    685:        ((int (*) __P((struct  vop_symlink_args *)))portal_enotsupp)
                    686: #define portal_readlink \
                    687:        ((int (*) __P((struct  vop_readlink_args *)))portal_enotsupp)
                    688: #define portal_abortop ((int (*) __P((struct  vop_abortop_args *)))nullop)
                    689: #define portal_lock ((int (*) __P((struct  vop_lock_args *)))vop_nolock)
                    690: #define portal_unlock ((int (*) __P((struct  vop_unlock_args *)))vop_nounlock)
                    691: #define portal_bmap ((int (*) __P((struct  vop_bmap_args *)))portal_badop)
                    692: #define portal_strategy \
                    693:        ((int (*) __P((struct  vop_strategy_args *)))portal_badop)
                    694: #define portal_islocked \
                    695:        ((int (*) __P((struct vop_islocked_args *)))vop_noislocked)
                    696: #define fifo_islocked ((int(*) __P((struct vop_islocked_args *)))vop_noislocked)
                    697: #define portal_advlock \
                    698:        ((int (*) __P((struct  vop_advlock_args *)))portal_enotsupp)
                    699: #define portal_blkatoff \
                    700:        ((int (*) __P((struct  vop_blkatoff_args *)))portal_enotsupp)
                    701: #define portal_valloc ((int(*) __P(( \
                    702:                struct vnode *pvp, \
                    703:                int mode, \
                    704:                struct ucred *cred, \
                    705:                struct vnode **vpp))) portal_enotsupp)
                    706: #define portal_truncate \
                    707:        ((int (*) __P((struct  vop_truncate_args *)))portal_enotsupp)
                    708: #define portal_update ((int (*) __P((struct vop_update_args *)))portal_enotsupp)
                    709: #define portal_bwrite ((int (*) __P((struct vop_bwrite_args *)))portal_enotsupp)
                    710: 
                    711: int (**portal_vnodeop_p)();
                    712: struct vnodeopv_entry_desc portal_vnodeop_entries[] = {
                    713:        { &vop_default_desc, vn_default_error },
                    714:        { &vop_lookup_desc, portal_lookup },            /* lookup */
                    715:        { &vop_create_desc, portal_create },            /* create */
                    716:        { &vop_mknod_desc, portal_mknod },              /* mknod */
                    717:        { &vop_open_desc, portal_open },                /* open */
                    718:        { &vop_close_desc, portal_close },              /* close */
                    719:        { &vop_access_desc, portal_access },            /* access */
                    720:        { &vop_getattr_desc, portal_getattr },          /* getattr */
                    721:        { &vop_setattr_desc, portal_setattr },          /* setattr */
                    722:        { &vop_read_desc, portal_read },                /* read */
                    723:        { &vop_write_desc, portal_write },              /* write */
                    724:        { &vop_ioctl_desc, portal_ioctl },              /* ioctl */
                    725:        { &vop_select_desc, portal_select },            /* select */
                    726:        { &vop_mmap_desc, portal_mmap },                /* mmap */
                    727:        { &vop_revoke_desc, portal_revoke },            /* revoke */
                    728:        { &vop_fsync_desc, portal_fsync },              /* fsync */
                    729:        { &vop_seek_desc, portal_seek },                /* seek */
                    730:        { &vop_remove_desc, portal_remove },            /* remove */
                    731:        { &vop_link_desc, portal_link },                /* link */
                    732:        { &vop_rename_desc, portal_rename },            /* rename */
                    733:        { &vop_mkdir_desc, portal_mkdir },              /* mkdir */
                    734:        { &vop_rmdir_desc, portal_rmdir },              /* rmdir */
                    735:        { &vop_symlink_desc, portal_symlink },          /* symlink */
                    736:        { &vop_readdir_desc, portal_readdir },          /* readdir */
                    737:        { &vop_readlink_desc, portal_readlink },        /* readlink */
                    738:        { &vop_abortop_desc, portal_abortop },          /* abortop */
                    739:        { &vop_inactive_desc, portal_inactive },        /* inactive */
                    740:        { &vop_reclaim_desc, portal_reclaim },          /* reclaim */
                    741:        { &vop_lock_desc, portal_lock },                /* lock */
                    742:        { &vop_unlock_desc, portal_unlock },            /* unlock */
                    743:        { &vop_bmap_desc, portal_bmap },                /* bmap */
                    744:        { &vop_strategy_desc, portal_strategy },        /* strategy */
                    745:        { &vop_print_desc, portal_print },              /* print */
                    746:        { &vop_islocked_desc, portal_islocked },        /* islocked */
                    747:        { &vop_pathconf_desc, portal_pathconf },        /* pathconf */
                    748:        { &vop_advlock_desc, portal_advlock },          /* advlock */
                    749:        { &vop_blkatoff_desc, portal_blkatoff },        /* blkatoff */
                    750:        { &vop_valloc_desc, portal_valloc },            /* valloc */
                    751:        { &vop_vfree_desc, portal_vfree },              /* vfree */
                    752:        { &vop_truncate_desc, portal_truncate },        /* truncate */
                    753:        { &vop_update_desc, portal_update },            /* update */
                    754:        { &vop_bwrite_desc, portal_bwrite },            /* bwrite */
                    755:        { &vop_pagein_desc, portal_pagein },            /* Pagein */
                    756:        { &vop_pageout_desc, portal_pageout },          /* Pageout */
                    757:        { (struct vnodeop_desc*)NULL, (int(*)())NULL }
                    758: };
                    759: struct vnodeopv_desc portal_vnodeop_opv_desc =
                    760:        { &portal_vnodeop_p, portal_vnodeop_entries };

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.