Skip to content
This repository has been archived by the owner on Feb 16, 2020. It is now read-only.

PortingNotes

Alex Blewitt edited this page Jul 18, 2010 · 7 revisions
  1. summary Information about how to port new changes
  2. labels Porting

Introduction

There are a number of differences between OSX and OpenSolaris that make porting more of a challenge than in other environments (including FreeBSD).

vnode_t

Mac OSX defines a `vnode_t` to be a pointer to a `struct vnode *`; but in OpenSolaris, a `vnode_t` is a pointer to a `struct vnode`. This was previously handled by Issue 27 and a set of `#ifdef` around the types - but this grows to be a porting problem generally.

To solve this problem, `zfs_context.h` defines a `#def` to replace `vnode_t` on the fly with `struct vnode`. That way, we're source compatible at the point of use. However, this then breaks Mac OSX libraries like `ubc.h` and `mount.h` which (understandably) need to use the right type.

This means we need to (conditionally) replace any system headers, including:

|| *Original code* || *Replacement* || || `#include <sys/mount.h></sys/mount.h>` || `#include <maczfs/maczfs_mount.h></maczfs/maczfs_mount.h>` || || `#include <sys/file.h></sys/file.h>` || `#include <maczfs/maczfs_mount.h></maczfs/maczfs_mount.h>` || || `#include <sys/ubc.h></sys/ubc.h>` || `#include <maczfs/maczfs_mount.h></maczfs/maczfs_mount.h>` || || `#include <libc.h`></libc.h`>follows:

Clone this wiki locally