mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-24 15:12:47 +00:00
btrfs-progs: dump-super: switch to getopt_long
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
3299da86fe
commit
a54ef26e51
@ -23,6 +23,7 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <uuid/uuid.h>
|
#include <uuid/uuid.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <getopt.h>
|
||||||
|
|
||||||
#include "ctree.h"
|
#include "ctree.h"
|
||||||
#include "disk-io.h"
|
#include "disk-io.h"
|
||||||
@ -453,7 +454,6 @@ const char * const cmd_inspect_dump_super_usage[] = {
|
|||||||
|
|
||||||
int cmd_inspect_dump_super(int argc, char **argv)
|
int cmd_inspect_dump_super(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int opt;
|
|
||||||
int all = 0;
|
int all = 0;
|
||||||
int full = 0;
|
int full = 0;
|
||||||
int force = 0;
|
int force = 0;
|
||||||
@ -464,8 +464,17 @@ int cmd_inspect_dump_super(int argc, char **argv)
|
|||||||
u64 arg;
|
u64 arg;
|
||||||
u64 sb_bytenr = btrfs_sb_offset(0);
|
u64 sb_bytenr = btrfs_sb_offset(0);
|
||||||
|
|
||||||
while ((opt = getopt(argc, argv, "fFai:s:")) != -1) {
|
while (1) {
|
||||||
switch (opt) {
|
int c;
|
||||||
|
static const struct option long_options[] = {
|
||||||
|
{NULL, 0, NULL, 0}
|
||||||
|
};
|
||||||
|
|
||||||
|
c = getopt_long(argc, argv, "fFai:s:", long_options, NULL);
|
||||||
|
if (c < 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
switch (c) {
|
||||||
case 'i':
|
case 'i':
|
||||||
arg = arg_strtou64(optarg);
|
arg = arg_strtou64(optarg);
|
||||||
if (arg >= BTRFS_SUPER_MIRROR_MAX) {
|
if (arg >= BTRFS_SUPER_MIRROR_MAX) {
|
||||||
|
Loading…
Reference in New Issue
Block a user