2 * btrfs - volume management
4 * Copyright (C) 2012 Kay Sievers <kay@vrfy.org>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
18 #include <sys/ioctl.h>
22 #define BTRFS_PATH_NAME_MAX 4087
23 struct btrfs_ioctl_vol_args {
25 char name[BTRFS_PATH_NAME_MAX + 1];
27 #define BTRFS_IOCTL_MAGIC 0x94
28 #define BTRFS_IOC_DEVICES_READY _IOR(BTRFS_IOCTL_MAGIC, 39, struct btrfs_ioctl_vol_args)
30 static int builtin_btrfs(struct udev_device *dev, int argc, char *argv[], bool test)
32 struct btrfs_ioctl_vol_args args;
36 if (argc != 3 || !streq(argv[1], "ready"))
39 fd = open("/dev/btrfs-control", O_RDWR);
43 util_strscpy(args.name, sizeof(args.name), argv[2]);
44 err = ioctl(fd, BTRFS_IOC_DEVICES_READY, &args);
49 udev_builtin_add_property(dev, test, "ID_BTRFS_READY", err == 0 ? "1" : "0");
53 const struct udev_builtin udev_builtin_btrfs = {
56 .help = "btrfs volume management",