| @@ -1780,7 +1780,7 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path, u64 devid) · 1779 unmodified lines |
| 1780 | 1780 | if (ret) |
| 1781 | 1781 | goto out; |
| 1782 | 1782 | |
| 1783 | | − ret = btrfs_find_device_by_user_input(root, devid, device_path, |
| 1783 | + ret = btrfs_find_device_by_devspec(root, devid, device_path, |
| 1784 | 1784 | &device); |
| 1785 | 1785 | if (ret) |
| 1786 | 1786 | goto out; |
| @@ -2065,23 +2065,26 @@ int btrfs_find_device_missing_or_by_path(struct btrfs_root *root, · 278 unmodified lines |
| 2065 | 2065 | } |
| 2066 | 2066 | } |
| 2067 | 2067 | |
| 2068 | | −int btrfs_find_device_by_user_input(struct btrfs_root *root, u64 srcdevid, |
| 2069 | | − char *srcdev_name, |
| 2068 | +/* |
| 2069 | + * Lookup a device given by device id, or the path if the id is 0. |
| 2070 | + */ |
| 2071 | +int btrfs_find_device_by_devspec(struct btrfs_root *root, u64 devid, |
| 2072 | + char *devpath, |
| 2070 | 2073 | struct btrfs_device **device) |
| 2071 | 2074 | { |
| 2072 | 2075 | int ret; |
| 2073 | 2076 | |
| 2074 | | − if (srcdevid) { |
| 2077 | + if (devid) { |
| 2075 | 2078 | ret = 0; |
| 2076 | | − *device = btrfs_find_device(root->fs_info, srcdevid, NULL, |
| 2079 | + *device = btrfs_find_device(root->fs_info, devid, NULL, |
| 2077 | 2080 | NULL); |
| 2078 | 2081 | if (!*device) |
| 2079 | 2082 | ret = -ENOENT; |
| 2080 | 2083 | } else { |
| 2081 | | − if (!srcdev_name || !srcdev_name[0]) |
| 2084 | + if (!devpath || !devpath[0]) |
| 2082 | 2085 | return -EINVAL; |
| 2083 | 2086 | |
| 2084 | | − ret = btrfs_find_device_missing_or_by_path(root, srcdev_name, |
| 2087 | + ret = btrfs_find_device_missing_or_by_path(root, devpath, |
| 2085 | 2088 | device); |
| 2086 | 2089 | } |
| 2087 | 2090 | return ret; |