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