1 /*- 2 * Copyright (c) 1998, 1999 Semen Ustimenko (semenu@FreeBSD.org) 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 * $FreeBSD: src/sys/fs/hpfs/hpfs_vnops.c,v 1.2.2.2 2002/01/15 18:35:09 semenu Exp $ 27 * $DragonFly: src/sys/vfs/hpfs/hpfs_vnops.c,v 1.23 2005/04/15 19:08:17 dillon Exp $ 28 */ 29 30 #include <sys/param.h> 31 #include <sys/systm.h> 32 #include <sys/kernel.h> 33 #include <sys/proc.h> 34 #include <sys/time.h> 35 #include <sys/types.h> 36 #include <sys/stat.h> 37 #include <sys/vnode.h> 38 #include <sys/mount.h> 39 #include <sys/namei.h> 40 #include <sys/malloc.h> 41 #include <sys/buf.h> 42 #include <sys/dirent.h> 43 44 #include <vm/vm.h> 45 #include <vm/vm_param.h> 46 #if !defined(__DragonFly__) 47 #include <vm/vm_prot.h> 48 #endif 49 #include <vm/vm_page.h> 50 #include <vm/vm_object.h> 51 #include <vm/vm_pager.h> 52 #include <vm/vm_zone.h> 53 #if defined(__DragonFly__) 54 #include <vm/vnode_pager.h> 55 #endif 56 #include <vm/vm_extern.h> 57 #include <sys/buf2.h> 58 59 #if !defined(__DragonFly__) 60 #include <miscfs/specfs/specdev.h> 61 #include <miscfs/genfs/genfs.h> 62 #endif 63 64 #include <sys/unistd.h> /* for pathconf(2) constants */ 65 66 #include "hpfs.h" 67 #include "hpfsmount.h" 68 #include "hpfs_subr.h" 69 #include "hpfs_ioctl.h" 70 71 static int hpfs_de_uiomove (struct hpfsmount *, struct hpfsdirent *, 72 struct uio *); 73 static int hpfs_ioctl (struct vop_ioctl_args *ap); 74 static int hpfs_read (struct vop_read_args *); 75 static int hpfs_write (struct vop_write_args *ap); 76 static int hpfs_getattr (struct vop_getattr_args *ap); 77 static int hpfs_setattr (struct vop_setattr_args *ap); 78 static int hpfs_inactive (struct vop_inactive_args *ap); 79 static int hpfs_print (struct vop_print_args *ap); 80 static int hpfs_reclaim (struct vop_reclaim_args *ap); 81 static int hpfs_strategy (struct vop_strategy_args *ap); 82 static int hpfs_access (struct vop_access_args *ap); 83 static int hpfs_open (struct vop_open_args *ap); 84 static int hpfs_close (struct vop_close_args *ap); 85 static int hpfs_readdir (struct vop_readdir_args *ap); 86 static int hpfs_lookup (struct vop_lookup_args *ap); 87 static int hpfs_create (struct vop_create_args *); 88 static int hpfs_remove (struct vop_remove_args *); 89 static int hpfs_bmap (struct vop_bmap_args *ap); 90 #if defined(__DragonFly__) 91 static int hpfs_getpages (struct vop_getpages_args *ap); 92 static int hpfs_putpages (struct vop_putpages_args *); 93 static int hpfs_fsync (struct vop_fsync_args *ap); 94 #endif 95 static int hpfs_pathconf (struct vop_pathconf_args *ap); 96 97 #if defined(__DragonFly__) 98 int 99 hpfs_getpages(struct vop_getpages_args *ap) 100 { 101 return vnode_pager_generic_getpages(ap->a_vp, ap->a_m, ap->a_count, 102 ap->a_reqpage); 103 } 104 105 int 106 hpfs_putpages(struct vop_putpages_args *ap) 107 { 108 return vnode_pager_generic_putpages(ap->a_vp, ap->a_m, ap->a_count, 109 ap->a_sync, ap->a_rtvals); 110 } 111 112 /* 113 * hpfs_fsync(struct vnode *a_vp, struct ucred *a_cred, int a_waitfor, 114 * struct proc *a_td) 115 */ 116 static int 117 hpfs_fsync(struct vop_fsync_args *ap) 118 { 119 struct vnode *vp = ap->a_vp; 120 121 /* 122 * Flush all dirty buffers associated with a vnode. 123 */ 124 #ifdef DIAGNOSTIC 125 loop: 126 #endif 127 vfsync(vp, ap->a_waitfor, 0, (daddr_t)-1, NULL, NULL); 128 #ifdef DIAGNOSTIC 129 if (ap->a_waitfor == MNT_WAIT && !RB_EMPTY(&vp->v_rbdirty_tree)) { 130 vprint("hpfs_fsync: dirty", vp); 131 goto loop; 132 } 133 #endif 134 135 /* 136 * Write out the on-disc version of the vnode. 137 */ 138 return hpfs_update(VTOHP(vp)); 139 } 140 141 #endif 142 143 /* 144 * hpfs_ioctl(struct vnode *a_vp, u_long a_command, caddr_t a_data, 145 * int a_fflag, struct ucred *a_cred, struct proc *a_td) 146 */ 147 static int 148 hpfs_ioctl(struct vop_ioctl_args *ap) 149 { 150 struct vnode *vp = ap->a_vp; 151 struct hpfsnode *hp = VTOHP(vp); 152 int error; 153 154 printf("hpfs_ioctl(0x%x, 0x%lx, 0x%p, 0x%x): ", 155 hp->h_no, ap->a_command, ap->a_data, ap->a_fflag); 156 157 switch (ap->a_command) { 158 case HPFSIOCGEANUM: { 159 u_long eanum; 160 u_long passed; 161 struct ea *eap; 162 163 eanum = 0; 164 165 if (hp->h_fn.fn_ealen > 0) { 166 eap = (struct ea *)&(hp->h_fn.fn_int); 167 passed = 0; 168 169 while (passed < hp->h_fn.fn_ealen) { 170 171 printf("EAname: %s\n", EA_NAME(eap)); 172 173 eanum++; 174 passed += sizeof(struct ea) + 175 eap->ea_namelen + 1 + eap->ea_vallen; 176 eap = (struct ea *)((caddr_t)hp->h_fn.fn_int + 177 passed); 178 } 179 error = 0; 180 } else { 181 error = ENOENT; 182 } 183 184 printf("%lu eas\n", eanum); 185 186 *(u_long *)ap->a_data = eanum; 187 188 break; 189 } 190 case HPFSIOCGEASZ: { 191 u_long eanum; 192 u_long passed; 193 struct ea *eap; 194 195 printf("EA%ld\n", *(u_long *)ap->a_data); 196 197 eanum = 0; 198 if (hp->h_fn.fn_ealen > 0) { 199 eap = (struct ea *)&(hp->h_fn.fn_int); 200 passed = 0; 201 202 error = ENOENT; 203 while (passed < hp->h_fn.fn_ealen) { 204 printf("EAname: %s\n", EA_NAME(eap)); 205 206 if (eanum == *(u_long *)ap->a_data) { 207 *(u_long *)ap->a_data = 208 eap->ea_namelen + 1 + 209 eap->ea_vallen; 210 211 error = 0; 212 break; 213 } 214 215 eanum++; 216 passed += sizeof(struct ea) + 217 eap->ea_namelen + 1 + eap->ea_vallen; 218 eap = (struct ea *)((caddr_t)hp->h_fn.fn_int + 219 passed); 220 } 221 } else { 222 error = ENOENT; 223 } 224 225 break; 226 } 227 case HPFSIOCRDEA: { 228 u_long eanum; 229 u_long passed; 230 struct hpfs_rdea *rdeap; 231 struct ea *eap; 232 233 rdeap = (struct hpfs_rdea *)ap->a_data; 234 printf("EA%ld\n", rdeap->ea_no); 235 236 eanum = 0; 237 if (hp->h_fn.fn_ealen > 0) { 238 eap = (struct ea *)&(hp->h_fn.fn_int); 239 passed = 0; 240 241 error = ENOENT; 242 while (passed < hp->h_fn.fn_ealen) { 243 printf("EAname: %s\n", EA_NAME(eap)); 244 245 if (eanum == rdeap->ea_no) { 246 rdeap->ea_sz = eap->ea_namelen + 1 + 247 eap->ea_vallen; 248 copyout(EA_NAME(eap),rdeap->ea_data, 249 rdeap->ea_sz); 250 error = 0; 251 break; 252 } 253 254 eanum++; 255 passed += sizeof(struct ea) + 256 eap->ea_namelen + 1 + eap->ea_vallen; 257 eap = (struct ea *)((caddr_t)hp->h_fn.fn_int + 258 passed); 259 } 260 } else { 261 error = ENOENT; 262 } 263 264 break; 265 } 266 default: 267 error = EOPNOTSUPP; 268 break; 269 } 270 return (error); 271 } 272 273 /* 274 * Map file offset to disk offset. 275 * 276 * hpfs_bmap(struct vnode *a_vp, daddr_t a_bn, struct vnode **a_vpp, 277 * daddr_t *a_bnp, int *a_runp, int *a_runb) 278 */ 279 int 280 hpfs_bmap(struct vop_bmap_args *ap) 281 { 282 struct hpfsnode *hp = VTOHP(ap->a_vp); 283 int error; 284 285 if (ap->a_vpp != NULL) 286 *ap->a_vpp = hp->h_devvp; 287 #if defined(__DragonFly__) 288 if (ap->a_runb != NULL) 289 *ap->a_runb = 0; 290 #endif 291 if (ap->a_bnp == NULL) 292 return (0); 293 294 dprintf(("hpfs_bmap(0x%x, 0x%x): ",hp->h_no, ap->a_bn)); 295 296 error = hpfs_hpbmap (hp, ap->a_bn, ap->a_bnp, ap->a_runp); 297 298 return (error); 299 } 300 301 /* 302 * hpfs_read(struct vnode *a_vp, struct uio *a_uio, int a_ioflag, 303 * struct ucred *a_cred) 304 */ 305 static int 306 hpfs_read(struct vop_read_args *ap) 307 { 308 struct vnode *vp = ap->a_vp; 309 struct hpfsnode *hp = VTOHP(vp); 310 struct uio *uio = ap->a_uio; 311 struct buf *bp; 312 u_int xfersz, toread; 313 u_int off; 314 daddr_t lbn, bn; 315 int resid; 316 int runl; 317 int error = 0; 318 319 resid = min (uio->uio_resid, hp->h_fn.fn_size - uio->uio_offset); 320 321 dprintf(("hpfs_read(0x%x, off: %d resid: %d, segflg: %d): [resid: 0x%x]\n",hp->h_no,(u_int32_t)uio->uio_offset,uio->uio_resid,uio->uio_segflg, resid)); 322 323 while (resid) { 324 lbn = uio->uio_offset >> DEV_BSHIFT; 325 off = uio->uio_offset & (DEV_BSIZE - 1); 326 dprintf(("hpfs_read: resid: 0x%x lbn: 0x%x off: 0x%x\n", 327 uio->uio_resid, lbn, off)); 328 error = hpfs_hpbmap(hp, lbn, &bn, &runl); 329 if (error) 330 return (error); 331 332 toread = min(off + resid, min(DFLTPHYS, (runl+1)*DEV_BSIZE)); 333 xfersz = (toread + DEV_BSIZE - 1) & ~(DEV_BSIZE - 1); 334 dprintf(("hpfs_read: bn: 0x%x (0x%x) toread: 0x%x (0x%x)\n", 335 bn, runl, toread, xfersz)); 336 337 if (toread == 0) 338 break; 339 340 error = bread(hp->h_devvp, bn, xfersz, &bp); 341 if (error) { 342 brelse(bp); 343 break; 344 } 345 346 error = uiomove(bp->b_data + off, toread - off, uio); 347 if(error) { 348 brelse(bp); 349 break; 350 } 351 brelse(bp); 352 resid -= toread; 353 } 354 dprintf(("hpfs_read: successful\n")); 355 return (error); 356 } 357 358 /* 359 * hpfs_write(struct vnode *a_vp, struct uio *a_uio, int a_ioflag, 360 * struct ucred *a_cred) 361 */ 362 static int 363 hpfs_write(struct vop_write_args *ap) 364 { 365 struct vnode *vp = ap->a_vp; 366 struct hpfsnode *hp = VTOHP(vp); 367 struct uio *uio = ap->a_uio; 368 struct buf *bp; 369 u_int xfersz, towrite; 370 u_int off; 371 daddr_t lbn, bn; 372 int runl; 373 int error = 0; 374 375 dprintf(("hpfs_write(0x%x, off: %d resid: %d, segflg: %d):\n",hp->h_no,(u_int32_t)uio->uio_offset,uio->uio_resid,uio->uio_segflg)); 376 377 if (ap->a_ioflag & IO_APPEND) { 378 dprintf(("hpfs_write: APPEND mode\n")); 379 uio->uio_offset = hp->h_fn.fn_size; 380 } 381 if (uio->uio_offset + uio->uio_resid > hp->h_fn.fn_size) { 382 error = hpfs_extend (hp, uio->uio_offset + uio->uio_resid); 383 if (error) { 384 printf("hpfs_write: hpfs_extend FAILED %d\n", error); 385 return (error); 386 } 387 } 388 389 while (uio->uio_resid) { 390 lbn = uio->uio_offset >> DEV_BSHIFT; 391 off = uio->uio_offset & (DEV_BSIZE - 1); 392 dprintf(("hpfs_write: resid: 0x%x lbn: 0x%x off: 0x%x\n", 393 uio->uio_resid, lbn, off)); 394 error = hpfs_hpbmap(hp, lbn, &bn, &runl); 395 if (error) 396 return (error); 397 398 towrite = min(off + uio->uio_resid, min(DFLTPHYS, (runl+1)*DEV_BSIZE)); 399 xfersz = (towrite + DEV_BSIZE - 1) & ~(DEV_BSIZE - 1); 400 dprintf(("hpfs_write: bn: 0x%x (0x%x) towrite: 0x%x (0x%x)\n", 401 bn, runl, towrite, xfersz)); 402 403 if ((off == 0) && (towrite == xfersz)) { 404 bp = getblk(hp->h_devvp, bn, xfersz, 0, 0); 405 clrbuf(bp); 406 } else { 407 error = bread(hp->h_devvp, bn, xfersz, &bp); 408 if (error) { 409 brelse(bp); 410 return (error); 411 } 412 } 413 414 error = uiomove(bp->b_data + off, towrite - off, uio); 415 if(error) { 416 brelse(bp); 417 return (error); 418 } 419 420 if (ap->a_ioflag & IO_SYNC) 421 bwrite(bp); 422 else 423 bawrite(bp); 424 } 425 426 dprintf(("hpfs_write: successful\n")); 427 return (0); 428 } 429 430 /* 431 * XXXXX do we need hpfsnode locking inside? 432 * 433 * hpfs_getattr(struct vnode *a_vp, struct vattr *a_vap, struct ucred *a_cred, 434 * struct proc *a_td) 435 */ 436 static int 437 hpfs_getattr(struct vop_getattr_args *ap) 438 { 439 struct vnode *vp = ap->a_vp; 440 struct hpfsnode *hp = VTOHP(vp); 441 struct vattr *vap = ap->a_vap; 442 int error; 443 444 dprintf(("hpfs_getattr(0x%x):\n", hp->h_no)); 445 446 #if defined(__DragonFly__) 447 vap->va_fsid = dev2udev(hp->h_dev); 448 #else /* defined(__NetBSD__) */ 449 vap->va_fsid = ip->i_dev; 450 #endif 451 vap->va_fileid = hp->h_no; 452 vap->va_mode = hp->h_mode; 453 vap->va_nlink = 1; 454 vap->va_uid = hp->h_uid; 455 vap->va_gid = hp->h_gid; 456 vap->va_rdev = 0; /* XXX UNODEV ? */ 457 vap->va_size = hp->h_fn.fn_size; 458 vap->va_bytes = ((hp->h_fn.fn_size + DEV_BSIZE-1) & ~(DEV_BSIZE-1)) + 459 DEV_BSIZE; 460 461 if (!(hp->h_flag & H_PARVALID)) { 462 error = hpfs_validateparent(hp); 463 if (error) 464 return (error); 465 } 466 vap->va_atime = hpfstimetounix(hp->h_atime); 467 vap->va_mtime = hpfstimetounix(hp->h_mtime); 468 vap->va_ctime = hpfstimetounix(hp->h_ctime); 469 470 vap->va_flags = 0; 471 vap->va_gen = 0; 472 vap->va_blocksize = DEV_BSIZE; 473 vap->va_type = vp->v_type; 474 vap->va_filerev = 0; 475 476 return (0); 477 } 478 479 /* 480 * XXXXX do we need hpfsnode locking inside? 481 * 482 * hpfs_setattr(struct vnode *a_vp, struct vattr *a_vap, struct ucred *a_cred, 483 * struct thread *a_td) 484 */ 485 static int 486 hpfs_setattr(struct vop_setattr_args *ap) 487 { 488 struct vnode *vp = ap->a_vp; 489 struct hpfsnode *hp = VTOHP(vp); 490 struct vattr *vap = ap->a_vap; 491 struct ucred *cred = ap->a_cred; 492 struct thread *td = ap->a_td; 493 int error; 494 495 dprintf(("hpfs_setattr(0x%x):\n", hp->h_no)); 496 497 /* 498 * Check for unsettable attributes. 499 */ 500 if ((vap->va_type != VNON) || (vap->va_nlink != VNOVAL) || 501 (vap->va_fsid != VNOVAL) || (vap->va_fileid != VNOVAL) || 502 (vap->va_blocksize != VNOVAL) || (vap->va_rdev != VNOVAL) || 503 (vap->va_bytes != VNOVAL) || (vap->va_gen != VNOVAL)) { 504 dprintf(("hpfs_setattr: changing nonsettable attr\n")); 505 return (EINVAL); 506 } 507 508 /* Can't change flags XXX Could be implemented */ 509 if (vap->va_flags != VNOVAL) { 510 printf("hpfs_setattr: FLAGS CANNOT BE SET\n"); 511 return (EINVAL); 512 } 513 514 /* Can't change uid/gid XXX Could be implemented */ 515 if (vap->va_uid != (uid_t)VNOVAL || vap->va_gid != (gid_t)VNOVAL) { 516 printf("hpfs_setattr: UID/GID CANNOT BE SET\n"); 517 return (EINVAL); 518 } 519 520 /* Can't change mode XXX Could be implemented */ 521 if (vap->va_mode != (mode_t)VNOVAL) { 522 printf("hpfs_setattr: MODE CANNOT BE SET\n"); 523 return (EINVAL); 524 } 525 526 /* Update times */ 527 if (vap->va_atime.tv_sec != VNOVAL || vap->va_mtime.tv_sec != VNOVAL) { 528 if (vp->v_mount->mnt_flag & MNT_RDONLY) 529 return (EROFS); 530 if (cred->cr_uid != hp->h_uid && 531 (error = suser_cred(cred, PRISON_ROOT)) && 532 ((vap->va_vaflags & VA_UTIMES_NULL) == 0 || 533 (error = VOP_ACCESS(vp, VWRITE, cred, td)))) 534 return (error); 535 if (vap->va_atime.tv_sec != VNOVAL) 536 hp->h_atime = vap->va_atime.tv_sec; 537 if (vap->va_mtime.tv_sec != VNOVAL) 538 hp->h_mtime = vap->va_mtime.tv_sec; 539 540 hp->h_flag |= H_PARCHANGE; 541 } 542 543 if (vap->va_size != VNOVAL) { 544 switch (vp->v_type) { 545 case VDIR: 546 return (EISDIR); 547 case VREG: 548 if (vp->v_mount->mnt_flag & MNT_RDONLY) 549 return (EROFS); 550 break; 551 default: 552 printf("hpfs_setattr: WRONG v_type\n"); 553 return (EINVAL); 554 } 555 556 if (vap->va_size < hp->h_fn.fn_size) { 557 #if defined(__DragonFly__) 558 error = vtruncbuf(vp, td, vap->va_size, DEV_BSIZE); 559 if (error) 560 return (error); 561 #else /* defined(__NetBSD__) */ 562 #error Need alternation for vtruncbuf() 563 #endif 564 error = hpfs_truncate(hp, vap->va_size); 565 if (error) 566 return (error); 567 568 } else if (vap->va_size > hp->h_fn.fn_size) { 569 #if defined(__DragonFly__) 570 vnode_pager_setsize(vp, vap->va_size); 571 #endif 572 error = hpfs_extend(hp, vap->va_size); 573 if (error) 574 return (error); 575 } 576 } 577 578 return (0); 579 } 580 581 /* 582 * Last reference to an node. If necessary, write or delete it. 583 * 584 * hpfs_inactive(struct vnode *a_vp) 585 */ 586 int 587 hpfs_inactive(struct vop_inactive_args *ap) 588 { 589 struct vnode *vp = ap->a_vp; 590 struct hpfsnode *hp = VTOHP(vp); 591 int error; 592 593 dprintf(("hpfs_inactive(0x%x): \n", hp->h_no)); 594 595 if (hp->h_flag & H_CHANGE) { 596 dprintf(("hpfs_inactive: node changed, update\n")); 597 error = hpfs_update (hp); 598 if (error) 599 return (error); 600 } 601 602 if (hp->h_flag & H_PARCHANGE) { 603 dprintf(("hpfs_inactive: parent node changed, update\n")); 604 error = hpfs_updateparent (hp); 605 if (error) 606 return (error); 607 } 608 609 if (prtactive && vp->v_usecount != 0) 610 vprint("hpfs_inactive: pushing active", vp); 611 612 if (hp->h_flag & H_INVAL) { 613 #if defined(__DragonFly__) 614 vrecycle(vp, ap->a_td); 615 #else /* defined(__NetBSD__) */ 616 vgone(vp); 617 #endif 618 return (0); 619 } 620 return (0); 621 } 622 623 /* 624 * Reclaim an inode so that it can be used for other purposes. 625 * 626 * hpfs_reclaim(struct vnode *a_vp) 627 */ 628 int 629 hpfs_reclaim(struct vop_reclaim_args *ap) 630 { 631 struct vnode *vp = ap->a_vp; 632 struct hpfsnode *hp = VTOHP(vp); 633 634 dprintf(("hpfs_reclaim(0x%x0): \n", hp->h_no)); 635 636 hpfs_hphashrem(hp); 637 638 /* Purge old data structures associated with the inode. */ 639 if (hp->h_devvp) { 640 vrele(hp->h_devvp); 641 hp->h_devvp = NULL; 642 } 643 644 vp->v_data = NULL; 645 646 FREE(hp, M_HPFSNO); 647 648 return (0); 649 } 650 651 /* 652 * hpfs_print(struct vnode *a_vp) 653 */ 654 static int 655 hpfs_print(struct vop_print_args *ap) 656 { 657 struct vnode *vp = ap->a_vp; 658 struct hpfsnode *hp = VTOHP(vp); 659 660 printf("tag VT_HPFS, ino 0x%x",hp->h_no); 661 lockmgr_printinfo(&vp->v_lock); 662 printf("\n"); 663 return (0); 664 } 665 666 /* 667 * Calculate the logical to physical mapping if not done already, 668 * then call the device strategy routine. 669 * 670 * In order to be able to swap to a file, the VOP_BMAP operation may not 671 * deadlock on memory. See hpfs_bmap() for details. XXXXXXX (not impl) 672 * 673 * hpfs_strategy(struct buf *a_bp) 674 */ 675 int 676 hpfs_strategy(struct vop_strategy_args *ap) 677 { 678 struct buf *bp = ap->a_bp; 679 struct vnode *vp = ap->a_vp; 680 struct vnode *nvp; 681 int error; 682 683 dprintf(("hpfs_strategy(): \n")); 684 685 if (vp->v_type == VBLK || vp->v_type == VCHR) 686 panic("hpfs_strategy: spec"); 687 if (bp->b_blkno == bp->b_lblkno) { 688 error = VOP_BMAP(vp, bp->b_lblkno, &nvp, &bp->b_blkno, NULL, NULL); 689 if (error) { 690 printf("hpfs_strategy: VOP_BMAP FAILED %d\n", error); 691 bp->b_error = error; 692 bp->b_flags |= B_ERROR; 693 biodone(bp); 694 return (error); 695 } 696 if ((long)bp->b_blkno == -1) 697 vfs_bio_clrbuf(bp); 698 } 699 if ((long)bp->b_blkno == -1) { 700 biodone(bp); 701 return (0); 702 } 703 bp->b_dev = nvp->v_rdev; 704 VOP_STRATEGY(nvp, bp); 705 return (0); 706 } 707 708 /* 709 * XXXXX do we need hpfsnode locking inside? 710 * 711 * hpfs_access(struct vnode *a_vp, int a_mode, struct ucred *a_cred, 712 * struct proc *a_td) 713 */ 714 int 715 hpfs_access(struct vop_access_args *ap) 716 { 717 struct vnode *vp = ap->a_vp; 718 struct hpfsnode *hp = VTOHP(vp); 719 struct ucred *cred = ap->a_cred; 720 mode_t mask, mode = ap->a_mode; 721 gid_t *gp; 722 int i; 723 724 dprintf(("hpfs_access(0x%x):\n", hp->h_no)); 725 726 /* 727 * Disallow write attempts on read-only file systems; 728 * unless the file is a socket, fifo, or a block or 729 * character device resident on the file system. 730 */ 731 if (mode & VWRITE) { 732 switch ((int)vp->v_type) { 733 case VDIR: 734 case VLNK: 735 case VREG: 736 if (vp->v_mount->mnt_flag & MNT_RDONLY) 737 return (EROFS); 738 break; 739 } 740 } 741 742 /* Otherwise, user id 0 always gets access. */ 743 if (cred->cr_uid == 0) 744 return (0); 745 746 mask = 0; 747 748 /* Otherwise, check the owner. */ 749 if (cred->cr_uid == hp->h_uid) { 750 if (mode & VEXEC) 751 mask |= S_IXUSR; 752 if (mode & VREAD) 753 mask |= S_IRUSR; 754 if (mode & VWRITE) 755 mask |= S_IWUSR; 756 return ((hp->h_mode & mask) == mask ? 0 : EACCES); 757 } 758 759 /* Otherwise, check the groups. */ 760 for (i = 0, gp = cred->cr_groups; i < cred->cr_ngroups; i++, gp++) 761 if (hp->h_gid == *gp) { 762 if (mode & VEXEC) 763 mask |= S_IXGRP; 764 if (mode & VREAD) 765 mask |= S_IRGRP; 766 if (mode & VWRITE) 767 mask |= S_IWGRP; 768 return ((hp->h_mode & mask) == mask ? 0 : EACCES); 769 } 770 771 /* Otherwise, check everyone else. */ 772 if (mode & VEXEC) 773 mask |= S_IXOTH; 774 if (mode & VREAD) 775 mask |= S_IROTH; 776 if (mode & VWRITE) 777 mask |= S_IWOTH; 778 return ((hp->h_mode & mask) == mask ? 0 : EACCES); 779 } 780 781 /* 782 * Open called. 783 * 784 * Nothing to do. 785 * 786 * hpfs_open(struct vnode *a_vp, int a_mode, struct ucred *a_cred, 787 * struct proc *a_td) 788 */ 789 /* ARGSUSED */ 790 static int 791 hpfs_open(struct vop_open_args *ap) 792 { 793 #if HPFS_DEBUG 794 struct vnode *vp = ap->a_vp; 795 struct hpfsnode *hp = VTOHP(vp); 796 797 printf("hpfs_open(0x%x):\n",hp->h_no); 798 #endif 799 800 /* 801 * Files marked append-only must be opened for appending. 802 */ 803 804 return (0); 805 } 806 807 /* 808 * Close called. 809 * 810 * Update the times on the inode. 811 * 812 * hpfs_close(struct vnode *a_vp, int a_fflag, struct ucred *a_cred, 813 * struct proc *a_td) 814 */ 815 /* ARGSUSED */ 816 static int 817 hpfs_close(struct vop_close_args *ap) 818 { 819 #if HPFS_DEBUG 820 struct vnode *vp = ap->a_vp; 821 struct hpfsnode *hp = VTOHP(vp); 822 823 printf("hpfs_close: %d\n",hp->h_no); 824 #endif 825 826 return (0); 827 } 828 829 static int 830 hpfs_de_uiomove(struct hpfsmount *hpmp, struct hpfsdirent *dep, 831 struct uio *uio) 832 { 833 struct dirent cde; 834 int i, error; 835 836 dprintf(("[no: 0x%x, size: %d, name: %2d:%.*s, flag: 0x%x] ", 837 dep->de_fnode, dep->de_size, dep->de_namelen, 838 dep->de_namelen, dep->de_name, dep->de_flag)); 839 840 /*strncpy(cde.d_name, dep->de_name, dep->de_namelen);*/ 841 for (i=0; i<dep->de_namelen; i++) 842 cde.d_name[i] = hpfs_d2u(hpmp, dep->de_name[i]); 843 844 cde.d_name[dep->de_namelen] = '\0'; 845 cde.d_namlen = dep->de_namelen; 846 cde.d_fileno = dep->de_fnode; 847 cde.d_type = (dep->de_flag & DE_DIR) ? DT_DIR : DT_REG; 848 cde.d_reclen = sizeof(struct dirent); 849 850 error = uiomove((char *)&cde, sizeof(struct dirent), uio); 851 if (error) 852 return (error); 853 854 dprintf(("[0x%x] ", uio->uio_resid)); 855 return (error); 856 } 857 858 859 static struct dirent hpfs_de_dot = 860 { 0, sizeof(struct dirent), DT_DIR, 1, "." }; 861 static struct dirent hpfs_de_dotdot = 862 { 0, sizeof(struct dirent), DT_DIR, 2, ".." }; 863 864 /* 865 * hpfs_readdir(struct vnode *a_vp, struct uio *a_uio, struct ucred *a_cred, 866 * int *a_ncookies, u_int **cookies) 867 */ 868 int 869 hpfs_readdir(struct vop_readdir_args *ap) 870 { 871 struct vnode *vp = ap->a_vp; 872 struct hpfsnode *hp = VTOHP(vp); 873 struct hpfsmount *hpmp = hp->h_hpmp; 874 struct uio *uio = ap->a_uio; 875 int ncookies = 0, i, num, cnum; 876 int error = 0; 877 off_t off; 878 struct buf *bp; 879 struct dirblk *dp; 880 struct hpfsdirent *dep; 881 lsn_t olsn; 882 lsn_t lsn; 883 int level; 884 885 dprintf(("hpfs_readdir(0x%x, 0x%x, 0x%x): ",hp->h_no,(u_int32_t)uio->uio_offset,uio->uio_resid)); 886 887 off = uio->uio_offset; 888 889 if( uio->uio_offset < sizeof(struct dirent) ) { 890 dprintf((". faked, ")); 891 hpfs_de_dot.d_fileno = hp->h_no; 892 error = uiomove((char *)&hpfs_de_dot,sizeof(struct dirent),uio); 893 if(error) { 894 return (error); 895 } 896 897 ncookies ++; 898 } 899 900 if( uio->uio_offset < 2 * sizeof(struct dirent) ) { 901 dprintf((".. faked, ")); 902 hpfs_de_dotdot.d_fileno = hp->h_fn.fn_parent; 903 904 error = uiomove((char *)&hpfs_de_dotdot, sizeof(struct dirent), 905 uio); 906 if(error) { 907 return (error); 908 } 909 910 ncookies ++; 911 } 912 913 num = uio->uio_offset / sizeof(struct dirent) - 2; 914 cnum = 0; 915 916 lsn = ((alleaf_t *)hp->h_fn.fn_abd)->al_lsn; 917 918 olsn = 0; 919 level = 1; 920 921 dive: 922 dprintf(("[dive 0x%x] ", lsn)); 923 error = bread(hp->h_devvp, lsn, D_BSIZE, &bp); 924 if (error) { 925 brelse(bp); 926 return (error); 927 } 928 929 dp = (struct dirblk *) bp->b_data; 930 if (dp->d_magic != D_MAGIC) { 931 printf("hpfs_readdir: MAGIC DOESN'T MATCH\n"); 932 brelse(bp); 933 return (EINVAL); 934 } 935 936 dep = D_DIRENT(dp); 937 938 if (olsn) { 939 dprintf(("[restore 0x%x] ", olsn)); 940 941 while(!(dep->de_flag & DE_END) ) { 942 if((dep->de_flag & DE_DOWN) && 943 (olsn == DE_DOWNLSN(dep))) 944 break; 945 dep = (hpfsdirent_t *)((caddr_t)dep + dep->de_reclen); 946 } 947 948 if((dep->de_flag & DE_DOWN) && (olsn == DE_DOWNLSN(dep))) { 949 if (dep->de_flag & DE_END) 950 goto blockdone; 951 952 if (!(dep->de_flag & DE_SPECIAL)) { 953 if (num <= cnum) { 954 if (uio->uio_resid < sizeof(struct dirent)) { 955 brelse(bp); 956 dprintf(("[resid] ")); 957 goto readdone; 958 } 959 960 error = hpfs_de_uiomove(hpmp, dep, uio); 961 if (error) { 962 brelse (bp); 963 return (error); 964 } 965 ncookies++; 966 967 if (uio->uio_resid < sizeof(struct dirent)) { 968 brelse(bp); 969 dprintf(("[resid] ")); 970 goto readdone; 971 } 972 } 973 cnum++; 974 } 975 976 dep = (hpfsdirent_t *)((caddr_t)dep + dep->de_reclen); 977 } else { 978 printf("hpfs_readdir: ERROR! oLSN not found\n"); 979 brelse(bp); 980 return (EINVAL); 981 } 982 } 983 984 olsn = 0; 985 986 while(!(dep->de_flag & DE_END)) { 987 if(dep->de_flag & DE_DOWN) { 988 lsn = DE_DOWNLSN(dep); 989 brelse(bp); 990 level++; 991 goto dive; 992 } 993 994 if (!(dep->de_flag & DE_SPECIAL)) { 995 if (num <= cnum) { 996 if (uio->uio_resid < sizeof(struct dirent)) { 997 brelse(bp); 998 dprintf(("[resid] ")); 999 goto readdone; 1000 } 1001 1002 error = hpfs_de_uiomove(hpmp, dep, uio); 1003 if (error) { 1004 brelse (bp); 1005 return (error); 1006 } 1007 ncookies++; 1008 1009 if (uio->uio_resid < sizeof(struct dirent)) { 1010 brelse(bp); 1011 dprintf(("[resid] ")); 1012 goto readdone; 1013 } 1014 } 1015 cnum++; 1016 } 1017 1018 dep = (hpfsdirent_t *)((caddr_t)dep + dep->de_reclen); 1019 } 1020 1021 if(dep->de_flag & DE_DOWN) { 1022 dprintf(("[enddive] ")); 1023 lsn = DE_DOWNLSN(dep); 1024 brelse(bp); 1025 level++; 1026 goto dive; 1027 } 1028 1029 blockdone: 1030 dprintf(("[EOB] ")); 1031 olsn = lsn; 1032 lsn = dp->d_parent; 1033 brelse(bp); 1034 level--; 1035 1036 dprintf(("[level %d] ", level)); 1037 1038 if (level > 0) 1039 goto dive; /* undive really */ 1040 1041 if (ap->a_eofflag) { 1042 dprintf(("[EOF] ")); 1043 *ap->a_eofflag = 1; 1044 } 1045 1046 readdone: 1047 dprintf(("[readdone]\n")); 1048 if (!error && ap->a_ncookies != NULL) { 1049 struct dirent* dpStart; 1050 struct dirent* dp; 1051 #if defined(__DragonFly__) 1052 u_long *cookies; 1053 u_long *cookiep; 1054 #else /* defined(__NetBSD__) */ 1055 off_t *cookies; 1056 off_t *cookiep; 1057 #endif 1058 1059 dprintf(("%d cookies, ",ncookies)); 1060 if (uio->uio_segflg != UIO_SYSSPACE || uio->uio_iovcnt != 1) 1061 panic("hpfs_readdir: unexpected uio from NFS server"); 1062 dpStart = (struct dirent *) 1063 ((caddr_t)uio->uio_iov->iov_base - 1064 (uio->uio_offset - off)); 1065 #if defined(__DragonFly__) 1066 MALLOC(cookies, u_long *, ncookies * sizeof(u_long), 1067 M_TEMP, M_WAITOK); 1068 #else /* defined(__NetBSD__) */ 1069 MALLOC(cookies, off_t *, ncookies * sizeof(off_t), 1070 M_TEMP, M_WAITOK); 1071 #endif 1072 for (dp = dpStart, cookiep = cookies, i=0; 1073 i < ncookies; 1074 dp = (struct dirent *)((caddr_t) dp + dp->d_reclen), i++) { 1075 off += dp->d_reclen; 1076 *cookiep++ = (u_int) off; 1077 } 1078 *ap->a_ncookies = ncookies; 1079 *ap->a_cookies = cookies; 1080 } 1081 1082 return (0); 1083 } 1084 1085 /* 1086 * hpfs_lookup(struct vnode *a_dvp, struct vnode **a_vpp, 1087 * struct componentname *a_cnp) 1088 */ 1089 int 1090 hpfs_lookup(struct vop_lookup_args *ap) 1091 { 1092 struct vnode *dvp = ap->a_dvp; 1093 struct hpfsnode *dhp = VTOHP(dvp); 1094 struct hpfsmount *hpmp = dhp->h_hpmp; 1095 struct componentname *cnp = ap->a_cnp; 1096 struct ucred *cred = cnp->cn_cred; 1097 int error; 1098 int nameiop = cnp->cn_nameiop; 1099 int flags = cnp->cn_flags; 1100 int lockparent = flags & CNP_LOCKPARENT; 1101 #if HPFS_DEBUG 1102 int wantparent = flags & (CNP_LOCKPARENT | CNP_WANTPARENT); 1103 #endif 1104 dprintf(("hpfs_lookup(0x%x, %s, %ld, %d, %d): \n", 1105 dhp->h_no, cnp->cn_nameptr, cnp->cn_namelen, 1106 lockparent, wantparent)); 1107 1108 if (nameiop != NAMEI_CREATE && nameiop != NAMEI_DELETE && nameiop != NAMEI_LOOKUP) { 1109 printf("hpfs_lookup: LOOKUP, DELETE and CREATE are only supported\n"); 1110 return (EOPNOTSUPP); 1111 } 1112 1113 error = VOP_ACCESS(dvp, VEXEC, cred, cnp->cn_td); 1114 if(error) 1115 return (error); 1116 1117 if( (cnp->cn_namelen == 1) && 1118 !strncmp(cnp->cn_nameptr,".",1) ) { 1119 dprintf(("hpfs_lookup(0x%x,...): . faked\n",dhp->h_no)); 1120 1121 vref(dvp); 1122 *ap->a_vpp = dvp; 1123 1124 return (0); 1125 } else if( (cnp->cn_namelen == 2) && 1126 !strncmp(cnp->cn_nameptr,"..",2) && (flags & CNP_ISDOTDOT) ) { 1127 dprintf(("hpfs_lookup(0x%x,...): .. faked (0x%x)\n", 1128 dhp->h_no, dhp->h_fn.fn_parent)); 1129 1130 VOP__UNLOCK(dvp,0,cnp->cn_td); 1131 1132 error = VFS_VGET(hpmp->hpm_mp, 1133 dhp->h_fn.fn_parent, ap->a_vpp); 1134 if (error) { 1135 VOP__LOCK(dvp, 0, cnp->cn_td); 1136 return(error); 1137 } 1138 1139 if (lockparent && (error = VOP__LOCK(dvp, 0, cnp->cn_td))) { 1140 vput( *(ap->a_vpp) ); 1141 return (error); 1142 } 1143 return (error); 1144 } else { 1145 struct buf *bp; 1146 struct hpfsdirent *dep; 1147 struct hpfsnode *hp; 1148 1149 error = hpfs_genlookupbyname(dhp, 1150 cnp->cn_nameptr, cnp->cn_namelen, &bp, &dep); 1151 if (error) { 1152 if (error == ENOENT && 1153 (nameiop == NAMEI_CREATE || nameiop == NAMEI_RENAME)) { 1154 if(!lockparent) 1155 VOP__UNLOCK(dvp, 0, cnp->cn_td); 1156 return (EJUSTRETURN); 1157 } 1158 1159 return (error); 1160 } 1161 1162 dprintf(("hpfs_lookup: fnode: 0x%x, CPID: 0x%x\n", 1163 dep->de_fnode, dep->de_cpid)); 1164 1165 if (nameiop == NAMEI_DELETE) { 1166 error = VOP_ACCESS(dvp, VWRITE, cred, cnp->cn_td); 1167 if (error) { 1168 brelse(bp); 1169 return (error); 1170 } 1171 } 1172 1173 if (dhp->h_no == dep->de_fnode) { 1174 brelse(bp); 1175 vref(dvp); 1176 *ap->a_vpp = dvp; 1177 return (0); 1178 } 1179 1180 error = VFS_VGET(hpmp->hpm_mp, dep->de_fnode, ap->a_vpp); 1181 if (error) { 1182 printf("hpfs_lookup: VFS_VGET FAILED %d\n", error); 1183 brelse(bp); 1184 return(error); 1185 } 1186 1187 hp = VTOHP(*ap->a_vpp); 1188 1189 hp->h_mtime = dep->de_mtime; 1190 hp->h_ctime = dep->de_ctime; 1191 hp->h_atime = dep->de_atime; 1192 bcopy(dep->de_name, hp->h_name, dep->de_namelen); 1193 hp->h_name[dep->de_namelen] = '\0'; 1194 hp->h_namelen = dep->de_namelen; 1195 hp->h_flag |= H_PARVALID; 1196 1197 brelse(bp); 1198 1199 if(!lockparent) 1200 VOP__UNLOCK(dvp, 0, cnp->cn_td); 1201 } 1202 return (error); 1203 } 1204 1205 /* 1206 * hpfs_remove(struct vnode *a_dvp, struct vnode *a_vp, 1207 * struct componentname *a_cnp) 1208 */ 1209 int 1210 hpfs_remove(struct vop_remove_args *ap) 1211 { 1212 int error; 1213 1214 dprintf(("hpfs_remove(0x%x, %s, %ld): \n", VTOHP(ap->a_vp)->h_no, 1215 ap->a_cnp->cn_nameptr, ap->a_cnp->cn_namelen)); 1216 1217 if (ap->a_vp->v_type == VDIR) 1218 return (EPERM); 1219 1220 error = hpfs_removefnode (ap->a_dvp, ap->a_vp, ap->a_cnp); 1221 return (error); 1222 } 1223 1224 /* 1225 * hpfs_create(struct vnode *a_dvp, struct vnode **a_vpp, 1226 * struct componentname *a_cnp, struct vattr *a_vap) 1227 */ 1228 int 1229 hpfs_create(struct vop_create_args *ap) 1230 { 1231 int error; 1232 1233 dprintf(("hpfs_create(0x%x, %s, %ld): \n", VTOHP(ap->a_dvp)->h_no, 1234 ap->a_cnp->cn_nameptr, ap->a_cnp->cn_namelen)); 1235 1236 error = hpfs_makefnode (ap->a_dvp, ap->a_vpp, ap->a_cnp, ap->a_vap); 1237 1238 return (error); 1239 } 1240 1241 /* 1242 * Return POSIX pathconf information applicable to NTFS filesystem 1243 * 1244 * hpfs_pathconf(struct vnode *a_vp, int a_name, t *a_retval) 1245 */ 1246 int 1247 hpfs_pathconf(struct vop_pathconf_args *ap) 1248 { 1249 switch (ap->a_name) { 1250 case _PC_LINK_MAX: 1251 *ap->a_retval = 1; 1252 return (0); 1253 case _PC_NAME_MAX: 1254 *ap->a_retval = HPFS_MAXFILENAME; 1255 return (0); 1256 case _PC_PATH_MAX: 1257 *ap->a_retval = PATH_MAX; 1258 return (0); 1259 case _PC_CHOWN_RESTRICTED: 1260 *ap->a_retval = 1; 1261 return (0); 1262 case _PC_NO_TRUNC: 1263 *ap->a_retval = 0; 1264 return (0); 1265 #if defined(__NetBSD__) 1266 case _PC_SYNC_IO: 1267 *ap->a_retval = 1; 1268 return (0); 1269 case _PC_FILESIZEBITS: 1270 *ap->a_retval = 32; 1271 return (0); 1272 #endif 1273 default: 1274 return (EINVAL); 1275 } 1276 /* NOTREACHED */ 1277 } 1278 1279 1280 /* 1281 * Global vfs data structures 1282 */ 1283 #if defined(__DragonFly__) 1284 struct vnodeopv_entry_desc hpfs_vnodeop_entries[] = { 1285 { &vop_default_desc, vop_defaultop }, 1286 1287 { &vop_getattr_desc, (vnodeopv_entry_t)hpfs_getattr }, 1288 { &vop_setattr_desc, (vnodeopv_entry_t)hpfs_setattr }, 1289 { &vop_inactive_desc, (vnodeopv_entry_t)hpfs_inactive }, 1290 { &vop_reclaim_desc, (vnodeopv_entry_t)hpfs_reclaim }, 1291 { &vop_print_desc, (vnodeopv_entry_t)hpfs_print }, 1292 { &vop_create_desc, (vnodeopv_entry_t)hpfs_create }, 1293 { &vop_remove_desc, (vnodeopv_entry_t)hpfs_remove }, 1294 { &vop_islocked_desc, vop_stdislocked }, 1295 { &vop_unlock_desc, vop_stdunlock }, 1296 { &vop_lock_desc, vop_stdlock }, 1297 { &vop_lookup_desc, (vnodeopv_entry_t)hpfs_lookup }, 1298 { &vop_access_desc, (vnodeopv_entry_t)hpfs_access }, 1299 { &vop_close_desc, (vnodeopv_entry_t)hpfs_close }, 1300 { &vop_open_desc, (vnodeopv_entry_t)hpfs_open }, 1301 { &vop_readdir_desc, (vnodeopv_entry_t)hpfs_readdir }, 1302 { &vop_fsync_desc, (vnodeopv_entry_t)hpfs_fsync }, 1303 { &vop_bmap_desc, (vnodeopv_entry_t)hpfs_bmap }, 1304 { &vop_getpages_desc, (vnodeopv_entry_t) hpfs_getpages }, 1305 { &vop_putpages_desc, (vnodeopv_entry_t) hpfs_putpages }, 1306 { &vop_strategy_desc, (vnodeopv_entry_t)hpfs_strategy }, 1307 { &vop_bwrite_desc, vop_stdbwrite }, 1308 { &vop_read_desc, (vnodeopv_entry_t)hpfs_read }, 1309 { &vop_write_desc, (vnodeopv_entry_t)hpfs_write }, 1310 { &vop_ioctl_desc, (vnodeopv_entry_t)hpfs_ioctl }, 1311 { &vop_pathconf_desc, (vnodeopv_entry_t)hpfs_pathconf }, 1312 { NULL, NULL } 1313 }; 1314 1315 #else /* defined(__NetBSD__) */ 1316 struct vnodeopv_entry_desc ntfs_vnodeop_entries[] = { 1317 { &vop_default_desc, (vnodeopv_entry_t) genfs_badop }, /* XXX */ 1318 { &vop_lookup_desc, (vnodeopv_entry_t) hpfs_lookup }, /* lookup */ 1319 { &vop_create_desc, genfs_eopnotsupp }, /* create */ 1320 { &vop_mknod_desc, genfs_eopnotsupp }, /* mknod */ 1321 { &vop_open_desc, (vnodeopv_entry_t) hpfs_open }, /* open */ 1322 { &vop_close_desc,(vnodeopv_entry_t) hpfs_close }, /* close */ 1323 { &vop_access_desc, (vnodeopv_entry_t) hpfs_access }, /* access */ 1324 { &vop_getattr_desc, (vnodeopv_entry_t) hpfs_getattr }, /* getattr */ 1325 { &vop_setattr_desc, genfs_eopnotsupp }, /* setattr */ 1326 { &vop_read_desc, (vnodeopv_entry_t) hpfs_read }, /* read */ 1327 { &vop_write_desc, (vnodeopv_entry_t) hpfs_write }, /* write */ 1328 { &vop_lease_desc, genfs_lease_check }, /* lease */ 1329 { &vop_fcntl_desc, genfs_fcntl }, /* fcntl */ 1330 { &vop_ioctl_desc, genfs_enoioctl }, /* ioctl */ 1331 { &vop_poll_desc, genfs_poll }, /* poll */ 1332 { &vop_revoke_desc, genfs_revoke }, /* revoke */ 1333 { &vop_mmap_desc, genfs_eopnotsupp }, /* mmap */ 1334 { &vop_fsync_desc, genfs_fsync }, /* fsync */ 1335 { &vop_seek_desc, genfs_seek }, /* seek */ 1336 { &vop_remove_desc, genfs_eopnotsupp }, /* remove */ 1337 { &vop_link_desc, genfs_eopnotsupp }, /* link */ 1338 { &vop_rename_desc, genfs_eopnotsupp }, /* rename */ 1339 { &vop_mkdir_desc, genfs_eopnotsupp }, /* mkdir */ 1340 { &vop_rmdir_desc, genfs_eopnotsupp }, /* rmdir */ 1341 { &vop_symlink_desc, genfs_eopnotsupp }, /* symlink */ 1342 { &vop_readdir_desc, (vnodeopv_entry_t) hpfs_readdir }, /* readdir */ 1343 { &vop_readlink_desc, genfs_eopnotsupp }, /* readlink */ 1344 { &vop_abortop_desc, genfs_abortop }, /* abortop */ 1345 { &vop_inactive_desc, (vnodeopv_entry_t) hpfs_inactive }, /* inactive */ 1346 { &vop_reclaim_desc, (vnodeopv_entry_t) hpfs_reclaim }, /* reclaim */ 1347 { &vop_lock_desc, genfs_lock }, /* lock */ 1348 { &vop_unlock_desc, genfs_unlock }, /* unlock */ 1349 { &vop_bmap_desc, (vnodeopv_entry_t) hpfs_bmap }, /* bmap */ 1350 { &vop_strategy_desc, (vnodeopv_entry_t) hpfs_strategy }, /* strategy */ 1351 { &vop_print_desc, (vnodeopv_entry_t) hpfs_print }, /* print */ 1352 { &vop_islocked_desc, genfs_islocked }, /* islocked */ 1353 { &vop_pathconf_desc, hpfs_pathconf }, /* pathconf */ 1354 { &vop_advlock_desc, genfs_nullop }, /* advlock */ 1355 { &vop_blkatoff_desc, genfs_eopnotsupp }, /* blkatoff */ 1356 { &vop_valloc_desc, genfs_eopnotsupp }, /* valloc */ 1357 { &vop_reallocblks_desc, genfs_eopnotsupp }, /* reallocblks */ 1358 { &vop_vfree_desc, genfs_eopnotsupp }, /* vfree */ 1359 { &vop_truncate_desc, genfs_eopnotsupp }, /* truncate */ 1360 { &vop_update_desc, genfs_eopnotsupp }, /* update */ 1361 { &vop_bwrite_desc, vn_bwrite }, /* bwrite */ 1362 { NULL, NULL } 1363 }; 1364 1365 #endif 1366