1ioctl_fslabel(2) System Calls Manual ioctl_fslabel(2)
2
3
4
6 ioctl_fslabel - get or set a filesystem label
7
9 Standard C library (libc, -lc)
10
12 #include <linux/fs.h> /* Definition of *FSLABEL* constants */
13 #include <sys/ioctl.h>
14
15 int ioctl(int fd, FS_IOC_GETFSLABEL, char label[FSLABEL_MAX]);
16 int ioctl(int fd, FS_IOC_SETFSLABEL, char label[FSLABEL_MAX]);
17
19 If a filesystem supports online label manipulation, these ioctl(2) op‐
20 erations can be used to get or set the filesystem label for the
21 filesystem on which fd resides. The FS_IOC_SETFSLABEL operation re‐
22 quires privilege (CAP_SYS_ADMIN).
23
25 On success zero is returned. On error, -1 is returned, and errno is
26 set to indicate the error.
27
29 Possible errors include (but are not limited to) the following:
30
31 EFAULT label references an inaccessible memory area.
32
33 EINVAL The specified label exceeds the maximum label length for the
34 filesystem.
35
36 ENOTTY This can appear if the filesystem does not support online label
37 manipulation.
38
39 EPERM The calling process does not have sufficient permissions to set
40 the label.
41
43 Linux.
44
46 Linux 4.18.
47
48 They were previously known as BTRFS_IOC_GET_FSLABEL and
49 BTRFS_IOC_SET_FSLABEL and were private to Btrfs.
50
52 The maximum string length for this interface is FSLABEL_MAX, including
53 the terminating null byte ('\0'). Filesystems have differing maximum
54 label lengths, which may or may not include the terminating null. The
55 string provided to FS_IOC_SETFSLABEL must always be null-terminated,
56 and the string returned by FS_IOC_GETFSLABEL will always be null-termi‐
57 nated.
58
60 ioctl(2), blkid(8)
61
62
63
64Linux man-pages 6.04 2023-03-30 ioctl_fslabel(2)