-
Notifications
You must be signed in to change notification settings - Fork 28
Home
Quick notes
== uio ==
OSX uio is now opaque, so we can't fiddle with the insides of uid-> anymore. Instead there are a number of API calls to use. uio_offset() etc.
In addition to that, Apple kernel defines "uio_t" as typedef struct uio *uio_t; and use it as "uio_t uio;" and ZFS defines it as typedef struct uio uio_t; and use it as "uio_t *uio;".
MacZFS uses #define uio_t struct uio
to work around that, so that is still around, however, I have generally replaced it with
uio_t *uio; -> struct uio *uio;
At the moment, including <sys/uio.h> will pull in spl/include/sys/uio.h;
#undef uio_t
#include_next <sys/uio.h>
#define uio_t struct uio
which creates a #define over the typedef. The same for sys/vnode.h
== vnode / inode ==
Linux's 'inode' are called 'vnode' on BSD systems, and on OSX it is opaque. So again, we can not see inside vnode struct.
Again we have the same "vnode_t" problem as with uio_t.
vnode_t *vp; -> struct vnode *vp;
Other porting items, minus-line means the ZFS original source, to be removed, and plus-line is the replacement.
-zfs_sb_t *zsb;
Is a linux thing, we replace with
+zfsvfs_t *zfsvfs;
-ZTOI(zp)
+ZTOV(zp);
- iput(ZTOI(dzp));
- VN_RELE(ZTOV(zp));
+ vnode_put(ZTOV(zp));
-flock64_t
+struct flock
-ZTOZSB(zp))
+zfsvfs_t *zfsvfs = zp->z_zfsvfs;
- ZTOZSB(zp)->i_mode
+vnode_vtype(vp)
-(S_ISDIR(ZTOI(dzp)->i_mode)
vnode_isdir(ZTOV(dzp))
-kauth_acl_t *vsecp
+vsecattr_t *vsecp
-ZFS_POSTPROCESS_ZP
+zfs_attach_vnode(xzp);
- if (mask & AT_SIZE)
+ if (VATTR_IS_ACTIVE(vap, va_data_size))
-struct super_block *sb
-vfs_t *vfsp
+
-uio->uio_iovcnt
+uio_iovcnt(uio)
-uio->uio_iov
+uio_curriovbase(uio)
-uio->uio_resid
+uio_resid(uio)
-uio->uio_loffset
+uio_offset(uio)
- uio_prefaultpages(MIN(n, max_blksz), uio);
+ zfs_prefault_write(n, uio);
== strdup ==
In kernel, use spa_strdup().
== API changes ==
Before
error = dmu_objset_open(osname, DMU_OST_ZFS, mode, &zfsvfs->z_os);
dmu_objset_close(zfsvfs->z_os);
after
error = dmu_objset_own(osname, DMU_OST_ZFS,
readonly ? B_TRUE : B_FALSE, &zfsvfs, &zfsvfs->z_os);
dmu_objset_disown(zfsvfs->z_os, &zfsvfs);
Where "&zfsvfs" is the tag "argument" (passed along as void *)