diff options
author | Matthew Macy <[email protected]> | 2020-10-21 14:08:06 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2020-10-21 14:08:06 -0700 |
commit | e53d678d4ad596a310d51dab107bb6fa97e2b226 (patch) | |
tree | bf1d9167e7f4c3f0fadbc190d23eb6a1f1dc67a4 /include/os/linux | |
parent | 666aa69f32ff2558ef9e9a27bc4cb5559e21d795 (diff) |
Share zfs_fsync, zfs_read, zfs_write, et al between Linux and FreeBSD
The zfs_fsync, zfs_read, and zfs_write function are almost identical
between Linux and FreeBSD. With a little refactoring they can be
moved to the common code which is what is done by this commit.
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Ryan Moeller <[email protected]>
Signed-off-by: Matt Macy <[email protected]>
Closes #11078
Diffstat (limited to 'include/os/linux')
-rw-r--r-- | include/os/linux/kernel/linux/mod_compat.h | 1 | ||||
-rw-r--r-- | include/os/linux/spl/sys/uio.h | 2 | ||||
-rw-r--r-- | include/os/linux/zfs/sys/Makefile.am | 2 | ||||
-rw-r--r-- | include/os/linux/zfs/sys/policy.h | 4 | ||||
-rw-r--r-- | include/os/linux/zfs/sys/zfs_vnops_os.h (renamed from include/os/linux/zfs/sys/zfs_vnops.h) | 11 | ||||
-rw-r--r-- | include/os/linux/zfs/sys/zfs_znode_impl.h | 6 |
6 files changed, 14 insertions, 12 deletions
diff --git a/include/os/linux/kernel/linux/mod_compat.h b/include/os/linux/kernel/linux/mod_compat.h index 1c48df5cb..1bd8206bb 100644 --- a/include/os/linux/kernel/linux/mod_compat.h +++ b/include/os/linux/kernel/linux/mod_compat.h @@ -74,6 +74,7 @@ enum scope_prefix_types { zfs_vdev_cache, zfs_vdev_file, zfs_vdev_mirror, + zfs_vnops, zfs_zevent, zfs_zio, zfs_zil diff --git a/include/os/linux/spl/sys/uio.h b/include/os/linux/spl/sys/uio.h index abcd90dd5..ce3b38fcd 100644 --- a/include/os/linux/spl/sys/uio.h +++ b/include/os/linux/spl/sys/uio.h @@ -59,7 +59,6 @@ typedef struct uio { boolean_t uio_fault_disable; uint16_t uio_fmode; uint16_t uio_extflg; - offset_t uio_limit; ssize_t uio_resid; size_t uio_skip; } uio_t; @@ -113,6 +112,7 @@ typedef struct xuio { #define uio_iovcnt(uio) (uio)->uio_iovcnt #define uio_iovlen(uio, idx) (uio)->uio_iov[(idx)].iov_len #define uio_iovbase(uio, idx) (uio)->uio_iov[(idx)].iov_base +#define uio_fault_disable(uio, set) (uio)->uio_fault_disable = set static inline void uio_iov_at_index(uio_t *uio, uint_t idx, void **base, uint64_t *len) diff --git a/include/os/linux/zfs/sys/Makefile.am b/include/os/linux/zfs/sys/Makefile.am index a5f2502d2..a075db476 100644 --- a/include/os/linux/zfs/sys/Makefile.am +++ b/include/os/linux/zfs/sys/Makefile.am @@ -21,7 +21,7 @@ KERNEL_H = \ zfs_ctldir.h \ zfs_dir.h \ zfs_vfsops_os.h \ - zfs_vnops.h \ + zfs_vnops_os.h \ zfs_znode_impl.h \ zpl.h diff --git a/include/os/linux/zfs/sys/policy.h b/include/os/linux/zfs/sys/policy.h index 77a73ad14..61afc3765 100644 --- a/include/os/linux/zfs/sys/policy.h +++ b/include/os/linux/zfs/sys/policy.h @@ -35,6 +35,8 @@ #include <sys/xvattr.h> #include <sys/zpl.h> +struct znode; + int secpolicy_nfs(const cred_t *); int secpolicy_sys_config(const cred_t *, boolean_t); int secpolicy_vnode_access2(const cred_t *, struct inode *, @@ -44,7 +46,7 @@ int secpolicy_vnode_chown(const cred_t *, uid_t); int secpolicy_vnode_create_gid(const cred_t *); int secpolicy_vnode_remove(const cred_t *); int secpolicy_vnode_setdac(const cred_t *, uid_t); -int secpolicy_vnode_setid_retain(const cred_t *, boolean_t); +int secpolicy_vnode_setid_retain(struct znode *, const cred_t *, boolean_t); int secpolicy_vnode_setids_setgids(const cred_t *, gid_t); int secpolicy_zinject(const cred_t *); int secpolicy_zfs(const cred_t *); diff --git a/include/os/linux/zfs/sys/zfs_vnops.h b/include/os/linux/zfs/sys/zfs_vnops_os.h index 2b41f3863..1c9cdf7bf 100644 --- a/include/os/linux/zfs/sys/zfs_vnops.h +++ b/include/os/linux/zfs/sys/zfs_vnops_os.h @@ -22,8 +22,8 @@ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. */ -#ifndef _SYS_FS_ZFS_VNOPS_H -#define _SYS_FS_ZFS_VNOPS_H +#ifndef _SYS_FS_ZFS_VNOPS_OS_H +#define _SYS_FS_ZFS_VNOPS_OS_H #include <sys/vnode.h> #include <sys/xvattr.h> @@ -41,8 +41,6 @@ extern "C" { extern int zfs_open(struct inode *ip, int mode, int flag, cred_t *cr); extern int zfs_close(struct inode *ip, int flag, cred_t *cr); extern int zfs_holey(struct inode *ip, int cmd, loff_t *off); -extern int zfs_read(struct inode *ip, uio_t *uio, int ioflag, cred_t *cr); -extern int zfs_write(struct inode *ip, uio_t *uio, int ioflag, cred_t *cr); extern int zfs_write_simple(znode_t *zp, const void *data, size_t len, loff_t pos, size_t *resid); extern int zfs_access(struct inode *ip, int mode, int flag, cred_t *cr); @@ -58,7 +56,6 @@ extern int zfs_mkdir(znode_t *dzp, char *dirname, vattr_t *vap, extern int zfs_rmdir(znode_t *dzp, char *name, znode_t *cwd, cred_t *cr, int flags); extern int zfs_readdir(struct inode *ip, zpl_dir_context_t *ctx, cred_t *cr); -extern int zfs_fsync(znode_t *zp, int syncflag, cred_t *cr); extern int zfs_getattr_fast(struct inode *ip, struct kstat *sp); extern int zfs_setattr(znode_t *zp, vattr_t *vap, int flag, cred_t *cr); extern int zfs_rename(znode_t *sdzp, char *snm, znode_t *tdzp, @@ -72,10 +69,6 @@ extern void zfs_inactive(struct inode *ip); extern int zfs_space(znode_t *zp, int cmd, flock64_t *bfp, int flag, offset_t offset, cred_t *cr); extern int zfs_fid(struct inode *ip, fid_t *fidp); -extern int zfs_getsecattr(struct inode *ip, vsecattr_t *vsecp, int flag, - cred_t *cr); -extern int zfs_setsecattr(znode_t *zp, vsecattr_t *vsecp, int flag, - cred_t *cr); extern int zfs_getpage(struct inode *ip, struct page *pl[], int nr_pages); extern int zfs_putpage(struct inode *ip, struct page *pp, struct writeback_control *wbc); diff --git a/include/os/linux/zfs/sys/zfs_znode_impl.h b/include/os/linux/zfs/sys/zfs_znode_impl.h index 39bbd135a..a4a136f01 100644 --- a/include/os/linux/zfs/sys/zfs_znode_impl.h +++ b/include/os/linux/zfs/sys/zfs_znode_impl.h @@ -68,6 +68,10 @@ extern "C" { #define Z_ISCHR(type) S_ISCHR(type) #define Z_ISLNK(type) S_ISLNK(type) #define Z_ISDEV(type) (S_ISCHR(type) || S_ISBLK(type) || S_ISFIFO(type)) +#define Z_ISDIR(type) S_ISDIR(type) + +#define zn_has_cached_data(zp) ((zp)->z_is_mapped) +#define zn_rlimit_fsize(zp, uio, td) (0) #define zhold(zp) igrab(ZTOI((zp))) #define zrele(zp) iput(ZTOI((zp))) @@ -143,6 +147,8 @@ do { \ } while (0) #endif /* HAVE_INODE_TIMESPEC64_TIMES */ +#define ZFS_ACCESSTIME_STAMP(zfsvfs, zp) + struct znode; extern int zfs_sync(struct super_block *, int, cred_t *); |