1 /* SPDX-License-Identifier: LGPL-2.1+ */
3 Copyright © 2012 Kay Sievers <kay@vrfy.org>
10 #if HAVE_LINUX_BTRFS_H
11 #include <linux/btrfs.h>
16 #include "string-util.h"
19 static int builtin_btrfs(struct udev_device
*dev
, int argc
, char *argv
[], bool test
) {
20 struct btrfs_ioctl_vol_args args
= {};
21 _cleanup_close_
int fd
= -1;
24 if (argc
!= 3 || !streq(argv
[1], "ready"))
27 fd
= open("/dev/btrfs-control", O_RDWR
|O_CLOEXEC
);
31 strscpy(args
.name
, sizeof(args
.name
), argv
[2]);
32 err
= ioctl(fd
, BTRFS_IOC_DEVICES_READY
, &args
);
36 udev_builtin_add_property(dev
, test
, "ID_BTRFS_READY", one_zero(err
== 0));
40 const struct udev_builtin udev_builtin_btrfs
= {
43 .help
= "btrfs volume management",