Hello list,

So naturally, we want to try to be as compatible with HFS as possible, so
eventually we can have ZFS are the root filesystem.

In this round, we are looking at the Permanent Version Storage, for example
TextEdit.app, where you can show recent version(s) of your file.

First step is to lie and set vfsstatfs->f_fstypename to "hfs". It is
unfortunate that even TextEdit (or rather the frameworks it uses) checks
for the literal string "hfs" instead of using the fancy API to test for
capabilities like VOL_CAP_INT_EXCHANGEDATA. But nearly all Apps do this,
so, it has become a bit of a standard.

Second step is supporting a bunch of ioctl()s as well as VNOP_EXCHANGE. The
latter is particularly troublesome on a COW filesystem. You can't just
fiddle with the block pointers, nor do kexts have permission to root around
with open file-descriptors. But, I have some gross (avert your eyes!) code
that will simulate the outcome of VNOP_EXCHANGE.

Unfortunately, that was not the last challenge. Now it feels like we are
getting close though.

The output from trying to save (second save) a file with TextEedit, with
home directory living on ZFS:

kernel[0]: ZFS: vnop_exchange start
kernel[0]: ZFS: vnop_exchange copy small->temp
kernel[0]: ZFS: vnop_exchange copy large->small
kernel[0]: ZFS: vnop_exchange copy temp->large
kernel[0]: ZFS: vnop_exchange copy done
kernel[0]: ZFS: vnop_exchange removing tmp file
kernel[0]: ZFS: vnop_exchange OK
kernel[0]: ZFS: vnop_exchange: 0

TextEdit[1837]: NSFileVersion tried to tried to add a new generation and
failed. Versioned file URL: file:///Volumes/tester/Desktop/test2.rtf,
contents URL: file:///Volumes/tester/Desktop/test2.rtf.sb-6e01643d-A8hzLk,
error: Error Domain=GSLibraryErrorDomain Code=2 "not a staged path"
UserInfo={NSDescription=not a staged path}

TextEdit[1837]: NSDocument failed to preserve the old version of a
document. Here's the error:
        Error Domain=GSLibraryErrorDomain Code=2 "not a staged path"
UserInfo={NSDescription=not a staged path}

TextEdit[1837]: <Document: 0x7fb7db5765c0>: An error occurred while
attempting to preserve the backup file at
file:///Volumes/tester/Desktop/test2.rtf.sb-6e01643d-A8hzLk: Error
Domain=GSLibraryErrorDomain Code=2 "not a staged path"
UserInfo={NSDescription=not a staged path}


Not entirely sure what "not a staged path" could mean, and dtrace of
TextEdit has not revealed any clues. But alas, the PVS magic is in the
frameworks, who communicate by using kevents (hard to dtrace those) with
other daemons (at very least revisiond, filecoordinationd, nsurlstoraged
etc) so the rabbit hole is deep.

Any hits, or vague directions, to help us navigate would be awesome.

Lund


-- 
Jorgen Lundman       | <lund...@lundman.net>
Unix Administrator   | +81 (0)90-5578-8500          (work)
Shibuya-ku, Tokyo    | +81 (0)80-2090-5800          (cell)
Japan                | +81 (0)3 -3375-1767          (home)
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Filesystem-dev mailing list      (Filesystem-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/filesystem-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to