Whamcloud - gitweb
tune2fs: implement support for set/get label iocts
authorLukas Czerner <lczerner@redhat.com>
Wed, 24 Nov 2021 13:45:42 +0000 (14:45 +0100)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 31 Dec 2021 05:34:29 +0000 (00:34 -0500)
commitf85b4526f60b1edf143a9c2657a8f04fb9f7ccb7
treecc29e941cf5208851a57ff6c49423df203a4ed5a
parent8adeabeec715adcc2f32caff8d33b0e9ca9d7d8a
tune2fs: implement support for set/get label iocts

Implement support for FS_IOC_SETFSLABEL and FS_IOC_GETFSLABEL ioctls.
Try to use the ioctls if possible even before we open the file system
since we don't need it. Only fall back to the old method in the case the
file system is not mounted, is mounted read only in the set label case,
or the ioctls are not suppported by the kernel.

The new ioctls can also be supported by file system drivers other than
ext4. As a result tune2fs and e2label will work for those file systems
as well as long as the file system is mounted. Note that we still truncate
the label exceeds the supported lenghth on extN file system family, while
we keep the label intact for others.

Update tune2fs and e2label as well.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ext2fs/ext2fs.h
lib/ext2fs/ismounted.c
misc/e2label.8.in
misc/tune2fs.8.in
misc/tune2fs.c