0

I can't find any explanation about this file in the official documentation, I just know from the official documentation in devices.txt that this file is: "234 = /dev/btrfs-control Btrfs control device".

1 Answer 1

1

It's defined in fs/btrfs/super.c in kernel source code, and used for various BtrFS-specific ioctl() system calls.

Generally, unless you are developing the libbtrfs library of the btrfs-progs package, you don't need to care about it.

But if you are curious, seeDocumentation/btrfs-ioctl.rst in btrfs-progs package, read the detailed description of each BtrFS ioctl, and see which ones have the ioctl fd specified as "file descriptor of the control device".

Alternatively, you can look at the btrfs_control_ioctl function in the kernel source code, which implements the ioctls accessible through the control device. At the time of this writing, there are four of them:

  • BTRFS_IOC_SCAN_DEV
  • BTRFS_IOC_FORGET_DEV
  • BTRFS_IOC_DEVICES_READY
  • BTRFS_IOC_GET_SUPPORTED_FEATURES
3
  • Thank you for your answer, I originally tried to find the answer in the source code as well, but unfortunately I was not sure about the structure of the source code and could not find anything about it, so I was curious how did you find it in the source code? Commented Feb 3, 2024 at 12:30
  • grep -r btrfs-control linux-6.6.15/fs/btrfs/* (note: searching without the /dev/prefix), plus a bit of prior knowledge about how registering a device in Linux kernel generally works. Basically, I expected to find a struct miscdevice tying the name of the device and the fops structure (type name struct file_operations) for it together, then that structure would contain a pointer to the function that identifies the relevant ioctls (btrfs_control_ioctl) and calls further functions to implement them. Commented Feb 3, 2024 at 12:56
  • Thank you for your answer. Commented Feb 3, 2024 at 13:01

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.