Closed GoogleCodeExporter closed 9 years ago
In the 10a286 code the 'struct vnode' way is replaced with the usual 'vnode_t'.
src/lib/libzpool/common/sys/zfs_context.h
/*
* vnodes
*/
/* A subset of the kernel vnode structure. */
struct vnode {
uint64_t v_size;
int v_fd;
char *v_path;
};
#define vnode_t struct vnode
Original comment by jason.richard.mcneil
on 20 Feb 2010 at 8:26
Normally it would be defined with typedef struct vnode { ... } vnode_t; -
however, I wonder if they have problems with that approach clobbering the type
elsewhere. Also interesting that this only shows up here ...
Original comment by alex.ble...@gmail.com
on 17 Jul 2010 at 9:45
Oh, I see. vnode_t is usually defined as typedef struct vnode * vnode_t; in
OSX, but in OpenSolaris, it's defined as typedef struct vnode vnode_t. So if we
just did a straight typedef, we'd end up with the wrong thing, or at least
inconsistent types. So by doing the #define trick, we avoid duping the type
whilst giving it the right type for the OpenSolaris codebase to work. Neat.
http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/sys/vno
de.h
Original comment by alex.ble...@gmail.com
on 17 Jul 2010 at 10:10
OK, so the rabbit hole goes deeper than that. The problem is that (Apple's)
mount.h, ubc. and file.h have references to the non-pointer stuff, so if we
swap this #define in, it breaks. It looks like in the 10a286 bits they worked
around this by forking zfs_file, zfs_ubc and zfs_mount which presumably stuck
in the extra * in order to get things working again.
In other news, I'm pretty sure the zfs_context.h is unused for libzpool in the
current layout. We really ought to get rid of unnecessary files.
Original comment by alex.ble...@gmail.com
on 17 Jul 2010 at 10:34
I've set the ground work in
http://github.com/alblue/mac-zfs/commit/c8a4c5786fc0cd04f7aaa615c4a53d8ac53f5cd6
and given it a brief spin. I still need to unpick the #ifdefs around before I
can close this off, but it's a work in progress.
Original comment by alex.ble...@gmail.com
on 18 Jul 2010 at 11:12
Fixed in
http://github.com/alblue/mac-zfs/commit/79d6126216e3cd8ee63126a23faa83b8e121111b
Original comment by alex.ble...@gmail.com
on 18 Jul 2010 at 1:55
Original issue reported on code.google.com by
alex.ble...@gmail.com
on 20 Feb 2010 at 3:29