X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=module%2Fzfs%2Fzfs_vnops.c;h=b666ee39ccbe78732d929240b70f61875713f044;hb=1ee1b76786aebc6eed546c6e869cc88f1e318890;hp=a0720079cf4679583c3dd088d3f2604e4e0d86ef;hpb=572e285762521df27fe5b026f409ba1a21abb7ac;p=zfs.git diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c index a072007..b666ee3 100644 --- a/module/zfs/zfs_vnops.c +++ b/module/zfs/zfs_vnops.c @@ -25,6 +25,8 @@ /* Portions Copyright 2007 Jeremy Teo */ /* Portions Copyright 2010 Robert Milkowski */ +#ifdef HAVE_ZPL + #include #include #include @@ -72,6 +74,7 @@ #include #include #include +#include #include #include #include @@ -319,6 +322,7 @@ zfs_ioctl(vnode_t *vp, int com, intptr_t data, int flag, cred_t *cred, return (ENOTTY); } +#if defined(_KERNEL) && defined(HAVE_UIO_RW) /* * Utility functions to map and unmap a single physical page. These * are used to manage the mappable copies of ZFS file data, and therefore @@ -343,6 +347,7 @@ zfs_unmap_page(page_t *pp, caddr_t addr) ppmapout(addr); } } +#endif /* _KERNEL && HAVE_UIO_RW */ /* * When a file is memory mapped, we must keep the IO data synchronized @@ -439,14 +444,14 @@ offset_t zfs_read_chunk_size = 1024 * 1024; /* Tunable */ * vp - atime updated if byte count > 0 */ /* ARGSUSED */ -static int +int zfs_read(vnode_t *vp, uio_t *uio, int ioflag, cred_t *cr, caller_context_t *ct) { znode_t *zp = VTOZ(vp); zfsvfs_t *zfsvfs = zp->z_zfsvfs; objset_t *os; ssize_t n, nbytes; - int error; + int error = 0; rl_t *rl; xuio_t *xuio = NULL; @@ -562,6 +567,7 @@ out: ZFS_EXIT(zfsvfs); return (error); } +EXPORT_SYMBOL(zfs_read); /* * Write the bytes to a file. @@ -583,7 +589,7 @@ out: */ /* ARGSUSED */ -static int +int zfs_write(vnode_t *vp, uio_t *uio, int ioflag, cred_t *cr, caller_context_t *ct) { znode_t *zp = VTOZ(vp); @@ -759,8 +765,8 @@ again: max_blksz); ASSERT(abuf != NULL); ASSERT(arc_buf_size(abuf) == max_blksz); - if (error = uiocopy(abuf->b_data, max_blksz, - UIO_WRITE, uio, &cbytes)) { + if ((error = uiocopy(abuf->b_data, max_blksz, + UIO_WRITE, uio, &cbytes))) { dmu_return_arcbuf(abuf); break; } @@ -935,6 +941,7 @@ again: ZFS_EXIT(zfsvfs); return (0); } +EXPORT_SYMBOL(zfs_write); void zfs_get_done(zgd_t *zgd, int error) @@ -1148,7 +1155,7 @@ specvp_check(vnode_t **vpp, cred_t *cr) * NA */ /* ARGSUSED */ -static int +int zfs_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, struct pathname *pnp, int flags, vnode_t *rdir, cred_t *cr, caller_context_t *ct, int *direntflags, pathname_t *realpnp) @@ -1219,7 +1226,7 @@ zfs_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, struct pathname *pnp, return (EINVAL); } - if (error = zfs_get_xattrdir(VTOZ(dvp), vpp, cr, flags)) { + if ((error = zfs_get_xattrdir(VTOZ(dvp), vpp, cr, flags))) { ZFS_EXIT(zfsvfs); return (error); } @@ -1228,8 +1235,8 @@ zfs_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, struct pathname *pnp, * Do we have permission to get into attribute directory? */ - if (error = zfs_zaccess(VTOZ(*vpp), ACE_EXECUTE, 0, - B_FALSE, cr)) { + if ((error = zfs_zaccess(VTOZ(*vpp), ACE_EXECUTE, 0, + B_FALSE, cr))) { VN_RELE(*vpp); *vpp = NULL; } @@ -1247,7 +1254,7 @@ zfs_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, struct pathname *pnp, * Check accessibility of directory. */ - if (error = zfs_zaccess(zdp, ACE_EXECUTE, 0, B_FALSE, cr)) { + if ((error = zfs_zaccess(zdp, ACE_EXECUTE, 0, B_FALSE, cr))) { ZFS_EXIT(zfsvfs); return (error); } @@ -1265,6 +1272,7 @@ zfs_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, struct pathname *pnp, ZFS_EXIT(zfsvfs); return (error); } +EXPORT_SYMBOL(zfs_lookup); /* * Attempt to create a new entry in a directory. If the entry @@ -1292,8 +1300,8 @@ zfs_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, struct pathname *pnp, */ /* ARGSUSED */ -static int -zfs_create(vnode_t *dvp, char *name, vattr_t *vap, vcexcl_t excl, +int +zfs_create(vnode_t *dvp, char *name, vattr_t *vap, int excl, int mode, vnode_t **vpp, cred_t *cr, int flag, caller_context_t *ct, vsecattr_t *vsecp) { @@ -1306,7 +1314,7 @@ zfs_create(vnode_t *dvp, char *name, vattr_t *vap, vcexcl_t excl, int error; ksid_t *ksid; uid_t uid; - gid_t gid = crgetgid(cr); + gid_t gid; zfs_acl_ids_t acl_ids; boolean_t fuid_dirtied; boolean_t have_acl = B_FALSE; @@ -1316,6 +1324,7 @@ zfs_create(vnode_t *dvp, char *name, vattr_t *vap, vcexcl_t excl, * make sure file system is at proper version */ + gid = crgetgid(cr); ksid = crgetsid(cr, KSID_OWNER); if (ksid) uid = ksid_getid(ksid); @@ -1385,7 +1394,7 @@ top: * Create a new file object and update the directory * to reference it. */ - if (error = zfs_zaccess(dzp, ACE_ADD_FILE, 0, B_FALSE, cr)) { + if ((error = zfs_zaccess(dzp, ACE_ADD_FILE, 0, B_FALSE, cr))) { if (have_acl) zfs_acl_ids_free(&acl_ids); goto out; @@ -1524,6 +1533,7 @@ out: ZFS_EXIT(zfsvfs); return (error); } +EXPORT_SYMBOL(zfs_create); /* * Remove an entry from a directory. @@ -1545,7 +1555,7 @@ out: uint64_t null_xattr = 0; /*ARGSUSED*/ -static int +int zfs_remove(vnode_t *dvp, char *name, cred_t *cr, caller_context_t *ct, int flags) { @@ -1583,8 +1593,8 @@ top: /* * Attempt to lock directory; fail if entry doesn't exist. */ - if (error = zfs_dirent_lock(&dl, dzp, name, &zp, zflg, - NULL, realnmp)) { + if ((error = zfs_dirent_lock(&dl, dzp, name, &zp, zflg, + NULL, realnmp))) { if (realnmp) pn_free(realnmp); ZFS_EXIT(zfsvfs); @@ -1593,7 +1603,7 @@ top: vp = ZTOV(zp); - if (error = zfs_zaccess_delete(dzp, zp, cr)) { + if ((error = zfs_zaccess_delete(dzp, zp, cr))) { goto out; } @@ -1613,7 +1623,7 @@ top: dnlc_remove(dvp, name); mutex_enter(&vp->v_lock); - may_delete_now = vp->v_count == 1 && !vn_has_cached_data(vp); + may_delete_now = ((vp->v_count == 1) && (!vn_has_cached_data(vp))); mutex_exit(&vp->v_lock); /* @@ -1755,6 +1765,7 @@ out: ZFS_EXIT(zfsvfs); return (error); } +EXPORT_SYMBOL(zfs_remove); /* * Create a new directory and insert it into dvp using the name @@ -1777,7 +1788,7 @@ out: * vp - ctime|mtime|atime updated */ /*ARGSUSED*/ -static int +int zfs_mkdir(vnode_t *dvp, char *dirname, vattr_t *vap, vnode_t **vpp, cred_t *cr, caller_context_t *ct, int flags, vsecattr_t *vsecp) { @@ -1852,14 +1863,14 @@ zfs_mkdir(vnode_t *dvp, char *dirname, vattr_t *vap, vnode_t **vpp, cred_t *cr, top: *vpp = NULL; - if (error = zfs_dirent_lock(&dl, dzp, dirname, &zp, zf, - NULL, NULL)) { + if ((error = zfs_dirent_lock(&dl, dzp, dirname, &zp, zf, + NULL, NULL))) { zfs_acl_ids_free(&acl_ids); ZFS_EXIT(zfsvfs); return (error); } - if (error = zfs_zaccess(dzp, ACE_ADD_SUBDIRECTORY, 0, B_FALSE, cr)) { + if ((error = zfs_zaccess(dzp, ACE_ADD_SUBDIRECTORY, 0, B_FALSE, cr))) { zfs_acl_ids_free(&acl_ids); zfs_dirent_unlock(dl); ZFS_EXIT(zfsvfs); @@ -1937,6 +1948,7 @@ top: ZFS_EXIT(zfsvfs); return (0); } +EXPORT_SYMBOL(zfs_mkdir); /* * Remove a directory subdir entry. If the current working @@ -1957,7 +1969,7 @@ top: * dvp - ctime|mtime updated */ /*ARGSUSED*/ -static int +int zfs_rmdir(vnode_t *dvp, char *name, vnode_t *cwd, cred_t *cr, caller_context_t *ct, int flags) { @@ -1983,15 +1995,15 @@ top: /* * Attempt to lock directory; fail if entry doesn't exist. */ - if (error = zfs_dirent_lock(&dl, dzp, name, &zp, zflg, - NULL, NULL)) { + if ((error = zfs_dirent_lock(&dl, dzp, name, &zp, zflg, + NULL, NULL))) { ZFS_EXIT(zfsvfs); return (error); } vp = ZTOV(zp); - if (error = zfs_zaccess_delete(dzp, zp, cr)) { + if ((error = zfs_zaccess_delete(dzp, zp, cr))) { goto out; } @@ -2065,6 +2077,7 @@ out: ZFS_EXIT(zfsvfs); return (error); } +EXPORT_SYMBOL(zfs_rmdir); /* * Read as many directory entries as will fit into the provided @@ -2359,7 +2372,7 @@ update: ulong_t zfs_fsync_sync_cnt = 4; -static int +int zfs_fsync(vnode_t *vp, int syncflag, cred_t *cr, caller_context_t *ct) { znode_t *zp = VTOZ(vp); @@ -2385,6 +2398,7 @@ zfs_fsync(vnode_t *vp, int syncflag, cred_t *cr, caller_context_t *ct) } return (0); } +EXPORT_SYMBOL(zfs_fsync); /* @@ -2403,7 +2417,7 @@ zfs_fsync(vnode_t *vp, int syncflag, cred_t *cr, caller_context_t *ct) * RETURN: 0 (always succeeds) */ /* ARGSUSED */ -static int +int zfs_getattr(vnode_t *vp, vattr_t *vap, int flags, cred_t *cr, caller_context_t *ct) { @@ -2438,8 +2452,8 @@ zfs_getattr(vnode_t *vp, vattr_t *vap, int flags, cred_t *cr, */ if (!(zp->z_pflags & ZFS_ACL_TRIVIAL) && (vap->va_uid != crgetuid(cr))) { - if (error = zfs_zaccess(zp, ACE_READ_ATTRIBUTES, 0, - skipaclchk, cr)) { + if ((error = zfs_zaccess(zp, ACE_READ_ATTRIBUTES, 0, + skipaclchk, cr))) { ZFS_EXIT(zfsvfs); return (error); } @@ -2589,6 +2603,7 @@ zfs_getattr(vnode_t *vp, vattr_t *vap, int flags, cred_t *cr, ZFS_EXIT(zfsvfs); return (0); } +EXPORT_SYMBOL(zfs_getattr); /* * Set the file attributes to the values contained in the @@ -2609,7 +2624,7 @@ zfs_getattr(vnode_t *vp, vattr_t *vap, int flags, cred_t *cr, * vp - ctime updated, mtime updated if size changed. */ /* ARGSUSED */ -static int +int zfs_setattr(vnode_t *vp, vattr_t *vap, int flags, cred_t *cr, caller_context_t *ct) { @@ -3221,6 +3236,7 @@ out2: ZFS_EXIT(zfsvfs); return (err); } +EXPORT_SYMBOL(zfs_setattr); typedef struct zfs_zlock { krwlock_t *zl_rwlock; /* lock we acquired */ @@ -3338,7 +3354,7 @@ zfs_rename_lock(znode_t *szp, znode_t *tdzp, znode_t *sdzp, zfs_zlock_t **zlpp) * sdvp,tdvp - ctime|mtime updated */ /*ARGSUSED*/ -static int +int zfs_rename(vnode_t *sdvp, char *snm, vnode_t *tdvp, char *tnm, cred_t *cr, caller_context_t *ct, int flags) { @@ -3516,7 +3532,7 @@ top: * done in a single check. */ - if (error = zfs_zaccess_rename(sdzp, szp, tdzp, tzp, cr)) + if ((error = zfs_zaccess_rename(sdzp, szp, tdzp, tzp, cr))) goto out; if (ZTOV(szp)->v_type == VDIR) { @@ -3524,7 +3540,7 @@ top: * Check to make sure rename is valid. * Can't do a move like this: /usr/a/b to /usr/a/b/c/d */ - if (error = zfs_rename_lock(szp, tdzp, sdzp, &zl)) + if ((error = zfs_rename_lock(szp, tdzp, sdzp, &zl))) goto out; } @@ -3672,6 +3688,7 @@ out: ZFS_EXIT(zfsvfs); return (error); } +EXPORT_SYMBOL(zfs_rename); /* * Insert the indicated symbolic reference entry into the directory. @@ -3691,7 +3708,7 @@ out: * dvp - ctime|mtime updated */ /*ARGSUSED*/ -static int +int zfs_symlink(vnode_t *dvp, char *name, vattr_t *vap, char *link, cred_t *cr, caller_context_t *ct, int flags) { @@ -3742,7 +3759,7 @@ top: return (error); } - if (error = zfs_zaccess(dzp, ACE_ADD_FILE, 0, B_FALSE, cr)) { + if ((error = zfs_zaccess(dzp, ACE_ADD_FILE, 0, B_FALSE, cr))) { zfs_acl_ids_free(&acl_ids); zfs_dirent_unlock(dl); ZFS_EXIT(zfsvfs); @@ -3825,6 +3842,7 @@ top: ZFS_EXIT(zfsvfs); return (error); } +EXPORT_SYMBOL(zfs_symlink); /* * Return, in the buffer contained in the provided uio structure, @@ -3844,7 +3862,7 @@ top: * vp - atime updated */ /* ARGSUSED */ -static int +int zfs_readlink(vnode_t *vp, uio_t *uio, cred_t *cr, caller_context_t *ct) { znode_t *zp = VTOZ(vp); @@ -3867,6 +3885,7 @@ zfs_readlink(vnode_t *vp, uio_t *uio, cred_t *cr, caller_context_t *ct) ZFS_EXIT(zfsvfs); return (error); } +EXPORT_SYMBOL(zfs_readlink); /* * Insert a new entry into directory tdvp referencing svp. @@ -3885,7 +3904,7 @@ zfs_readlink(vnode_t *vp, uio_t *uio, cred_t *cr, caller_context_t *ct) * svp - ctime updated */ /* ARGSUSED */ -static int +int zfs_link(vnode_t *tdvp, vnode_t *svp, char *name, cred_t *cr, caller_context_t *ct, int flags) { @@ -3965,7 +3984,7 @@ zfs_link(vnode_t *tdvp, vnode_t *svp, char *name, cred_t *cr, return (EPERM); } - if (error = zfs_zaccess(dzp, ACE_ADD_FILE, 0, B_FALSE, cr)) { + if ((error = zfs_zaccess(dzp, ACE_ADD_FILE, 0, B_FALSE, cr))) { ZFS_EXIT(zfsvfs); return (error); } @@ -4021,6 +4040,7 @@ top: ZFS_EXIT(zfsvfs); return (error); } +EXPORT_SYMBOL(zfs_link); /* * zfs_null_putapage() is used when the file system has been force @@ -4318,6 +4338,7 @@ zfs_inactive(vnode_t *vp, cred_t *cr, caller_context_t *ct) zfs_zinactive(zp); rw_exit(&zfsvfs->z_teardown_inactive_lock); } +EXPORT_SYMBOL(zfs_inactive); /* * Bounds-check the seek operation. @@ -4706,7 +4727,7 @@ zfs_delmap(vnode_t *vp, offset_t off, struct as *as, caddr_t addr, * vp - ctime|mtime updated */ /* ARGSUSED */ -static int +int zfs_space(vnode_t *vp, int cmd, flock64_t *bfp, int flag, offset_t offset, cred_t *cr, caller_context_t *ct) { @@ -4723,7 +4744,7 @@ zfs_space(vnode_t *vp, int cmd, flock64_t *bfp, int flag, return (EINVAL); } - if (error = convoff(vp, bfp, 0, offset)) { + if ((error = convoff(vp, bfp, 0, offset))) { ZFS_EXIT(zfsvfs); return (error); } @@ -4741,9 +4762,10 @@ zfs_space(vnode_t *vp, int cmd, flock64_t *bfp, int flag, ZFS_EXIT(zfsvfs); return (error); } +EXPORT_SYMBOL(zfs_space); /*ARGSUSED*/ -static int +int zfs_fid(vnode_t *vp, fid_t *fidp, caller_context_t *ct) { znode_t *zp = VTOZ(vp); @@ -4802,6 +4824,7 @@ zfs_fid(vnode_t *vp, fid_t *fidp, caller_context_t *ct) ZFS_EXIT(zfsvfs); return (0); } +EXPORT_SYMBOL(zfs_fid); static int zfs_pathconf(vnode_t *vp, int cmd, ulong_t *valp, cred_t *cr, @@ -4874,7 +4897,7 @@ zfs_pathconf(vnode_t *vp, int cmd, ulong_t *valp, cred_t *cr, } /*ARGSUSED*/ -static int +int zfs_getsecattr(vnode_t *vp, vsecattr_t *vsecp, int flag, cred_t *cr, caller_context_t *ct) { @@ -4890,9 +4913,10 @@ zfs_getsecattr(vnode_t *vp, vsecattr_t *vsecp, int flag, cred_t *cr, return (error); } +EXPORT_SYMBOL(zfs_getsecattr); /*ARGSUSED*/ -static int +int zfs_setsecattr(vnode_t *vp, vsecattr_t *vsecp, int flag, cred_t *cr, caller_context_t *ct) { @@ -4913,6 +4937,7 @@ zfs_setsecattr(vnode_t *vp, vsecattr_t *vsecp, int flag, cred_t *cr, ZFS_EXIT(zfsvfs); return (error); } +EXPORT_SYMBOL(zfs_setsecattr); /* * Tunable, both must be a power of 2. @@ -5241,3 +5266,4 @@ const fs_operation_def_t zfs_evnodeops_template[] = { VOPNAME_PATHCONF, { .vop_pathconf = zfs_pathconf }, NULL, NULL }; +#endif /* HAVE_ZPL */