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 2021-03-22 "Linux" "Linux Programmer's Manual"
25 ioctl_fslabel \- get or set a filesystem label
28 .BR "#include <linux/fs.h>" " /* Definition of " *FSLABEL* " constants */"
29 .B #include <sys/ioctl.h>
31 .BI "int ioctl(int " fd ", FS_IOC_GETFSLABEL, char " label [FSLABEL_MAX]);
32 .BI "int ioctl(int " fd ", FS_IOC_SETFSLABEL, char " label [FSLABEL_MAX]);
35 If a filesystem supports online label manipulation, these
37 operations can be used to get or set the filesystem label for the filesystem
43 operation requires privilege
44 .RB ( CAP_SYS_ADMIN ).
46 On success zero is returned.
47 On error, \-1 is returned, and
49 is set to indicate the error.
51 Possible errors include (but are not limited to) the following:
55 references an inaccessible memory area.
58 The specified label exceeds the maximum label length for the filesystem.
61 This can appear if the filesystem does not support online label manipulation.
64 The calling process does not have sufficient permissions to set the label.
68 operations first appeared in Linux 4.18.
69 They were previously known as
70 .B BTRFS_IOC_GET_FSLABEL
72 .B BTRFS_IOC_SET_FSLABEL
73 and were private to Btrfs.
75 This API is Linux-specific.
77 The maximum string length for this interface is
79 including the terminating null byte (\(aq\\0\(aq).
80 Filesystems have differing maximum label lengths, which may or
81 may not include the terminating null.
82 The string provided to
84 must always be null-terminated, and the string returned by
86 will always be null-terminated.