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/OPENSOLARIS.LICENSE 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/OPENSOLARIS.LICENSE. 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 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26 #pragma ident "%Z%%M% %I% %E% SMI" 27 28 /* 29 * vnode ops for the /dev filesystem 30 * 31 * - VDIR, VCHR, CBLK, and VLNK are considered must supported files 32 * - VREG and VDOOR are used for some internal implementations in 33 * the global zone, e.g. devname and devfsadm communication 34 * - other file types are unusual in this namespace and 35 * not supported for now 36 */ 37 38 #include <sys/types.h> 39 #include <sys/param.h> 40 #include <sys/t_lock.h> 41 #include <sys/systm.h> 42 #include <sys/sysmacros.h> 43 #include <sys/user.h> 44 #include <sys/time.h> 45 #include <sys/vfs.h> 46 #include <sys/vnode.h> 47 #include <sys/file.h> 48 #include <sys/fcntl.h> 49 #include <sys/flock.h> 50 #include <sys/kmem.h> 51 #include <sys/uio.h> 52 #include <sys/errno.h> 53 #include <sys/stat.h> 54 #include <sys/cred.h> 55 #include <sys/cred_impl.h> 56 #include <sys/dirent.h> 57 #include <sys/pathname.h> 58 #include <sys/cmn_err.h> 59 #include <sys/debug.h> 60 #include <sys/policy.h> 61 #include <vm/hat.h> 62 #include <vm/seg_vn.h> 63 #include <vm/seg_map.h> 64 #include <vm/seg.h> 65 #include <vm/as.h> 66 #include <vm/page.h> 67 #include <sys/proc.h> 68 #include <sys/mode.h> 69 #include <sys/sunndi.h> 70 #include <sys/ptms.h> 71 #include <fs/fs_subr.h> 72 #include <sys/fs/dv_node.h> 73 #include <sys/fs/sdev_impl.h> 74 #include <sys/fs/sdev_node.h> 75 76 /*ARGSUSED*/ 77 static int 78 sdev_open(struct vnode **vpp, int flag, struct cred *cred) 79 { 80 struct sdev_node *dv = VTOSDEV(*vpp); 81 struct sdev_node *ddv = dv->sdev_dotdot; 82 int error = 0; 83 84 if ((*vpp)->v_type == VDIR) 85 return (0); 86 87 if (!SDEV_IS_GLOBAL(dv)) 88 return (ENOTSUP); 89 90 ASSERT((*vpp)->v_type == VREG); 91 if ((*vpp)->v_type != VREG) 92 return (ENOTSUP); 93 94 ASSERT(ddv); 95 rw_enter(&ddv->sdev_contents, RW_READER); 96 if (dv->sdev_attrvp == NULL) { 97 rw_exit(&ddv->sdev_contents); 98 return (ENOENT); 99 } 100 error = VOP_OPEN(&(dv->sdev_attrvp), flag, cred); 101 rw_exit(&ddv->sdev_contents); 102 return (error); 103 } 104 105 /*ARGSUSED1*/ 106 static int 107 sdev_close(struct vnode *vp, int flag, int count, 108 offset_t offset, struct cred *cred) 109 { 110 struct sdev_node *dv = VTOSDEV(vp); 111 112 if (vp->v_type == VDIR) { 113 cleanlocks(vp, ttoproc(curthread)->p_pid, 0); 114 cleanshares(vp, ttoproc(curthread)->p_pid); 115 return (0); 116 } 117 118 if (!SDEV_IS_GLOBAL(dv)) 119 return (ENOTSUP); 120 121 ASSERT(vp->v_type == VREG); 122 if (vp->v_type != VREG) 123 return (ENOTSUP); 124 125 ASSERT(dv->sdev_attrvp); 126 return (VOP_CLOSE(dv->sdev_attrvp, flag, count, offset, cred)); 127 } 128 129 /*ARGSUSED*/ 130 static int 131 sdev_read(struct vnode *vp, struct uio *uio, int ioflag, struct cred *cred, 132 struct caller_context *ct) 133 { 134 struct sdev_node *dv = (struct sdev_node *)VTOSDEV(vp); 135 int error; 136 137 if (!SDEV_IS_GLOBAL(dv)) 138 return (EINVAL); 139 140 if (vp->v_type == VDIR) 141 return (EISDIR); 142 143 /* only supporting regular files in /dev */ 144 ASSERT(vp->v_type == VREG); 145 if (vp->v_type != VREG) 146 return (EINVAL); 147 148 ASSERT(RW_READ_HELD(&VTOSDEV(vp)->sdev_contents)); 149 ASSERT(dv->sdev_attrvp); 150 (void) VOP_RWLOCK(dv->sdev_attrvp, 0, NULL); 151 error = VOP_READ(dv->sdev_attrvp, uio, ioflag, cred, ct); 152 VOP_RWUNLOCK(dv->sdev_attrvp, 0, NULL); 153 return (error); 154 } 155 156 /*ARGSUSED*/ 157 static int 158 sdev_write(struct vnode *vp, struct uio *uio, int ioflag, struct cred *cred, 159 struct caller_context *ct) 160 { 161 struct sdev_node *dv = VTOSDEV(vp); 162 int error = 0; 163 164 if (!SDEV_IS_GLOBAL(dv)) 165 return (EINVAL); 166 167 if (vp->v_type == VDIR) 168 return (EISDIR); 169 170 /* only supporting regular files in /dev */ 171 ASSERT(vp->v_type == VREG); 172 if (vp->v_type != VREG) 173 return (EINVAL); 174 175 ASSERT(dv->sdev_attrvp); 176 177 (void) VOP_RWLOCK(dv->sdev_attrvp, 1, NULL); 178 error = VOP_WRITE(dv->sdev_attrvp, uio, ioflag, cred, ct); 179 VOP_RWUNLOCK(dv->sdev_attrvp, 1, NULL); 180 if (error == 0) { 181 sdev_update_timestamps(dv->sdev_attrvp, kcred, 182 AT_MTIME); 183 } 184 return (error); 185 } 186 187 /*ARGSUSED*/ 188 static int 189 sdev_ioctl(struct vnode *vp, int cmd, intptr_t arg, int flag, 190 struct cred *cred, int *rvalp) 191 { 192 struct sdev_node *dv = VTOSDEV(vp); 193 194 if (!SDEV_IS_GLOBAL(dv) || (vp->v_type == VDIR)) 195 return (ENOTTY); 196 197 ASSERT(vp->v_type == VREG); 198 if (vp->v_type != VREG) 199 return (EINVAL); 200 201 ASSERT(dv->sdev_attrvp); 202 return (VOP_IOCTL(dv->sdev_attrvp, cmd, arg, flag, cred, rvalp)); 203 } 204 205 static int 206 sdev_getattr(struct vnode *vp, struct vattr *vap, int flags, struct cred *cr) 207 { 208 int error = 0; 209 struct sdev_node *dv = VTOSDEV(vp); 210 struct sdev_node *parent = dv->sdev_dotdot; 211 struct devname_nsmap *map = NULL; 212 struct devname_ops *dirops = NULL; 213 int (*fn)(devname_handle_t *, struct vattr *, struct cred *); 214 215 ASSERT(parent); 216 217 rw_enter(&parent->sdev_contents, RW_READER); 218 ASSERT(dv->sdev_attr || dv->sdev_attrvp); 219 if (SDEV_IS_GLOBAL(dv) && (dv->sdev_state != SDEV_ZOMBIE)) { 220 map = sdev_get_map(parent, 0); 221 dirops = map ? map->dir_ops : NULL; 222 } 223 224 /* 225 * search order: 226 * - for persistent nodes (SDEV_PERSIST): backstore 227 * - for non-persistent nodes: module ops if global, then memory 228 */ 229 if (dv->sdev_attrvp) { 230 rw_exit(&parent->sdev_contents); 231 error = VOP_GETATTR(dv->sdev_attrvp, vap, flags, cr); 232 sdev_vattr_merge(dv, vap); 233 } else if (dirops && (fn = dirops->devnops_getattr)) { 234 sdev_vattr_merge(dv, vap); 235 rw_exit(&parent->sdev_contents); 236 error = (*fn)(&(dv->sdev_handle), vap, cr); 237 } else { 238 ASSERT(dv->sdev_attr); 239 *vap = *dv->sdev_attr; 240 sdev_vattr_merge(dv, vap); 241 rw_exit(&parent->sdev_contents); 242 } 243 244 return (error); 245 } 246 247 /*ARGSUSED4*/ 248 static int 249 sdev_setattr(struct vnode *vp, struct vattr *vap, int flags, 250 struct cred *cred, caller_context_t *ctp) 251 { 252 return (devname_setattr_func(vp, vap, flags, cred, NULL, 0)); 253 } 254 255 static int 256 sdev_getsecattr(struct vnode *vp, struct vsecattr *vsap, int flags, 257 struct cred *cr) 258 { 259 int error; 260 struct sdev_node *dv = VTOSDEV(vp); 261 struct vnode *avp = dv->sdev_attrvp; 262 263 if (avp == NULL) { 264 /* return fs_fab_acl() if flavor matches, else do nothing */ 265 if ((SDEV_ACL_FLAVOR(vp) == _ACL_ACLENT_ENABLED && 266 (vsap->vsa_mask & (VSA_ACLCNT | VSA_DFACLCNT))) || 267 (SDEV_ACL_FLAVOR(vp) == _ACL_ACE_ENABLED && 268 (vsap->vsa_mask & (VSA_ACECNT | VSA_ACE)))) 269 return (fs_fab_acl(vp, vsap, flags, cr)); 270 271 return (ENOSYS); 272 } 273 274 (void) VOP_RWLOCK(avp, 1, NULL); 275 error = VOP_GETSECATTR(avp, vsap, flags, cr); 276 VOP_RWUNLOCK(avp, 1, NULL); 277 return (error); 278 } 279 280 static int 281 sdev_setsecattr(struct vnode *vp, struct vsecattr *vsap, int flags, 282 struct cred *cr) 283 { 284 int error; 285 struct sdev_node *dv = VTOSDEV(vp); 286 struct vnode *avp = dv->sdev_attrvp; 287 288 if (dv->sdev_state == SDEV_ZOMBIE) 289 return (0); 290 291 if (avp == NULL) { 292 if (SDEV_IS_GLOBAL(dv) && !SDEV_IS_PERSIST(dv)) 293 return (fs_nosys()); 294 ASSERT(dv->sdev_attr); 295 /* 296 * if coming in directly, the acl system call will 297 * have held the read-write lock via VOP_RWLOCK() 298 * If coming in via specfs, specfs will have 299 * held the rw lock on the realvp i.e. us. 300 */ 301 ASSERT(RW_WRITE_HELD(&dv->sdev_contents)); 302 sdev_vattr_merge(dv, dv->sdev_attr); 303 error = sdev_shadow_node(dv, cr); 304 if (error) { 305 return (fs_nosys()); 306 } 307 308 ASSERT(dv->sdev_attrvp); 309 /* clean out the memory copy if any */ 310 if (dv->sdev_attr) { 311 kmem_free(dv->sdev_attr, sizeof (struct vattr)); 312 dv->sdev_attr = NULL; 313 } 314 avp = dv->sdev_attrvp; 315 } 316 ASSERT(avp); 317 318 (void) VOP_RWLOCK(avp, V_WRITELOCK_TRUE, NULL); 319 error = VOP_SETSECATTR(avp, vsap, flags, cr); 320 VOP_RWUNLOCK(avp, V_WRITELOCK_TRUE, NULL); 321 return (error); 322 } 323 324 int 325 sdev_unlocked_access(void *vdv, int mode, struct cred *cr) 326 { 327 struct sdev_node *dv = vdv; 328 int shift = 0; 329 uid_t owner = dv->sdev_attr->va_uid; 330 331 if (crgetuid(cr) != owner) { 332 shift += 3; 333 if (groupmember(dv->sdev_attr->va_gid, cr) == 0) 334 shift += 3; 335 } 336 337 mode &= ~(dv->sdev_attr->va_mode << shift); 338 if (mode == 0) 339 return (0); 340 341 return (secpolicy_vnode_access(cr, SDEVTOV(dv), owner, mode)); 342 } 343 344 static int 345 sdev_access(struct vnode *vp, int mode, int flags, struct cred *cr) 346 { 347 struct sdev_node *dv = VTOSDEV(vp); 348 int ret = 0; 349 350 ASSERT(dv->sdev_attr || dv->sdev_attrvp); 351 352 if (dv->sdev_attrvp) { 353 ret = VOP_ACCESS(dv->sdev_attrvp, mode, flags, cr); 354 } else if (dv->sdev_attr) { 355 rw_enter(&dv->sdev_contents, RW_READER); 356 ret = sdev_unlocked_access(dv, mode, cr); 357 if (ret) 358 ret = EACCES; 359 rw_exit(&dv->sdev_contents); 360 } 361 362 return (ret); 363 } 364 365 /* 366 * Lookup 367 */ 368 /*ARGSUSED3*/ 369 static int 370 sdev_lookup(struct vnode *dvp, char *nm, struct vnode **vpp, 371 struct pathname *pnp, int flags, struct vnode *rdir, struct cred *cred) 372 { 373 struct sdev_node *parent; 374 375 parent = VTOSDEV(dvp); 376 ASSERT(parent); 377 378 if (!SDEV_IS_GLOBAL(parent)) 379 return (prof_lookup(dvp, nm, vpp, cred)); 380 return (devname_lookup_func(parent, nm, vpp, cred, NULL, 0)); 381 } 382 383 /*ARGSUSED2*/ 384 static int 385 sdev_create(struct vnode *dvp, char *nm, struct vattr *vap, vcexcl_t excl, 386 int mode, struct vnode **vpp, struct cred *cred, int flag) 387 { 388 struct vnode *vp = NULL; 389 struct vnode *avp; 390 struct sdev_node *parent; 391 struct sdev_node *self = NULL; 392 int error = 0; 393 vtype_t type = vap->va_type; 394 395 ASSERT(type != VNON && type != VBAD); 396 397 if ((type == VFIFO) || (type == VSOCK) || 398 (type == VPROC) || (type == VPORT)) 399 return (ENOTSUP); 400 401 parent = VTOSDEV(dvp); 402 ASSERT(parent); 403 404 rw_enter(&parent->sdev_dotdot->sdev_contents, RW_READER); 405 if (parent->sdev_state == SDEV_ZOMBIE) { 406 rw_exit(&parent->sdev_dotdot->sdev_contents); 407 return (ENOENT); 408 } 409 410 /* non-global do not allow pure node creation */ 411 if (!SDEV_IS_GLOBAL(parent)) { 412 rw_exit(&parent->sdev_dotdot->sdev_contents); 413 return (prof_lookup(dvp, nm, vpp, cred)); 414 } 415 rw_exit(&parent->sdev_dotdot->sdev_contents); 416 417 again: 418 /* check existing name */ 419 error = VOP_LOOKUP(dvp, nm, &vp, NULL, 0, NULL, cred); 420 421 /* name found */ 422 if (error == 0) { 423 ASSERT(vp); 424 if (excl == EXCL) { 425 error = EEXIST; 426 } else if ((vp->v_type == VDIR) && (mode & VWRITE)) { 427 /* allowing create/read-only an existing directory */ 428 error = EISDIR; 429 } else { 430 error = VOP_ACCESS(vp, mode, flag, cred); 431 } 432 433 if (error) { 434 VN_RELE(vp); 435 return (error); 436 } 437 438 /* truncation first */ 439 if ((vp->v_type == VREG) && (vap->va_mask & AT_SIZE) && 440 (vap->va_size == 0)) { 441 ASSERT(parent->sdev_attrvp); 442 ASSERT(VTOSDEV(vp)->sdev_attrvp); 443 error = VOP_CREATE(parent->sdev_attrvp, 444 nm, vap, excl, mode, &avp, cred, flag); 445 446 if (error) { 447 VN_RELE(vp); 448 return (error); 449 } 450 } 451 452 sdev_update_timestamps(vp, kcred, 453 AT_CTIME|AT_MTIME|AT_ATIME); 454 *vpp = vp; 455 return (0); 456 } 457 458 /* bail out early */ 459 if (error != ENOENT) 460 return (error); 461 462 /* 463 * For memory-based (ROFS) directory: 464 * - either disallow node creation; 465 * - or implement VOP_CREATE of its own 466 */ 467 rw_enter(&parent->sdev_contents, RW_WRITER); 468 if (!SDEV_IS_PERSIST(parent)) { 469 rw_exit(&parent->sdev_contents); 470 return (ENOTSUP); 471 } 472 ASSERT(parent->sdev_attrvp); 473 error = sdev_mknode(parent, nm, &self, vap, NULL, NULL, 474 cred, SDEV_READY); 475 if (error) { 476 rw_exit(&parent->sdev_contents); 477 if (self) 478 SDEV_RELE(self); 479 return (error); 480 } 481 rw_exit(&parent->sdev_contents); 482 483 ASSERT(self); 484 /* take care the timestamps for the node and its parent */ 485 sdev_update_timestamps(SDEVTOV(self), kcred, 486 AT_CTIME|AT_MTIME|AT_ATIME); 487 sdev_update_timestamps(dvp, kcred, AT_MTIME|AT_ATIME); 488 if (SDEV_IS_GLOBAL(parent)) 489 atomic_inc_ulong(&parent->sdev_gdir_gen); 490 491 /* wake up other threads blocked on looking up this node */ 492 mutex_enter(&self->sdev_lookup_lock); 493 SDEV_UNBLOCK_OTHERS(self, SDEV_LOOKUP); 494 mutex_exit(&self->sdev_lookup_lock); 495 error = sdev_to_vp(self, vpp); 496 return (error); 497 } 498 499 static int 500 sdev_remove(struct vnode *dvp, char *nm, struct cred *cred) 501 { 502 int error; 503 struct sdev_node *parent = (struct sdev_node *)VTOSDEV(dvp); 504 struct vnode *vp = NULL; 505 struct sdev_node *dv = NULL; 506 struct devname_nsmap *map = NULL; 507 struct devname_ops *dirops = NULL; 508 int (*fn)(devname_handle_t *); 509 int len; 510 int bkstore = 0; 511 512 /* bail out early */ 513 len = strlen(nm); 514 if (nm[0] == '.') { 515 if (len == 1) { 516 return (EINVAL); 517 } else if (len == 2 && nm[1] == '.') { 518 return (EEXIST); 519 } 520 } 521 522 ASSERT(parent); 523 rw_enter(&parent->sdev_contents, RW_READER); 524 if (!SDEV_IS_GLOBAL(parent)) { 525 rw_exit(&parent->sdev_contents); 526 return (ENOTSUP); 527 } 528 529 /* check existence first */ 530 dv = sdev_cache_lookup(parent, nm); 531 if (dv == NULL) { 532 rw_exit(&parent->sdev_contents); 533 return (ENOENT); 534 } 535 536 vp = SDEVTOV(dv); 537 if ((dv->sdev_state == SDEV_INIT) || 538 (dv->sdev_state == SDEV_ZOMBIE)) { 539 rw_exit(&parent->sdev_contents); 540 VN_RELE(vp); 541 return (ENOENT); 542 } 543 544 /* the module may record/reject removing a device node */ 545 map = sdev_get_map(parent, 0); 546 dirops = map ? map->dir_ops : NULL; 547 if (dirops && ((fn = dirops->devnops_remove) != NULL)) { 548 error = (*fn)(&(dv->sdev_handle)); 549 if (error) { 550 rw_exit(&parent->sdev_contents); 551 VN_RELE(vp); 552 return (error); 553 } 554 } 555 556 /* 557 * sdev_dirdelete does the real job of: 558 * - make sure no open ref count 559 * - destroying the sdev_node 560 * - releasing the hold on attrvp 561 */ 562 bkstore = SDEV_IS_PERSIST(dv) ? 1 : 0; 563 if (!rw_tryupgrade(&parent->sdev_contents)) { 564 rw_exit(&parent->sdev_contents); 565 rw_enter(&parent->sdev_contents, RW_WRITER); 566 } 567 error = sdev_cache_update(parent, &dv, nm, SDEV_CACHE_DELETE); 568 rw_exit(&parent->sdev_contents); 569 570 sdcmn_err2(("sdev_remove: cache_update error %d\n", error)); 571 if (error && (error != EBUSY)) { 572 /* report errors other than EBUSY */ 573 VN_RELE(vp); 574 } else { 575 sdcmn_err2(("sdev_remove: cleaning node %s from cache " 576 " with error %d\n", nm, error)); 577 578 /* 579 * best efforts clean up the backing store 580 */ 581 if (bkstore) { 582 ASSERT(parent->sdev_attrvp); 583 error = VOP_REMOVE(parent->sdev_attrvp, nm, cred); 584 /* 585 * do not report BUSY error 586 * because the backing store ref count is released 587 * when the last ref count on the sdev_node is 588 * released. 589 */ 590 if (error == EBUSY) { 591 sdcmn_err2(("sdev_remove: device %s is still on" 592 "disk %s\n", nm, parent->sdev_path)); 593 error = 0; 594 } 595 } 596 597 if (error == EBUSY) 598 error = 0; 599 } 600 601 return (error); 602 } 603 604 /* 605 * Some restrictions for this file system: 606 * - both oldnm and newnm are in the scope of /dev file system, 607 * to simply the namespace management model. 608 */ 609 static int 610 sdev_rename(struct vnode *odvp, char *onm, struct vnode *ndvp, char *nnm, 611 struct cred *cred) 612 { 613 struct sdev_node *fromparent = NULL; 614 struct vattr vattr; 615 struct sdev_node *toparent; 616 struct sdev_node *fromdv = NULL; /* source node */ 617 struct vnode *ovp = NULL; /* source vnode */ 618 struct sdev_node *todv = NULL; /* destination node */ 619 struct vnode *nvp = NULL; /* destination vnode */ 620 int samedir = 0; /* set if odvp == ndvp */ 621 struct vnode *realvp; 622 int len; 623 char nnm_path[MAXPATHLEN]; 624 struct devname_nsmap *omap = NULL; 625 struct devname_ops *odirops = NULL; 626 int (*fn)(devname_handle_t *, char *); 627 int (*rmfn)(devname_handle_t *); 628 int error = 0; 629 dev_t fsid; 630 int bkstore = 0; 631 vtype_t type; 632 633 /* prevent modifying "." and ".." */ 634 if ((onm[0] == '.' && 635 (onm[1] == '\0' || (onm[1] == '.' && onm[2] == '\0'))) || 636 (nnm[0] == '.' && 637 (nnm[1] == '\0' || (nnm[1] == '.' && nnm[2] == '\0')))) { 638 return (EINVAL); 639 } 640 641 fromparent = VTOSDEV(odvp); 642 toparent = VTOSDEV(ndvp); 643 644 /* ZOMBIE parent doesn't allow new node creation */ 645 rw_enter(&fromparent->sdev_dotdot->sdev_contents, RW_READER); 646 if (fromparent->sdev_state == SDEV_ZOMBIE) { 647 rw_exit(&fromparent->sdev_dotdot->sdev_contents); 648 return (ENOENT); 649 } 650 651 /* renaming only supported for global device nodes */ 652 if (!SDEV_IS_GLOBAL(fromparent)) { 653 rw_exit(&fromparent->sdev_dotdot->sdev_contents); 654 return (ENOTSUP); 655 } 656 rw_exit(&fromparent->sdev_dotdot->sdev_contents); 657 658 rw_enter(&toparent->sdev_dotdot->sdev_contents, RW_READER); 659 if (toparent->sdev_state == SDEV_ZOMBIE) { 660 rw_exit(&toparent->sdev_dotdot->sdev_contents); 661 return (ENOENT); 662 } 663 rw_exit(&toparent->sdev_dotdot->sdev_contents); 664 665 /* 666 * grabbing the global lock to prevent 667 * mount/unmount/other rename activities. 668 */ 669 mutex_enter(&sdev_lock); 670 671 /* check existence of the source node */ 672 error = VOP_LOOKUP(odvp, onm, &ovp, NULL, 0, NULL, cred); 673 if (error) { 674 sdcmn_err2(("sdev_rename: the source node %s exists\n", 675 onm)); 676 mutex_exit(&sdev_lock); 677 return (error); 678 } 679 680 if (VOP_REALVP(ovp, &realvp) == 0) { 681 VN_HOLD(realvp); 682 VN_RELE(ovp); 683 ovp = realvp; 684 } 685 686 /* check existence of destination */ 687 error = VOP_LOOKUP(ndvp, nnm, &nvp, NULL, 0, NULL, cred); 688 if (error && (error != ENOENT)) { 689 mutex_exit(&sdev_lock); 690 VN_RELE(ovp); 691 return (error); 692 } 693 694 if (nvp && (VOP_REALVP(nvp, &realvp) == 0)) { 695 VN_HOLD(realvp); 696 VN_RELE(nvp); 697 nvp = realvp; 698 } 699 700 /* 701 * make sure the source and the destination are 702 * in the same dev filesystem 703 */ 704 if (odvp != ndvp) { 705 vattr.va_mask = AT_FSID; 706 if (error = VOP_GETATTR(odvp, &vattr, 0, cred)) { 707 mutex_exit(&sdev_lock); 708 VN_RELE(ovp); 709 return (error); 710 } 711 fsid = vattr.va_fsid; 712 vattr.va_mask = AT_FSID; 713 if (error = VOP_GETATTR(ndvp, &vattr, 0, cred)) { 714 mutex_exit(&sdev_lock); 715 VN_RELE(ovp); 716 return (error); 717 } 718 if (fsid != vattr.va_fsid) { 719 mutex_exit(&sdev_lock); 720 VN_RELE(ovp); 721 return (EXDEV); 722 } 723 } 724 725 /* make sure the old entry can be deleted */ 726 error = VOP_ACCESS(odvp, VWRITE, 0, cred); 727 if (error) { 728 mutex_exit(&sdev_lock); 729 VN_RELE(ovp); 730 return (error); 731 } 732 733 /* make sure the destination allows creation */ 734 samedir = (fromparent == toparent); 735 if (!samedir) { 736 error = VOP_ACCESS(ndvp, VEXEC|VWRITE, 0, cred); 737 if (error) { 738 mutex_exit(&sdev_lock); 739 VN_RELE(ovp); 740 return (error); 741 } 742 } 743 744 fromdv = VTOSDEV(ovp); 745 ASSERT(fromdv); 746 747 /* check with the plug-in modules for the source directory */ 748 rw_enter(&fromparent->sdev_contents, RW_READER); 749 omap = sdev_get_map(fromparent, 0); 750 rw_exit(&fromparent->sdev_contents); 751 odirops = omap ? omap->dir_ops : NULL; 752 if (odirops && ((fn = odirops->devnops_rename) != NULL)) { 753 if (samedir) { 754 error = (*fn)(&(fromdv->sdev_handle), nnm); 755 } else { 756 len = strlen(nnm) + strlen(toparent->sdev_name) + 2; 757 (void) snprintf(nnm_path, len, "%s/%s", 758 toparent->sdev_name, nnm); 759 error = (*fn)(&(fromdv->sdev_handle), nnm); 760 } 761 762 if (error) { 763 mutex_exit(&sdev_lock); 764 sdcmn_err2(("sdev_rename: DBNR doesn't " 765 "allow rename, error %d", error)); 766 VN_RELE(ovp); 767 return (error); 768 } 769 } 770 771 /* destination file exists */ 772 if (nvp) { 773 todv = VTOSDEV(nvp); 774 ASSERT(todv); 775 } 776 777 /* 778 * link source to new target in the memory 779 */ 780 error = sdev_rnmnode(fromparent, fromdv, toparent, &todv, nnm, cred); 781 if (error) { 782 sdcmn_err2(("sdev_rename: renaming %s to %s failed " 783 " with error %d\n", onm, nnm, error)); 784 mutex_exit(&sdev_lock); 785 if (nvp) 786 VN_RELE(nvp); 787 VN_RELE(ovp); 788 return (error); 789 } 790 791 /* notify the DBNR module the node is going away */ 792 if (odirops && ((rmfn = odirops->devnops_remove) != NULL)) { 793 (void) (*rmfn)(&(fromdv->sdev_handle)); 794 } 795 796 /* 797 * unlink from source 798 */ 799 rw_enter(&fromparent->sdev_contents, RW_READER); 800 fromdv = sdev_cache_lookup(fromparent, onm); 801 if (fromdv == NULL) { 802 rw_exit(&fromparent->sdev_contents); 803 mutex_exit(&sdev_lock); 804 sdcmn_err2(("sdev_rename: the source is deleted already\n")); 805 return (0); 806 } 807 808 if (fromdv->sdev_state == SDEV_ZOMBIE) { 809 rw_exit(&fromparent->sdev_contents); 810 mutex_exit(&sdev_lock); 811 VN_RELE(SDEVTOV(fromdv)); 812 sdcmn_err2(("sdev_rename: the source is being deleted\n")); 813 return (0); 814 } 815 rw_exit(&fromparent->sdev_contents); 816 ASSERT(SDEVTOV(fromdv) == ovp); 817 VN_RELE(ovp); 818 819 /* clean out the directory contents before it can be removed */ 820 type = SDEVTOV(fromdv)->v_type; 821 if (type == VDIR) { 822 error = sdev_cleandir(fromdv, NULL, 0); 823 sdcmn_err2(("sdev_rename: cleandir finished with %d\n", 824 error)); 825 if (error == EBUSY) 826 error = 0; 827 } 828 829 rw_enter(&fromparent->sdev_contents, RW_WRITER); 830 bkstore = SDEV_IS_PERSIST(fromdv) ? 1 : 0; 831 error = sdev_cache_update(fromparent, &fromdv, onm, 832 SDEV_CACHE_DELETE); 833 834 /* best effforts clean up the backing store */ 835 if (bkstore) { 836 ASSERT(fromparent->sdev_attrvp); 837 if (type != VDIR) { 838 error = VOP_REMOVE(fromparent->sdev_attrvp, 839 onm, kcred); 840 } else { 841 error = VOP_RMDIR(fromparent->sdev_attrvp, 842 onm, fromparent->sdev_attrvp, kcred); 843 } 844 845 if (error) { 846 sdcmn_err2(("sdev_rename: device %s is " 847 "still on disk %s\n", onm, 848 fromparent->sdev_path)); 849 error = 0; 850 } 851 } 852 rw_exit(&fromparent->sdev_contents); 853 mutex_exit(&sdev_lock); 854 855 /* once reached to this point, the rename is regarded successful */ 856 return (0); 857 } 858 859 /* 860 * dev-fs version of "ln -s path dev-name" 861 * tnm - path, e.g. /devices/... or /dev/... 862 * lnm - dev_name 863 */ 864 static int 865 sdev_symlink(struct vnode *dvp, char *lnm, struct vattr *tva, 866 char *tnm, struct cred *cred) 867 { 868 int error; 869 struct vnode *vp = NULL; 870 struct sdev_node *parent = (struct sdev_node *)VTOSDEV(dvp); 871 struct sdev_node *self = (struct sdev_node *)NULL; 872 873 ASSERT(parent); 874 rw_enter(&parent->sdev_dotdot->sdev_contents, RW_READER); 875 if (parent->sdev_state == SDEV_ZOMBIE) { 876 rw_exit(&parent->sdev_dotdot->sdev_contents); 877 sdcmn_err2(("sdev_symlink: parent %s is ZOMBIED \n", 878 parent->sdev_name)); 879 return (ENOENT); 880 } 881 882 if (!SDEV_IS_GLOBAL(parent)) { 883 rw_exit(&parent->sdev_dotdot->sdev_contents); 884 return (ENOTSUP); 885 } 886 rw_exit(&parent->sdev_dotdot->sdev_contents); 887 888 /* find existing name */ 889 error = VOP_LOOKUP(dvp, lnm, &vp, NULL, 0, NULL, cred); 890 if (error == 0) { 891 ASSERT(vp); 892 VN_RELE(vp); 893 sdcmn_err2(("sdev_symlink: node %s already exists\n", lnm)); 894 return (EEXIST); 895 } 896 897 if (error != ENOENT) { 898 return (error); 899 } 900 901 /* put it into memory cache */ 902 rw_enter(&parent->sdev_contents, RW_WRITER); 903 error = sdev_mknode(parent, lnm, &self, tva, NULL, (void *)tnm, 904 cred, SDEV_READY); 905 if (error) { 906 rw_exit(&parent->sdev_contents); 907 sdcmn_err2(("sdev_symlink: node %s creation failed\n", lnm)); 908 if (self) 909 SDEV_RELE(self); 910 911 return (error); 912 } 913 ASSERT(self && (self->sdev_state == SDEV_READY)); 914 rw_exit(&parent->sdev_contents); 915 916 /* take care the timestamps for the node and its parent */ 917 sdev_update_timestamps(SDEVTOV(self), kcred, 918 AT_CTIME|AT_MTIME|AT_ATIME); 919 sdev_update_timestamps(dvp, kcred, AT_MTIME|AT_ATIME); 920 if (SDEV_IS_GLOBAL(parent)) 921 atomic_inc_ulong(&parent->sdev_gdir_gen); 922 923 /* wake up other threads blocked on looking up this node */ 924 mutex_enter(&self->sdev_lookup_lock); 925 SDEV_UNBLOCK_OTHERS(self, SDEV_LOOKUP); 926 mutex_exit(&self->sdev_lookup_lock); 927 SDEV_RELE(self); /* don't return with vnode held */ 928 return (0); 929 } 930 931 static int 932 sdev_mkdir(struct vnode *dvp, char *nm, struct vattr *va, struct vnode **vpp, 933 struct cred *cred) 934 { 935 int error; 936 struct sdev_node *parent = (struct sdev_node *)VTOSDEV(dvp); 937 struct sdev_node *self = NULL; 938 struct vnode *vp = NULL; 939 940 ASSERT(parent && parent->sdev_dotdot); 941 rw_enter(&parent->sdev_dotdot->sdev_contents, RW_READER); 942 if (parent->sdev_state == SDEV_ZOMBIE) { 943 rw_exit(&parent->sdev_dotdot->sdev_contents); 944 return (ENOENT); 945 } 946 947 /* non-global do not allow pure directory creation */ 948 if (!SDEV_IS_GLOBAL(parent)) { 949 rw_exit(&parent->sdev_dotdot->sdev_contents); 950 return (prof_lookup(dvp, nm, vpp, cred)); 951 } 952 rw_exit(&parent->sdev_dotdot->sdev_contents); 953 954 /* find existing name */ 955 error = VOP_LOOKUP(dvp, nm, &vp, NULL, 0, NULL, cred); 956 if (error == 0) { 957 VN_RELE(vp); 958 return (EEXIST); 959 } 960 961 if (error != ENOENT) 962 return (error); 963 964 /* put it into memory */ 965 rw_enter(&parent->sdev_contents, RW_WRITER); 966 error = sdev_mknode(parent, nm, &self, 967 va, NULL, NULL, cred, SDEV_READY); 968 if (error) { 969 rw_exit(&parent->sdev_contents); 970 if (self) 971 SDEV_RELE(self); 972 return (error); 973 } 974 ASSERT(self && (self->sdev_state == SDEV_READY)); 975 rw_exit(&parent->sdev_contents); 976 977 /* take care the timestamps for the node and its parent */ 978 sdev_update_timestamps(SDEVTOV(self), kcred, 979 AT_CTIME|AT_MTIME|AT_ATIME); 980 sdev_update_timestamps(dvp, kcred, AT_MTIME|AT_ATIME); 981 if (SDEV_IS_GLOBAL(parent)) 982 atomic_inc_ulong(&parent->sdev_gdir_gen); 983 984 /* wake up other threads blocked on looking up this node */ 985 mutex_enter(&self->sdev_lookup_lock); 986 SDEV_UNBLOCK_OTHERS(self, SDEV_LOOKUP); 987 mutex_exit(&self->sdev_lookup_lock); 988 *vpp = SDEVTOV(self); 989 return (0); 990 } 991 992 /* 993 * allowing removing an empty directory under /dev 994 */ 995 /*ARGSUSED*/ 996 static int 997 sdev_rmdir(struct vnode *dvp, char *nm, struct vnode *cdir, struct cred *cred) 998 { 999 int error = 0; 1000 struct sdev_node *parent = (struct sdev_node *)VTOSDEV(dvp); 1001 struct sdev_node *self = NULL; 1002 struct vnode *vp = NULL; 1003 1004 /* bail out early */ 1005 if (strcmp(nm, ".") == 0) 1006 return (EINVAL); 1007 if (strcmp(nm, "..") == 0) 1008 return (EEXIST); /* should be ENOTEMPTY */ 1009 1010 /* no destruction of non-global node */ 1011 ASSERT(parent && parent->sdev_dotdot); 1012 rw_enter(&parent->sdev_dotdot->sdev_contents, RW_READER); 1013 if (!SDEV_IS_GLOBAL(parent)) { 1014 rw_exit(&parent->sdev_dotdot->sdev_contents); 1015 return (ENOTSUP); 1016 } 1017 rw_exit(&parent->sdev_dotdot->sdev_contents); 1018 1019 /* check existing name */ 1020 rw_enter(&parent->sdev_contents, RW_WRITER); 1021 self = sdev_cache_lookup(parent, nm); 1022 if (self == NULL) { 1023 rw_exit(&parent->sdev_contents); 1024 return (ENOENT); 1025 } 1026 1027 vp = SDEVTOV(self); 1028 if ((self->sdev_state == SDEV_INIT) || 1029 (self->sdev_state == SDEV_ZOMBIE)) { 1030 rw_exit(&parent->sdev_contents); 1031 VN_RELE(vp); 1032 return (ENOENT); 1033 } 1034 1035 /* some sanity checks */ 1036 if (vp == dvp || vp == cdir) { 1037 rw_exit(&parent->sdev_contents); 1038 VN_RELE(vp); 1039 return (EINVAL); 1040 } 1041 1042 if (vp->v_type != VDIR) { 1043 rw_exit(&parent->sdev_contents); 1044 VN_RELE(vp); 1045 return (ENOTDIR); 1046 } 1047 1048 if (vn_vfswlock(vp)) { 1049 rw_exit(&parent->sdev_contents); 1050 VN_RELE(vp); 1051 return (EBUSY); 1052 } 1053 1054 if (vn_mountedvfs(vp) != NULL) { 1055 rw_exit(&parent->sdev_contents); 1056 vn_vfsunlock(vp); 1057 VN_RELE(vp); 1058 return (EBUSY); 1059 } 1060 1061 self = VTOSDEV(vp); 1062 /* bail out on a non-empty directory */ 1063 rw_enter(&self->sdev_contents, RW_READER); 1064 if (self->sdev_nlink > 2) { 1065 rw_exit(&self->sdev_contents); 1066 rw_exit(&parent->sdev_contents); 1067 vn_vfsunlock(vp); 1068 VN_RELE(vp); 1069 return (ENOTEMPTY); 1070 } 1071 rw_exit(&self->sdev_contents); 1072 1073 /* unlink it from the directory cache */ 1074 error = sdev_cache_update(parent, &self, nm, SDEV_CACHE_DELETE); 1075 rw_exit(&parent->sdev_contents); 1076 vn_vfsunlock(vp); 1077 1078 if (error && (error != EBUSY)) { 1079 VN_RELE(vp); 1080 } else { 1081 sdcmn_err2(("sdev_rmdir: cleaning node %s from directory " 1082 " cache with error %d\n", nm, error)); 1083 1084 /* best effort to clean up the backing store */ 1085 if (SDEV_IS_PERSIST(parent)) { 1086 ASSERT(parent->sdev_attrvp); 1087 error = VOP_RMDIR(parent->sdev_attrvp, nm, 1088 parent->sdev_attrvp, kcred); 1089 sdcmn_err2(("sdev_rmdir: cleaning device %s is on" 1090 " disk error %d\n", parent->sdev_path, error)); 1091 } 1092 1093 if (error == EBUSY) 1094 error = 0; 1095 } 1096 1097 return (error); 1098 } 1099 1100 /* 1101 * read the contents of a symbolic link 1102 */ 1103 static int 1104 sdev_readlink(struct vnode *vp, struct uio *uiop, struct cred *cred) 1105 { 1106 struct sdev_node *dv; 1107 int error = 0; 1108 1109 ASSERT(vp->v_type == VLNK); 1110 1111 dv = VTOSDEV(vp); 1112 1113 if (dv->sdev_attrvp) { 1114 /* non-NULL attrvp implys a persisted node at READY state */ 1115 return (VOP_READLINK(dv->sdev_attrvp, uiop, cred)); 1116 } else if (dv->sdev_symlink != NULL) { 1117 /* memory nodes, e.g. local nodes */ 1118 rw_enter(&dv->sdev_contents, RW_READER); 1119 sdcmn_err2(("sdev_readlink link is %s\n", dv->sdev_symlink)); 1120 error = uiomove(dv->sdev_symlink, strlen(dv->sdev_symlink), 1121 UIO_READ, uiop); 1122 rw_exit(&dv->sdev_contents); 1123 return (error); 1124 } 1125 1126 return (ENOENT); 1127 } 1128 1129 static int 1130 sdev_readdir(struct vnode *dvp, struct uio *uiop, struct cred *cred, int *eofp) 1131 { 1132 struct sdev_node *parent = VTOSDEV(dvp); 1133 1134 ASSERT(parent); 1135 if (!SDEV_IS_GLOBAL(parent)) 1136 prof_filldir(parent); 1137 return (devname_readdir_func(dvp, uiop, cred, eofp, SDEV_BROWSE)); 1138 } 1139 1140 /*ARGSUSED1*/ 1141 static void 1142 sdev_inactive(struct vnode *vp, struct cred *cred) 1143 { 1144 int clean; 1145 struct sdev_node *dv = VTOSDEV(vp); 1146 struct sdev_node *ddv = dv->sdev_dotdot; 1147 struct sdev_node *idv; 1148 struct sdev_node *prev = NULL; 1149 int state; 1150 struct devname_nsmap *map = NULL; 1151 struct devname_ops *dirops = NULL; 1152 void (*fn)(devname_handle_t *, struct cred *) = NULL; 1153 1154 rw_enter(&ddv->sdev_contents, RW_WRITER); 1155 state = dv->sdev_state; 1156 1157 mutex_enter(&vp->v_lock); 1158 ASSERT(vp->v_count >= 1); 1159 1160 clean = (vp->v_count == 1) && (state == SDEV_ZOMBIE); 1161 1162 /* 1163 * last ref count on the ZOMBIE node is released. 1164 * clean up the sdev_node, and 1165 * release the hold on the backing store node so that 1166 * the ZOMBIE backing stores also cleaned out. 1167 */ 1168 if (clean) { 1169 ASSERT(ddv); 1170 if (SDEV_IS_GLOBAL(dv)) { 1171 map = ddv->sdev_mapinfo; 1172 dirops = map ? map->dir_ops : NULL; 1173 if (dirops && (fn = dirops->devnops_inactive)) 1174 (*fn)(&(dv->sdev_handle), cred); 1175 } 1176 1177 ddv->sdev_nlink--; 1178 if (vp->v_type == VDIR) { 1179 dv->sdev_nlink--; 1180 } 1181 for (idv = ddv->sdev_dot; idv && idv != dv; 1182 prev = idv, idv = idv->sdev_next); 1183 ASSERT(idv == dv); 1184 if (prev == NULL) 1185 ddv->sdev_dot = dv->sdev_next; 1186 else 1187 prev->sdev_next = dv->sdev_next; 1188 dv->sdev_next = NULL; 1189 dv->sdev_nlink--; 1190 --vp->v_count; 1191 mutex_exit(&vp->v_lock); 1192 sdev_nodedestroy(dv, 0); 1193 } else { 1194 --vp->v_count; 1195 mutex_exit(&vp->v_lock); 1196 } 1197 rw_exit(&ddv->sdev_contents); 1198 } 1199 1200 static int 1201 sdev_fid(struct vnode *vp, struct fid *fidp) 1202 { 1203 struct sdev_node *dv = VTOSDEV(vp); 1204 struct sdev_fid *sdev_fid; 1205 1206 if (fidp->fid_len < (sizeof (struct sdev_fid) - sizeof (ushort_t))) { 1207 fidp->fid_len = sizeof (struct sdev_fid) - sizeof (ushort_t); 1208 return (ENOSPC); 1209 } 1210 1211 sdev_fid = (struct sdev_fid *)fidp; 1212 bzero(sdev_fid, sizeof (struct sdev_fid)); 1213 sdev_fid->sdevfid_len = 1214 (int)sizeof (struct sdev_fid) - sizeof (ushort_t); 1215 sdev_fid->sdevfid_ino = dv->sdev_ino; 1216 1217 return (0); 1218 } 1219 1220 /* 1221 * This pair of routines bracket all VOP_READ, VOP_WRITE 1222 * and VOP_READDIR requests. The contents lock stops things 1223 * moving around while we're looking at them. 1224 */ 1225 /*ARGSUSED2*/ 1226 static int 1227 sdev_rwlock(struct vnode *vp, int write_flag, caller_context_t *ctp) 1228 { 1229 rw_enter(&VTOSDEV(vp)->sdev_contents, 1230 write_flag ? RW_WRITER : RW_READER); 1231 return (write_flag ? V_WRITELOCK_TRUE : V_WRITELOCK_FALSE); 1232 } 1233 1234 /*ARGSUSED1*/ 1235 static void 1236 sdev_rwunlock(struct vnode *vp, int write_flag, caller_context_t *ctp) 1237 { 1238 rw_exit(&VTOSDEV(vp)->sdev_contents); 1239 } 1240 1241 /*ARGSUSED1*/ 1242 static int 1243 sdev_seek(struct vnode *vp, offset_t ooff, offset_t *noffp) 1244 { 1245 struct vnode *attrvp = VTOSDEV(vp)->sdev_attrvp; 1246 1247 ASSERT(vp->v_type != VCHR && 1248 vp->v_type != VBLK && vp->v_type != VLNK); 1249 1250 if (vp->v_type == VDIR) 1251 return (fs_seek(vp, ooff, noffp)); 1252 1253 ASSERT(attrvp); 1254 return (VOP_SEEK(attrvp, ooff, noffp)); 1255 } 1256 1257 /*ARGSUSED1*/ 1258 static int 1259 sdev_frlock(struct vnode *vp, int cmd, struct flock64 *bfp, int flag, 1260 offset_t offset, struct flk_callback *flk_cbp, struct cred *cr) 1261 { 1262 int error; 1263 struct sdev_node *dv = VTOSDEV(vp); 1264 1265 ASSERT(dv); 1266 ASSERT(dv->sdev_attrvp); 1267 error = VOP_FRLOCK(dv->sdev_attrvp, cmd, bfp, flag, offset, 1268 flk_cbp, cr); 1269 1270 return (error); 1271 } 1272 1273 static int 1274 sdev_setfl(struct vnode *vp, int oflags, int nflags, cred_t *cr) 1275 { 1276 struct sdev_node *dv = VTOSDEV(vp); 1277 ASSERT(dv); 1278 ASSERT(dv->sdev_attrvp); 1279 1280 return (VOP_SETFL(dv->sdev_attrvp, oflags, nflags, cr)); 1281 } 1282 1283 static int 1284 sdev_pathconf(vnode_t *vp, int cmd, ulong_t *valp, cred_t *cr) 1285 { 1286 switch (cmd) { 1287 case _PC_ACL_ENABLED: 1288 *valp = SDEV_ACL_FLAVOR(vp); 1289 return (0); 1290 } 1291 1292 return (fs_pathconf(vp, cmd, valp, cr)); 1293 } 1294 1295 vnodeops_t *sdev_vnodeops; 1296 1297 const fs_operation_def_t sdev_vnodeops_tbl[] = { 1298 VOPNAME_OPEN, sdev_open, 1299 VOPNAME_CLOSE, sdev_close, 1300 VOPNAME_READ, sdev_read, 1301 VOPNAME_WRITE, sdev_write, 1302 VOPNAME_IOCTL, sdev_ioctl, 1303 VOPNAME_GETATTR, sdev_getattr, 1304 VOPNAME_SETATTR, sdev_setattr, 1305 VOPNAME_ACCESS, sdev_access, 1306 VOPNAME_LOOKUP, sdev_lookup, 1307 VOPNAME_CREATE, sdev_create, 1308 VOPNAME_RENAME, sdev_rename, 1309 VOPNAME_REMOVE, sdev_remove, 1310 VOPNAME_MKDIR, sdev_mkdir, 1311 VOPNAME_RMDIR, sdev_rmdir, 1312 VOPNAME_READDIR, sdev_readdir, 1313 VOPNAME_SYMLINK, sdev_symlink, 1314 VOPNAME_READLINK, sdev_readlink, /* readlink */ 1315 VOPNAME_INACTIVE, (fs_generic_func_p)sdev_inactive, 1316 VOPNAME_FID, sdev_fid, 1317 VOPNAME_RWLOCK, (fs_generic_func_p)sdev_rwlock, 1318 VOPNAME_RWUNLOCK, (fs_generic_func_p)sdev_rwunlock, 1319 VOPNAME_SEEK, sdev_seek, 1320 VOPNAME_FRLOCK, sdev_frlock, 1321 VOPNAME_PATHCONF, sdev_pathconf, 1322 VOPNAME_SETFL, sdev_setfl, 1323 VOPNAME_SETSECATTR, sdev_setsecattr, /* setsecattr */ 1324 VOPNAME_GETSECATTR, sdev_getsecattr, /* getsecattr */ 1325 NULL, NULL 1326 }; 1327 1328 int sdev_vnodeops_tbl_size = sizeof (sdev_vnodeops_tbl); 1329