summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/Makefile.in2
-rw-r--r--tools/commands.h15
-rw-r--r--tools/formats.c3
-rw-r--r--tools/lvchange.c6
-rw-r--r--tools/lvconvert.c3
-rw-r--r--tools/lvcreate.c33
-rw-r--r--tools/lvmchange.c3
-rw-r--r--tools/lvmcmdline.c47
-rw-r--r--tools/lvmdiskscan.c5
-rw-r--r--tools/lvremove.c2
-rw-r--r--tools/lvresize.c31
-rw-r--r--tools/lvscan.c4
-rw-r--r--tools/polldaemon.c2
-rw-r--r--tools/pvchange.c2
-rw-r--r--tools/pvdisplay.c7
-rw-r--r--tools/pvmove.c15
-rw-r--r--tools/pvremove.c2
-rw-r--r--tools/pvscan.c26
-rw-r--r--tools/reporter.c9
-rw-r--r--tools/segtypes.c3
-rw-r--r--tools/stub.h22
-rw-r--r--tools/toollib.c18
-rw-r--r--tools/tools.h5
-rw-r--r--tools/version.h.in2
-rw-r--r--tools/vgchange.c9
-rw-r--r--tools/vgck.c6
-rw-r--r--tools/vgconvert.c2
-rw-r--r--tools/vgcreate.c2
-rw-r--r--tools/vgdisplay.c2
-rw-r--r--tools/vgexport.c5
-rw-r--r--tools/vgimport.c5
-rw-r--r--tools/vgmknodes.c2
-rw-r--r--tools/vgreduce.c5
-rw-r--r--tools/vgremove.c2
-rw-r--r--tools/vgrename.c6
-rw-r--r--tools/vgscan.c3
-rw-r--r--tools/vgsplit.c2
37 files changed, 164 insertions, 154 deletions
diff --git a/tools/Makefile.in b/tools/Makefile.in
index 6731ceb9..23c5267c 100644
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -80,7 +80,7 @@ endif
LVMLIBS = -llvm
-CLEAN_TARGETS = liblvm2cmd.so liblvm2cmd.a lvm lvm.static lvm.cflow lvm.xref lvm.tree lvm.rxref lvm.rtree
+CLEAN_TARGETS = liblvm2cmd.so liblvm2cmd.a lvm lvm.o lvm.static lvm.cflow lvm.xref lvm.tree lvm.rxref lvm.rtree
ifeq ("@CMDLIB@", "yes")
TARGETS += liblvm2cmd.so
diff --git a/tools/commands.h b/tools/commands.h
index d5f06902..b450e2fe 100644
--- a/tools/commands.h
+++ b/tools/commands.h
@@ -509,21 +509,6 @@ xx(pvremove,
force_ARG, test_ARG, yes_ARG)
-xx(pvresize,
- "Resize a physical volume in use by a volume group",
- "Not implemented. Use pvcreate options.",
-/***
- "pvresize "
- "[-A|--autobackup {y|n}] "
- "[-d|--debug] "
- "[-h|-?|--help]\n\t"
- "[-s|--size PhysicalVolumeSize[kKmMgGtT]" "\n"
- "[-v|--verbose] "
- "[--version]\n\t"
- "\tPhysicalVolumePath [PhysicalVolumePath...]\n",
-***/
- autobackup_ARG, physicalvolumesize_ARG)
-
xx(pvs,
"Display information about physical volumes",
"pvs" "\n"
diff --git a/tools/formats.c b/tools/formats.c
index 8782d4c8..c3239676 100644
--- a/tools/formats.c
+++ b/tools/formats.c
@@ -15,7 +15,8 @@
#include "tools.h"
-int formats(struct cmd_context *cmd, int argc, char **argv)
+int formats(struct cmd_context *cmd, int argc __attribute((unused)),
+ char **argv __attribute((unused)))
{
display_formats(cmd);
diff --git a/tools/lvchange.c b/tools/lvchange.c
index 13c2b7a4..147519d0 100644
--- a/tools/lvchange.c
+++ b/tools/lvchange.c
@@ -150,7 +150,7 @@ static int lvchange_alloc(struct cmd_context *cmd, struct logical_volume *lv)
want_contiguous = strcmp(arg_str_value(cmd, contiguous_ARG, "n"), "n");
alloc = want_contiguous ? ALLOC_CONTIGUOUS : ALLOC_INHERIT;
- alloc = (alloc_policy_t) arg_uint_value(cmd, alloc_ARG, alloc);
+ alloc = arg_uint_value(cmd, alloc_ARG, alloc);
if (alloc == lv->alloc) {
log_error("Allocation policy of logical volume \"%s\" is "
@@ -186,7 +186,7 @@ static int lvchange_alloc(struct cmd_context *cmd, struct logical_volume *lv)
static int lvchange_readahead(struct cmd_context *cmd,
struct logical_volume *lv)
{
- unsigned int read_ahead = 0;
+ unsigned read_ahead = 0;
read_ahead = arg_uint_value(cmd, readahead_ARG, 0);
@@ -369,7 +369,7 @@ static int lvchange_tag(struct cmd_context *cmd, struct logical_volume *lv,
}
static int lvchange_single(struct cmd_context *cmd, struct logical_volume *lv,
- void *handle)
+ void *handle __attribute((unused)))
{
int doit = 0;
int archived = 0;
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 2d57eccf..2e4c0ae5 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -122,8 +122,7 @@ static int _read_params(struct lvconvert_params *lp, struct cmd_context *cmd,
lp->alloc = ALLOC_INHERIT;
if (arg_count(cmd, alloc_ARG))
- lp->alloc = (alloc_policy_t) arg_uint_value(cmd, alloc_ARG,
- lp->alloc);
+ lp->alloc = arg_uint_value(cmd, alloc_ARG, lp->alloc);
if (lp->snapshot) {
if (arg_count(cmd, regionsize_ARG)) {
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index 7464929b..23c0f3ee 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -36,7 +36,7 @@ struct lvcreate_params {
uint32_t mirrors;
- struct segment_type *segtype;
+ const struct segment_type *segtype;
/* size */
uint32_t extents;
@@ -154,7 +154,7 @@ static int _lvcreate_name_params(struct lvcreate_params *lp,
}
static int _read_size_params(struct lvcreate_params *lp,
- struct cmd_context *cmd, int *pargc, char ***pargv)
+ struct cmd_context *cmd)
{
if (arg_count(cmd, extents_ARG) + arg_count(cmd, size_ARG) != 1) {
log_error("Please specify either size or extents (not both)");
@@ -187,7 +187,7 @@ static int _read_size_params(struct lvcreate_params *lp,
* up to the power of 2) */
static int _read_stripe_params(struct lvcreate_params *lp,
struct cmd_context *cmd,
- int *pargc, char ***pargv)
+ int *pargc)
{
int argc = *pargc;
@@ -199,7 +199,7 @@ static int _read_stripe_params(struct lvcreate_params *lp,
/* Check to make sure we won't overflow lp->stripe_size */
if(arg_uint_value(cmd, stripesize_ARG, 0) > STRIPE_SIZE_LIMIT) {
log_error("Stripe size cannot be larger than %s",
- display_size(cmd, STRIPE_SIZE_LIMIT, SIZE_SHORT));
+ display_size(cmd, (uint64_t) STRIPE_SIZE_LIMIT));
return 0;
}
lp->stripe_size = 2 * arg_uint_value(cmd, stripesize_ARG, 0);
@@ -215,7 +215,7 @@ static int _read_stripe_params(struct lvcreate_params *lp,
"metadata/stripesize",
DEFAULT_STRIPESIZE) * 2;
log_print("Using default stripesize %s",
- display_size(cmd, lp->stripe_size, SIZE_SHORT));
+ display_size(cmd, (uint64_t) lp->stripe_size));
}
if (argc && (unsigned) argc < lp->stripes) {
@@ -234,7 +234,7 @@ static int _read_stripe_params(struct lvcreate_params *lp,
if (lp->stripes > 1 && (lp->stripe_size < STRIPE_SIZE_MIN ||
lp->stripe_size & (lp->stripe_size - 1))) {
log_error("Invalid stripe size %s",
- display_size(cmd, lp->stripe_size, SIZE_SHORT));
+ display_size(cmd, (uint64_t) lp->stripe_size));
return 0;
}
@@ -243,7 +243,7 @@ static int _read_stripe_params(struct lvcreate_params *lp,
static int _read_mirror_params(struct lvcreate_params *lp,
struct cmd_context *cmd,
- int *pargc, char ***pargv)
+ int *pargc)
{
int argc = *pargc;
int region_size;
@@ -304,7 +304,7 @@ static int _lvcreate_params(struct lvcreate_params *lp, struct cmd_context *cmd,
/*
* Check selected options are compatible and determine segtype
*/
- lp->segtype = (struct segment_type *)
+ lp->segtype = (const struct segment_type *)
arg_ptr_value(cmd, type_ARG,
get_segtype_from_string(cmd, "striped"));
@@ -387,9 +387,9 @@ static int _lvcreate_params(struct lvcreate_params *lp, struct cmd_context *cmd,
}
if (!_lvcreate_name_params(lp, cmd, &argc, &argv) ||
- !_read_size_params(lp, cmd, &argc, &argv) ||
- !_read_stripe_params(lp, cmd, &argc, &argv) ||
- !_read_mirror_params(lp, cmd, &argc, &argv)) {
+ !_read_size_params(lp, cmd) ||
+ !_read_stripe_params(lp, cmd, &argc) ||
+ !_read_mirror_params(lp, cmd, &argc)) {
stack;
return 0;
}
@@ -407,7 +407,7 @@ static int _lvcreate_params(struct lvcreate_params *lp, struct cmd_context *cmd,
lp->alloc = contiguous ? ALLOC_CONTIGUOUS : ALLOC_INHERIT;
- lp->alloc = (alloc_policy_t) arg_uint_value(cmd, alloc_ARG, lp->alloc);
+ lp->alloc = arg_uint_value(cmd, alloc_ARG, lp->alloc);
if (contiguous && (lp->alloc != ALLOC_CONTIGUOUS)) {
log_error("Conflicting contiguous and alloc arguments");
@@ -519,8 +519,8 @@ static int _lvcreate(struct cmd_context *cmd, struct lvcreate_params *lp)
if (lp->stripe_size > vg->extent_size) {
log_error("Reducing requested stripe size %s to maximum, "
"physical extent size %s",
- display_size(cmd, lp->stripe_size, SIZE_SHORT),
- display_size(cmd, vg->extent_size, SIZE_SHORT));
+ display_size(cmd, (uint64_t) lp->stripe_size),
+ display_size(cmd, (uint64_t) vg->extent_size));
lp->stripe_size = vg->extent_size;
}
@@ -529,8 +529,7 @@ static int _lvcreate(struct cmd_context *cmd, struct lvcreate_params *lp)
!(vg->fid->fmt->features & FMT_UNLIMITED_STRIPESIZE) &&
(lp->stripe_size > STRIPE_SIZE_MAX)) {
log_error("Stripe size may not exceed %s",
- display_size(cmd, STRIPE_SIZE_MAX,
- SIZE_SHORT));
+ display_size(cmd, (uint64_t) STRIPE_SIZE_MAX));
return 0;
}
@@ -542,7 +541,7 @@ static int _lvcreate(struct cmd_context *cmd, struct lvcreate_params *lp)
tmp_size += vg->extent_size - tmp_size %
vg->extent_size;
log_print("Rounding up size to full physical extent %s",
- display_size(cmd, tmp_size, SIZE_SHORT));
+ display_size(cmd, tmp_size));
}
lp->extents = tmp_size / vg->extent_size;
diff --git a/tools/lvmchange.c b/tools/lvmchange.c
index 98e079dc..df6af022 100644
--- a/tools/lvmchange.c
+++ b/tools/lvmchange.c
@@ -15,7 +15,8 @@
#include "tools.h"
-int lvmchange(struct cmd_context *cmd, int argc, char **argv)
+int lvmchange(struct cmd_context *cmd __attribute((unused)),
+ int argc __attribute((unused)), char **argv __attribute((unused)))
{
log_print("With LVM2 and the device mapper, this program is obsolete.");
return ECMD_FAILED;
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index c4f2c186..39a2af9b 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -66,7 +66,7 @@ static struct command *_commands;
static int _interactive;
-int yes_no_arg(struct cmd_context *cmd, struct arg *a)
+int yes_no_arg(struct cmd_context *cmd __attribute((unused)), struct arg *a)
{
a->sign = SIGN_NONE;
@@ -86,7 +86,8 @@ int yes_no_arg(struct cmd_context *cmd, struct arg *a)
return 1;
}
-int yes_no_excl_arg(struct cmd_context *cmd, struct arg *a)
+int yes_no_excl_arg(struct cmd_context *cmd __attribute((unused)),
+ struct arg *a)
{
a->sign = SIGN_NONE;
@@ -177,7 +178,7 @@ static int _get_int_arg(struct arg *a, char **ptr)
return 1;
}
-static int _size_arg(struct cmd_context *cmd, struct arg *a, int factor)
+static int _size_arg(struct cmd_context *cmd __attribute((unused)), struct arg *a, int factor)
{
char *ptr;
int i;
@@ -238,7 +239,7 @@ 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)
+int int_arg(struct cmd_context *cmd __attribute((unused)), struct arg *a)
{
char *ptr;
@@ -248,7 +249,7 @@ int int_arg(struct cmd_context *cmd, struct arg *a)
return 1;
}
-int int_arg_with_sign(struct cmd_context *cmd, struct arg *a)
+int int_arg_with_sign(struct cmd_context *cmd __attribute((unused)), struct arg *a)
{
char *ptr;
@@ -258,7 +259,7 @@ int int_arg_with_sign(struct cmd_context *cmd, struct arg *a)
return 1;
}
-int minor_arg(struct cmd_context *cmd, struct arg *a)
+int minor_arg(struct cmd_context *cmd __attribute((unused)), struct arg *a)
{
char *ptr;
@@ -273,7 +274,7 @@ int minor_arg(struct cmd_context *cmd, struct arg *a)
return 1;
}
-int major_arg(struct cmd_context *cmd, struct arg *a)
+int major_arg(struct cmd_context *cmd __attribute((unused)), struct arg *a)
{
char *ptr;
@@ -290,13 +291,13 @@ int major_arg(struct cmd_context *cmd, struct arg *a)
return 1;
}
-int string_arg(struct cmd_context *cmd, struct arg *a)
+int string_arg(struct cmd_context *cmd __attribute((unused)),
+ struct arg *a __attribute((unused)))
{
-
return 1;
}
-int tag_arg(struct cmd_context *cmd, struct arg *a)
+int tag_arg(struct cmd_context *cmd __attribute((unused)), struct arg *a)
{
char *pos = a->value;
@@ -309,7 +310,7 @@ int tag_arg(struct cmd_context *cmd, struct arg *a)
return 1;
}
-int permission_arg(struct cmd_context *cmd, struct arg *a)
+int permission_arg(struct cmd_context *cmd __attribute((unused)), struct arg *a)
{
a->sign = SIGN_NONE;
@@ -325,7 +326,7 @@ int permission_arg(struct cmd_context *cmd, struct arg *a)
return 1;
}
-int alloc_arg(struct cmd_context *cmd, struct arg *a)
+int alloc_arg(struct cmd_context *cmd __attribute((unused)), struct arg *a)
{
alloc_policy_t alloc;
@@ -638,7 +639,9 @@ static int _merge_synonym(struct cmd_context *cmd, int oldarg, int newarg)
return 1;
}
-int version(struct cmd_context *cmd, int argc, char **argv)
+int version(struct cmd_context *cmd __attribute((unused)),
+ int argc __attribute((unused)),
+ char **argv __attribute((unused)))
{
char vsn[80];
@@ -744,7 +747,7 @@ static void _display_help(void)
}
}
-int help(struct cmd_context *cmd, int argc, char **argv)
+int help(struct cmd_context *cmd __attribute((unused)), int argc, char **argv)
{
if (!argc)
_display_help();
@@ -918,7 +921,7 @@ static int _split(char *str, int *argc, char **argv, int max)
static void _init_rand(void)
{
- srand((unsigned int) time(NULL) + (unsigned int) getpid());
+ srand((unsigned) time(NULL) + (unsigned) getpid());
}
static void _close_stray_fds(void)
@@ -963,7 +966,7 @@ static struct cmd_context *_init_lvm(void)
return cmd;
}
-static void _fin_commands(struct cmd_context *cmd)
+static void _fin_commands(void)
{
int i;
@@ -975,7 +978,7 @@ static void _fin_commands(struct cmd_context *cmd)
static void _fin(struct cmd_context *cmd)
{
- _fin_commands(cmd);
+ _fin_commands();
destroy_toolcontext(cmd);
}
@@ -994,8 +997,10 @@ static int _run_script(struct cmd_context *cmd, int argc, char **argv)
if (!magic_number) {
if (buffer[0] == '#' && buffer[1] == '!')
magic_number = 1;
- else
- return ENO_SUCH_CMD;
+ else {
+ ret = ENO_SUCH_CMD;
+ break;
+ }
}
if ((strlen(buffer) == sizeof(buffer) - 1)
&& (buffer[sizeof(buffer) - 1] - 2 != '\n')) {
@@ -1343,7 +1348,7 @@ static int _lvm1_fallback(struct cmd_context *cmd)
return 1;
}
-static void _exec_lvm1_command(struct cmd_context *cmd, int argc, char **argv)
+static void _exec_lvm1_command(char **argv)
{
char path[PATH_MAX];
@@ -1400,7 +1405,7 @@ int lvm2_main(int argc, char **argv, int is_static)
"command specified.");
return ECMD_FAILED;
}
- _exec_lvm1_command(cmd, argc, argv);
+ _exec_lvm1_command(argv);
return ECMD_FAILED;
}
#ifdef READLINE_SUPPORT
diff --git a/tools/lvmdiskscan.c b/tools/lvmdiskscan.c
index 1d11efa7..087215d7 100644
--- a/tools/lvmdiskscan.c
+++ b/tools/lvmdiskscan.c
@@ -64,7 +64,7 @@ static void _print(struct cmd_context *cmd, const struct device *dev,
uint64_t size, const char *what)
{
log_print("%-*s [%15s] %s", max_len, dev_name(dev),
- display_size(cmd, size, SIZE_SHORT), what ? : "");
+ display_size(cmd, size), what ? : "");
}
static int _check_device(struct cmd_context *cmd, struct device *dev)
@@ -91,7 +91,8 @@ static int _check_device(struct cmd_context *cmd, struct device *dev)
return 1;
}
-int lvmdiskscan(struct cmd_context *cmd, int argc, char **argv)
+int lvmdiskscan(struct cmd_context *cmd, int argc __attribute((unused)),
+ char **argv __attribute((unused)))
{
uint64_t size;
struct dev_iter *iter;
diff --git a/tools/lvremove.c b/tools/lvremove.c
index 5ecf850e..cd3b36b2 100644
--- a/tools/lvremove.c
+++ b/tools/lvremove.c
@@ -16,7 +16,7 @@
#include "tools.h"
static int lvremove_single(struct cmd_context *cmd, struct logical_volume *lv,
- void *handle)
+ void *handle __attribute((unused)))
{
struct volume_group *vg;
struct lvinfo info;
diff --git a/tools/lvresize.c b/tools/lvresize.c
index f3956fa2..41eb6de4 100644
--- a/tools/lvresize.c
+++ b/tools/lvresize.c
@@ -25,7 +25,7 @@ struct lvresize_params {
uint32_t stripe_size;
uint32_t mirrors;
- struct segment_type *segtype;
+ const struct segment_type *segtype;
/* size */
uint32_t extents;
@@ -181,7 +181,7 @@ static int _lvresize(struct cmd_context *cmd, struct lvresize_params *lp)
if (arg_uint_value(cmd, stripesize_ARG, 0) > STRIPE_SIZE_LIMIT) {
log_error("Stripe size cannot be larger than %s",
- display_size(cmd, STRIPE_SIZE_LIMIT, SIZE_SHORT));
+ display_size(cmd, (uint64_t) STRIPE_SIZE_LIMIT));
return 0;
}
@@ -191,9 +191,8 @@ static int _lvresize(struct cmd_context *cmd, struct lvresize_params *lp)
log_error("Reducing stripe size %s to maximum, "
"physical extent size %s",
display_size(cmd,
- arg_uint_value(cmd, stripesize_ARG, 0) * 2,
- SIZE_SHORT),
- display_size(cmd, vg->extent_size, SIZE_SHORT));
+ (uint64_t) arg_uint_value(cmd, stripesize_ARG, 0) * 2),
+ display_size(cmd, (uint64_t) vg->extent_size));
lp->stripe_size = vg->extent_size;
} else
lp->stripe_size = 2 * arg_uint_value(cmd,
@@ -216,7 +215,7 @@ static int _lvresize(struct cmd_context *cmd, struct lvresize_params *lp)
return ECMD_FAILED;
}
- alloc = (alloc_policy_t) arg_uint_value(cmd, alloc_ARG, lv->alloc);
+ alloc = arg_uint_value(cmd, alloc_ARG, lv->alloc);
if (lp->size) {
if (lp->size % vg->extent_size) {
@@ -227,8 +226,7 @@ static int _lvresize(struct cmd_context *cmd, struct lvresize_params *lp)
(lp->size % vg->extent_size);
log_print("Rounding up size to full physical extent %s",
- display_size(cmd, (uint64_t) lp->size,
- SIZE_SHORT));
+ display_size(cmd, (uint64_t) lp->size));
}
lp->extents = lp->size / vg->extent_size;
@@ -266,8 +264,7 @@ static int _lvresize(struct cmd_context *cmd, struct lvresize_params *lp)
}
/* FIXME Support LVs with mixed segment types */
- if (lp->segtype != (struct segment_type *) arg_ptr_value(cmd, type_ARG,
- lp->segtype)) {
+ if (lp->segtype != arg_ptr_value(cmd, type_ARG, lp->segtype)) {
log_error("VolumeType does not match (%s)", lp->segtype->name);
return EINVALID_CMD_LINE;
}
@@ -300,8 +297,7 @@ static int _lvresize(struct cmd_context *cmd, struct lvresize_params *lp)
if (!lp->stripe_size && lp->stripes > 1) {
if (seg_stripesize) {
log_print("Using stripesize of last segment %s",
- display_size(cmd, seg_stripesize,
- SIZE_SHORT));
+ display_size(cmd, (uint64_t) seg_stripesize));
lp->stripe_size = seg_stripesize;
} else {
lp->stripe_size =
@@ -309,8 +305,7 @@ static int _lvresize(struct cmd_context *cmd, struct lvresize_params *lp)
"metadata/stripesize",
DEFAULT_STRIPESIZE) * 2;
log_print("Using default stripesize %s",
- display_size(cmd, lp->stripe_size,
- SIZE_SHORT));
+ display_size(cmd, (uint64_t) lp->stripe_size));
}
}
}
@@ -387,7 +382,7 @@ static int _lvresize(struct cmd_context *cmd, struct lvresize_params *lp)
if (lp->stripe_size < STRIPE_SIZE_MIN) {
log_error("Invalid stripe size %s",
- display_size(cmd, lp->stripe_size, SIZE_SHORT));
+ display_size(cmd, (uint64_t) lp->stripe_size));
return 0;
}
}
@@ -467,8 +462,7 @@ static int _lvresize(struct cmd_context *cmd, struct lvresize_params *lp)
log_print("WARNING: Reducing active%s logical volume "
"to %s", info.open_count ? " and open" : "",
display_size(cmd, (uint64_t) lp->extents *
- vg->extent_size,
- SIZE_SHORT));
+ vg->extent_size));
log_print("THIS MAY DESTROY YOUR DATA "
"(filesystem etc.)");
@@ -523,8 +517,7 @@ static int _lvresize(struct cmd_context *cmd, struct lvresize_params *lp)
log_print("%sing logical volume %s to %s",
(lp->resize == LV_REDUCE) ? "Reduc" : "Extend",
lp->lv_name,
- display_size(cmd, (uint64_t) lp->extents * vg->extent_size,
- SIZE_SHORT));
+ display_size(cmd, (uint64_t) lp->extents * vg->extent_size));
if (lp->resize == LV_REDUCE) {
if (!lv_reduce(lv, lv->le_count - lp->extents)) {
diff --git a/tools/lvscan.c b/tools/lvscan.c
index 2faeac7d..560ee706 100644
--- a/tools/lvscan.c
+++ b/tools/lvscan.c
@@ -16,7 +16,7 @@
#include "tools.h"
static int lvscan_single(struct cmd_context *cmd, struct logical_volume *lv,
- void *handle)
+ void *handle __attribute((unused)))
{
struct lvinfo info;
int lv_total = 0;
@@ -63,7 +63,7 @@ static int lvscan_single(struct cmd_context *cmd, struct logical_volume *lv,
log_print("%s%s '%s%s/%s' [%s] %s", active_str, snapshot_str,
cmd->dev_dir, lv->vg->name, lv->name,
- display_size(cmd, lv->size, SIZE_SHORT),
+ display_size(cmd, lv->size),
get_alloc_string(lv->alloc));
lv_total++;
diff --git a/tools/polldaemon.c b/tools/polldaemon.c
index 34cc90cb..a784cb8f 100644
--- a/tools/polldaemon.c
+++ b/tools/polldaemon.c
@@ -18,7 +18,7 @@
#include <signal.h>
#include <sys/wait.h>
-static void _sigchld_handler(int sig)
+static void _sigchld_handler(int sig __attribute((unused)))
{
while (wait4(-1, NULL, WNOHANG | WUNTRACED, NULL) > 0) ;
}
diff --git a/tools/pvchange.c b/tools/pvchange.c
index dc9439ba..7056ddd2 100644
--- a/tools/pvchange.c
+++ b/tools/pvchange.c
@@ -18,7 +18,7 @@
/* FIXME Locking. PVs in VG. */
static int _pvchange_single(struct cmd_context *cmd, struct physical_volume *pv,
- void *handle)
+ void *handle __attribute((unused)))
{
struct volume_group *vg = NULL;
struct pv_list *pvl;
diff --git a/tools/pvdisplay.c b/tools/pvdisplay.c
index 8489c266..3fda7de6 100644
--- a/tools/pvdisplay.c
+++ b/tools/pvdisplay.c
@@ -15,7 +15,8 @@
#include "tools.h"
-static int _pvdisplay_single(struct cmd_context *cmd, struct volume_group *vg,
+static int _pvdisplay_single(struct cmd_context *cmd,
+ struct volume_group *vg __attribute((unused)),
struct physical_volume *pv, void *handle)
{
uint64_t size;
@@ -29,7 +30,7 @@ static int _pvdisplay_single(struct cmd_context *cmd, struct volume_group *vg,
if (arg_count(cmd, short_ARG)) {
log_print("Device \"%s\" has a capacity of %s", pv_name,
- display_size(cmd, size, SIZE_SHORT));
+ display_size(cmd, size));
return ECMD_PROCESSED;
}
@@ -39,7 +40,7 @@ static int _pvdisplay_single(struct cmd_context *cmd, struct volume_group *vg,
if (!pv->vg_name)
log_print("\"%s\" is a new physical volume of \"%s\"",
- pv_name, display_size(cmd, size, SIZE_SHORT));
+ pv_name, display_size(cmd, size));
if (arg_count(cmd, colon_ARG)) {
pvdisplay_colons(pv);
diff --git a/tools/pvmove.c b/tools/pvmove.c
index 50a5d1c9..5829b4c0 100644
--- a/tools/pvmove.c
+++ b/tools/pvmove.c
@@ -335,8 +335,7 @@ static int _set_up_pvmove(struct cmd_context *cmd, const char *pv_name,
return ECMD_FAILED;
}
- alloc = (alloc_policy_t) arg_uint_value(cmd, alloc_ARG,
- ALLOC_INHERIT);
+ alloc = arg_uint_value(cmd, alloc_ARG, ALLOC_INHERIT);
if (alloc == ALLOC_INHERIT)
alloc = vg->alloc;
@@ -483,11 +482,11 @@ static struct volume_group *_get_move_vg(struct cmd_context *cmd,
}
static struct poll_functions _pvmove_fns = {
- get_copy_name_from_lv:get_pvmove_pvname_from_lv_mirr,
- get_copy_vg:_get_move_vg,
- get_copy_lv:find_pvmove_lv_from_pvname,
- update_metadata:_update_metadata,
- finish_copy:_finish_pvmove,
+ .get_copy_name_from_lv = get_pvmove_pvname_from_lv_mirr,
+ .get_copy_vg = _get_move_vg,
+ .get_copy_lv = find_pvmove_lv_from_pvname,
+ .update_metadata = _update_metadata,
+ .finish_copy = _finish_pvmove,
};
int pvmove_poll(struct cmd_context *cmd, const char *pv_name,
@@ -525,5 +524,5 @@ int pvmove(struct cmd_context *cmd, int argc, char **argv)
}
return pvmove_poll(cmd, pv_name,
- arg_count(cmd, background_ARG) ? 1 : 0);
+ arg_count(cmd, background_ARG) ? 1U : 0);
}
diff --git a/tools/pvremove.c b/tools/pvremove.c
index 75ea7f56..c40af9ef 100644
--- a/tools/pvremove.c
+++ b/tools/pvremove.c
@@ -73,7 +73,7 @@ static int pvremove_check(struct cmd_context *cmd, const char *name)
}
static int pvremove_single(struct cmd_context *cmd, const char *pv_name,
- void *handle)
+ void *handle __attribute((unused)))
{
struct device *dev;
diff --git a/tools/pvscan.c b/tools/pvscan.c
index bbe054d6..4636ddda 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -19,10 +19,11 @@ int pv_max_name_len = 0;
int vg_max_name_len = 0;
static void _pvscan_display_single(struct cmd_context *cmd,
- struct physical_volume *pv, void *handle)
+ struct physical_volume *pv,
+ void *handle __attribute((unused)))
{
char uuid[64];
- unsigned int vg_name_len = 0;
+ unsigned vg_name_len = 0;
char pv_tmp_name[NAME_LEN] = { 0, };
char vg_tmp_name[NAME_LEN] = { 0, };
@@ -66,7 +67,7 @@ static void _pvscan_display_single(struct cmd_context *cmd,
pv_max_name_len, pv_tmp_name,
vg_max_name_len, " ",
pv->fmt ? pv->fmt->name : " ",
- display_size(cmd, pv->size, SIZE_SHORT));
+ display_size(cmd, pv->size));
return;
}
@@ -77,10 +78,10 @@ static void _pvscan_display_single(struct cmd_context *cmd,
pv_max_name_len, pv_tmp_name,
vg_name_this,
display_size(cmd, (uint64_t) pv->pe_count *
- pv->pe_size, SIZE_SHORT),
+ pv->pe_size),
display_size(cmd, (uint64_t) (pv->pe_count -
pv->pe_alloc_count)
- * pv->pe_size, SIZE_SHORT));
+ * pv->pe_size));
return;
}
@@ -88,16 +89,15 @@ static void _pvscan_display_single(struct cmd_context *cmd,
log_print("PV %-*s VG %-*s %s [%s / %s free]", pv_max_name_len,
pv_tmp_name, vg_max_name_len, vg_tmp_name,
pv->fmt ? pv->fmt->name : " ",
- display_size(cmd, (uint64_t) pv->pe_count * pv->pe_size,
- SIZE_SHORT),
+ display_size(cmd, (uint64_t) pv->pe_count * pv->pe_size),
display_size(cmd,
(uint64_t) (pv->pe_count - pv->pe_alloc_count) *
- pv->pe_size,
- SIZE_SHORT));
+ pv->pe_size));
return;
}
-int pvscan(struct cmd_context *cmd, int argc, char **argv)
+int pvscan(struct cmd_context *cmd, int argc __attribute((unused)),
+ char **argv __attribute((unused)))
{
int new_pvs_found = 0;
int pvs_found = 0;
@@ -185,10 +185,10 @@ int pvscan(struct cmd_context *cmd, int argc, char **argv)
log_print("Total: %d [%s] / in use: %d [%s] / in no VG: %d [%s]",
pvs_found,
- display_size(cmd, size_total, SIZE_SHORT),
+ display_size(cmd, size_total),
pvs_found - new_pvs_found,
- display_size(cmd, (size_total - size_new), SIZE_SHORT),
- new_pvs_found, display_size(cmd, size_new, SIZE_SHORT));
+ display_size(cmd, (size_total - size_new)),
+ new_pvs_found, display_size(cmd, size_new));
return ECMD_PROCESSED;
}
diff --git a/tools/reporter.c b/tools/reporter.c
index 26fddaa2..4991f5a2 100644
--- a/tools/reporter.c
+++ b/tools/reporter.c
@@ -16,8 +16,9 @@
#include "tools.h"
#include "report.h"
-static int _vgs_single(struct cmd_context *cmd, const char *vg_name,
- struct volume_group *vg, int consistent, void *handle)
+static int _vgs_single(struct cmd_context *cmd __attribute((unused)),
+ const char *vg_name, struct volume_group *vg,
+ int consistent __attribute((unused)), void *handle)
{
if (!vg) {
log_error("Volume group %s not found", vg_name);
@@ -44,8 +45,8 @@ static int _lvs_single(struct cmd_context *cmd, struct logical_volume *lv,
return ECMD_PROCESSED;
}
-static int _segs_single(struct cmd_context *cmd, struct lv_segment *seg,
- void *handle)
+static int _segs_single(struct cmd_context *cmd __attribute((unused)),
+ struct lv_segment *seg, void *handle)
{
if (!report_object(handle, seg->lv->vg, seg->lv, NULL, seg, NULL))
return ECMD_FAILED;
diff --git a/tools/segtypes.c b/tools/segtypes.c
index 1ba9d5ff..ca93bdc6 100644
--- a/tools/segtypes.c
+++ b/tools/segtypes.c
@@ -15,7 +15,8 @@
#include "tools.h"
-int segtypes(struct cmd_context *cmd, int argc, char **argv)
+int segtypes(struct cmd_context *cmd, int argc __attribute((unused)),
+ char **argv __attribute((unused)))
{
display_segtypes(cmd);
diff --git a/tools/stub.h b/tools/stub.h
index 61b0a98e..e6779217 100644
--- a/tools/stub.h
+++ b/tools/stub.h
@@ -14,13 +14,27 @@
*/
#define unimplemented \
- { log_error("Command not implemented yet."); return ECMD_FAILED;}
+ log_error("Command not implemented yet."); return ECMD_FAILED
/*int e2fsadm(struct cmd_context *cmd, int argc, char **argv) unimplemented*/
-int lvmsadc(struct cmd_context *cmd, int argc, char **argv) unimplemented
-int lvmsar(struct cmd_context *cmd, int argc, char **argv) unimplemented
+int lvmsadc(struct cmd_context *cmd __attribute((unused)),
+ int argc __attribute((unused)),
+ char **argv __attribute((unused)))
+{
+ unimplemented;
+}
+
+int lvmsar(struct cmd_context *cmd __attribute((unused)),
+ int argc __attribute((unused)),
+ char **argv __attribute((unused)))
+{
+ unimplemented;
+}
-int pvdata(struct cmd_context *cmd, int argc, char **argv) {
+int pvdata(struct cmd_context *cmd __attribute((unused)),
+ int argc __attribute((unused)),
+ char **argv __attribute((unused)))
+{
log_error("There's no 'pvdata' command in LVM2.");
log_error("Use lvs, pvs, vgs instead; or use vgcfgbackup and read the text file backup.");
log_error("Metadata in LVM1 format can still be displayed using LVM1's pvdata command.");
diff --git a/tools/toollib.c b/tools/toollib.c
index 695f707d..ab81e377 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -20,7 +20,7 @@
#include <sys/wait.h>
/* Command line args */
-unsigned int arg_count(struct cmd_context *cmd, int a)
+unsigned arg_count(struct cmd_context *cmd, int a)
{
return cmd->args[a].count;
}
@@ -45,7 +45,7 @@ uint32_t arg_uint_value(struct cmd_context *cmd, int a, const uint32_t def)
return arg_count(cmd, a) ? cmd->args[a].ui_value : def;
}
-int64_t arg_int64_value(struct cmd_context *cmd, int a, const uint64_t def)
+int64_t arg_int64_value(struct cmd_context *cmd, int a, const int64_t def)
{
return arg_count(cmd, a) ? cmd->args[a].i64_value : def;
}
@@ -87,11 +87,11 @@ int process_each_lv_in_vg(struct cmd_context *cmd, struct volume_group *vg,
{
int ret_max = 0;
int ret = 0;
- int process_all = 0;
- int process_lv = 0;
- int tags_supplied = 0;
- int lvargs_supplied = 0;
- int lvargs_matched = 0;
+ unsigned process_all = 0;
+ unsigned process_lv = 0;
+ unsigned tags_supplied = 0;
+ unsigned lvargs_supplied = 0;
+ unsigned lvargs_matched = 0;
struct lv_list *lvl;
@@ -1082,8 +1082,8 @@ int validate_vg_name(struct cmd_context *cmd, const char *vg_name)
return 1;
}
-int generate_log_name_format(struct volume_group *vg, const char *lv_name,
- char *buffer, size_t size)
+int generate_log_name_format(struct volume_group *vg __attribute((unused)),
+ const char *lv_name, char *buffer, size_t size)
{
if (lvm_snprintf(buffer, size, "%s_mlog", lv_name) < 0) {
stack;
diff --git a/tools/tools.h b/tools/tools.h
index 10d3df50..fc7278d2 100644
--- a/tools/tools.h
+++ b/tools/tools.h
@@ -19,6 +19,7 @@
#define _GNU_SOURCE
#define _FILE_OFFSET_BITS 64
+#include <configure.h>
#include <assert.h>
#include <libdevmapper.h>
@@ -95,7 +96,7 @@ struct arg {
int (*fn) (struct cmd_context * cmd, struct arg * a);
- unsigned int count;
+ unsigned count;
char *value;
int32_t i_value;
uint32_t ui_value;
@@ -143,7 +144,7 @@ const char *arg_value(struct cmd_context *cmd, int a);
const char *arg_str_value(struct cmd_context *cmd, int a, const char *def);
int32_t arg_int_value(struct cmd_context *cmd, int a, const int32_t def);
uint32_t arg_uint_value(struct cmd_context *cmd, int a, const uint32_t def);
-int64_t arg_int64_value(struct cmd_context *cmd, int a, const uint64_t def);
+int64_t arg_int64_value(struct cmd_context *cmd, int a, const int64_t def);
uint64_t arg_uint64_value(struct cmd_context *cmd, int a, const uint64_t def);
const void *arg_ptr_value(struct cmd_context *cmd, int a, const void *def);
sign_t arg_sign_value(struct cmd_context *cmd, int a, const sign_t def);
diff --git a/tools/version.h.in b/tools/version.h.in
index 7ce441f6..a1227928 100644
--- a/tools/version.h.in
+++ b/tools/version.h.in
@@ -1 +1,3 @@
+#ifndef _LVM_VERSION_H
#define LVM_VERSION @LVM_VERSION@
+#endif
diff --git a/tools/vgchange.c b/tools/vgchange.c
index 6584560e..dd7c6181 100644
--- a/tools/vgchange.c
+++ b/tools/vgchange.c
@@ -114,7 +114,7 @@ static int _vgchange_alloc(struct cmd_context *cmd, struct volume_group *vg)
{
alloc_policy_t alloc;
- alloc = (alloc_policy_t) arg_uint_value(cmd, alloc_ARG, ALLOC_NORMAL);
+ alloc = arg_uint_value(cmd, alloc_ARG, ALLOC_NORMAL);
if (alloc == ALLOC_INHERIT) {
log_error("Volume Group allocation policy cannot inherit "
@@ -290,7 +290,7 @@ static int _vgchange_pesize(struct cmd_context *cmd, struct volume_group *vg)
if (extent_size == vg->extent_size) {
log_error("Physical extent size of VG %s is already %s",
- vg->name, display_size(cmd, extent_size, SIZE_SHORT));
+ vg->name, display_size(cmd, (uint64_t) extent_size));
return ECMD_PROCESSED;
}
@@ -367,7 +367,8 @@ static int _vgchange_tag(struct cmd_context *cmd, struct volume_group *vg,
return ECMD_PROCESSED;
}
-static int _vgchange_uuid(struct cmd_context *cmd, struct volume_group *vg)
+static int _vgchange_uuid(struct cmd_context *cmd __attribute((unused)),
+ struct volume_group *vg)
{
struct lv_list *lvl;
@@ -401,7 +402,7 @@ static int _vgchange_uuid(struct cmd_context *cmd, struct volume_group *vg)
static int vgchange_single(struct cmd_context *cmd, const char *vg_name,
struct volume_group *vg, int consistent,
- void *handle)
+ void *handle __attribute((unused)))
{
int r = ECMD_FAILED;
diff --git a/tools/vgck.c b/tools/vgck.c
index 52fdf1d5..42cd216d 100644
--- a/tools/vgck.c
+++ b/tools/vgck.c
@@ -15,8 +15,10 @@
#include "tools.h"
-static int vgck_single(struct cmd_context *cmd, const char *vg_name,
- struct volume_group *vg, int consistent, void *handle)
+static int vgck_single(struct cmd_context *cmd __attribute((unused)),
+ const char *vg_name,
+ struct volume_group *vg, int consistent,
+ void *handle __attribute((unused)))
{
if (!vg) {
log_error("Volume group \"%s\" not found", vg_name);
diff --git a/tools/vgconvert.c b/tools/vgconvert.c
index 4ebf4e94..ad81d01a 100644
--- a/tools/vgconvert.c
+++ b/tools/vgconvert.c
@@ -17,7 +17,7 @@
static int vgconvert_single(struct cmd_context *cmd, const char *vg_name,
struct volume_group *vg, int consistent,
- void *handle)
+ void *handle __attribute((unused)))
{
struct physical_volume *pv, *existing_pv;
struct logical_volume *lv;
diff --git a/tools/vgcreate.c b/tools/vgcreate.c
index d7ca9ff2..e79e85c4 100644
--- a/tools/vgcreate.c
+++ b/tools/vgcreate.c
@@ -41,7 +41,7 @@ int vgcreate(struct cmd_context *cmd, int argc, char **argv)
vg_name = argv[0];
max_lv = arg_uint_value(cmd, maxlogicalvolumes_ARG, 0);
max_pv = arg_uint_value(cmd, maxphysicalvolumes_ARG, 0);
- alloc = (alloc_policy_t) arg_uint_value(cmd, alloc_ARG, ALLOC_NORMAL);
+ alloc = arg_uint_value(cmd, alloc_ARG, ALLOC_NORMAL);
if (alloc == ALLOC_INHERIT) {
log_error("Volume Group allocation policy cannot inherit "
diff --git a/tools/vgdisplay.c b/tools/vgdisplay.c
index d5b42724..52390737 100644
--- a/tools/vgdisplay.c
+++ b/tools/vgdisplay.c
@@ -17,7 +17,7 @@
static int vgdisplay_single(struct cmd_context *cmd, const char *vg_name,
struct volume_group *vg, int consistent,
- void *handle)
+ void *handle __attribute((unused)))
{
/* FIXME Do the active check here if activevolumegroups_ARG ? */
if (!vg) {
diff --git a/tools/vgexport.c b/tools/vgexport.c
index bff93bb5..b1c498a1 100644
--- a/tools/vgexport.c
+++ b/tools/vgexport.c
@@ -15,9 +15,10 @@
#include "tools.h"
-static int vgexport_single(struct cmd_context *cmd, const char *vg_name,
+static int vgexport_single(struct cmd_context *cmd __attribute((unused)),
+ const char *vg_name,
struct volume_group *vg, int consistent,
- void *handle)
+ void *handle __attribute((unused)))
{
struct pv_list *pvl;
struct physical_volume *pv;
diff --git a/tools/vgimport.c b/tools/vgimport.c
index d95ef8d0..64a19b77 100644
--- a/tools/vgimport.c
+++ b/tools/vgimport.c
@@ -15,9 +15,10 @@
#include "tools.h"
-static int vgimport_single(struct cmd_context *cmd, const char *vg_name,
+static int vgimport_single(struct cmd_context *cmd __attribute((unused)),
+ const char *vg_name,
struct volume_group *vg, int consistent,
- void *handle)
+ void *handle __attribute((unused)))
{
struct pv_list *pvl;
struct physical_volume *pv;
diff --git a/tools/vgmknodes.c b/tools/vgmknodes.c
index 1cde8cad..2cfc88a5 100644
--- a/tools/vgmknodes.c
+++ b/tools/vgmknodes.c
@@ -16,7 +16,7 @@
#include "tools.h"
static int _vgmknodes_single(struct cmd_context *cmd, struct logical_volume *lv,
- void *handle)
+ void *handle __attribute((unused)))
{
if (!lv_mknodes(cmd, lv))
return ECMD_FAILED;
diff --git a/tools/vgreduce.c b/tools/vgreduce.c
index 0c535c81..c0f70aaf 100644
--- a/tools/vgreduce.c
+++ b/tools/vgreduce.c
@@ -157,7 +157,7 @@ static int _make_vg_consistent(struct cmd_context *cmd, struct volume_group *vg)
struct physical_volume *pv;
struct lv_segment *seg, *mirrored_seg;
struct lv_segment_area area;
- unsigned int s;
+ unsigned s;
uint32_t mimages;
int list_unsafe, only_mirror_images_found;
LIST_INIT(lvs_changed);
@@ -323,7 +323,8 @@ static int _make_vg_consistent(struct cmd_context *cmd, struct volume_group *vg)
/* Or take pv_name instead? */
static int _vgreduce_single(struct cmd_context *cmd, struct volume_group *vg,
- struct physical_volume *pv, void *handle)
+ struct physical_volume *pv,
+ void *handle __attribute((unused)))
{
struct pv_list *pvl;
const char *name = dev_name(pv->dev);
diff --git a/tools/vgremove.c b/tools/vgremove.c
index f68d892c..f350f1c5 100644
--- a/tools/vgremove.c
+++ b/tools/vgremove.c
@@ -17,7 +17,7 @@
static int vgremove_single(struct cmd_context *cmd, const char *vg_name,
struct volume_group *vg, int consistent,
- void *handle)
+ void *handle __attribute((unused)))
{
struct physical_volume *pv;
struct pv_list *pvl;
diff --git a/tools/vgrename.c b/tools/vgrename.c
index df62dbac..3facaf7e 100644
--- a/tools/vgrename.c
+++ b/tools/vgrename.c
@@ -18,7 +18,7 @@
int vgrename(struct cmd_context *cmd, int argc, char **argv)
{
char *dev_dir;
- unsigned int length;
+ unsigned length;
struct id id;
int consistent = 1;
int match = 0;
@@ -90,9 +90,9 @@ int vgrename(struct cmd_context *cmd, int argc, char **argv)
log_suppress(2);
found_id = id_read_format(&id, vg_name_old);
log_suppress(0);
- if (found_id && (vg_name = vgname_from_vgid(cmd->mem, id.uuid))) {
+ if (found_id && (vg_name = vgname_from_vgid(cmd->mem, (char *)id.uuid))) {
vg_name_old = vg_name;
- vgid = id.uuid;
+ vgid = (char *)id.uuid;
} else
vgid = NULL;
diff --git a/tools/vgscan.c b/tools/vgscan.c
index c020a12c..de2c106b 100644
--- a/tools/vgscan.c
+++ b/tools/vgscan.c
@@ -16,7 +16,8 @@
#include "tools.h"
static int vgscan_single(struct cmd_context *cmd, const char *vg_name,
- struct volume_group *vg, int consistent, void *handle)
+ struct volume_group *vg, int consistent,
+ void *handle __attribute((unused)))
{
if (!vg) {
log_error("Volume group \"%s\" not found", vg_name);
diff --git a/tools/vgsplit.c b/tools/vgsplit.c
index 02534780..42cecf68 100644
--- a/tools/vgsplit.c
+++ b/tools/vgsplit.c
@@ -64,7 +64,7 @@ static int _move_lvs(struct volume_group *vg_from, struct volume_group *vg_to)
struct lv_segment *seg;
struct physical_volume *pv;
struct volume_group *vg_with;
- unsigned int s;
+ unsigned s;
list_iterate_safe(lvh, lvht, &vg_from->lvs) {
lv = list_item(lvh, struct lv_list)->lv;