153846Spendry /* 263246Sbostic * Copyright (c) 1992, 1993 363246Sbostic * The Regents of the University of California. All rights reserved. 453846Spendry * 553846Spendry * This code is derived from software donated to Berkeley by 653846Spendry * Jan-Simon Pendry. 753846Spendry * 853846Spendry * %sccs.include.redist.c% 953846Spendry * 10*68731Smckusick * @(#)portal_vnops.c 8.11 (Berkeley) 04/03/95 1153846Spendry * 1253846Spendry * $Id: portal_vnops.c,v 1.4 1992/05/30 10:05:24 jsp Exp jsp $ 1353846Spendry */ 1453846Spendry 1553846Spendry /* 1653846Spendry * Portal Filesystem 1753846Spendry */ 1853846Spendry 1953846Spendry #include <sys/param.h> 2053846Spendry #include <sys/systm.h> 2153846Spendry #include <sys/kernel.h> 2253846Spendry #include <sys/types.h> 2353846Spendry #include <sys/time.h> 2453846Spendry #include <sys/proc.h> 2553846Spendry #include <sys/filedesc.h> 2653846Spendry #include <sys/vnode.h> 2753846Spendry #include <sys/file.h> 2853846Spendry #include <sys/stat.h> 2953846Spendry #include <sys/mount.h> 3053846Spendry #include <sys/malloc.h> 3153846Spendry #include <sys/namei.h> 3253846Spendry #include <sys/mbuf.h> 3353846Spendry #include <sys/socket.h> 3453846Spendry #include <sys/socketvar.h> 3553846Spendry #include <sys/un.h> 3653846Spendry #include <sys/unpcb.h> 3755027Smckusick #include <miscfs/portal/portal.h> 3853846Spendry 3953846Spendry static int portal_fileid = PORTAL_ROOTFILEID+1; 4053846Spendry 4153846Spendry static void 4253846Spendry portal_closefd(p, fd) 4353846Spendry struct proc *p; 4453846Spendry int fd; 4553846Spendry { 4653846Spendry int error; 4753846Spendry struct { 4853846Spendry int fd; 4953846Spendry } ua; 5053846Spendry int rc; 5153846Spendry 5253846Spendry ua.fd = fd; 5353846Spendry error = close(p, &ua, &rc); 5453846Spendry /* 5553846Spendry * We should never get an error, and there isn't anything 5653846Spendry * we could do if we got one, so just print a message. 5753846Spendry */ 5853846Spendry if (error) 5953846Spendry printf("portal_closefd: error = %d\n", error); 6053846Spendry } 6153846Spendry 6253846Spendry /* 6353846Spendry * vp is the current namei directory 6453846Spendry * cnp is the name to locate in that directory... 6553846Spendry */ 6665516Spendry int 6755027Smckusick portal_lookup(ap) 6855027Smckusick struct vop_lookup_args /* { 6955027Smckusick struct vnode * a_dvp; 7055027Smckusick struct vnode ** a_vpp; 7155027Smckusick struct componentname * a_cnp; 7255027Smckusick } */ *ap; 7353846Spendry { 7453846Spendry char *pname = ap->a_cnp->cn_nameptr; 7553846Spendry struct portalnode *pt; 7653846Spendry int error; 7753846Spendry struct vnode *fvp = 0; 7853846Spendry char *path; 7953846Spendry int size; 8053846Spendry 8153846Spendry if (ap->a_cnp->cn_namelen == 1 && *pname == '.') { 8253846Spendry *ap->a_vpp = ap->a_dvp; 8353846Spendry VREF(ap->a_dvp); 8453846Spendry /*VOP_LOCK(ap->a_dvp);*/ 8553846Spendry return (0); 8653846Spendry } 8753846Spendry 8853846Spendry 8965380Spendry error = getnewvnode(VT_PORTAL, ap->a_dvp->v_mount, portal_vnodeop_p, &fvp); 9053846Spendry if (error) 9153846Spendry goto bad; 9253846Spendry fvp->v_type = VREG; 9353846Spendry MALLOC(fvp->v_data, void *, sizeof(struct portalnode), 9453846Spendry M_TEMP, M_WAITOK); 9553846Spendry 9653846Spendry pt = VTOPORTAL(fvp); 9753846Spendry /* 9853846Spendry * Save all of the remaining pathname and 9953846Spendry * advance the namei next pointer to the end 10053846Spendry * of the string. 10153846Spendry */ 10253846Spendry for (size = 0, path = pname; *path; path++) 10353846Spendry size++; 10454978Spendry ap->a_cnp->cn_consume = size - ap->a_cnp->cn_namelen; 10554978Spendry 10653846Spendry pt->pt_arg = malloc(size+1, M_TEMP, M_WAITOK); 10753846Spendry pt->pt_size = size+1; 10853846Spendry bcopy(pname, pt->pt_arg, pt->pt_size); 10953846Spendry pt->pt_fileid = portal_fileid++; 11053846Spendry 11153846Spendry *ap->a_vpp = fvp; 11253846Spendry /*VOP_LOCK(fvp);*/ 11353846Spendry return (0); 11453846Spendry 11553846Spendry bad:; 11653846Spendry if (fvp) { 11753846Spendry vrele(fvp); 11853846Spendry } 11953846Spendry *ap->a_vpp = NULL; 12053846Spendry return (error); 12153846Spendry } 12253846Spendry 12353846Spendry static int 12453846Spendry portal_connect(so, so2) 12553846Spendry struct socket *so; 12653846Spendry struct socket *so2; 12753846Spendry { 12853846Spendry /* from unp_connect, bypassing the namei stuff... */ 12953846Spendry struct socket *so3; 13053846Spendry struct unpcb *unp2; 13153846Spendry struct unpcb *unp3; 13253846Spendry 13353846Spendry if (so2 == 0) 13453846Spendry return (ECONNREFUSED); 13553846Spendry 13653846Spendry if (so->so_type != so2->so_type) 13753846Spendry return (EPROTOTYPE); 13853846Spendry 13953846Spendry if ((so2->so_options & SO_ACCEPTCONN) == 0) 14053846Spendry return (ECONNREFUSED); 14153846Spendry 14253846Spendry if ((so3 = sonewconn(so2, 0)) == 0) 14353846Spendry return (ECONNREFUSED); 14453846Spendry 14553846Spendry unp2 = sotounpcb(so2); 14653846Spendry unp3 = sotounpcb(so3); 14753846Spendry if (unp2->unp_addr) 14853846Spendry unp3->unp_addr = m_copy(unp2->unp_addr, 0, (int)M_COPYALL); 14953846Spendry 15053846Spendry so2 = so3; 15153846Spendry 15253846Spendry 15353846Spendry return (unp_connect2(so, so2)); 15453846Spendry } 15553846Spendry 15665516Spendry int 15755027Smckusick portal_open(ap) 15855027Smckusick struct vop_open_args /* { 15955027Smckusick struct vnode *a_vp; 16055027Smckusick int a_mode; 16155027Smckusick struct ucred *a_cred; 16255027Smckusick struct proc *a_p; 16355027Smckusick } */ *ap; 16453846Spendry { 16553846Spendry struct socket *so = 0; 16653846Spendry struct portalnode *pt; 16755910Spendry struct proc *p = ap->a_p; 16855910Spendry struct vnode *vp = ap->a_vp; 16953846Spendry int s; 17053846Spendry struct uio auio; 17153846Spendry struct iovec aiov[2]; 17253846Spendry int res; 17353846Spendry struct mbuf *cm = 0; 17453846Spendry struct cmsghdr *cmsg; 17553846Spendry int newfds; 17653846Spendry int *ip; 17753846Spendry int fd; 17853846Spendry int error; 17953846Spendry int len; 18053846Spendry struct portalmount *fmp; 18153846Spendry struct file *fp; 18253846Spendry struct portal_cred pcred; 18353846Spendry 18453846Spendry /* 18553846Spendry * Nothing to do when opening the root node. 18653846Spendry */ 18755910Spendry if (vp->v_flag & VROOT) 18853846Spendry return (0); 18953846Spendry 19053846Spendry /* 19153846Spendry * Can't be opened unless the caller is set up 19253846Spendry * to deal with the side effects. Check for this 19353846Spendry * by testing whether the p_dupfd has been set. 19453846Spendry */ 19555910Spendry if (p->p_dupfd >= 0) 19653846Spendry return (ENODEV); 19753846Spendry 19855910Spendry pt = VTOPORTAL(vp); 19955910Spendry fmp = VFSTOPORTAL(vp->v_mount); 20053846Spendry 20153846Spendry /* 20253846Spendry * Create a new socket. 20353846Spendry */ 20453846Spendry error = socreate(AF_UNIX, &so, SOCK_STREAM, 0); 20553846Spendry if (error) 20653846Spendry goto bad; 20753846Spendry 20853846Spendry /* 20953846Spendry * Reserve some buffer space 21053846Spendry */ 21154978Spendry res = pt->pt_size + sizeof(pcred) + 512; /* XXX */ 21253846Spendry error = soreserve(so, res, res); 21353846Spendry if (error) 21453846Spendry goto bad; 21553846Spendry 21653846Spendry /* 21753846Spendry * Kick off connection 21853846Spendry */ 21953846Spendry error = portal_connect(so, (struct socket *)fmp->pm_server->f_data); 22053846Spendry if (error) 22153846Spendry goto bad; 22253846Spendry 22353846Spendry /* 22453846Spendry * Wait for connection to complete 22553846Spendry */ 22653846Spendry /* 22753846Spendry * XXX: Since the mount point is holding a reference on the 22853846Spendry * underlying server socket, it is not easy to find out whether 22953846Spendry * the server process is still running. To handle this problem 23053846Spendry * we loop waiting for the new socket to be connected (something 23153846Spendry * which will only happen if the server is still running) or for 23253846Spendry * the reference count on the server socket to drop to 1, which 23353846Spendry * will happen if the server dies. Sleep for 5 second intervals 23453846Spendry * and keep polling the reference count. XXX. 23553846Spendry */ 23653846Spendry s = splnet(); 23753846Spendry while ((so->so_state & SS_ISCONNECTING) && so->so_error == 0) { 23853846Spendry if (fmp->pm_server->f_count == 1) { 23953846Spendry error = ECONNREFUSED; 24053846Spendry splx(s); 24153846Spendry goto bad; 24253846Spendry } 24353846Spendry (void) tsleep((caddr_t) &so->so_timeo, PSOCK, "portalcon", 5 * hz); 24453846Spendry } 24553846Spendry splx(s); 24653846Spendry 24753846Spendry if (so->so_error) { 24853846Spendry error = so->so_error; 24953846Spendry goto bad; 25053846Spendry } 25153846Spendry 25253846Spendry /* 25353846Spendry * Set miscellaneous flags 25453846Spendry */ 25553846Spendry so->so_rcv.sb_timeo = 0; 25653846Spendry so->so_snd.sb_timeo = 0; 25753846Spendry so->so_rcv.sb_flags |= SB_NOINTR; 25853846Spendry so->so_snd.sb_flags |= SB_NOINTR; 25953846Spendry 26053846Spendry 26154978Spendry pcred.pcr_flag = ap->a_mode; 26253846Spendry pcred.pcr_uid = ap->a_cred->cr_uid; 26354978Spendry pcred.pcr_ngroups = ap->a_cred->cr_ngroups; 26454978Spendry bcopy(ap->a_cred->cr_groups, pcred.pcr_groups, NGROUPS * sizeof(gid_t)); 26553846Spendry aiov[0].iov_base = (caddr_t) &pcred; 26653846Spendry aiov[0].iov_len = sizeof(pcred); 26753846Spendry aiov[1].iov_base = pt->pt_arg; 26853846Spendry aiov[1].iov_len = pt->pt_size; 26953846Spendry auio.uio_iov = aiov; 27053846Spendry auio.uio_iovcnt = 2; 27153846Spendry auio.uio_rw = UIO_WRITE; 27253846Spendry auio.uio_segflg = UIO_SYSSPACE; 27355910Spendry auio.uio_procp = p; 27453846Spendry auio.uio_offset = 0; 27553846Spendry auio.uio_resid = aiov[0].iov_len + aiov[1].iov_len; 27653846Spendry 27765492Spendry error = sosend(so, (struct mbuf *) 0, &auio, 27853846Spendry (struct mbuf *) 0, (struct mbuf *) 0, 0); 27953846Spendry if (error) 28053846Spendry goto bad; 28153846Spendry 28253846Spendry len = auio.uio_resid = sizeof(int); 28353846Spendry do { 28453846Spendry struct mbuf *m = 0; 28553846Spendry int flags = MSG_WAITALL; 28653846Spendry error = soreceive(so, (struct mbuf **) 0, &auio, 28753846Spendry &m, &cm, &flags); 28853846Spendry if (error) 28953846Spendry goto bad; 29053846Spendry 29153846Spendry /* 29253846Spendry * Grab an error code from the mbuf. 29353846Spendry */ 29453846Spendry if (m) { 29553846Spendry m = m_pullup(m, sizeof(int)); /* Needed? */ 29653846Spendry if (m) { 29753846Spendry error = *(mtod(m, int *)); 29853846Spendry m_freem(m); 29953846Spendry } else { 30053846Spendry error = EINVAL; 30153846Spendry } 30253846Spendry } else { 30353846Spendry if (cm == 0) { 30453846Spendry error = ECONNRESET; /* XXX */ 30553846Spendry #ifdef notdef 30653846Spendry break; 30753846Spendry #endif 30853846Spendry } 30953846Spendry } 31053846Spendry } while (cm == 0 && auio.uio_resid == len && !error); 31153846Spendry 31253846Spendry if (cm == 0) 31353846Spendry goto bad; 31453846Spendry 31553846Spendry if (auio.uio_resid) { 31653846Spendry error = 0; 31753846Spendry #ifdef notdef 31853846Spendry error = EMSGSIZE; 31953846Spendry goto bad; 32053846Spendry #endif 32153846Spendry } 32253846Spendry 32353846Spendry /* 32453846Spendry * XXX: Break apart the control message, and retrieve the 32553846Spendry * received file descriptor. Note that more than one descriptor 32653846Spendry * may have been received, or that the rights chain may have more 32753846Spendry * than a single mbuf in it. What to do? 32853846Spendry */ 32953846Spendry cmsg = mtod(cm, struct cmsghdr *); 33053846Spendry newfds = (cmsg->cmsg_len - sizeof(*cmsg)) / sizeof (int); 33153846Spendry if (newfds == 0) { 33253846Spendry error = ECONNREFUSED; 33353846Spendry goto bad; 33453846Spendry } 33553846Spendry /* 33653846Spendry * At this point the rights message consists of a control message 33753846Spendry * header, followed by a data region containing a vector of 33853846Spendry * integer file descriptors. The fds were allocated by the action 33953846Spendry * of receiving the control message. 34053846Spendry */ 34153846Spendry ip = (int *) (cmsg + 1); 34253846Spendry fd = *ip++; 34353846Spendry if (newfds > 1) { 34453846Spendry /* 34553846Spendry * Close extra fds. 34653846Spendry */ 34753846Spendry int i; 34853846Spendry printf("portal_open: %d extra fds\n", newfds - 1); 34953846Spendry for (i = 1; i < newfds; i++) { 35055910Spendry portal_closefd(p, *ip); 35153846Spendry ip++; 35253846Spendry } 35353846Spendry } 35453846Spendry 35553846Spendry /* 35655910Spendry * Check that the mode the file is being opened for is a subset 35755910Spendry * of the mode of the existing descriptor. 35853846Spendry */ 35955910Spendry fp = p->p_fd->fd_ofiles[fd]; 36053846Spendry if (((ap->a_mode & (FREAD|FWRITE)) | fp->f_flag) != fp->f_flag) { 36155910Spendry portal_closefd(p, fd); 36253846Spendry error = EACCES; 36353846Spendry goto bad; 36453846Spendry } 36553846Spendry 36653846Spendry /* 36753846Spendry * Save the dup fd in the proc structure then return the 36853846Spendry * special error code (ENXIO) which causes magic things to 36953846Spendry * happen in vn_open. The whole concept is, well, hmmm. 37053846Spendry */ 37155910Spendry p->p_dupfd = fd; 37253846Spendry error = ENXIO; 37353846Spendry 37453846Spendry bad:; 37553846Spendry /* 37653846Spendry * And discard the control message. 37753846Spendry */ 37853846Spendry if (cm) { 37953846Spendry m_freem(cm); 38053846Spendry } 38153846Spendry 38253846Spendry if (so) { 38353846Spendry soshutdown(so, 2); 38453846Spendry soclose(so); 38553846Spendry } 38653846Spendry return (error); 38753846Spendry } 38853846Spendry 38965516Spendry int 39055027Smckusick portal_getattr(ap) 39155027Smckusick struct vop_getattr_args /* { 39255027Smckusick struct vnode *a_vp; 39355027Smckusick struct vattr *a_vap; 39455027Smckusick struct ucred *a_cred; 39555027Smckusick struct proc *a_p; 39655027Smckusick } */ *ap; 39753846Spendry { 39855910Spendry struct vnode *vp = ap->a_vp; 39955910Spendry struct vattr *vap = ap->a_vap; 40068172Scgd struct timeval tv; 40153846Spendry 40265450Sbostic bzero(vap, sizeof(*vap)); 40355910Spendry vattr_null(vap); 40455910Spendry vap->va_uid = 0; 40555910Spendry vap->va_gid = 0; 40655910Spendry vap->va_fsid = vp->v_mount->mnt_stat.f_fsid.val[0]; 40755910Spendry vap->va_size = DEV_BSIZE; 40855910Spendry vap->va_blocksize = DEV_BSIZE; 40968172Scgd microtime(&tv); 41068172Scgd TIMEVAL_TO_TIMESPEC(&tv, &vap->va_atime); 41155910Spendry vap->va_mtime = vap->va_atime; 41255910Spendry vap->va_ctime = vap->va_ctime; 41355910Spendry vap->va_gen = 0; 41455910Spendry vap->va_flags = 0; 41555910Spendry vap->va_rdev = 0; 41655910Spendry /* vap->va_qbytes = 0; */ 41755910Spendry vap->va_bytes = 0; 41855910Spendry /* vap->va_qsize = 0; */ 41955910Spendry if (vp->v_flag & VROOT) { 42055910Spendry vap->va_type = VDIR; 42155910Spendry vap->va_mode = S_IRUSR|S_IWUSR|S_IXUSR| 42253846Spendry S_IRGRP|S_IWGRP|S_IXGRP| 42353846Spendry S_IROTH|S_IWOTH|S_IXOTH; 42455910Spendry vap->va_nlink = 2; 42555910Spendry vap->va_fileid = 2; 42653846Spendry } else { 42755910Spendry vap->va_type = VREG; 42855910Spendry vap->va_mode = S_IRUSR|S_IWUSR| 42953846Spendry S_IRGRP|S_IWGRP| 43053846Spendry S_IROTH|S_IWOTH; 43155910Spendry vap->va_nlink = 1; 43255910Spendry vap->va_fileid = VTOPORTAL(vp)->pt_fileid; 43353846Spendry } 43453846Spendry return (0); 43553846Spendry } 43653846Spendry 43765516Spendry int 43855027Smckusick portal_setattr(ap) 43955027Smckusick struct vop_setattr_args /* { 44055027Smckusick struct vnode *a_vp; 44155027Smckusick struct vattr *a_vap; 44255027Smckusick struct ucred *a_cred; 44355027Smckusick struct proc *a_p; 44455027Smckusick } */ *ap; 44553846Spendry { 44665516Spendry 44753846Spendry /* 44853846Spendry * Can't mess with the root vnode 44953846Spendry */ 45053846Spendry if (ap->a_vp->v_flag & VROOT) 45153846Spendry return (EACCES); 45253846Spendry 45353846Spendry return (0); 45453846Spendry } 45553846Spendry 45653846Spendry /* 45753846Spendry * Fake readdir, just return empty directory. 45853846Spendry * It is hard to deal with '.' and '..' so don't bother. 45953846Spendry */ 46065516Spendry int 46155027Smckusick portal_readdir(ap) 46255027Smckusick struct vop_readdir_args /* { 46355027Smckusick struct vnode *a_vp; 46455027Smckusick struct uio *a_uio; 46555027Smckusick struct ucred *a_cred; 46667366Smckusick int *a_eofflag; 46767366Smckusick u_long *a_cookies; 46867366Smckusick int a_ncookies; 46955027Smckusick } */ *ap; 47053846Spendry { 47165516Spendry 47267366Smckusick /* 47367366Smckusick * We don't allow exporting portal mounts, and currently local 47467366Smckusick * requests do not need cookies. 47567366Smckusick */ 47667366Smckusick if (ap->a_ncookies) 47767366Smckusick panic("portal_readdir: not hungry"); 47867366Smckusick 47953846Spendry return (0); 48053846Spendry } 48153846Spendry 48265516Spendry int 48355027Smckusick portal_inactive(ap) 48455027Smckusick struct vop_inactive_args /* { 48555027Smckusick struct vnode *a_vp; 48655027Smckusick } */ *ap; 48753846Spendry { 48865516Spendry 48953846Spendry return (0); 49053846Spendry } 49153846Spendry 49265516Spendry int 49355027Smckusick portal_reclaim(ap) 49455027Smckusick struct vop_reclaim_args /* { 49555027Smckusick struct vnode *a_vp; 49655027Smckusick } */ *ap; 49753846Spendry { 49853846Spendry struct portalnode *pt = VTOPORTAL(ap->a_vp); 49965516Spendry 50053846Spendry if (pt->pt_arg) { 50153846Spendry free((caddr_t) pt->pt_arg, M_TEMP); 50253846Spendry pt->pt_arg = 0; 50353846Spendry } 50465384Spendry FREE(ap->a_vp->v_data, M_TEMP); 50565384Spendry ap->a_vp->v_data = 0; 50665516Spendry 50753846Spendry return (0); 50853846Spendry } 50953846Spendry 51053846Spendry /* 51165741Spendry * Return POSIX pathconf information applicable to special devices. 51265741Spendry */ 51365741Spendry portal_pathconf(ap) 51465741Spendry struct vop_pathconf_args /* { 51565741Spendry struct vnode *a_vp; 51665741Spendry int a_name; 51765741Spendry int *a_retval; 51865741Spendry } */ *ap; 51965741Spendry { 52065741Spendry 52165741Spendry switch (ap->a_name) { 52265741Spendry case _PC_LINK_MAX: 52365741Spendry *ap->a_retval = LINK_MAX; 52465741Spendry return (0); 52565741Spendry case _PC_MAX_CANON: 52665741Spendry *ap->a_retval = MAX_CANON; 52765741Spendry return (0); 52865741Spendry case _PC_MAX_INPUT: 52965741Spendry *ap->a_retval = MAX_INPUT; 53065741Spendry return (0); 53165741Spendry case _PC_PIPE_BUF: 53265741Spendry *ap->a_retval = PIPE_BUF; 53365741Spendry return (0); 53465741Spendry case _PC_CHOWN_RESTRICTED: 53565741Spendry *ap->a_retval = 1; 53665741Spendry return (0); 53765741Spendry case _PC_VDISABLE: 53865741Spendry *ap->a_retval = _POSIX_VDISABLE; 53965741Spendry return (0); 54065741Spendry default: 54165741Spendry return (EINVAL); 54265741Spendry } 54365741Spendry /* NOTREACHED */ 54465741Spendry } 54565741Spendry 54665741Spendry /* 54753846Spendry * Print out the contents of a Portal vnode. 54853846Spendry */ 54953846Spendry /* ARGSUSED */ 55065516Spendry int 55155027Smckusick portal_print(ap) 55255027Smckusick struct vop_print_args /* { 55355027Smckusick struct vnode *a_vp; 55455027Smckusick } */ *ap; 55553846Spendry { 55655027Smckusick 55753846Spendry printf("tag VT_PORTAL, portal vnode\n"); 55855027Smckusick return (0); 55953846Spendry } 56053846Spendry 56153846Spendry /*void*/ 56265516Spendry int 56355027Smckusick portal_vfree(ap) 56455027Smckusick struct vop_vfree_args /* { 56555027Smckusick struct vnode *a_pvp; 56655027Smckusick ino_t a_ino; 56755027Smckusick int a_mode; 56855027Smckusick } */ *ap; 56953846Spendry { 57055027Smckusick 57155027Smckusick return (0); 57253846Spendry } 57353846Spendry 57453846Spendry 57553846Spendry /* 57653846Spendry * Portal vnode unsupported operation 57753846Spendry */ 57865516Spendry int 57953846Spendry portal_enotsupp() 58053846Spendry { 58155027Smckusick 58253846Spendry return (EOPNOTSUPP); 58353846Spendry } 58453846Spendry 58553846Spendry /* 58653846Spendry * Portal "should never get here" operation 58753846Spendry */ 58865516Spendry int 58953846Spendry portal_badop() 59053846Spendry { 59155027Smckusick 59253846Spendry panic("portal: bad op"); 59353846Spendry /* NOTREACHED */ 59453846Spendry } 59553846Spendry 59653846Spendry /* 59753846Spendry * Portal vnode null operation 59853846Spendry */ 59965516Spendry int 60053846Spendry portal_nullop() 60153846Spendry { 60255027Smckusick 60353846Spendry return (0); 60453846Spendry } 60553846Spendry 60655027Smckusick #define portal_create ((int (*) __P((struct vop_create_args *)))portal_enotsupp) 60753846Spendry #define portal_mknod ((int (*) __P((struct vop_mknod_args *)))portal_enotsupp) 60853846Spendry #define portal_close ((int (*) __P((struct vop_close_args *)))nullop) 60953846Spendry #define portal_access ((int (*) __P((struct vop_access_args *)))nullop) 61053846Spendry #define portal_read ((int (*) __P((struct vop_read_args *)))portal_enotsupp) 61153846Spendry #define portal_write ((int (*) __P((struct vop_write_args *)))portal_enotsupp) 61253846Spendry #define portal_ioctl ((int (*) __P((struct vop_ioctl_args *)))portal_enotsupp) 61355027Smckusick #define portal_select ((int (*) __P((struct vop_select_args *)))portal_enotsupp) 61453846Spendry #define portal_mmap ((int (*) __P((struct vop_mmap_args *)))portal_enotsupp) 615*68731Smckusick #define portal_revoke vop_revoke 61653846Spendry #define portal_fsync ((int (*) __P((struct vop_fsync_args *)))nullop) 61753846Spendry #define portal_seek ((int (*) __P((struct vop_seek_args *)))nullop) 61855027Smckusick #define portal_remove ((int (*) __P((struct vop_remove_args *)))portal_enotsupp) 61953846Spendry #define portal_link ((int (*) __P((struct vop_link_args *)))portal_enotsupp) 62055027Smckusick #define portal_rename ((int (*) __P((struct vop_rename_args *)))portal_enotsupp) 62153846Spendry #define portal_mkdir ((int (*) __P((struct vop_mkdir_args *)))portal_enotsupp) 62253846Spendry #define portal_rmdir ((int (*) __P((struct vop_rmdir_args *)))portal_enotsupp) 62355171Spendry #define portal_symlink \ 62455027Smckusick ((int (*) __P((struct vop_symlink_args *)))portal_enotsupp) 62555171Spendry #define portal_readlink \ 62655027Smckusick ((int (*) __P((struct vop_readlink_args *)))portal_enotsupp) 62753846Spendry #define portal_abortop ((int (*) __P((struct vop_abortop_args *)))nullop) 62853846Spendry #define portal_lock ((int (*) __P((struct vop_lock_args *)))nullop) 62953846Spendry #define portal_unlock ((int (*) __P((struct vop_unlock_args *)))nullop) 63053846Spendry #define portal_bmap ((int (*) __P((struct vop_bmap_args *)))portal_badop) 63155171Spendry #define portal_strategy \ 63255027Smckusick ((int (*) __P((struct vop_strategy_args *)))portal_badop) 63353846Spendry #define portal_islocked ((int (*) __P((struct vop_islocked_args *)))nullop) 63455171Spendry #define portal_advlock \ 63555027Smckusick ((int (*) __P((struct vop_advlock_args *)))portal_enotsupp) 63655171Spendry #define portal_blkatoff \ 63755027Smckusick ((int (*) __P((struct vop_blkatoff_args *)))portal_enotsupp) 63853846Spendry #define portal_valloc ((int(*) __P(( \ 63953846Spendry struct vnode *pvp, \ 64053846Spendry int mode, \ 64153846Spendry struct ucred *cred, \ 64253846Spendry struct vnode **vpp))) portal_enotsupp) 64355171Spendry #define portal_truncate \ 64455027Smckusick ((int (*) __P((struct vop_truncate_args *)))portal_enotsupp) 64555027Smckusick #define portal_update ((int (*) __P((struct vop_update_args *)))portal_enotsupp) 64655027Smckusick #define portal_bwrite ((int (*) __P((struct vop_bwrite_args *)))portal_enotsupp) 64753846Spendry 64853846Spendry int (**portal_vnodeop_p)(); 64953846Spendry struct vnodeopv_entry_desc portal_vnodeop_entries[] = { 65053846Spendry { &vop_default_desc, vn_default_error }, 65153846Spendry { &vop_lookup_desc, portal_lookup }, /* lookup */ 65253846Spendry { &vop_create_desc, portal_create }, /* create */ 65353846Spendry { &vop_mknod_desc, portal_mknod }, /* mknod */ 65453846Spendry { &vop_open_desc, portal_open }, /* open */ 65553846Spendry { &vop_close_desc, portal_close }, /* close */ 65653846Spendry { &vop_access_desc, portal_access }, /* access */ 65753846Spendry { &vop_getattr_desc, portal_getattr }, /* getattr */ 65853846Spendry { &vop_setattr_desc, portal_setattr }, /* setattr */ 65953846Spendry { &vop_read_desc, portal_read }, /* read */ 66053846Spendry { &vop_write_desc, portal_write }, /* write */ 66153846Spendry { &vop_ioctl_desc, portal_ioctl }, /* ioctl */ 66253846Spendry { &vop_select_desc, portal_select }, /* select */ 66353846Spendry { &vop_mmap_desc, portal_mmap }, /* mmap */ 664*68731Smckusick { &vop_revoke_desc, portal_revoke }, /* revoke */ 66553846Spendry { &vop_fsync_desc, portal_fsync }, /* fsync */ 66653846Spendry { &vop_seek_desc, portal_seek }, /* seek */ 66753846Spendry { &vop_remove_desc, portal_remove }, /* remove */ 66853846Spendry { &vop_link_desc, portal_link }, /* link */ 66953846Spendry { &vop_rename_desc, portal_rename }, /* rename */ 67053846Spendry { &vop_mkdir_desc, portal_mkdir }, /* mkdir */ 67153846Spendry { &vop_rmdir_desc, portal_rmdir }, /* rmdir */ 67253846Spendry { &vop_symlink_desc, portal_symlink }, /* symlink */ 67353846Spendry { &vop_readdir_desc, portal_readdir }, /* readdir */ 67453846Spendry { &vop_readlink_desc, portal_readlink }, /* readlink */ 67553846Spendry { &vop_abortop_desc, portal_abortop }, /* abortop */ 67653846Spendry { &vop_inactive_desc, portal_inactive }, /* inactive */ 67753846Spendry { &vop_reclaim_desc, portal_reclaim }, /* reclaim */ 67853846Spendry { &vop_lock_desc, portal_lock }, /* lock */ 67953846Spendry { &vop_unlock_desc, portal_unlock }, /* unlock */ 68053846Spendry { &vop_bmap_desc, portal_bmap }, /* bmap */ 68153846Spendry { &vop_strategy_desc, portal_strategy }, /* strategy */ 68253846Spendry { &vop_print_desc, portal_print }, /* print */ 68353846Spendry { &vop_islocked_desc, portal_islocked }, /* islocked */ 68465741Spendry { &vop_pathconf_desc, portal_pathconf }, /* pathconf */ 68553846Spendry { &vop_advlock_desc, portal_advlock }, /* advlock */ 68653846Spendry { &vop_blkatoff_desc, portal_blkatoff }, /* blkatoff */ 68753846Spendry { &vop_valloc_desc, portal_valloc }, /* valloc */ 68853846Spendry { &vop_vfree_desc, portal_vfree }, /* vfree */ 68953846Spendry { &vop_truncate_desc, portal_truncate }, /* truncate */ 69053846Spendry { &vop_update_desc, portal_update }, /* update */ 69153846Spendry { &vop_bwrite_desc, portal_bwrite }, /* bwrite */ 69253846Spendry { (struct vnodeop_desc*)NULL, (int(*)())NULL } 69353846Spendry }; 69453846Spendry struct vnodeopv_desc portal_vnodeop_opv_desc = 69553846Spendry { &portal_vnodeop_p, portal_vnodeop_entries }; 696