It seems to me (again, just from looking at the code, I don't have OS-X)
that OS-X supports some additional setxattr() flags: XATTR_NOFOLLOW,
XATTR_NOSECURITY and XATTR_NODEFAULT.
Am I right that XATTR_NOFOLLOW and XATTR_NOSECURITY are handled in the
kernel and will never be passed to the FUSE setxattr() low-level handler?
Could someone explain to me the semantics of XATTR_NODEFAULT? Is this
something that may be passed to the FUSE handler? I couldn't find any
documentation of it...
Best,
-Nikolaus
--
»Time flies like an arrow, fruit flies like a Banana.«
PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6 02CF A9AD B7F8 AE4E 425C
Hello,
It seems to me (again, just from looking at the code, I don't have OS-X)
that OS-X supports some additional setxattr() flags: XATTR_NOFOLLOW,
XATTR_NOSECURITY and XATTR_NODEFAULT.
Am I right that XATTR_NOFOLLOW and XATTR_NOSECURITY are handled in the
kernel and will never be passed to the FUSE setxattr() low-level handler?
Could someone explain to me the semantics of XATTR_NODEFAULT? Is this
something that may be passed to the FUSE handler? I couldn't find any
documentation of it...
Regarding XATTR_NOFOLLOW. From what I know that is having the same effect as lsetxattr() on Linux. Actually, it is not only setxattr that is affected by this, but all functions in the xattr suit.
setxattr flags are also different - e.g. macosx has flag XATTR_SHOWCOMPRESSION that is HFS specific.... It also looks like xnu might pass kernel-specific flags XATTR_NODEFAULT, XATTR_NOSECURITY to fuse4x. These flags do not look useful for userspace filesystem but it is not clear for me if fuse4x should filter it out automatically. Currently fuse4x passes all flags straight to userspace.
I don't follow. Your file system is not supposed to call any specific
functions, it's supposed to set the provided extended attribute for the
provided inode. If the client application attempted to set the
attributes on a symbolic link without specifying XATTR_NOFOLLOW, the
kernel will resolve this and pass the inode of the symlink target to
your FUSE file system. A FUSE file system does not need to know anything
about the original request.
> I do not know if this was the correct choice though. But I had to do
> something since Fuse does not provide the l-suit of callbacks. At least
> not the last time I checked.
No, because that would be pointless. The implementation of the non-l
functions would be the same for every fuse file system: follow the link,
and then call the l variant of the function.
> I do not know if this was the correct choice though. But I had to do
> something since Fuse does not provide the l-suit of callbacks. At least
> not the last time I checked.No, because that would be pointless. The implementation of the non-l
functions would be the same for every fuse file system: follow the link,
and then call the l variant of the function.
In a way. The request will reach FUSE userspace, but possibly with a
different inode (the link target).
> How would a user otherwise know if the request is targeting the link
> itself or the file it links to?
I guess you mean the FUSE file system here, not the user, right? The
FUSE file system does not need to know it. If the *user* targeted the
link, the kernel will pass the inode of the link to the FUSE file
system. If the user targeted the target of the link, the kernel will
resolve the link and pass the inode of the destination to the FUSE fs.
In any case, the FUSE fs just has to work on the provided inode.
> But do OSX and Linux handle this the
> same way?
Linux handles it this way, and I think this also makes most sense. I
would hope that Fuse4x behaves the same way.
> How would a user otherwise know if the request is targeting the link
> itself or the file it links to?I guess you mean the FUSE file system here, not the user, right? The
FUSE file system does not need to know it. If the *user* targeted the
link, the kernel will pass the inode of the link to the FUSE file
system. If the user targeted the target of the link, the kernel will
resolve the link and pass the inode of the destination to the FUSE fs.
In any case, the FUSE fs just has to work on the provided inode.
Since the high level API runs on top of the low level API, every path
passed to the high-level functions has been generated from the low level
inode parameter, and is therefore the final path to work on. No link
following has to be done.
On 04/23/2012 02:29 PM, Hans Beckérus wrote:
>
>
> On Monday, April 23, 2012 2:17:53 PM UTC+2, Nikolaus Rath wrote:
>
>
> > How would a user otherwise know if the request is targeting the link
> > itself or the file it links to?
>
> I guess you mean the FUSE file system here, not the user, right? The
> FUSE file system does not need to know it. If the *user* targeted the
> link, the kernel will pass the inode of the link to the FUSE file
> system. If the user targeted the target of the link, the kernel will
> resolve the link and pass the inode of the destination to the FUSE fs.
> In any case, the FUSE fs just has to work on the provided inode.
>
> Ah, but herein lies the problem ;) I guess your are referring to the
> low-level API.
> But for the high-level API there is no inode involved. How would the
> FUSE fs using the high-level API know if the xattr call is targeting the
> link or not when there is no l-set of callback unless some flags was
> forwarded from kernel?Since the high level API runs on top of the low level API, every path
passed to the high-level functions has been generated from the low level
inode parameter, and is therefore the final path to work on. No link
following has to be done.