mirror of
https://github.com/kdave/btrfs-progs
synced 2025-03-05 10:17:35 +00:00
Add error processing for btrfsctl -a
brfsctl -a will do nothing and no error is output if btrfs.ko is not inserted. Since no caller do error processing for btrfs_register_one_device, make its return void and do error processing inside. Signed-off-by: Shen Feng <shen@cn.fujitsu.com>
This commit is contained in:
parent
52b14673e6
commit
2e1ca67177
15
utils.c
15
utils.c
@ -645,19 +645,26 @@ struct pending_dir {
|
||||
char name[256];
|
||||
};
|
||||
|
||||
int btrfs_register_one_device(char *fname)
|
||||
void btrfs_register_one_device(char *fname)
|
||||
{
|
||||
struct btrfs_ioctl_vol_args args;
|
||||
int fd;
|
||||
int ret;
|
||||
|
||||
fd = open("/dev/btrfs-control", O_RDONLY);
|
||||
if (fd < 0)
|
||||
return -EINVAL;
|
||||
if (fd < 0) {
|
||||
fprintf(stderr, "failed to open"
|
||||
"/dev/btrfs-control\n");
|
||||
exit(1);
|
||||
}
|
||||
strcpy(args.name, fname);
|
||||
ret = ioctl(fd, BTRFS_IOC_SCAN_DEV, &args);
|
||||
close(fd);
|
||||
return ret;
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "failed to register device %s\n",
|
||||
fname);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
int btrfs_scan_one_dir(char *dirname, int run_ioctl)
|
||||
|
2
utils.h
2
utils.h
@ -34,7 +34,7 @@ int btrfs_add_to_fsid(struct btrfs_trans_handle *trans,
|
||||
u32 sectorsize);
|
||||
int btrfs_scan_for_fsid(struct btrfs_fs_devices *fs_devices, u64 total_devs,
|
||||
int run_ioctls);
|
||||
int btrfs_register_one_device(char *fname);
|
||||
void btrfs_register_one_device(char *fname);
|
||||
int btrfs_scan_one_dir(char *dirname, int run_ioctl);
|
||||
int check_mounted(char *devicename);
|
||||
int btrfs_device_already_in_root(struct btrfs_root *root, int fd,
|
||||
|
Loading…
Reference in New Issue
Block a user