Per our design, we need a third state for files which have been hydrated with their contents, but not modified by the user. We can implement this by setting our user.projection.empty flag to n, and then only removing the xattr if the file is opened for writing.
This will allow us to detect and send events at the "convert to full (i.e., modified)" state transition (when the file is opened for writing), akin to how the VFSForGit Mac kext sends PreConvertToFull events when it receives a KAUTH_VNODE_WRITE_DATA authorization request on a file which has been hydrated but still has a org.vfsforgit.xattr.file xattr. After sending this event, the Mac user-space library then removes the xattr.
We don't need a second xattr, because unlike the VFSForGit kext, which uses a spare BSD file flag to mark un-hydrated empty files, we're already using an xattr for that purpose, and can simply give it a different value (n) upon hydration, and then only remove it if the file is ever opened for writing.
Per our design, we need a third state for files which have been hydrated with their contents, but not modified by the user. We can implement this by setting our
user.projection.empty
flag ton
, and then only removing the xattr if the file is opened for writing.This will allow us to detect and send events at the "convert to full (i.e., modified)" state transition (when the file is opened for writing), akin to how the VFSForGit Mac kext sends
PreConvertToFull
events when it receives aKAUTH_VNODE_WRITE_DATA
authorization request on a file which has been hydrated but still has aorg.vfsforgit.xattr.file
xattr. After sending this event, the Mac user-space library then removes the xattr.We don't need a second xattr, because unlike the VFSForGit kext, which uses a spare BSD file flag to mark un-hydrated empty files, we're already using an xattr for that purpose, and can simply give it a different value (
n
) upon hydration, and then only remove it if the file is ever opened for writing.