1 .\" Copyright (c) 2018, Red Hat, Inc. All rights reserved.
3 .\" %%%LICENSE_START(GPLv2+_DOC_FULL)
4 .\" This is free documentation; you can redistribute it and/or
5 .\" modify it under the terms of the GNU General Public License as
6 .\" published by the Free Software Foundation; either version 2 of
7 .\" the License, or (at your option) any later version.
9 .\" The GNU General Public License's references to "object code"
10 .\" and "executables" are to be interpreted as the output of any
11 .\" document formatting or typesetting system, including
12 .\" intermediate and printed output.
14 .\" This manual is distributed in the hope that it will be useful,
15 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
16 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 .\" GNU General Public License for more details.
19 .\" You should have received a copy of the GNU General Public
20 .\" License along with this manual; if not, see
21 .\" <http://www.gnu.org/licenses/>.
23 .TH IOCTL_FSLABEL 2 2020-04-20 "Linux" "Linux Programmer's Manual"
25 ioctl_fslabel \- get or set a filesystem label
28 .B #include <sys/ioctl.h>
30 .B #include <linux/fs.h>
32 .BI "int ioctl(int " fd ", FS_IOC_GETFSLABEL, char " label [FSLABEL_MAX]);
34 .BI "int ioctl(int " fd ", FS_IOC_SETFSLABEL, char " label [FSLABEL_MAX]);
36 If a filesystem supports online label manipulation, these
38 operations can be used to get or set the filesystem label for the filesystem
44 operation requires privilege
45 .RB ( CAP_SYS_ADMIN ).
47 On success zero is returned. On error, \-1 is returned, and
49 is set to indicate the error.
52 Error can include (but are not limited to) the following:
56 references an inaccessible memory area.
59 The specified label exceeds the maximum label length for the filesystem.
62 This can appear if the filesystem does not support online label manipulation.
65 The calling process does not have sufficient permissions to set the label.
69 operations first appeared in Linux 4.18.
70 They were previously known as
71 .B BTRFS_IOC_GET_FSLABEL
73 .B BTRFS_IOC_SET_FSLABEL
74 and were private to Btrfs.
76 This API is Linux-specific.
78 The maximum string length for this interface is
80 including the terminating null byte (\(aq\\0\(aq).
81 Filesystems have differing maximum label lengths, which may or
82 may not include the terminating null. The string provided to
84 must always be null-terminated, and the string returned by
86 will always be null-terminated.