diff options
Diffstat (limited to 'sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c')
-rw-r--r-- | sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c | 78 |
1 files changed, 51 insertions, 27 deletions
diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c index 52c3edd2d9c4..18c71511fccd 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c @@ -104,14 +104,6 @@ VFS_SMR_DECLARE; #define vm_page_wire_unlock(pp) vm_page_unlock(pp) #endif -static int -zfs_u8_validate(const char *u8str, size_t n, char **list, int flag, int *errnum) -{ - - return (u8_validate(__DECONST(char *, u8str), n, list, flag, errnum)); -} -#define u8_validate zfs_u8_validate - #ifdef DEBUG_VFS_LOCKS #define VNCHECKREF(vp) \ VNASSERT((vp)->v_holdcnt > 0 && (vp)->v_usecount > 0, vp, \ @@ -1536,8 +1528,9 @@ zfs_lookup_lock(vnode_t *dvp, vnode_t *vp, const char *name, int lkflags) */ /* ARGSUSED */ static int -zfs_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, struct componentname *cnp, - int nameiop, cred_t *cr, kthread_t *td, int flags, boolean_t cached) +zfs_lookup(vnode_t *dvp, const char *nm, vnode_t **vpp, + struct componentname *cnp, int nameiop, cred_t *cr, kthread_t *td, + int flags, boolean_t cached) { znode_t *zdp = VTOZ(dvp); znode_t *zp; @@ -1561,7 +1554,8 @@ zfs_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, struct componentname *cnp, } } - DTRACE_PROBE2(zfs__fastpath__lookup__miss, vnode_t *, dvp, char *, nm); + DTRACE_PROBE2(zfs__fastpath__lookup__miss, vnode_t *, dvp, + const char *, nm); ZFS_ENTER(zfsvfs); ZFS_VERIFY_ZP(zdp); @@ -1778,7 +1772,7 @@ zfs_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, struct componentname *cnp, /* ARGSUSED */ int -zfs_create(znode_t *dzp, char *name, vattr_t *vap, int excl, int mode, +zfs_create(znode_t *dzp, const char *name, vattr_t *vap, int excl, int mode, znode_t **zpp, cred_t *cr, int flag, vsecattr_t *vsecp) { znode_t *zp; @@ -1945,7 +1939,7 @@ out: /*ARGSUSED*/ static int -zfs_remove_(vnode_t *dvp, vnode_t *vp, char *name, cred_t *cr) +zfs_remove_(vnode_t *dvp, vnode_t *vp, const char *name, cred_t *cr) { znode_t *dzp = VTOZ(dvp); znode_t *zp; @@ -2059,13 +2053,13 @@ out: static int -zfs_lookup_internal(znode_t *dzp, char *name, vnode_t **vpp, +zfs_lookup_internal(znode_t *dzp, const char *name, vnode_t **vpp, struct componentname *cnp, int nameiop) { zfsvfs_t *zfsvfs = dzp->z_zfsvfs; int error; - cnp->cn_nameptr = name; + cnp->cn_nameptr = __DECONST(char *, name); cnp->cn_namelen = strlen(name); cnp->cn_nameiop = nameiop; cnp->cn_flags = ISLASTCN | SAVENAME; @@ -2096,7 +2090,7 @@ zfs_lookup_internal(znode_t *dzp, char *name, vnode_t **vpp, } int -zfs_remove(znode_t *dzp, char *name, cred_t *cr, int flags) +zfs_remove(znode_t *dzp, const char *name, cred_t *cr, int flags) { vnode_t *vp; int error; @@ -2131,8 +2125,8 @@ zfs_remove(znode_t *dzp, char *name, cred_t *cr, int flags) */ /*ARGSUSED*/ int -zfs_mkdir(znode_t *dzp, char *dirname, vattr_t *vap, znode_t **zpp, cred_t *cr, - int flags, vsecattr_t *vsecp) +zfs_mkdir(znode_t *dzp, const char *dirname, vattr_t *vap, znode_t **zpp, + cred_t *cr, int flags, vsecattr_t *vsecp) { znode_t *zp; zfsvfs_t *zfsvfs = dzp->z_zfsvfs; @@ -2298,7 +2292,7 @@ zfs_mkdir(znode_t *dzp, char *dirname, vattr_t *vap, znode_t **zpp, cred_t *cr, */ /*ARGSUSED*/ static int -zfs_rmdir_(vnode_t *dvp, vnode_t *vp, char *name, cred_t *cr) +zfs_rmdir_(vnode_t *dvp, vnode_t *vp, const char *name, cred_t *cr) { znode_t *dzp = VTOZ(dvp); znode_t *zp = VTOZ(vp); @@ -2360,7 +2354,7 @@ out: } int -zfs_rmdir(znode_t *dzp, char *name, znode_t *cwd, cred_t *cr, int flags) +zfs_rmdir(znode_t *dzp, const char *name, znode_t *cwd, cred_t *cr, int flags) { struct componentname cn; vnode_t *vp; @@ -3907,6 +3901,19 @@ zfs_rename_check(znode_t *szp, znode_t *sdzp, znode_t *tdzp) return (error); } +#if __FreeBSD_version < 1300110 +static void +cache_rename(struct vnode *fdvp, struct vnode *fvp, struct vnode *tdvp, + struct vnode *tvp, struct componentname *fcnp, struct componentname *tcnp) +{ + + cache_purge(fvp); + if (tvp != NULL) + cache_purge(tvp); + cache_purge_negative(tdvp); +} +#endif + /* * Move an entry from the provided source directory to the target * directory. Change the entry name as indicated. @@ -3934,8 +3941,8 @@ zfs_rename_(vnode_t *sdvp, vnode_t **svpp, struct componentname *scnp, znode_t *sdzp, *tdzp, *szp, *tzp; zilog_t *zilog = NULL; dmu_tx_t *tx; - char *snm = scnp->cn_nameptr; - char *tnm = tcnp->cn_nameptr; + const char *snm = scnp->cn_nameptr; + const char *tnm = tcnp->cn_nameptr; int error = 0; bool want_seqc_end __maybe_unused = false; @@ -4198,7 +4205,7 @@ out: /* original two vnodes are locked */ } int -zfs_rename(znode_t *sdzp, char *sname, znode_t *tdzp, char *tname, +zfs_rename(znode_t *sdzp, const char *sname, znode_t *tdzp, const char *tname, cred_t *cr, int flags) { struct componentname scn, tcn; @@ -4357,8 +4364,7 @@ zfs_symlink(znode_t *dzp, const char *name, vattr_t *vap, */ (void) zfs_link_create(dzp, name, zp, tx, ZNEW); - zfs_log_symlink(zilog, tx, txtype, dzp, zp, - __DECONST(char *, name), __DECONST(char *, link)); + zfs_log_symlink(zilog, tx, txtype, dzp, zp, name, link); *zpp = zp; zfs_acl_ids_free(&acl_ids); @@ -4429,7 +4435,7 @@ zfs_readlink(vnode_t *vp, uio_t *uio, cred_t *cr, caller_context_t *ct) */ /* ARGSUSED */ int -zfs_link(znode_t *tdzp, znode_t *szp, char *name, cred_t *cr, +zfs_link(znode_t *tdzp, znode_t *szp, const char *name, cred_t *cr, int flags) { znode_t *tzp; @@ -4738,6 +4744,8 @@ static int zfs_pathconf(vnode_t *vp, int cmd, ulong_t *valp, cred_t *cr, caller_context_t *ct) { + znode_t *zp; + zfsvfs_t *zfsvfs; switch (cmd) { case _PC_LINK_MAX: @@ -4751,11 +4759,25 @@ zfs_pathconf(vnode_t *vp, int cmd, ulong_t *valp, cred_t *cr, *valp = (int)SPA_MINBLOCKSIZE; return (0); case _PC_ACL_EXTENDED: +#if 0 /* POSIX ACLs are not implemented for ZFS on FreeBSD yet. */ + zp = VTOZ(vp); + zfsvfs = zp->z_zfsvfs; + ZFS_ENTER(zfsvfs); + ZFS_VERIFY_ZP(zp); + *valp = zfsvfs->z_acl_type == ZFSACLTYPE_POSIX ? 1 : 0; + ZFS_EXIT(zfsvfs); +#else *valp = 0; +#endif return (0); case _PC_ACL_NFS4: - *valp = 1; + zp = VTOZ(vp); + zfsvfs = zp->z_zfsvfs; + ZFS_ENTER(zfsvfs); + ZFS_VERIFY_ZP(zp); + *valp = zfsvfs->z_acl_type == ZFS_ACLTYPE_NFSV4 ? 1 : 0; + ZFS_EXIT(zfsvfs); return (0); case _PC_ACL_PATH_MAX: @@ -6619,7 +6641,9 @@ VFS_VOP_VECTOR_REGISTER(zfs_fifoops); */ struct vop_vector zfs_shareops = { .vop_default = &default_vnodeops, +#if __FreeBSD_version >= 1300121 .vop_fplookup_vexec = VOP_EAGAIN, +#endif .vop_access = zfs_freebsd_access, .vop_inactive = zfs_freebsd_inactive, .vop_reclaim = zfs_freebsd_reclaim, |