diff options
author | Anand Jain <anand.jain@oracle.com> | 2013-07-15 13:30:50 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.cz> | 2013-08-09 14:32:36 +0200 |
commit | 5333445574adf8415ce3b7e8b13cf8feeb39b836 (patch) | |
tree | 824ba45bb8bb56b341e8c40be7b9eb7f71cf497a /cmds-device.c | |
parent | 8f7c5897e96607ef0b47ecbc2f0d3cb4df2b8c07 (diff) |
btrfs-progs: congregate dev scan
the dev scan to find btrfs is performed at two locations
all most the same way one at filesystem show and another
at device scan. They both follow the same steps. This
patch does not alter anything except that it brings these
two same logic into the function scan_for_btrfs so that
we can play tweaking it.
the patch which recommends to use /dev/mapper
will also need it
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'cmds-device.c')
-rw-r--r-- | cmds-device.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/cmds-device.c b/cmds-device.c index 4bbf4017..c1dc363a 100644 --- a/cmds-device.c +++ b/cmds-device.c @@ -188,26 +188,21 @@ static const char * const cmd_scan_dev_usage[] = { static int cmd_scan_dev(int argc, char **argv) { int i, fd, e; - int checklist = 1; + int where = BTRFS_SCAN_PROC; int devstart = 1; if( argc > 1 && !strcmp(argv[1],"--all-devices")){ if (check_argc_max(argc, 2)) usage(cmd_scan_dev_usage); - checklist = 0; + where = BTRFS_SCAN_DEV; devstart += 1; } if(argc<=devstart){ - int ret; - printf("Scanning for Btrfs filesystems\n"); - if(checklist) - ret = btrfs_scan_block_devices(1); - else - ret = btrfs_scan_one_dir("/dev", 1); + ret = scan_for_btrfs(where, 1); if (ret){ fprintf(stderr, "ERROR: error %d while scanning\n", ret); return 18; |