Re: FS_IOC_GETFSLABEL and FS_IOC_SETFSLABEL

From: Eric Sandeen
Date: Tue Dec 31 2019 - 17:54:33 EST


On 12/28/19 6:36 AM, Pali RohÃr wrote:
> Hello!
>
> I see that you have introduced in commit 62750d0 two new IOCTLs for
> filesyetems: FS_IOC_GETFSLABEL and FS_IOC_SETFSLABEL.
>
> I would like to ask, are these two new ioctls mean to be generic way for
> userspace to get or set fs label independently of which filesystem is
> used? Or are they only for btrfs?

The reason it was lifted out of btrfs to the vfs is so that other filesystems
can use the same interface. However, it is up to each filesystem to implement
it (and to interpret what's been written to or read from disk.)

> Because I was not able to find any documentation for it, what is format
> of passed buffer... null-term string? fixed-length? and in which
> encoding? utf-8? latin1? utf-16? or filesystem dependent?

It simply copies the bits from the memory location you pass in, it knows
nothing of encodings.

For the most part it's up to the filesystem's own utilities to do any
interpretation of the resulting bits on disk, null-terminating maximal-length
label strings, etc.

-Eric