]>
Commit | Line | Data |
---|---|---|
bcdf6f9c ES |
1 | .\" Copyright (c) 2018, Red Hat, Inc. All rights reserved. |
2 | .\" | |
e4a74ca8 | 3 | .\" SPDX-License-Identifier: GPL-2.0-or-later |
45186a5d | 4 | .TH IOCTL_FSLABEL 2 2021-03-22 "Linux man-pages (unreleased)" |
bcdf6f9c ES |
5 | .SH NAME |
6 | ioctl_fslabel \- get or set a filesystem label | |
c0baf2ba AC |
7 | .SH LIBRARY |
8 | Standard C library | |
8fc3b2cf | 9 | .RI ( libc ", " \-lc ) |
bcdf6f9c | 10 | .SH SYNOPSIS |
c7db92b9 | 11 | .nf |
9c9e0561 | 12 | .BR "#include <linux/fs.h>" " /* Definition of " *FSLABEL* " constants */" |
bcdf6f9c | 13 | .B #include <sys/ioctl.h> |
e9a0682b | 14 | .PP |
bcdf6f9c | 15 | .BI "int ioctl(int " fd ", FS_IOC_GETFSLABEL, char " label [FSLABEL_MAX]); |
bcdf6f9c | 16 | .BI "int ioctl(int " fd ", FS_IOC_SETFSLABEL, char " label [FSLABEL_MAX]); |
c7db92b9 | 17 | .fi |
bcdf6f9c ES |
18 | .SH DESCRIPTION |
19 | If a filesystem supports online label manipulation, these | |
20 | .BR ioctl (2) | |
21 | operations can be used to get or set the filesystem label for the filesystem | |
22 | on which | |
f72f6f26 | 23 | .I fd |
bcdf6f9c ES |
24 | resides. |
25 | The | |
26 | .B FS_IOC_SETFSLABEL | |
27 | operation requires privilege | |
28 | .RB ( CAP_SYS_ADMIN ). | |
29 | .SH RETURN VALUE | |
5e833e27 MK |
30 | On success zero is returned. |
31 | On error, \-1 is returned, and | |
bcdf6f9c ES |
32 | .I errno |
33 | is set to indicate the error. | |
bcdf6f9c | 34 | .SH ERRORS |
e8d28f7c | 35 | Possible errors include (but are not limited to) the following: |
c11e258b MK |
36 | .TP |
37 | .B EFAULT | |
38 | .I label | |
39 | references an inaccessible memory area. | |
bcdf6f9c ES |
40 | .TP |
41 | .B EINVAL | |
42 | The specified label exceeds the maximum label length for the filesystem. | |
43 | .TP | |
44 | .B ENOTTY | |
45 | This can appear if the filesystem does not support online label manipulation. | |
46 | .TP | |
47 | .B EPERM | |
48 | The calling process does not have sufficient permissions to set the label. | |
bcdf6f9c | 49 | .SH VERSIONS |
c11e258b MK |
50 | These |
51 | .BR ioctl (2) | |
52 | operations first appeared in Linux 4.18. | |
bcdf6f9c ES |
53 | They were previously known as |
54 | .B BTRFS_IOC_GET_FSLABEL | |
55 | and | |
56 | .B BTRFS_IOC_SET_FSLABEL | |
57 | and were private to Btrfs. | |
3113c7f3 | 58 | .SH STANDARDS |
bcdf6f9c ES |
59 | This API is Linux-specific. |
60 | .SH NOTES | |
61 | The maximum string length for this interface is | |
62 | .BR FSLABEL_MAX , | |
63 | including the terminating null byte (\(aq\\0\(aq). | |
64 | Filesystems have differing maximum label lengths, which may or | |
5e833e27 MK |
65 | may not include the terminating null. |
66 | The string provided to | |
bcdf6f9c ES |
67 | .B FS_IOC_SETFSLABEL |
68 | must always be null-terminated, and the string returned by | |
69 | .B FS_IOC_GETFSLABEL | |
70 | will always be null-terminated. | |
71 | .SH SEE ALSO | |
72 | .BR ioctl (2), | |
73 | .BR blkid (8) |