📄 vnode.c
字号:
vnode_t *hidden_vp; fist_dprint(4, "wrapfs_fsync vp %x\n", vp); hidden_vp = vntofwn(vp)->fwn_vnodep; /* pass operation to hidden filesystem, and return status */ error = VOP_FSYNC(hidden_vp, syncflag, cr); print_location(); return (error);}/* * Free up a vnode once the last reference count to it * has been released (via vn_rele()). */static voidwrapfs_inactive( vnode_t * vp, cred_t * cr){ vnode_t *hidden_vp; vfs_t *tmp_vfsp; struct fist_wrapfs_info *fwip = NULL; int ret; fist_dprint(4, "wrapfs_inactive vp %x\n", vp); /* flush all pages if need to */ if (vp->v_pages) { /* * using B_INVAL will instruct *_dispose() to remove the * mappings of the page from the vnode and the page hash. */ ret = pvn_vplist_dirty(vp, 0, wrapfs_putapage, B_INVAL, cr); if (ret) { fist_dprint(6, "WRAPFS_INACTIVE, pvn_vnlist_dirty returns %d.\n", ret); } } hidden_vp = vntofwn(vp)->fwn_vnodep;#if 0 /* * XXX: EZK experimental. * flush hidden_vp's pages. * don't do it: too slow */ if (hidden_vp->v_pages) { printk("INACTIVE: hidden_vp has pages to flush...\n"); ret = VOP_PUTPAGE(hidden_vp, (offset_t) 0, 0, B_INVAL, cr); printk("INACTIVE: hidden PUTPAGE returned %d\n", ret); }#endif /* * This is a tricky function. We need to first perform the action to the * interposed vnode, and then to this vnode. This call can only have come * normally from VN_RELE() which called vn_rele(). * * XXX: should I call VN_RELE on the interposed vnode instead? */ /* * XXX: Is this right? Should I call inactive on the interposed vode as * well? If I do it means that the reference count for an interposed and * interposing vnodes are always the same. That cannot always be true * because I can access the interposed filesystem from the original path. * It might be best if I ensure that the refcount is exactly 1 here. * I must investigate this bug!!! -Erez. */ /* pass operation to hidden filesystem, and return status */ /* VOP_INACTIVE(hidden_vp, cr); */ fist_dprint(6, "WRAPFS_INACTIVE1: hidden_vp->v_count %d\n", hidden_vp->v_count); VN_RELE(hidden_vp); fist_dprint(6, "WRAPFS_INACTIVE2: hidden_vp->v_count %d\n", hidden_vp->v_count); mutex_enter(&vfstofwi(vp->v_vfsp)->fwi_ht_lock); fist_ht_del_vp(hidden_vp, vp->v_vfsp); /* free space used by opaque v_data field */ if (vp->v_data) { mutex_destroy(&vntofwn(vp)->fwn_lock); kmem_free(vp->v_data, sizeof(fist_wrapfs_node_t)); vp->v_data = NULL; } /* free actual vnode */ tmp_vfsp = vp->v_vfsp; /* save for mutex_exit later on */ kmem_free(vp, sizeof(vnode_t)); /* XXX: should I reset this vnode? */ /* vp = NULL; */ /* decrement interposed vnodes counter */ fwip = vfstofwi(tmp_vfsp); fwip->fwi_num_vnodes--; mutex_exit(&vfstofwi(tmp_vfsp)->fwi_ht_lock); print_location(); return;}static intwrapfs_fid( vnode_t * vp, fid_t * fidp){ int error = EPERM; vnode_t *hidden_vp; fist_dprint(4, "wrapfs_fid vp %x\n", vp); hidden_vp = vntofwn(vp)->fwn_vnodep; /* pass operation to hidden filesystem, and return status */ error = VOP_FID(hidden_vp, fidp); print_location(); return (error);}static voidwrapfs_rwlock( vnode_t * vp, int write_lock){ vnode_t *hidden_vp; fist_dprint(4, "wrapfs_rwlock vp %x\n", vp); hidden_vp = vntofwn(vp)->fwn_vnodep; /* pass operation to hidden filesystem, and return status */ VOP_RWLOCK(hidden_vp, write_lock); print_location(); return;}static voidwrapfs_rwunlock( vnode_t * vp, int write_lock){ vnode_t *hidden_vp; fist_dprint(4, "wrapfs_rwunlock vp %x\n", vp); hidden_vp = vntofwn(vp)->fwn_vnodep; /* pass operation to hidden filesystem, and return status */ VOP_RWUNLOCK(hidden_vp, write_lock); print_location(); return;}static intwrapfs_seek( vnode_t * vp, offset_t offset, offset_t * offsetp){ int error = EPERM; vnode_t *hidden_vp; fist_dprint(4, "wrapfs_seek vp %x\n", vp); hidden_vp = vntofwn(vp)->fwn_vnodep; /* pass operation to hidden filesystem, and return status */ error = VOP_SEEK(hidden_vp, offset, offsetp); print_location(); return (error);}static intwrapfs_cmp( vnode_t * vp1, vnode_t * vp2){ int error = EPERM; vnode_t *hidden_vp1; vnode_t *hidden_vp2; fist_dprint(4, "wrapfs_cmp vp1 %x, vp2\n", vp1, vp2); hidden_vp1 = vntofwn(vp1)->fwn_vnodep; hidden_vp2 = vntofwn(vp2)->fwn_vnodep; /* pass operation to hidden filesystem, and return status */ error = VOP_CMP(hidden_vp1, hidden_vp2); print_location(); return (error);}static intwrapfs_frlock( vnode_t * vp, int cmd, struct flock64 * bfp, int flag, offset_t offset, cred_t * cr){ int error = EPERM; vnode_t *hidden_vp; fist_dprint(4, "wrapfs_frlock vp %x\n", vp); hidden_vp = vntofwn(vp)->fwn_vnodep; /* pass operation to hidden filesystem, and return status */ error = VOP_FRLOCK(hidden_vp, cmd, bfp, flag, offset, cr); print_location(); return (error);}static intwrapfs_space( vnode_t * vp, int cmd, struct flock64 * bfp, int flag, offset_t offset, cred_t * cr){ int error = EPERM; vnode_t *hidden_vp; fist_dprint(4, "wrapfs_space vp %x\n", vp); hidden_vp = vntofwn(vp)->fwn_vnodep; /* pass operation to hidden filesystem, and return status */ error = VOP_SPACE(hidden_vp, cmd, bfp, flag, offset, cr); print_location(); return (error);}static intwrapfs_realvp( vnode_t * vp, vnode_t ** vpp){ int error = EPERM; vnode_t *hidden_vp; fist_dprint(4, "wrapfs_realvp vp %x\n", vp); hidden_vp = vntofwn(vp)->fwn_vnodep; /* pass operation to hidden filesystem, and return status */ error = VOP_REALVP(hidden_vp, vpp); /* if no error, interpose vnode */ if (!error) { /* XXX: is this right? Is the vfs type passed to _interpose right? */ *vpp = wrapfs_interpose(*vpp, vp->v_vfsp); } print_location(); return (error);}/* mmap functions were here and were moved to wrapfs_mmap.c */static intwrapfs_poll( vnode_t * vp, short events, int anyyet, short *reventsp, pollhead_t ** phpp){ int error = EPERM; vnode_t *hidden_vp; fist_dprint(4, "wrapfs_poll vp %x\n", vp); hidden_vp = vntofwn(vp)->fwn_vnodep; /* pass operation to hidden filesystem, and return status */ error = VOP_POLL(hidden_vp, events, anyyet, reventsp, phpp); print_location(); return (error);}static intwrapfs_dump( vnode_t * vp, caddr_t addr, int ldbn, int dblks){ int error = EPERM; vnode_t *hidden_vp; fist_dprint(4, "wrapfs_dump vp %x\n", vp); hidden_vp = vntofwn(vp)->fwn_vnodep; /* pass operation to hidden filesystem, and return status */ error = VOP_DUMP(hidden_vp, addr, ldbn, dblks); print_location(); return (error);}static intwrapfs_pathconf( vnode_t * vp, int cmd, u_long * valp, cred_t * cr){ int error = EPERM; vnode_t *hidden_vp; fist_dprint(4, "wrapfs_pathconf vp %x\n", vp); hidden_vp = vntofwn(vp)->fwn_vnodep; /* pass operation to hidden filesystem, and return status */ error = VOP_PATHCONF(hidden_vp, cmd, valp, cr); print_location(); return (error);}static intwrapfs_pageio( vnode_t * vp, page_t * pp, u_offset_t io_off, u_int io_len, int flags, cred_t * cr){ int error = EPERM; vnode_t *hidden_vp; fist_dprint(4, "wrapfs_pageio vp %x\n", vp); hidden_vp = vntofwn(vp)->fwn_vnodep; /* pass operation to hidden filesystem, and return status */ error = VOP_PAGEIO(hidden_vp, pp, io_off, io_len, flags, cr); print_location(); return (error);}static intwrapfs_dumpctl( vnode_t * vp, int free){ int error = EPERM; vnode_t *hidden_vp; fist_dprint(4, "wrapfs_dumpctl vp %x\n", vp); hidden_vp = vntofwn(vp)->fwn_vnodep; /* pass operation to hidden filesystem, and return status */ error = VOP_DUMPCTL(hidden_vp, free); print_location(); return (error);}static voidwrapfs_dispose( vnode_t * vp, page_t * pp, int fl, int dn, cred_t * cr){ fist_dprint(4, "wrapfs_DISPOSE vp 0x%x, page 0x%x fl=0x%x, dn=0x%x\n", vp, pp, fl, dn); /* wrapfs_DISPOSE vp 0x600cf2b0, page 0x104f59c0 fl=0x8000, dn=0x2000 */ fs_dispose(vp, pp, fl, dn, cr); return;}static intwrapfs_setsecattr( vnode_t * vp, vsecattr_t * vsap, int flag, cred_t * cr){ int error = EPERM; vnode_t *hidden_vp; fist_dprint(4, "wrapfs_setsecattr vp %x\n", vp); hidden_vp = vntofwn(vp)->fwn_vnodep; /* pass operation to hidden filesystem, and return status */ error = VOP_SETSECATTR(hidden_vp, vsap, flag, cr); print_location(); return (error);}static intwrapfs_getsecattr( vnode_t * vp, vsecattr_t * vsap, int flag, cred_t * cr){ int error = EPERM; vnode_t *hidden_vp; fist_dprint(4, "wrapfs_getsecattr vp %x\n", vp); hidden_vp = vntofwn(vp)->fwn_vnodep; /* pass operation to hidden filesystem, and return status */ error = VOP_GETSECATTR(hidden_vp, vsap, flag, cr); print_location(); return (error);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -