So far, the hard part was getting the headers right, especially zfs_context.h.
Most of the code changes so far were specific to gcc (fixing warnings) and POSIX threads (and maybe a few glibc ones, I don't know for sure). I intend to separate Linux-specific code into a linux.c file, or at least mark it with a /* LINUX */ tag, so that porting to FreeBSD will be easier.
Anyway, here's what I still have to do to make zdb work:
- Port kernel.c (hard)
- Port the remaining libzpool files (should be easy)
- Figure out how to implement the atomic_add_64() and atomic_cas_64() functions..
- Figure out how to make read-write locks work (using POSIX threads). It already has read-write locks (when __USE_UNIX98 is defined in the system header features.h), but I think it's impossible to know if the current thread owns a read (or write) lock, which is necessary to implement the RW_xxx_HELD() macros...
- Port libumem. Actually, I'm planning on doing a simple stub implementation using malloc() and mutexes, and later integrate the libumem linux port.
- Port whatever else is needed that I still haven't found out ;)