1IOCTL_FSLABEL(2) Linux Programmer's Manual IOCTL_FSLABEL(2)
2
3
4
6 ioctl_fslabel - get or set a filesystem label
7
9 #include <sys/ioctl.h>
10 #include <linux/fs.h>
11
12 int ioctl(int fd, FS_IOC_GETFSLABEL, char label[FSLABEL_MAX]);
13 int ioctl(int fd, FS_IOC_SETFSLABEL, char label[FSLABEL_MAX]);
14
16 If a filesystem supports online label manipulation, these ioctl(2)
17 operations can be used to get or set the filesystem label for the
18 filesystem on which fd resides. The FS_IOC_SETFSLABEL operation
19 requires privilege (CAP_SYS_ADMIN).
20
22 On success zero is returned. On error, -1 is returned, and errno is
23 set to indicate the error.
24
26 Error can include (but are not limited to) the following:
27
28 EFAULT label references an inaccessible memory area.
29
30 EINVAL The specified label exceeds the maximum label length for the
31 filesystem.
32
33 ENOTTY This can appear if the filesystem does not support online label
34 manipulation.
35
36 EPERM The calling process does not have sufficient permissions to set
37 the label.
38
40 These ioctl(2) operations first appeared in Linux 4.18. They were pre‐
41 viously known as BTRFS_IOC_GET_FSLABEL and BTRFS_IOC_SET_FSLABEL and
42 were private to Btrfs.
43
45 This API is Linux-specific.
46
48 The maximum string length for this interface is FSLABEL_MAX, including
49 the terminating null byte ('\0'). Filesystems have differing maximum
50 label lengths, which may or may not include the terminating null. The
51 string provided to FS_IOC_SETFSLABEL must always be null-terminated,
52 and the string returned by FS_IOC_GETFSLABEL will always be null-termi‐
53 nated.
54
56 ioctl(2), blkid(8)
57
59 This page is part of release 5.07 of the Linux man-pages project. A
60 description of the project, information about reporting bugs, and the
61 latest version of this page, can be found at
62 https://www.kernel.org/doc/man-pages/.
63
64
65
66Linux 2020-04-20 IOCTL_FSLABEL(2)