From 4c22730b5367b2a9fb54c47c6c63b12514270313 Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Wed, 20 Aug 2003 15:48:27 +0000 Subject: [PATCH] Some tidyups and minor fixes. --- lib/activate/dev_manager.c | 2 +- lib/format1/Makefile.in | 2 +- lib/format1/format1.c | 6 ++++-- lib/format1/format1.h | 2 -- lib/format1/lvm1-label.c | 4 +++- lib/format_text/format-text.c | 3 +++ lib/format_text/format-text.h | 3 --- lib/format_text/text_label.c | 8 +++---- lib/mm/memlock.c | 4 ++++ lib/mm/xlate.h | 40 +++++++++++++++++++++++------------ lib/uuid/uuid.c | 2 +- tools/pvmove.c | 11 ++++++---- 12 files changed, 54 insertions(+), 33 deletions(-) diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c index 8d37673b9..a7c9ba9c3 100644 --- a/lib/activate/dev_manager.c +++ b/lib/activate/dev_manager.c @@ -531,7 +531,7 @@ static int _percent_run(struct dev_manager *dm, const char *name, else *percent = 100; - log_debug("Mirror percent: %f", *percent); + log_debug("LV percent: %f", *percent); r = 1; out: diff --git a/lib/format1/Makefile.in b/lib/format1/Makefile.in index 5e52ffba8..21fc76b09 100644 --- a/lib/format1/Makefile.in +++ b/lib/format1/Makefile.in @@ -22,7 +22,7 @@ TARGETS=liblvm2format1.so include ../../make.tmpl -install: libformat1.so +install: liblvm2format1.so $(INSTALL) -D -o $(OWNER) -g $(GROUP) -m 555 $(STRIP) $< \ $(libdir)/liblvm2format1.so.$(LIB_VERSION) $(LN_S) -f liblvm2format1.so.$(LIB_VERSION) $(libdir)/liblvm2format1.so diff --git a/lib/format1/format1.c b/lib/format1/format1.c index 593ea8825..31c935793 100644 --- a/lib/format1/format1.c +++ b/lib/format1/format1.c @@ -16,6 +16,8 @@ #include "lvm1-label.h" #include "format1.h" +#define FMT_LVM1_NAME "lvm1" + /* VG consistency checks */ static int _check_vgs(struct list *pvs, int *partial) { @@ -75,9 +77,9 @@ static int _check_vgs(struct list *pvs, int *partial) } /* On entry to fn, list known to be non-empty */ - if (pv_count != dl->vgd.pv_cur) { + if (pv_count != first->vgd.pv_cur) { log_error("%d PV(s) found for VG %s: expected %d", - pv_count, dl->pvd.vg_name, dl->vgd.pv_cur); + pv_count, first->pvd.vg_name, first->vgd.pv_cur); if (!partial_mode()) return 0; *partial = 1; diff --git a/lib/format1/format1.h b/lib/format1/format1.h index 26be50757..a6d4c1b22 100644 --- a/lib/format1/format1.h +++ b/lib/format1/format1.h @@ -9,8 +9,6 @@ #include "metadata.h" -#define FMT_LVM1_NAME "lvm1" - #ifdef LVM1_INTERNAL struct format_type *init_lvm1_format(struct cmd_context *cmd); #endif diff --git a/lib/format1/lvm1-label.c b/lib/format1/lvm1-label.c index d801c48ca..9d7590618 100644 --- a/lib/format1/lvm1-label.c +++ b/lib/format1/lvm1-label.c @@ -52,8 +52,10 @@ static int _read(struct labeller *l, struct device *dev, char *buf, struct lvmcache_info *info; munge_exported_vg(pvd); - if (!(info = lvmcache_add(l, pvd->pv_uuid, dev, pvd->vg_name, NULL))) + if (!(info = lvmcache_add(l, pvd->pv_uuid, dev, pvd->vg_name, NULL))) { + stack; return 0; + } *label = info->label; info->device_size = xlate32(pvd->pv_size) << SECTOR_SHIFT; diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c index e3be7bb85..4ffe83f67 100644 --- a/lib/format_text/format-text.c +++ b/lib/format_text/format-text.c @@ -28,6 +28,9 @@ #include #include +#define FMT_TEXT_NAME "lvm2" +#define FMT_TEXT_ALIAS "text" + static struct format_instance *_create_text_instance(const struct format_type *fmt, const char *vgname, void *context); diff --git a/lib/format_text/format-text.h b/lib/format_text/format-text.h index dccc10e77..5abab7028 100644 --- a/lib/format_text/format-text.h +++ b/lib/format_text/format-text.h @@ -11,9 +11,6 @@ #include "metadata.h" #include "pool.h" -#define FMT_TEXT_NAME "lvm2" -#define FMT_TEXT_ALIAS "text" - /* * Archives a vg config. 'retain_days' is the minimum number of * days that an archive file must be held for. 'min_archives' is diff --git a/lib/format_text/text_label.c b/lib/format_text/text_label.c index e3dd09fdf..3022f13bb 100644 --- a/lib/format_text/text_label.c +++ b/lib/format_text/text_label.c @@ -56,8 +56,8 @@ static int _write(struct label *label, char *buf) } /* NULL-termination */ - pvh_dlocn_xl->offset = xlate64(0); - pvh_dlocn_xl->size = xlate64(0); + pvh_dlocn_xl->offset = xlate64(UINT64_C(0)); + pvh_dlocn_xl->size = xlate64(UINT64_C(0)); pvh_dlocn_xl++; /* List of metadata area header locations */ @@ -74,8 +74,8 @@ static int _write(struct label *label, char *buf) } /* NULL-termination */ - pvh_dlocn_xl->offset = xlate64(0); - pvh_dlocn_xl->size = xlate64(0); + pvh_dlocn_xl->offset = xlate64(UINT64_C(0)); + pvh_dlocn_xl->size = xlate64(UINT64_C(0)); return 1; } diff --git a/lib/mm/memlock.c b/lib/mm/memlock.c index 49d6c1a92..dc82ff7e6 100644 --- a/lib/mm/memlock.c +++ b/lib/mm/memlock.c @@ -30,6 +30,10 @@ int memlock(void) { return 0; } +void memlock_init(struct cmd_context *cmd) +{ + return; +} #else /* DEVMAPPER_SUPPORT */ diff --git a/lib/mm/xlate.h b/lib/mm/xlate.h index 05a9e5b52..36c05c68d 100644 --- a/lib/mm/xlate.h +++ b/lib/mm/xlate.h @@ -13,31 +13,43 @@ # define xlate16(x) __cpu_to_le16((x)) # define xlate32(x) __cpu_to_le32((x)) # define xlate64(x) __cpu_to_le64((x)) +# define xlate16_be(x) __cpu_to_be16((x)) +# define xlate32_be(x) __cpu_to_be32((x)) +# define xlate64_be(x) __cpu_to_be64((x)) #else # include # if !defined(BYTE_ORDER) || \ (BYTE_ORDER != BIG_ENDIAN && BYTE_ORDER != LITTLE_ENDIAN) # error "Undefined or unrecognised BYTE_ORDER"; # endif +# define __xlate16(x) (((x) & 0x00ffU) << 8 | \ + ((x) & 0xff00U) >> 8) +# define __xlate32(x) (((x) & 0x000000ffU) << 24 | \ + ((x) & 0xff000000U) >> 24 | \ + ((x) & 0x0000ff00U) << 8 | \ + ((x) & 0x00ff0000U) >> 8) +# define __xlate64(x) (((x) & 0x00000000000000ffU) << 56 | \ + ((x) & 0xff00000000000000U) >> 56 | \ + ((x) & 0x000000000000ff00U) << 40 | \ + ((x) & 0x00ff000000000000U) >> 40 | \ + ((x) & 0x0000000000ff0000U) << 24 | \ + ((x) & 0x0000ff0000000000U) >> 24 | \ + ((x) & 0x00000000ff000000U) << 8 | \ + ((x) & 0x000000ff00000000U) >> 8) # if BYTE_ORDER == LITTLE_ENDIAN # define xlate16(x) (x) # define xlate32(x) (x) # define xlate64(x) (x) +# define xlate16_be(x) __xlate16(x) +# define xlate32_be(x) __xlate32(x) +# define xlate64_be(x) __xlate64(x) # else -# define xlate16(x) (((x) & 0x00ffU) << 8 | \ - ((x) & 0xff00U) >> 8) -# define xlate32(x) (((x) & 0x000000ffU) << 24 | \ - ((x) & 0xff000000U) >> 24 | \ - ((x) & 0x0000ff00U) << 8 | \ - ((x) & 0x00ff0000U) >> 8) -# define xlate64(x) (((x) & 0x00000000000000ffU) << 56 | \ - ((x) & 0xff00000000000000U) >> 56 | \ - ((x) & 0x000000000000ff00U) << 40 | \ - ((x) & 0x00ff000000000000U) >> 40 | \ - ((x) & 0x0000000000ff0000U) << 24 | \ - ((x) & 0x0000ff0000000000U) >> 24 | \ - ((x) & 0x00000000ff000000U) << 8 | \ - ((x) & 0x000000ff00000000U) >> 8) +# define xlate16(x) __xlate16(x) +# define xlate32(x) __xlate32(x) +# define xlate64(x) __xlate64(x) +# define xlate16_be(x) (x) +# define xlate32_be(x) (x) +# define xlate64_be(x) (x) # endif #endif diff --git a/lib/uuid/uuid.c b/lib/uuid/uuid.c index 2f8068c40..7ff73301a 100644 --- a/lib/uuid/uuid.c +++ b/lib/uuid/uuid.c @@ -12,7 +12,7 @@ #include static unsigned char _c[] = - "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; + "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!#"; static int _built_inverse; static unsigned char _inverse_c[256]; diff --git a/tools/pvmove.c b/tools/pvmove.c index 7798082d4..cc80cea05 100644 --- a/tools/pvmove.c +++ b/tools/pvmove.c @@ -639,9 +639,11 @@ int pvmove_poll(struct cmd_context *cmd, const char *pv_name, log_verbose("Checking progress every %u seconds", parms.interval); - if (parms.interval == 0) { - parms.interval = DEFAULT_INTERVAL; + if (!parms.interval) { parms.progress_display = 0; + + if (!pv_name) + parms.interval = DEFAULT_INTERVAL; } if (parms.background) { @@ -669,8 +671,9 @@ int pvmove(struct cmd_context *cmd, int argc, char **argv) argc--; argv++; - if ((ret = _set_up_pvmove(cmd, pv_name, argc, argv)) != - ECMD_PROCESSED) { + if (!arg_count(cmd, abort_ARG) && + (ret = _set_up_pvmove(cmd, pv_name, argc, argv)) != + ECMD_PROCESSED) { stack; return ret; } -- 2.43.5