diff options
author | pjd <pjd@FreeBSD.org> | 2007-04-23 00:52:07 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2007-04-23 00:52:07 +0000 |
commit | 2063f013741d3fee2d48a255b6bbec6f1d15d003 (patch) | |
tree | 54c85efd93c3e6d93de3afcd7ec31f6e802cec59 /sys/compat | |
parent | e06dca92fe6d546958ccf3012b122a74b8fffc9c (diff) | |
download | FreeBSD-src-2063f013741d3fee2d48a255b6bbec6f1d15d003.zip FreeBSD-src-2063f013741d3fee2d48a255b6bbec6f1d15d003.tar.gz |
MFp4: Reduce diff against vendor code:
- Move FreeBSD-specific code to zfs_freebsd_*() functions in zfs_vnops.c
and keep original functions as similar to vendor's code as possible.
- Add various includes back, now that we have them.
Diffstat (limited to 'sys/compat')
-rw-r--r-- | sys/compat/opensolaris/kern/opensolaris_misc.c | 1 | ||||
-rw-r--r-- | sys/compat/opensolaris/sys/misc.h | 9 | ||||
-rw-r--r-- | sys/compat/opensolaris/sys/sunddi.h | 36 | ||||
-rw-r--r-- | sys/compat/opensolaris/sys/types.h | 1 | ||||
-rw-r--r-- | sys/compat/opensolaris/sys/vnode.h | 30 |
5 files changed, 72 insertions, 5 deletions
diff --git a/sys/compat/opensolaris/kern/opensolaris_misc.c b/sys/compat/opensolaris/kern/opensolaris_misc.c index bb51c37..a89d478 100644 --- a/sys/compat/opensolaris/kern/opensolaris_misc.c +++ b/sys/compat/opensolaris/kern/opensolaris_misc.c @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include <sys/kernel.h> #include <sys/libkern.h> #include <sys/misc.h> +#include <sys/sunddi.h> char hw_serial[11] = "0"; diff --git a/sys/compat/opensolaris/sys/misc.h b/sys/compat/opensolaris/sys/misc.h index d18c8c7..a5a52b7 100644 --- a/sys/compat/opensolaris/sys/misc.h +++ b/sys/compat/opensolaris/sys/misc.h @@ -29,12 +29,17 @@ #ifndef _OPENSOLARIS_SYS_MISC_H_ #define _OPENSOLARIS_SYS_MISC_H_ +#define _FIOFFS (INT_MIN) +#define _FIOGDIO (INT_MIN+1) +#define _FIOSDIO (INT_MIN+2) + +#define _FIO_SEEK_DATA FIOSEEKDATA +#define _FIO_SEEK_HOLE FIOSEEKHOLE + struct opensolaris_utsname { char *nodename; }; extern char hw_serial[11]; extern struct opensolaris_utsname utsname; - -int ddi_strtoul(const char *str, char **nptr, int base, unsigned long *result); #endif /* _OPENSOLARIS_SYS_MISC_H_ */ diff --git a/sys/compat/opensolaris/sys/sunddi.h b/sys/compat/opensolaris/sys/sunddi.h new file mode 100644 index 0000000..192d5a9 --- /dev/null +++ b/sys/compat/opensolaris/sys/sunddi.h @@ -0,0 +1,36 @@ +/*- + * Copyright (c) 2007 Pawel Jakub Dawidek <pjd@FreeBSD.org> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _OPENSOLARIS_SYS_SUNDDI_H_ +#define _OPENSOLARIS_SYS_SUNDDI_H_ + +#define ddi_copyin(from, to, size, flag) (bcopy((from), (to), (size)), 0) +#define ddi_copyout(from, to, size, flag) (bcopy((from), (to), (size)), 0) +int ddi_strtoul(const char *str, char **nptr, int base, unsigned long *result); + +#endif /* _OPENSOLARIS_SYS_SUNDDI_H_ */ diff --git a/sys/compat/opensolaris/sys/types.h b/sys/compat/opensolaris/sys/types.h index bc8f164..4006aec 100644 --- a/sys/compat/opensolaris/sys/types.h +++ b/sys/compat/opensolaris/sys/types.h @@ -49,6 +49,7 @@ typedef short index_t; typedef off_t offset_t; typedef long ptrdiff_t; /* pointer difference */ typedef void pathname_t; +typedef int64_t rlim64_t; #else diff --git a/sys/compat/opensolaris/sys/vnode.h b/sys/compat/opensolaris/sys/vnode.h index af886e8..06a4eb2 100644 --- a/sys/compat/opensolaris/sys/vnode.h +++ b/sys/compat/opensolaris/sys/vnode.h @@ -40,6 +40,7 @@ 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 @@ -63,11 +64,25 @@ vn_is_readonly(vnode_t *vp) #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 IS_DEVVP(vp) \ ((vp)->v_type == VCHR || (vp)->v_type == VBLK || (vp)->v_type == VFIFO) #define MODEMASK ALLPERMS +#define specvp(vp, rdev, type, cr) (VN_HOLD(vp), (vp)) +#define MANDMODE(mode) (0) +#define chklock(vp, op, offset, size, mode, ct) (0) +#define cleanlocks(vp, pid, foo) do { } while (0) +#define cleanshares(vp, pid) do { } while (0) + /* * We will use va_spare is place of Solaris' va_mask. * This field is initialized in zfs_setattr(). @@ -80,6 +95,9 @@ vn_is_readonly(vnode_t *vp) #define va_blksize va_blocksize #define va_seq va_gen +#define MAXOFFSET_T OFF_MAX +#define EXCL 0 + #define AT_TYPE 0x0001 #define AT_MODE 0x0002 #define AT_UID 0x0004 @@ -95,6 +113,8 @@ vn_is_readonly(vnode_t *vp) #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) @@ -122,10 +142,15 @@ vattr_init_mask(vattr_t *vap) vap->va_mask |= AT_MODE; } -enum create { CRCREAT }; #define FCREAT O_CREAT #define FTRUNC O_TRUNC +#define FDSYNC FFSYNC +#define FRSYNC FFSYNC +#define FSYNC FFSYNC #define FOFFMAX 0x00 + +enum create { CRCREAT }; + 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) @@ -185,7 +210,6 @@ zfs_vn_rdwr(enum uio_rw rw, vnode_t *vp, caddr_t base, ssize_t len, #define vn_rdwr(rw, vp, base, len, offset, seg, ioflag, ulimit, cr, residp) \ zfs_vn_rdwr((rw), (vp), (base), (len), (offset), (seg), (ioflag), (ulimit), (cr), (residp)) -#define FSYNC MNT_WAIT static __inline int zfs_vop_fsync(vnode_t *vp, int flag, cred_t *cr) { @@ -199,7 +223,7 @@ zfs_vop_fsync(vnode_t *vp, int flag, cred_t *cr) if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) goto drop; vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); - error = VOP_FSYNC(vp, flag, td); + error = VOP_FSYNC(vp, MNT_WAIT, td); VOP_UNLOCK(vp, 0, td); vn_finished_write(mp); drop: |