aboutsummaryrefslogtreecommitdiff
path: root/sys/cddl/compat/opensolaris/sys/vnode.h
diff options
context:
space:
mode:
authorPawel Jakub Dawidek <pjd@FreeBSD.org>2008-11-17 20:49:29 +0000
committerPawel Jakub Dawidek <pjd@FreeBSD.org>2008-11-17 20:49:29 +0000
commit1ba4a712dde6e6c613fc411a96958b4ade67de4c (patch)
tree81b89fa4ac6467771d5aa291a97f4665981a6108 /sys/cddl/compat/opensolaris/sys/vnode.h
parent8fc061164d74a4c9775f39da3c0b5d02112866c8 (diff)
downloadsrc-1ba4a712dde6e6c613fc411a96958b4ade67de4c.tar.gz
src-1ba4a712dde6e6c613fc411a96958b4ade67de4c.zip
Update ZFS from version 6 to 13 and bring some FreeBSD-specific changes.
This bring huge amount of changes, I'll enumerate only user-visible changes: - Delegated Administration Allows regular users to perform ZFS operations, like file system creation, snapshot creation, etc. - L2ARC Level 2 cache for ZFS - allows to use additional disks for cache. Huge performance improvements mostly for random read of mostly static content. - slog Allow to use additional disks for ZFS Intent Log to speed up operations like fsync(2). - vfs.zfs.super_owner Allows regular users to perform privileged operations on files stored on ZFS file systems owned by him. Very careful with this one. - chflags(2) Not all the flags are supported. This still needs work. - ZFSBoot Support to boot off of ZFS pool. Not finished, AFAIK. Submitted by: dfr - Snapshot properties - New failure modes Before if write requested failed, system paniced. Now one can select from one of three failure modes: - panic - panic on write error - wait - wait for disk to reappear - continue - serve read requests if possible, block write requests - Refquota, refreservation properties Just quota and reservation properties, but don't count space consumed by children file systems, clones and snapshots. - Sparse volumes ZVOLs that don't reserve space in the pool. - External attributes Compatible with extattr(2). - NFSv4-ACLs Not sure about the status, might not be complete yet. Submitted by: trasz - Creation-time properties - Regression tests for zpool(8) command. Obtained from: OpenSolaris
Notes
Notes: svn path=/head/; revision=185029
Diffstat (limited to 'sys/cddl/compat/opensolaris/sys/vnode.h')
-rw-r--r--sys/cddl/compat/opensolaris/sys/vnode.h125
1 files changed, 69 insertions, 56 deletions
diff --git a/sys/cddl/compat/opensolaris/sys/vnode.h b/sys/cddl/compat/opensolaris/sys/vnode.h
index a8a261cc2449..b490d337d5e7 100644
--- a/sys/cddl/compat/opensolaris/sys/vnode.h
+++ b/sys/cddl/compat/opensolaris/sys/vnode.h
@@ -29,24 +29,32 @@
#ifndef _OPENSOLARIS_SYS_VNODE_H_
#define _OPENSOLARIS_SYS_VNODE_H_
+struct vnode;
+struct vattr;
+
+typedef struct vnode vnode_t;
+typedef struct vattr vattr_t;
+typedef enum vtype vtype_t;
+
+#include <sys/namei.h>
+enum symfollow { NO_FOLLOW = NOFOLLOW };
+
+#include <sys/proc.h>
#include_next <sys/vnode.h>
#include <sys/mount.h>
#include <sys/cred.h>
#include <sys/fcntl.h>
-#include <sys/namei.h>
-#include <sys/proc.h>
+#include <sys/file.h>
#include <sys/filedesc.h>
#include <sys/syscallsubr.h>
-typedef struct vnode vnode_t;
-typedef struct vattr vattr_t;
-typedef void caller_context_t;
-
typedef struct vop_vector vnodeops_t;
#define vop_fid vop_vptofh
#define vop_fid_args vop_vptofh_args
#define a_fid a_fhp
+#define IS_XATTRDIR(dvp) (0)
+
#define v_count v_usecount
static __inline int
@@ -59,23 +67,24 @@ vn_is_readonly(vnode_t *vp)
#define vn_ismntpt(vp) ((vp)->v_type == VDIR && (vp)->v_mountedhere != NULL)
#define vn_mountedvfs(vp) ((vp)->v_mountedhere)
#define vn_has_cached_data(vp) ((vp)->v_object != NULL && (vp)->v_object->resident_page_count > 0)
+#define vn_exists(vp) do { } while (0)
+#define vn_invalid(vp) do { } while (0)
+#define vn_renamepath(tdvp, svp, tnm, lentnm) do { } while (0)
+#define vn_free(vp) do { } while (0)
#define VN_HOLD(v) vref(v)
#define VN_RELE(v) vrele(v)
#define VN_URELE(v) vput(v)
-#define VOP_REALVP(vp, vpp) (*(vpp) = (vp), 0)
-
-#define vnevent_remove(vp) do { } while (0)
-#define vnevent_rmdir(vp) do { } while (0)
-#define vnevent_rename_src(vp) do { } while (0)
-#define vnevent_rename_dest(vp) do { } while (0)
-
+#define VOP_REALVP(vp, vpp, ct) (*(vpp) = (vp), 0)
-#define IS_DEVVP(vp) \
- ((vp)->v_type == VCHR || (vp)->v_type == VBLK || (vp)->v_type == VFIFO)
-
-#define MODEMASK ALLPERMS
+#define vnevent_create(vp, ct) do { } while (0)
+#define vnevent_link(vp, ct) do { } while (0)
+#define vnevent_remove(vp, dvp, name, ct) do { } while (0)
+#define vnevent_rmdir(vp, dvp, name, ct) do { } while (0)
+#define vnevent_rename_src(vp, dvp, name, ct) do { } while (0)
+#define vnevent_rename_dest(vp, dvp, name, ct) do { } while (0)
+#define vnevent_rename_dest_dir(vp, ct) do { } while (0)
#define specvp(vp, rdev, type, cr) (VN_HOLD(vp), (vp))
#define MANDMODE(mode) (0)
@@ -98,24 +107,6 @@ vn_is_readonly(vnode_t *vp)
#define MAXOFFSET_T OFF_MAX
#define EXCL 0
-#define AT_TYPE 0x0001
-#define AT_MODE 0x0002
-#define AT_UID 0x0004
-#define AT_GID 0x0008
-#define AT_FSID 0x0010
-#define AT_NODEID 0x0020
-#define AT_NLINK 0x0040
-#define AT_SIZE 0x0080
-#define AT_ATIME 0x0100
-#define AT_MTIME 0x0200
-#define AT_CTIME 0x0400
-#define AT_RDEV 0x0800
-#define AT_BLKSIZE 0x1000
-#define AT_NBLOCKS 0x2000
-#define AT_SEQ 0x4000
-#define AT_NOSET (AT_NLINK|AT_RDEV|AT_FSID|AT_NODEID|AT_TYPE|\
- AT_BLKSIZE|AT_NBLOCKS|AT_SEQ)
-
#define ACCESSED (AT_ATIME)
#define STATE_CHANGED (AT_CTIME)
#define CONTENT_MODIFIED (AT_MTIME | AT_CTIME)
@@ -140,28 +131,37 @@ vattr_init_mask(vattr_t *vap)
vap->va_mask |= AT_MTIME;
if (vap->va_mode != (u_short)VNOVAL)
vap->va_mask |= AT_MODE;
+ if (vap->va_flags != VNOVAL)
+ vap->va_mask |= AT_XVATTR;
}
-#define FCREAT O_CREAT
-#define FTRUNC O_TRUNC
-#define FDSYNC FFSYNC
-#define FRSYNC FFSYNC
-#define FSYNC FFSYNC
-#define FOFFMAX 0x00
-
-enum create { CRCREAT };
+#define FCREAT O_CREAT
+#define FTRUNC O_TRUNC
+#define FDSYNC FFSYNC
+#define FRSYNC FFSYNC
+#define FSYNC FFSYNC
+#define FOFFMAX 0x00
+#define FIGNORECASE 0x00
static __inline int
-zfs_vn_open(char *pnamep, enum uio_seg seg, int filemode, int createmode,
- vnode_t **vpp, enum create crwhy, mode_t umask)
+vn_openat(char *pnamep, enum uio_seg seg, int filemode, int createmode,
+ vnode_t **vpp, enum create crwhy, mode_t umask, struct vnode *startvp,
+ int fd)
{
struct thread *td = curthread;
struct nameidata nd;
- int error;
+ int error, operation;
ASSERT(seg == UIO_SYSSPACE);
- ASSERT(filemode == (FWRITE | FCREAT | FTRUNC | FOFFMAX));
- ASSERT(crwhy == CRCREAT);
+ if ((filemode & FCREAT) != 0) {
+ ASSERT(filemode == (FWRITE | FCREAT | FTRUNC | FOFFMAX));
+ ASSERT(crwhy == CRCREAT);
+ operation = CREATE;
+ } else {
+ ASSERT(filemode == (FREAD | FWRITE | FOFFMAX));
+ ASSERT(crwhy == 0);
+ operation = LOOKUP;
+ }
ASSERT(umask == 0);
if (td->td_proc->p_fd->fd_rdir == NULL)
@@ -169,7 +169,10 @@ zfs_vn_open(char *pnamep, enum uio_seg seg, int filemode, int createmode,
if (td->td_proc->p_fd->fd_cdir == NULL)
td->td_proc->p_fd->fd_cdir = rootvnode;
- NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, pnamep, td);
+ if (startvp != NULL)
+ vref(startvp);
+ NDINIT_ATVP(&nd, operation, NOFOLLOW | MPSAFE, UIO_SYSSPACE, pnamep,
+ startvp, td);
error = vn_open_cred(&nd, &filemode, createmode, td->td_ucred, NULL);
NDFREE(&nd, NDF_ONLY_PNBUF);
if (error == 0) {
@@ -180,6 +183,15 @@ zfs_vn_open(char *pnamep, enum uio_seg seg, int filemode, int createmode,
}
return (error);
}
+
+static __inline int
+zfs_vn_open(char *pnamep, enum uio_seg seg, int filemode, int createmode,
+ vnode_t **vpp, enum create crwhy, mode_t umask)
+{
+
+ return (vn_openat(pnamep, seg, filemode, createmode, vpp, crwhy,
+ umask, NULL, -1));
+}
#define vn_open(pnamep, seg, filemode, createmode, vpp, crwhy, umask) \
zfs_vn_open((pnamep), (seg), (filemode), (createmode), (vpp), (crwhy), (umask))
@@ -192,14 +204,16 @@ zfs_vn_rdwr(enum uio_rw rw, vnode_t *vp, caddr_t base, ssize_t len,
struct thread *td = curthread;
int error, vfslocked, resid;
- ASSERT(rw == UIO_WRITE);
ASSERT(ioflag == 0);
ASSERT(ulimit == RLIM64_INFINITY);
- ioflag = IO_APPEND | IO_UNIT;
-
vfslocked = VFS_LOCK_GIANT(vp->v_mount);
- VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
+ if (rw == UIO_WRITE) {
+ ioflag = IO_SYNC;
+ VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
+ } else {
+ ioflag = IO_DIRECT;
+ }
error = vn_rdwr(rw, vp, base, len, offset, seg, ioflag, cr, NOCRED,
&resid, td);
VFS_UNLOCK_GIANT(vfslocked);
@@ -229,7 +243,7 @@ drop:
VFS_UNLOCK_GIANT(vfslocked);
return (error);
}
-#define VOP_FSYNC(vp, flag, cr) zfs_vop_fsync((vp), (flag), (cr))
+#define VOP_FSYNC(vp, flag, cr, ct) zfs_vop_fsync((vp), (flag), (cr))
static __inline int
zfs_vop_close(vnode_t *vp, int flag, int count, offset_t offset, cred_t *cr)
@@ -241,7 +255,7 @@ zfs_vop_close(vnode_t *vp, int flag, int count, offset_t offset, cred_t *cr)
return (vn_close(vp, flag, cr, curthread));
}
-#define VOP_CLOSE(vp, oflags, count, offset, cr) \
+#define VOP_CLOSE(vp, oflags, count, offset, cr, ct) \
zfs_vop_close((vp), (oflags), (count), (offset), (cr))
static __inline int
@@ -253,7 +267,6 @@ vn_rename(char *from, char *to, enum uio_seg seg)
return (kern_rename(curthread, from, to, seg));
}
-enum rm { RMFILE };
static __inline int
vn_remove(char *fnamep, enum uio_seg seg, enum rm dirflag)
{