diff options
-rw-r--r-- | utils.c | 27 | ||||
-rw-r--r-- | utils.h | 1 |
2 files changed, 28 insertions, 0 deletions
@@ -1266,6 +1266,33 @@ int btrfs_register_one_device(const char *fname) return ret; } +/* + * Register all devices in the fs_uuid list created in the user + * space. Ensure btrfs_scan_lblkid() is called before this func. + */ +int btrfs_register_all_devices(void) +{ + int err; + struct btrfs_fs_devices *fs_devices; + struct btrfs_device *device; + struct list_head *all_uuids; + + all_uuids = btrfs_scanned_uuids(); + + list_for_each_entry(fs_devices, all_uuids, list) { + list_for_each_entry(device, &fs_devices->devices, dev_list) { + if (strlen(device->name) != 0) { + err = btrfs_register_one_device(device->name); + if (err < 0) + return err; + if (err > 0) + return -err; + } + } + } + return 0; +} + int btrfs_device_already_in_root(struct btrfs_root *root, int fd, int super_offset) { @@ -82,6 +82,7 @@ int btrfs_add_to_fsid(struct btrfs_trans_handle *trans, u32 sectorsize); int btrfs_scan_for_fsid(int run_ioctls); int btrfs_register_one_device(const char *fname); +int btrfs_register_all_devices(void); char *canonicalize_dm_name(const char *ptname); char *canonicalize_path(const char *path); int check_mounted(const char *devicename); |