tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: extended attributes and lsextattr/extattr_list_file


> YAMAMOTO Takashi <> wrote:
>> > The Linux-flavor API has option for test-and-set operation on attribute.
>> > It cannot be done in libc, that really require to be done in the kernel.
>> do you think the opposite, implementing freebsd-flavor in userland
>> using linux-flavor, is possible?
> Yes it would be possible. The only problem woule be to map namespaces.
> Linux API uses a dot-separated prefix in the attribute name (e.g.:
>, while the FreeBSD API uses an int that can stand for system
> or user.
> In order to keep the namespace information, you therefore would have to
> rewrite attribute name on set/get/delete operations:
> FreeBSD (system, "foo") should become Linux (""), and same
> thing for user namespace.
> But the problem then is listing, when applications using the Linux API
> may have stored other namespaces: if you are requested system
> attributes, you need to look for system.* attribute and strip the
> leading "system.", but what happens if you encounter an odd namespace
> savec through the Linux API? Something like that:
> Linux ("") becomes FreeBSD (system, "foo")
> Linux ("") becomes FreeBSD (system, "foo")
> Linux ("") becomes FreeBSD (system, "foo")
> Linux ("*.foo") becomes FreeBSD (user, "foo")
> But here you see a problem when listing user attributes with the FreeBSD
> API when you have "" and "": we will see two attributes
> with the same name.
> A workaround or this would be to use add a special prefix on
> set/get/delete operations: 
> FreeBSD (system, "foo") would become Linux ("")
> That was, when listing attributes, you know you must strip netbsd_system
> and netbsd_user namespaces and keep everything else. 
> Linux ("") becomes FreeBSD (system, "foo")
> Linux ("") becomes FreeBSD (user, "foo")
> Linux ("") becomes FreeBSD (system, "")
> Linux ("") becomes FreeBSD (system, "")
> Linux ("") becomes FreeBSD (system, "")
> Linux ("*.foo") becomes FreeBSD (user, "*.foo")
> But then when listing using the Linux API, it would see our weird
> netbsd_user and netbsd_system namespaces. A possible fix is to have a
> libc stub, unused by the FreeBSD API, that rewrite them to system and
> user, e.g.: "" becomes ""
> The answer to your question is therefore yes, but it may introduce
> confusion.


the namespace mapping issue exists regardless where (kernel/userland)
they are implemented, doesn't it?
anyway most applications only care about the user namespace, i guess.

i tend to think it's better to just kill the freebsd flavor of syscalls.


> -- 
> Emmanuel Dreyfus

Home | Main Index | Thread Index | Old Index