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
hi,
> YAMAMOTO Takashi <yamt%mwd.biglobe.ne.jp@localhost> 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.:
> system.foo), 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 ("system.foo"), 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 ("system.foo") becomes FreeBSD (system, "foo")
> Linux ("trusted.foo") becomes FreeBSD (system, "foo")
> Linux ("security.foo") 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 "user.foo" and "bar.foo": 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 ("netbsd_system.foo")
>
> That was, when listing attributes, you know you must strip netbsd_system
> and netbsd_user namespaces and keep everything else.
> Linux ("netbsd_system.foo") becomes FreeBSD (system, "foo")
> Linux ("user_system.foo") becomes FreeBSD (user, "foo")
> Linux ("system.foo") becomes FreeBSD (system, "system.foo")
> Linux ("trusted.foo") becomes FreeBSD (system, "trusted.foo")
> Linux ("security.foo") becomes FreeBSD (system, "security.foo")
> 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.: "netbsd_system.foo" becomes "system.foo"
>
> The answer to your question is therefore yes, but it may introduce
> confusion.
thanks.
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.
YAMAMOTO Takashi
>
> --
> Emmanuel Dreyfus
> http://hcpnet.free.fr/pubz
> manu%netbsd.org@localhost
Home |
Main Index |
Thread Index |
Old Index