mirror of
https://github.com/kdave/btrfs-progs
synced 2025-04-28 22:17:56 +00:00
btrfs-progs: do not set optind if not necessary
In the subcommand callbacks that are called just once, we don't need to explicitly reset optind. Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
83dc05b013
commit
f551548372
@ -399,7 +399,6 @@ int main(int argc, char *argv[])
|
|||||||
int ret;
|
int ret;
|
||||||
u64 super_flags = 0;
|
u64 super_flags = 0;
|
||||||
|
|
||||||
optind = 1;
|
|
||||||
while(1) {
|
while(1) {
|
||||||
static const struct option long_options[] = {
|
static const struct option long_options[] = {
|
||||||
{ "help", no_argument, NULL, GETOPT_VAL_HELP},
|
{ "help", no_argument, NULL, GETOPT_VAL_HELP},
|
||||||
|
@ -522,7 +522,6 @@ static int cmd_balance_start(int argc, char **argv)
|
|||||||
|
|
||||||
memset(&args, 0, sizeof(args));
|
memset(&args, 0, sizeof(args));
|
||||||
|
|
||||||
optind = 1;
|
|
||||||
while (1) {
|
while (1) {
|
||||||
enum { GETOPT_VAL_FULL_BALANCE = 256 };
|
enum { GETOPT_VAL_FULL_BALANCE = 256 };
|
||||||
static const struct option longopts[] = {
|
static const struct option longopts[] = {
|
||||||
@ -785,7 +784,6 @@ static int cmd_balance_status(int argc, char **argv)
|
|||||||
int verbose = 0;
|
int verbose = 0;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
optind = 1;
|
|
||||||
while (1) {
|
while (1) {
|
||||||
int opt;
|
int opt;
|
||||||
static const struct option longopts[] = {
|
static const struct option longopts[] = {
|
||||||
|
@ -257,7 +257,6 @@ static int cmd_device_scan(int argc, char **argv)
|
|||||||
int all = 0;
|
int all = 0;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
optind = 1;
|
|
||||||
while (1) {
|
while (1) {
|
||||||
int c;
|
int c;
|
||||||
static const struct option long_options[] = {
|
static const struct option long_options[] = {
|
||||||
@ -392,7 +391,6 @@ static int cmd_device_stats(int argc, char **argv)
|
|||||||
__u64 flags = 0;
|
__u64 flags = 0;
|
||||||
DIR *dirstream = NULL;
|
DIR *dirstream = NULL;
|
||||||
|
|
||||||
optind = 1;
|
|
||||||
while ((c = getopt(argc, argv, "z")) != -1) {
|
while ((c = getopt(argc, argv, "z")) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'z':
|
case 'z':
|
||||||
|
@ -543,7 +543,6 @@ int cmd_filesystem_du(int argc, char **argv)
|
|||||||
|
|
||||||
unit_mode = get_unit_mode_from_arg(&argc, argv, 1);
|
unit_mode = get_unit_mode_from_arg(&argc, argv, 1);
|
||||||
|
|
||||||
optind = 1;
|
|
||||||
while (1) {
|
while (1) {
|
||||||
static const struct option long_options[] = {
|
static const struct option long_options[] = {
|
||||||
{ "summarize", no_argument, NULL, 's'},
|
{ "summarize", no_argument, NULL, 's'},
|
||||||
|
@ -922,7 +922,6 @@ int cmd_filesystem_usage(int argc, char **argv)
|
|||||||
|
|
||||||
unit_mode = get_unit_mode_from_arg(&argc, argv, 1);
|
unit_mode = get_unit_mode_from_arg(&argc, argv, 1);
|
||||||
|
|
||||||
optind = 1;
|
|
||||||
while (1) {
|
while (1) {
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
|
@ -1041,7 +1041,6 @@ static int cmd_filesystem_defrag(int argc, char **argv)
|
|||||||
defrag_global_verbose = 0;
|
defrag_global_verbose = 0;
|
||||||
defrag_global_errors = 0;
|
defrag_global_errors = 0;
|
||||||
defrag_global_fancy_ioctl = 0;
|
defrag_global_fancy_ioctl = 0;
|
||||||
optind = 1;
|
|
||||||
while(1) {
|
while(1) {
|
||||||
int c = getopt(argc, argv, "vrc::fs:l:t:");
|
int c = getopt(argc, argv, "vrc::fs:l:t:");
|
||||||
if (c < 0)
|
if (c < 0)
|
||||||
|
@ -96,7 +96,6 @@ static int cmd_inspect_inode_resolve(int argc, char **argv)
|
|||||||
int ret;
|
int ret;
|
||||||
DIR *dirstream = NULL;
|
DIR *dirstream = NULL;
|
||||||
|
|
||||||
optind = 1;
|
|
||||||
while (1) {
|
while (1) {
|
||||||
int c = getopt(argc, argv, "v");
|
int c = getopt(argc, argv, "v");
|
||||||
if (c < 0)
|
if (c < 0)
|
||||||
@ -151,7 +150,6 @@ static int cmd_inspect_logical_resolve(int argc, char **argv)
|
|||||||
char *path_ptr;
|
char *path_ptr;
|
||||||
DIR *dirstream = NULL;
|
DIR *dirstream = NULL;
|
||||||
|
|
||||||
optind = 1;
|
|
||||||
while (1) {
|
while (1) {
|
||||||
int c = getopt(argc, argv, "Pvs:");
|
int c = getopt(argc, argv, "Pvs:");
|
||||||
if (c < 0)
|
if (c < 0)
|
||||||
|
@ -309,7 +309,6 @@ static int cmd_qgroup_show(int argc, char **argv)
|
|||||||
|
|
||||||
unit_mode = get_unit_mode_from_arg(&argc, argv, 0);
|
unit_mode = get_unit_mode_from_arg(&argc, argv, 0);
|
||||||
|
|
||||||
optind = 1;
|
|
||||||
while (1) {
|
while (1) {
|
||||||
int c;
|
int c;
|
||||||
static const struct option long_options[] = {
|
static const struct option long_options[] = {
|
||||||
@ -408,7 +407,6 @@ static int cmd_qgroup_limit(int argc, char **argv)
|
|||||||
int exclusive = 0;
|
int exclusive = 0;
|
||||||
DIR *dirstream = NULL;
|
DIR *dirstream = NULL;
|
||||||
|
|
||||||
optind = 1;
|
|
||||||
while (1) {
|
while (1) {
|
||||||
int c = getopt(argc, argv, "ce");
|
int c = getopt(argc, argv, "ce");
|
||||||
if (c < 0)
|
if (c < 0)
|
||||||
|
@ -120,7 +120,6 @@ static int cmd_quota_rescan(int argc, char **argv)
|
|||||||
DIR *dirstream = NULL;
|
DIR *dirstream = NULL;
|
||||||
int wait_for_completion = 0;
|
int wait_for_completion = 0;
|
||||||
|
|
||||||
optind = 1;
|
|
||||||
while (1) {
|
while (1) {
|
||||||
int c = getopt(argc, argv, "sw");
|
int c = getopt(argc, argv, "sw");
|
||||||
if (c < 0)
|
if (c < 0)
|
||||||
|
@ -1141,7 +1141,6 @@ static int scrub_start(int argc, char **argv, int resume)
|
|||||||
int force = 0;
|
int force = 0;
|
||||||
int nothing_to_resume = 0;
|
int nothing_to_resume = 0;
|
||||||
|
|
||||||
optind = 1;
|
|
||||||
while ((c = getopt(argc, argv, "BdqrRc:n:f")) != -1) {
|
while ((c = getopt(argc, argv, "BdqrRc:n:f")) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'B':
|
case 'B':
|
||||||
@ -1675,7 +1674,6 @@ static int cmd_scrub_status(int argc, char **argv)
|
|||||||
int err = 0;
|
int err = 0;
|
||||||
DIR *dirstream = NULL;
|
DIR *dirstream = NULL;
|
||||||
|
|
||||||
optind = 1;
|
|
||||||
while ((c = getopt(argc, argv, "dR")) != -1) {
|
while ((c = getopt(argc, argv, "dR")) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'd':
|
case 'd':
|
||||||
|
@ -127,7 +127,6 @@ static int cmd_subvol_create(int argc, char **argv)
|
|||||||
struct btrfs_qgroup_inherit *inherit = NULL;
|
struct btrfs_qgroup_inherit *inherit = NULL;
|
||||||
DIR *dirstream = NULL;
|
DIR *dirstream = NULL;
|
||||||
|
|
||||||
optind = 1;
|
|
||||||
while (1) {
|
while (1) {
|
||||||
int c = getopt(argc, argv, "c:i:v");
|
int c = getopt(argc, argv, "c:i:v");
|
||||||
if (c < 0)
|
if (c < 0)
|
||||||
@ -263,7 +262,6 @@ static int cmd_subvol_delete(int argc, char **argv)
|
|||||||
int verbose = 0;
|
int verbose = 0;
|
||||||
int commit_mode = 0;
|
int commit_mode = 0;
|
||||||
|
|
||||||
optind = 1;
|
|
||||||
while (1) {
|
while (1) {
|
||||||
int c;
|
int c;
|
||||||
static const struct option long_options[] = {
|
static const struct option long_options[] = {
|
||||||
@ -439,7 +437,6 @@ static int cmd_subvol_list(int argc, char **argv)
|
|||||||
filter_set = btrfs_list_alloc_filter_set();
|
filter_set = btrfs_list_alloc_filter_set();
|
||||||
comparer_set = btrfs_list_alloc_comparer_set();
|
comparer_set = btrfs_list_alloc_comparer_set();
|
||||||
|
|
||||||
optind = 1;
|
|
||||||
while(1) {
|
while(1) {
|
||||||
int c;
|
int c;
|
||||||
static const struct option long_options[] = {
|
static const struct option long_options[] = {
|
||||||
@ -616,7 +613,6 @@ static int cmd_subvol_snapshot(int argc, char **argv)
|
|||||||
struct btrfs_qgroup_inherit *inherit = NULL;
|
struct btrfs_qgroup_inherit *inherit = NULL;
|
||||||
DIR *dirstream1 = NULL, *dirstream2 = NULL;
|
DIR *dirstream1 = NULL, *dirstream2 = NULL;
|
||||||
|
|
||||||
optind = 1;
|
|
||||||
memset(&args, 0, sizeof(args));
|
memset(&args, 0, sizeof(args));
|
||||||
while (1) {
|
while (1) {
|
||||||
int c = getopt(argc, argv, "c:i:r");
|
int c = getopt(argc, argv, "c:i:r");
|
||||||
@ -1186,7 +1182,6 @@ static int cmd_subvol_sync(int argc, char **argv)
|
|||||||
int id_count;
|
int id_count;
|
||||||
int sleep_interval = 1;
|
int sleep_interval = 1;
|
||||||
|
|
||||||
optind = 1;
|
|
||||||
while (1) {
|
while (1) {
|
||||||
int c = getopt(argc, argv, "s:");
|
int c = getopt(argc, argv, "s:");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user