diff options
author | Chris Mason <chris.mason@oracle.com> | 2008-03-24 15:05:44 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@hera.kernel.org> | 2008-03-24 15:05:44 -0400 |
commit | 0dcfa3b8270f38edacee1c62f308129c36073d0c (patch) | |
tree | 74e084b5cceed48161b5ca1508a88afd6f8ca8b1 /btrfsctl.c | |
parent | 26afd0f31d59853f51120622b0121cdfc72cd398 (diff) |
Walk all block devices looking for btrfs
Diffstat (limited to 'btrfsctl.c')
-rw-r--r-- | btrfsctl.c | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -29,6 +29,9 @@ #include <unistd.h> #include <dirent.h> #include "kerncompat.h" +#include "ctree.h" +#include "transaction.h" +#include "utils.h" #ifdef __CHECKER__ #define BLKGETSIZE64 0 @@ -47,7 +50,8 @@ void print_usage(void) printf("\t-s snap_name existing_subvol creates a new snapshot\n"); printf("\t-s snap_name tree_root creates a new subvolume\n"); printf("\t-r [+-]size[gkm] resize the FS\n"); - printf("\t-a device scans the device for a Btrfs filesystem\n"); + printf("\t-A device scans the device for a Btrfs filesystem\n"); + printf("\t-a scans all devices for a Btrfs filesystems\n"); exit(1); } @@ -64,6 +68,11 @@ int main(int ac, char **av) unsigned long command = 0; int len; + if (ac == 2 && strcmp(av[1], "-a") == 0) { + fprintf(stderr, "Scanning for Btrfs filesystems\n"); + btrfs_scan_one_dir("/dev", 1); + exit(0); + } for (i = 1; i < ac - 1; i++) { if (strcmp(av[i], "-s") == 0) { if (i + 1 >= ac - 1) { @@ -89,9 +98,9 @@ int main(int ac, char **av) print_usage(); } command = BTRFS_IOC_DEFRAG; - } else if (strcmp(av[i], "-a") == 0) { + } else if (strcmp(av[i], "-A") == 0) { if (i >= ac - 1) { - fprintf(stderr, "-a requires an arg\n"); + fprintf(stderr, "-A requires an arg\n"); print_usage(); } command = BTRFS_IOC_SCAN_DEV; |