1 // 2 // CDDL HEADER START 3 // 4 // The contents of this file are subject to the terms of the 5 // Common Development and Distribution License (the License). 6 // You may not use this file except in compliance with the License. 7 // 8 // You can obtain a copy of the license at usr/src/CDDL.txt 9 // or http://www.opensolaris.org/os/licensing. 10 // See the License for the specific language governing permissions 11 // and limitations under the License. 12 // 13 // When distributing Covered Code, include this CDDL HEADER in each 14 // file and include the License file at usr/src/CDDL.txt. 15 // If applicable, add the following below this CDDL HEADER, with the 16 // fields enclosed by brackets [] replaced with your own identifying 17 // information: Portions Copyright [yyyy] [name of copyright owner] 18 // 19 // CDDL HEADER END 20 // 21 22 // 23 // Copyright 2008 Sun Microsystems, Inc. All rights reserved. 24 // Use is subject to license terms. 25 // 26 // bulkio_impl_pgio_vn.cc - implementation of the class bulkio_impl::pgio_vn 27 // 28 29 #pragma ident "@(#)bulkio_impl_pgio_vn.cc 1.10 08/05/20 SMI" 30 31 #include <sys/types.h> 32 #include <sys/t_lock.h> 33 #include <sys/param.h> 34 #include <sys/systm.h> 35 #include <sys/sysmacros.h> 36 #include <sys/kmem.h> 37 #include <sys/signal.h> 38 #include <sys/user.h> 39 #include <sys/proc.h> 40 #include <sys/disp.h> 41 #include <sys/buf.h> 42 #include <sys/pathname.h> 43 #include <sys/vfs.h> 44 #include <sys/vnode.h> 45 #include <sys/file.h> 46 #include <sys/uio.h> 47 #include <sys/conf.h> 48 #include <sys/debug.h> 49 #include <pxfs/common/pxfslib.h> 50 51 #include <sys/os.h> 52 53 #include "../version.h" 54 #include <pxfs/bulkio/bulkio_impl.h> 55 56 static struct vfs pgio_vfs; 57 58 #ifdef FSI 59 60 // 61 // Page data must always be connected to a vnode. When we ship 62 // a page to the server, sun cluster must have a vnode to which 63 // the page can be connected. Therefore, bulkio subsystem creates 64 // a dummy vnode with dummy vnodeops. 65 // 66 struct vnodeops *pgio_vnodeopsp = NULL; 67 68 // 69 // Operations of the dummy vnode is not supported. 70 // 71 static int 72 pgio_nosys() 73 { 74 return (ENOSYS); 75 } 76 77 // 78 // Dummy vnodeops template for bulkio subsystem. 79 // 80 fs_operation_def_t pgio_vnodeops_template[] = { 81 VOPNAME_OPEN, pgio_nosys, 82 VOPNAME_CLOSE, pgio_nosys, 83 VOPNAME_READ, pgio_nosys, 84 VOPNAME_WRITE, pgio_nosys, 85 VOPNAME_IOCTL, pgio_nosys, 86 VOPNAME_SETFL, pgio_nosys, 87 VOPNAME_GETATTR, pgio_nosys, 88 VOPNAME_SETATTR, pgio_nosys, 89 VOPNAME_ACCESS, pgio_nosys, 90 VOPNAME_LOOKUP, pgio_nosys, 91 VOPNAME_CREATE, pgio_nosys, 92 VOPNAME_REMOVE, pgio_nosys, 93 VOPNAME_LINK, pgio_nosys, 94 VOPNAME_RENAME, pgio_nosys, 95 VOPNAME_MKDIR, pgio_nosys, 96 VOPNAME_RMDIR, pgio_nosys, 97 VOPNAME_READDIR, pgio_nosys, 98 VOPNAME_SYMLINK, pgio_nosys, 99 VOPNAME_READLINK, pgio_nosys, 100 VOPNAME_FSYNC, pgio_nosys, 101 VOPNAME_INACTIVE, pgio_nosys, 102 VOPNAME_FID, pgio_nosys, 103 VOPNAME_RWLOCK, pgio_nosys, 104 VOPNAME_RWUNLOCK, pgio_nosys, 105 VOPNAME_SEEK, pgio_nosys, 106 VOPNAME_CMP, pgio_nosys, 107 VOPNAME_FRLOCK, pgio_nosys, 108 VOPNAME_SPACE, pgio_nosys, 109 VOPNAME_REALVP, pgio_nosys, 110 VOPNAME_GETPAGE, pgio_nosys, 111 VOPNAME_PUTPAGE, pgio_nosys, 112 VOPNAME_MAP, pgio_nosys, 113 VOPNAME_ADDMAP, pgio_nosys, 114 VOPNAME_DELMAP, pgio_nosys, 115 VOPNAME_POLL, pgio_nosys, 116 VOPNAME_DUMP, pgio_nosys, 117 VOPNAME_PATHCONF, pgio_nosys, 118 VOPNAME_PAGEIO, pgio_nosys, 119 VOPNAME_DUMPCTL, pgio_nosys, 120 VOPNAME_DISPOSE, pgio_nosys, 121 VOPNAME_GETSECATTR, pgio_nosys, 122 VOPNAME_SETSECATTR, pgio_nosys, 123 VOPNAME_SHRLOCK, pgio_nosys, 124 NULL, NULL 125 }; 126 127 int 128 pgio_vn_init() 129 { 130 int error; 131 132 error = vn_make_ops("pgio", pgio_vnodeops_template, 133 &pgio_vnodeopsp); 134 return (error); 135 } 136 137 void 138 pgio_vn_uninit() 139 { 140 if (pgio_vnodeopsp != NULL) { 141 vn_freevnodeops(pgio_vnodeopsp); 142 } 143 } 144 145 #endif 146 147 bulkio_impl::pgio_vn::pgio_vn() 148 { 149 #ifdef FSI 150 vp = vn_alloc(KM_SLEEP); 151 VN_SET_VFS_TYPE_DEV(vp, &pgio_vfs, VNON, 0); 152 (void) vn_setops(vp, pgio_vnodeopsp); 153 #else 154 vp = (vnode_t *)this; 155 VN_INIT(vp, &pgio_vfs, VNON, 0); 156 vp->v_op = NULL; 157 #endif 158 } 159 160 bulkio_impl::pgio_vn::~pgio_vn() 161 { 162 #ifdef FSI 163 vn_free(vp); 164 #endif 165 vp = NULL; 166 } 167 168 void 169 bulkio_impl::pgio_vn::set_vdata(void *ptr) 170 { 171 vp->v_data = (caddr_t)ptr; 172 } 173