summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMatthew Macy <[email protected]>2019-11-21 09:32:57 -0800
committerBrian Behlendorf <[email protected]>2019-11-21 09:32:57 -0800
commitda92d5cbb38cea3a860b8a6bb8ee21f9129e7d7c (patch)
treecc2d84b481a30b43d4097603e79a55a1975b0b64 /include
parent67a6c3bc9ff401fa04bc41354c5172b51aaed1c9 (diff)
Add zfs_file_* interface, remove vnodes
Provide a common zfs_file_* interface which can be implemented on all platforms to perform normal file access from either the kernel module or the libzpool library. This allows all non-portable vnode_t usage in the common code to be replaced by the new portable zfs_file_t. The associated vnode and kobj compatibility functions, types, and macros have been removed from the SPL. Moving forward, vnodes should only be used in platform specific code when provided by the native operating system. Reviewed-by: Sean Eric Fagan <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Igor Kozhukhov <[email protected]> Reviewed-by: Jorgen Lundman <[email protected]> Signed-off-by: Matt Macy <[email protected]> Closes #9556
Diffstat (limited to 'include')
-rw-r--r--include/os/linux/spl/sys/Makefile.am2
-rw-r--r--include/os/linux/spl/sys/kobj.h42
-rw-r--r--include/os/linux/spl/sys/mode.h32
-rw-r--r--include/os/linux/spl/sys/vnode.h95
-rw-r--r--include/os/linux/zfs/sys/policy.h2
-rw-r--r--include/os/linux/zfs/sys/zfs_vnops.h1
-rw-r--r--include/sys/Makefile.am1
-rw-r--r--include/sys/dmu.h3
-rw-r--r--include/sys/dmu_recv.h4
-rw-r--r--include/sys/spa.h12
-rw-r--r--include/sys/spa_impl.h2
-rw-r--r--include/sys/vdev_file.h2
-rw-r--r--include/sys/vdev_impl.h2
-rw-r--r--include/sys/zfs_context.h53
-rw-r--r--include/sys/zfs_file.h61
-rw-r--r--include/sys/zil.h2
16 files changed, 82 insertions, 234 deletions
diff --git a/include/os/linux/spl/sys/Makefile.am b/include/os/linux/spl/sys/Makefile.am
index e3df4edae..63b5ba71b 100644
--- a/include/os/linux/spl/sys/Makefile.am
+++ b/include/os/linux/spl/sys/Makefile.am
@@ -19,11 +19,9 @@ KERNEL_H = \
$(top_srcdir)/include/os/linux/spl/sys/isa_defs.h \
$(top_srcdir)/include/os/linux/spl/sys/kmem_cache.h \
$(top_srcdir)/include/os/linux/spl/sys/kmem.h \
- $(top_srcdir)/include/os/linux/spl/sys/kobj.h \
$(top_srcdir)/include/os/linux/spl/sys/kstat.h \
$(top_srcdir)/include/os/linux/spl/sys/list.h \
$(top_srcdir)/include/os/linux/spl/sys/mod_os.h \
- $(top_srcdir)/include/os/linux/spl/sys/mode.h \
$(top_srcdir)/include/os/linux/spl/sys/mutex.h \
$(top_srcdir)/include/os/linux/spl/sys/param.h \
$(top_srcdir)/include/os/linux/spl/sys/processor.h \
diff --git a/include/os/linux/spl/sys/kobj.h b/include/os/linux/spl/sys/kobj.h
deleted file mode 100644
index 558ec39a8..000000000
--- a/include/os/linux/spl/sys/kobj.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <[email protected]>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- * For details, see <http://zfsonlinux.org/>.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_KOBJ_H
-#define _SPL_KOBJ_H
-
-#include <sys/vnode.h>
-
-typedef struct _buf {
- vnode_t *vp;
-} _buf_t;
-
-typedef struct _buf buf_t;
-
-extern struct _buf *kobj_open_file(const char *name);
-extern void kobj_close_file(struct _buf *file);
-extern int kobj_read_file(struct _buf *file, char *buf, unsigned size,
- unsigned off);
-extern int kobj_get_filesize(struct _buf *file, uint64_t *size);
-
-#endif /* SPL_KOBJ_H */
diff --git a/include/os/linux/spl/sys/mode.h b/include/os/linux/spl/sys/mode.h
deleted file mode 100644
index 02802d0d4..000000000
--- a/include/os/linux/spl/sys/mode.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <[email protected]>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- * For details, see <http://zfsonlinux.org/>.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_MODE_H
-#define _SPL_MODE_H
-
-#define IFTOVT(mode) vn_mode_to_vtype(mode)
-#define VTTOIF(vtype) vn_vtype_to_mode(vtype)
-#define MAKEIMODE(T, M) (VTTOIF(T) | ((M) & ~S_IFMT))
-
-#endif /* SPL_MODE_H */
diff --git a/include/os/linux/spl/sys/vnode.h b/include/os/linux/spl/sys/vnode.h
index 7bd278e4e..07eac8e44 100644
--- a/include/os/linux/spl/sys/vnode.h
+++ b/include/os/linux/spl/sys/vnode.h
@@ -51,23 +51,8 @@
#define O_DSYNC O_SYNC
#endif
-#define FREAD 1
-#define FWRITE 2
-#define FCREAT O_CREAT
-#define FTRUNC O_TRUNC
-#define FOFFMAX O_LARGEFILE
-#define FSYNC O_SYNC
-#define FDSYNC O_DSYNC
-#define FEXCL O_EXCL
-#define FDIRECT O_DIRECT
-#define FAPPEND O_APPEND
-
-#define FNODSYNC 0x10000 /* fsync pseudo flag */
-#define FNOFOLLOW 0x20000 /* don't follow symlinks */
-
#define F_FREESP 11 /* Free file space */
-
/*
* The vnode AT_ flags are mapped to the Linux ATTR_* flags.
* This allows them to be used safely with an iattr structure.
@@ -102,23 +87,7 @@
#define CREATE_XATTR_DIR 0x04
#define ATTR_NOACLCHECK 0x20
-typedef enum vtype {
- VNON = 0,
- VREG = 1,
- VDIR = 2,
- VBLK = 3,
- VCHR = 4,
- VLNK = 5,
- VFIFO = 6,
- VDOOR = 7,
- VPROC = 8,
- VSOCK = 9,
- VPORT = 10,
- VBAD = 11
-} vtype_t;
-
typedef struct vattr {
- enum vtype va_type; /* vnode type */
uint32_t va_mask; /* attribute bit-mask */
ushort_t va_mode; /* acc mode */
uid_t va_uid; /* owner uid */
@@ -133,70 +102,6 @@ typedef struct vattr {
dev_t va_rdev; /* dev */
uint64_t va_nblocks; /* space used */
uint32_t va_blksize; /* block size */
- uint32_t va_seq; /* sequence */
struct dentry *va_dentry; /* dentry to wire */
} vattr_t;
-
-typedef struct vnode {
- struct file *v_file;
- kmutex_t v_lock; /* protects vnode fields */
- uint_t v_flag; /* vnode flags (see below) */
- uint_t v_count; /* reference count */
- void *v_data; /* private data for fs */
- struct vfs *v_vfsp; /* ptr to containing VFS */
- struct stdata *v_stream; /* associated stream */
- enum vtype v_type; /* vnode type */
- dev_t v_rdev; /* device (VCHR, VBLK) */
- gfp_t v_gfp_mask; /* original mapping gfp mask */
-} vnode_t;
-
-typedef struct vn_file {
- int f_fd; /* linux fd for lookup */
- struct task_struct *f_task; /* linux task this fd belongs to */
- struct file *f_file; /* linux file struct */
- atomic_t f_ref; /* ref count */
- kmutex_t f_lock; /* struct lock */
- loff_t f_offset; /* offset */
- vnode_t *f_vnode; /* vnode */
- struct list_head f_list; /* list referenced file_t's */
-} file_t;
-
-extern vnode_t *vn_alloc(int flag);
-void vn_free(vnode_t *vp);
-extern vtype_t vn_mode_to_vtype(mode_t);
-extern mode_t vn_vtype_to_mode(vtype_t);
-extern int vn_open(const char *path, uio_seg_t seg, int flags, int mode,
- vnode_t **vpp, int x1, void *x2);
-extern int vn_openat(const char *path, uio_seg_t seg, int flags, int mode,
- vnode_t **vpp, int x1, void *x2, vnode_t *vp, int fd);
-extern int vn_rdwr(uio_rw_t uio, vnode_t *vp, void *addr, ssize_t len,
- offset_t off, uio_seg_t seg, int x1, rlim64_t x2,
- void *x3, ssize_t *residp);
-extern int vn_close(vnode_t *vp, int flags, int x1, int x2, void *x3, void *x4);
-extern int vn_seek(vnode_t *vp, offset_t o, offset_t *op, void *ct);
-
-extern int vn_getattr(vnode_t *vp, vattr_t *vap, int flags, void *x3, void *x4);
-extern int vn_fsync(vnode_t *vp, int flags, void *x3, void *x4);
-extern int vn_space(vnode_t *vp, int cmd, struct flock *bfp, int flag,
- offset_t offset, void *x6, void *x7);
-extern file_t *vn_getf(int fd);
-extern void vn_releasef(int fd);
-extern void vn_areleasef(int fd, uf_info_t *fip);
-
-int spl_vn_init(void);
-void spl_vn_fini(void);
-
-#define VOP_CLOSE vn_close
-#define VOP_SEEK vn_seek
-#define VOP_GETATTR vn_getattr
-#define VOP_FSYNC vn_fsync
-#define VOP_SPACE vn_space
-#define VOP_PUTPAGE(vp, o, s, f, x1, x2) ((void)0)
-#define vn_is_readonly(vp) 0
-#define getf vn_getf
-#define releasef vn_releasef
-#define areleasef vn_areleasef
-
-extern vnode_t *rootdir;
-
#endif /* SPL_VNODE_H */
diff --git a/include/os/linux/zfs/sys/policy.h b/include/os/linux/zfs/sys/policy.h
index 23d7d4db7..a8327e02f 100644
--- a/include/os/linux/zfs/sys/policy.h
+++ b/include/os/linux/zfs/sys/policy.h
@@ -51,7 +51,7 @@ int secpolicy_zfs(const cred_t *);
void secpolicy_setid_clear(vattr_t *, cred_t *);
int secpolicy_setid_setsticky_clear(struct inode *, vattr_t *,
const vattr_t *, cred_t *);
-int secpolicy_xvattr(xvattr_t *, uid_t, cred_t *, vtype_t);
+int secpolicy_xvattr(xvattr_t *, uid_t, cred_t *, mode_t);
int secpolicy_vnode_setattr(cred_t *, struct inode *, struct vattr *,
const struct vattr *, int, int (void *, int, cred_t *), void *);
int secpolicy_basic_link(const cred_t *);
diff --git a/include/os/linux/zfs/sys/zfs_vnops.h b/include/os/linux/zfs/sys/zfs_vnops.h
index 767cba10d..21b61c07f 100644
--- a/include/os/linux/zfs/sys/zfs_vnops.h
+++ b/include/os/linux/zfs/sys/zfs_vnops.h
@@ -32,6 +32,7 @@
#include <sys/fcntl.h>
#include <sys/pathname.h>
#include <sys/zpl.h>
+#include <sys/zfs_file.h>
#ifdef __cplusplus
extern "C" {
diff --git a/include/sys/Makefile.am b/include/sys/Makefile.am
index 21e85431c..75f7d93e7 100644
--- a/include/sys/Makefile.am
+++ b/include/sys/Makefile.am
@@ -104,6 +104,7 @@ COMMON_H = \
$(top_srcdir)/include/sys/zfs_context.h \
$(top_srcdir)/include/sys/zfs_debug.h \
$(top_srcdir)/include/sys/zfs_delay.h \
+ $(top_srcdir)/include/sys/zfs_file.h \
$(top_srcdir)/include/sys/zfs_fuid.h \
$(top_srcdir)/include/sys/zfs_project.h \
$(top_srcdir)/include/sys/zfs_ratelimit.h \
diff --git a/include/sys/dmu.h b/include/sys/dmu.h
index 44889bb10..24cbb2f7a 100644
--- a/include/sys/dmu.h
+++ b/include/sys/dmu.h
@@ -49,6 +49,7 @@
#include <sys/zio_compress.h>
#include <sys/zio_priority.h>
#include <sys/uio.h>
+#include <sys/zfs_file.h>
#ifdef __cplusplus
extern "C" {
@@ -1071,7 +1072,7 @@ void dmu_traverse_objset(objset_t *os, uint64_t txg_start,
dmu_traverse_cb_t cb, void *arg);
int dmu_diff(const char *tosnap_name, const char *fromsnap_name,
- struct vnode *vp, offset_t *offp);
+ zfs_file_t *fp, offset_t *offp);
/* CRC64 table */
#define ZFS_CRC64_POLY 0xC96C5795D7870F42ULL /* ECMA-182, reflected form */
diff --git a/include/sys/dmu_recv.h b/include/sys/dmu_recv.h
index 1a7347d66..2cbe49c49 100644
--- a/include/sys/dmu_recv.h
+++ b/include/sys/dmu_recv.h
@@ -62,7 +62,7 @@ typedef struct dmu_recv_cookie {
nvlist_t *drc_begin_nvl;
objset_t *drc_os;
- vnode_t *drc_vp; /* The vnode to read the stream from */
+ zfs_file_t *drc_fp; /* The file to read the stream from */
uint64_t drc_voff; /* The current offset in the stream */
uint64_t drc_bytes_read;
/*
@@ -82,7 +82,7 @@ typedef struct dmu_recv_cookie {
int dmu_recv_begin(char *tofs, char *tosnap, dmu_replay_record_t *drr_begin,
boolean_t force, boolean_t resumable, nvlist_t *localprops,
nvlist_t *hidden_args, char *origin, dmu_recv_cookie_t *drc,
- vnode_t *vp, offset_t *voffp);
+ zfs_file_t *fp, offset_t *voffp);
int dmu_recv_stream(dmu_recv_cookie_t *drc, int cleanup_fd,
uint64_t *action_handlep, offset_t *voffp);
int dmu_recv_end(dmu_recv_cookie_t *drc, void *owner);
diff --git a/include/sys/spa.h b/include/sys/spa.h
index cb9157738..cae29a4f4 100644
--- a/include/sys/spa.h
+++ b/include/sys/spa.h
@@ -723,6 +723,12 @@ typedef enum spa_import_type {
SPA_IMPORT_ASSEMBLE
} spa_import_type_t;
+typedef enum spa_mode {
+ SPA_MODE_UNINIT = 0,
+ SPA_MODE_READ = 1,
+ SPA_MODE_WRITE = 2,
+} spa_mode_t;
+
/*
* Send TRIM commands in-line during normal pool operation while deleting.
* OFF: no
@@ -1099,7 +1105,7 @@ extern uint32_t spa_get_hostid(spa_t *spa);
extern void spa_activate_allocation_classes(spa_t *, dmu_tx_t *);
extern boolean_t spa_livelist_delete_check(spa_t *spa);
-extern int spa_mode(spa_t *spa);
+extern spa_mode_t spa_mode(spa_t *spa);
extern uint64_t zfs_strtonum(const char *str, char **nptr);
extern char *spa_his_ievent_table[];
@@ -1149,7 +1155,7 @@ extern void vdev_mirror_stat_init(void);
extern void vdev_mirror_stat_fini(void);
/* Initialization and termination */
-extern void spa_init(int flags);
+extern void spa_init(spa_mode_t mode);
extern void spa_fini(void);
extern void spa_boot_init(void);
@@ -1189,7 +1195,7 @@ _NOTE(CONSTCOND) } while (0)
#define dprintf_bp(bp, fmt, ...)
#endif
-extern int spa_mode_global; /* mode, e.g. FREAD | FWRITE */
+extern spa_mode_t spa_mode_global;
extern int zfs_deadman_enabled;
extern unsigned long zfs_deadman_synctime_ms;
extern unsigned long zfs_deadman_ziotime_ms;
diff --git a/include/sys/spa_impl.h b/include/sys/spa_impl.h
index c83252bca..5a581214d 100644
--- a/include/sys/spa_impl.h
+++ b/include/sys/spa_impl.h
@@ -362,7 +362,7 @@ struct spa {
uint8_t spa_claiming; /* pool is doing zil_claim() */
boolean_t spa_is_root; /* pool is root */
int spa_minref; /* num refs when first opened */
- int spa_mode; /* FREAD | FWRITE */
+ spa_mode_t spa_mode; /* SPA_MODE_{READ|WRITE} */
spa_log_state_t spa_log_state; /* log state */
uint64_t spa_autoexpand; /* lun expansion on/off */
ddt_t *spa_ddt[ZIO_CHECKSUM_FUNCTIONS]; /* in-core DDTs */
diff --git a/include/sys/vdev_file.h b/include/sys/vdev_file.h
index 9a398c583..1514a44fc 100644
--- a/include/sys/vdev_file.h
+++ b/include/sys/vdev_file.h
@@ -34,7 +34,7 @@ extern "C" {
#endif
typedef struct vdev_file {
- vnode_t *vf_vnode;
+ zfs_file_t *vf_file;
} vdev_file_t;
extern void vdev_file_init(void);
diff --git a/include/sys/vdev_impl.h b/include/sys/vdev_impl.h
index ae82b75c0..4f63e1ae5 100644
--- a/include/sys/vdev_impl.h
+++ b/include/sys/vdev_impl.h
@@ -220,8 +220,6 @@ struct vdev {
vdev_ops_t *vdev_ops; /* vdev operations */
spa_t *vdev_spa; /* spa for this vdev */
void *vdev_tsd; /* type-specific data */
- vnode_t *vdev_name_vp; /* vnode for pathname */
- vnode_t *vdev_devid_vp; /* vnode for devid */
vdev_t *vdev_top; /* top-level vdev */
vdev_t *vdev_parent; /* parent vdev */
vdev_t **vdev_child; /* array of children */
diff --git a/include/sys/zfs_context.h b/include/sys/zfs_context.h
index f221091d8..c14d92a2c 100644
--- a/include/sys/zfs_context.h
+++ b/include/sys/zfs_context.h
@@ -42,7 +42,6 @@
#include <sys/vmem.h>
#include <sys/taskq.h>
#include <sys/param.h>
-#include <sys/kobj.h>
#include <sys/disp.h>
#include <sys/debug.h>
#include <sys/random.h>
@@ -515,16 +514,6 @@ extern void system_taskq_fini(void);
#define XVA_MAPSIZE 3
#define XVA_MAGIC 0x78766174
-/*
- * vnodes
- */
-typedef struct vnode {
- uint64_t v_size;
- int v_fd;
- char *v_path;
- int v_dump_fd;
-} vnode_t;
-
extern char *vn_dumpdir;
#define AV_SCANSTAMP_SZ 32 /* length of anti-virus scanstamp */
@@ -593,40 +582,7 @@ typedef struct vsecattr {
#define CRCREAT 0
#define F_FREESP 11
-
-extern int fop_getattr(vnode_t *vp, vattr_t *vap);
-
-#define VOP_CLOSE(vp, f, c, o, cr, ct) vn_close(vp)
-#define VOP_PUTPAGE(vp, of, sz, fl, cr, ct) 0
-#define VOP_GETATTR(vp, vap, fl, cr, ct) fop_getattr((vp), (vap));
-
-#define VOP_FSYNC(vp, f, cr, ct) fsync((vp)->v_fd)
-
-#if defined(FALLOC_FL_PUNCH_HOLE) && defined(FALLOC_FL_KEEP_SIZE)
-#define VOP_SPACE(vp, cmd, flck, fl, off, cr, ct) \
- fallocate((vp)->v_fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, \
- (flck)->l_start, (flck)->l_len)
-#else
-#define VOP_SPACE(vp, cmd, flck, fl, off, cr, ct) (0)
-#endif
-
-#define VN_RELE(vp) vn_close(vp)
-
-extern int vn_open(char *path, int x1, int oflags, int mode, vnode_t **vpp,
- int x2, int x3);
-extern int vn_openat(char *path, int x1, int oflags, int mode, vnode_t **vpp,
- int x2, int x3, vnode_t *vp, int fd);
-extern int vn_rdwr(int uio, vnode_t *vp, void *addr, ssize_t len,
- offset_t offset, int x1, int x2, rlim64_t x3, void *x4, ssize_t *residp);
-extern void vn_close(vnode_t *vp);
-
-#define vn_remove(path, x1, x2) remove(path)
-#define vn_rename(from, to, seg) rename((from), (to))
-#define vn_is_readonly(vp) B_FALSE
-
-extern vnode_t *rootdir;
-
-#include <sys/file.h> /* for FREAD, FWRITE, etc */
+#define FIGNORECASE 0x80000 /* request case-insensitive lookups */
/*
* Random stuff
@@ -681,7 +637,7 @@ extern int lowbit64(uint64_t i);
extern int random_get_bytes(uint8_t *ptr, size_t len);
extern int random_get_pseudo_bytes(uint8_t *ptr, size_t len);
-extern void kernel_init(int);
+extern void kernel_init(int mode);
extern void kernel_fini(void);
extern void random_init(void);
extern void random_fini(void);
@@ -758,11 +714,6 @@ typedef struct ace_object {
#define ACE_SYSTEM_AUDIT_OBJECT_ACE_TYPE 0x07
#define ACE_SYSTEM_ALARM_OBJECT_ACE_TYPE 0x08
-extern struct _buf *kobj_open_file(char *name);
-extern int kobj_read_file(struct _buf *file, char *buf, unsigned size,
- unsigned off);
-extern void kobj_close_file(struct _buf *file);
-extern int kobj_get_filesize(struct _buf *file, uint64_t *size);
extern int zfs_secpolicy_snapshot_perms(const char *name, cred_t *cr);
extern int zfs_secpolicy_rename_perms(const char *from, const char *to,
cred_t *cr);
diff --git a/include/sys/zfs_file.h b/include/sys/zfs_file.h
new file mode 100644
index 000000000..6b33420e3
--- /dev/null
+++ b/include/sys/zfs_file.h
@@ -0,0 +1,61 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+#ifndef _SYS_ZFS_FILE_H
+#define _SYS_ZFS_FILE_H
+
+#ifndef _KERNEL
+typedef struct zfs_file {
+ int f_fd;
+ int f_dump_fd;
+} zfs_file_t;
+#elif defined(__linux__) || defined(__FreeBSD__)
+typedef struct file zfs_file_t;
+#else
+#error "unknown OS"
+#endif
+
+typedef struct zfs_file_attr {
+ uint64_t zfa_size; /* file size */
+ mode_t zfa_mode; /* file type */
+} zfs_file_attr_t;
+
+int zfs_file_open(const char *path, int flags, int mode, zfs_file_t **fp);
+void zfs_file_close(zfs_file_t *fp);
+
+int zfs_file_write(zfs_file_t *fp, const void *buf, size_t len, ssize_t *resid);
+int zfs_file_pwrite(zfs_file_t *fp, const void *buf, size_t len, loff_t off,
+ ssize_t *resid);
+int zfs_file_read(zfs_file_t *fp, void *buf, size_t len, ssize_t *resid);
+int zfs_file_pread(zfs_file_t *fp, void *buf, size_t len, loff_t off,
+ ssize_t *resid);
+
+int zfs_file_seek(zfs_file_t *fp, loff_t *offp, int whence);
+int zfs_file_getattr(zfs_file_t *fp, zfs_file_attr_t *zfattr);
+int zfs_file_fsync(zfs_file_t *fp, int flags);
+int zfs_file_fallocate(zfs_file_t *fp, int mode, loff_t offset, loff_t len);
+loff_t zfs_file_off(zfs_file_t *fp);
+int zfs_file_unlink(const char *);
+
+int zfs_file_get(int fd, zfs_file_t **fp);
+void zfs_file_put(int fd);
+
+#endif /* _SYS_ZFS_FILE_H */
diff --git a/include/sys/zil.h b/include/sys/zil.h
index e84fb864a..716b19e56 100644
--- a/include/sys/zil.h
+++ b/include/sys/zil.h
@@ -373,7 +373,7 @@ typedef struct {
* - the write occupies only one block
* WR_COPIED:
* If we know we'll immediately be committing the
- * transaction (FSYNC or FDSYNC), then we allocate a larger
+ * transaction (O_SYNC or O_DSYNC), then we allocate a larger
* log record here for the data and copy the data in.
* WR_NEED_COPY:
* Otherwise we don't allocate a buffer, and *if* we need to