mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
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 <behlendorf1@llnl.gov> Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Signed-off-by: Matt Macy <mmacy@FreeBSD.org> Closes #11078
This commit is contained in:
committed by
Brian Behlendorf
parent
fa7b558bef
commit
3d40b65540
@@ -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
|
||||
|
||||
|
||||
@@ -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 *);
|
||||
|
||||
@@ -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);
|
||||
@@ -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)))
|
||||
@@ -147,6 +151,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 *);
|
||||
|
||||
Reference in New Issue
Block a user