mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-24 06:04:19 +03:00
Default size unit normally MB not KB.
This commit is contained in:
parent
d89ca2087e
commit
13427578c9
13
tools/args.h
13
tools/args.h
@ -10,10 +10,10 @@
|
||||
*/
|
||||
arg(version_ARG, '\0', "version", NULL)
|
||||
arg(quiet_ARG, '\0', "quiet", NULL)
|
||||
arg(physicalvolumesize_ARG, '\0', "setphysicalvolumesize", size_arg)
|
||||
arg(physicalvolumesize_ARG, '\0', "setphysicalvolumesize", size_mb_arg)
|
||||
arg(ignorelockingfailure_ARG, '\0', "ignorelockingfailure", NULL)
|
||||
arg(metadatacopies_ARG, '\0', "metadatacopies", int_arg)
|
||||
arg(metadatasize_ARG, '\0', "metadatasize", size_arg)
|
||||
arg(metadatasize_ARG, '\0', "metadatasize", size_mb_arg)
|
||||
arg(restorefile_ARG, '\0', "restorefile", string_arg)
|
||||
arg(labelsector_ARG, '\0', "labelsector", int_arg)
|
||||
arg(driverloaded_ARG, '\0', "driverloaded", yes_no_arg)
|
||||
@ -30,7 +30,7 @@ arg(all_ARG, 'a', "all", NULL)
|
||||
arg(autobackup_ARG, 'A', "autobackup", yes_no_arg)
|
||||
arg(activevolumegroups_ARG, 'A', "activevolumegroups", NULL)
|
||||
arg(blockdevice_ARG, 'b', "blockdevice", NULL)
|
||||
arg(chunksize_ARG, 'c', "chunksize", size_arg)
|
||||
arg(chunksize_ARG, 'c', "chunksize", size_kb_arg)
|
||||
arg(colon_ARG, 'c', "colon", NULL)
|
||||
arg(contiguous_ARG, 'C', "contiguous", yes_no_arg)
|
||||
arg(debug_ARG, 'd', "debug", NULL)
|
||||
@ -42,7 +42,7 @@ arg(force_ARG, 'f', "force", NULL)
|
||||
arg(full_ARG, 'f', "full", NULL)
|
||||
arg(help_ARG, 'h', "help", NULL)
|
||||
arg(help2_ARG, '?', "", NULL)
|
||||
arg(stripesize_ARG, 'I', "stripesize", size_arg)
|
||||
arg(stripesize_ARG, 'I', "stripesize", size_kb_arg)
|
||||
arg(stripes_ARG, 'i', "stripes", int_arg)
|
||||
arg(iop_version_ARG, 'i', "iop_version", NULL)
|
||||
arg(logicalvolume_ARG, 'l', "logicalvolume", int_arg)
|
||||
@ -50,7 +50,7 @@ arg(maxlogicalvolumes_ARG, 'l', "maxlogicalvolumes", int_arg)
|
||||
arg(extents_ARG, 'l', "extents", int_arg_with_sign)
|
||||
arg(lvmpartition_ARG, 'l', "lvmpartition", NULL)
|
||||
arg(list_ARG, 'l', "list", NULL)
|
||||
arg(size_ARG, 'L', "size", size_arg)
|
||||
arg(size_ARG, 'L', "size", size_mb_arg)
|
||||
arg(logicalextent_ARG, 'L', "logicalextent", int_arg_with_sign)
|
||||
arg(persistent_ARG, 'M', "persistent", yes_no_arg)
|
||||
arg(metadatatype_ARG, 'M', "metadatatype", metadatatype_arg)
|
||||
@ -60,13 +60,14 @@ arg(name_ARG, 'n', "name", string_arg)
|
||||
arg(oldpath_ARG, 'n', "oldpath", NULL)
|
||||
arg(nofsck_ARG, 'n', "nofsck", NULL)
|
||||
arg(novolumegroup_ARG, 'n', "novolumegroup", NULL)
|
||||
arg(options_ARG, 'o', "options", string_arg)
|
||||
arg(permission_ARG, 'p', "permission", permission_arg)
|
||||
arg(maxphysicalvolumes_ARG, 'p', "maxphysicalvolumes", int_arg)
|
||||
arg(partial_ARG, 'P', "partial", NULL)
|
||||
arg(physicalvolume_ARG, 'P', "physicalvolume", NULL)
|
||||
arg(readahead_ARG, 'r', "readahead", int_arg)
|
||||
arg(reset_ARG, 'R', "reset", NULL)
|
||||
arg(physicalextentsize_ARG, 's', "physicalextentsize", size_arg)
|
||||
arg(physicalextentsize_ARG, 's', "physicalextentsize", size_mb_arg)
|
||||
arg(stdin_ARG, 's', "stdin", NULL)
|
||||
arg(snapshot_ARG, 's', "snapshot", NULL)
|
||||
arg(short_ARG, 's', "short", NULL)
|
||||
|
16
tools/lvm.c
16
tools/lvm.c
@ -113,7 +113,7 @@ int _get_int_arg(struct arg *a, char **ptr)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int size_arg(struct cmd_context *cmd, struct arg *a)
|
||||
static int _size_arg(struct cmd_context *cmd, struct arg *a, int factor)
|
||||
{
|
||||
char *ptr;
|
||||
int i;
|
||||
@ -153,13 +153,25 @@ int size_arg(struct cmd_context *cmd, struct arg *a)
|
||||
|
||||
while (i-- > 0)
|
||||
v *= 1024;
|
||||
}
|
||||
} else
|
||||
v *= factor;
|
||||
|
||||
a->i_value = (uint32_t) v;
|
||||
a->i64_value = (uint64_t) v;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int size_kb_arg(struct cmd_context *cmd, struct arg *a)
|
||||
{
|
||||
return _size_arg(cmd, a, 1);
|
||||
}
|
||||
|
||||
int size_mb_arg(struct cmd_context *cmd, struct arg *a)
|
||||
{
|
||||
return _size_arg(cmd, a, 1024);
|
||||
}
|
||||
|
||||
int int_arg(struct cmd_context *cmd, struct arg *a)
|
||||
{
|
||||
char *ptr;
|
||||
|
@ -94,7 +94,8 @@ void usage(const char *name);
|
||||
|
||||
/* the argument verify/normalise functions */
|
||||
int yes_no_arg(struct cmd_context *cmd, struct arg *a);
|
||||
int size_arg(struct cmd_context *cmd, struct arg *a);
|
||||
int size_kb_arg(struct cmd_context *cmd, struct arg *a);
|
||||
int size_mb_arg(struct cmd_context *cmd, struct arg *a);
|
||||
int int_arg(struct cmd_context *cmd, struct arg *a);
|
||||
int int_arg_with_sign(struct cmd_context *cmd, struct arg *a);
|
||||
int minor_arg(struct cmd_context *cmd, struct arg *a);
|
||||
|
Loading…
x
Reference in New Issue
Block a user