aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2023-12-06 15:00:49 +0100
committerDavid Sterba <dsterba@suse.com>2023-12-06 17:44:28 +0100
commit478a295b006df4078809c14b20ffd9b01432c96e (patch)
tree054960ad5fefadfb56b076e69fae0ed5a47ae0d7 /Documentation
parentf9ebee683871324c9a51c79009c9061ea252c858 (diff)
downloadbtrfs-progs-478a295b006df4078809c14b20ffd9b01432c96e.tar.gz
btrfs-progs: docs: document label ioctls
[ci skip] Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/btrfs-ioctl.rst57
1 files changed, 51 insertions, 6 deletions
diff --git a/Documentation/btrfs-ioctl.rst b/Documentation/btrfs-ioctl.rst
index 49da01ac..0dac021d 100644
--- a/Documentation/btrfs-ioctl.rst
+++ b/Documentation/btrfs-ioctl.rst
@@ -177,6 +177,8 @@ DATA STRUCTURES AND DEFINITIONS
__u8 reserved[944]; /* pad to 1k */
};
+.. _constants-table:
+
.. list-table::
:header-rows: 1
@@ -192,6 +194,8 @@ DATA STRUCTURES AND DEFINITIONS
- 4087
* - BTRFS_VOL_NAME_MAX
- 255
+ * - BTRFS_LABEL_SIZE
+ - 256
OVERVIEW
--------
@@ -372,12 +376,12 @@ LIST OF IOCTLS
* - BTRFS_IOC_QUOTA_RESCAN_WAIT
-
-
- * - BTRFS_IOC_GET_FSLABEL
- -
- -
- * - BTRFS_IOC_SET_FSLABEL
- -
- -
+ * - :ref:`BTRFS_IOC_GET_FSLABEL<BTRFS_IOC_GET_FSLABEL>`
+ - read filesystem label
+ - char buffer[BTRFS_LABEL_SIZE]
+ * - :ref:`BTRFS_IOC_SET_FSLABEL<BTRFS_IOC_SET_FSLABEL>`
+ - set the filesystem label
+ - char buffer[BTRFS_LABEL_SIZE]
* - BTRFS_IOC_GET_DEV_STATS
-
-
@@ -710,6 +714,47 @@ Change the flags of a subvolume.
* - ioctl args
- uint64_t, either 0 or `BTRFS_SUBVOL_RDONLY`
+.. _BTRFS_IOC_GET_FSLABEL:
+
+BTRFS_IOC_GET_FSLABEL
+~~~~~~~~~~~~~~~~~~~~~
+
+Read the label of the filesystem into a given buffer. Alternatively it
+can be read from :file:`/sys/fs/btrfs/FSID/label` though it requires to
+know the FSID of the filesystem.
+
+.. list-table::
+ :header-rows: 1
+
+ * - Field
+ - Description
+ * - ioctl fd
+ - file descriptor of any file/directory in the filesystem
+ * - ioctl args
+ - char buffer[:ref:`BTRFS_LABEL_SIZE<constants-table>`]
+
+.. _BTRFS_IOC_SET_FSLABEL:
+
+BTRFS_IOC_SET_FSLABEL
+~~~~~~~~~~~~~~~~~~~~~
+
+Set the label of filesystem from given buffer. The maximum length also accounts
+for terminating NUL character. Alternatively it can be also set by writing to
+:file:`/sys/fs/btrfs/FSID/label` though it requires to know the FSID of the
+filesystem (and an explicit commit before the change is permanent).
+
+Required permissions: CAP_SYS_ADMIN
+
+.. list-table::
+ :header-rows: 1
+
+ * - Field
+ - Description
+ * - ioctl fd
+ - file descriptor of any file/directory in the filesystem
+ * - ioctl args
+ - char buffer[:ref:`BTRFS_LABEL_SIZE<constants-table>`]
+
.. _BTRFS_IOC_FS_INFO:
BTRFS_IOC_FS_INFO