From f868d63582d5964fe2e3cbfd40362b31333d754b Mon Sep 17 00:00:00 2001 From: Joe Thornber Date: Mon, 21 Jan 2002 16:49:32 +0000 Subject: [PATCH] o Similar changes for lv_list. --- lib/activate/activate.c | 12 ++++-------- lib/format1/import-export.c | 13 +++++++------ lib/format1/import-extents.c | 6 +++--- lib/format_text/export.c | 2 +- lib/format_text/import.c | 5 +++-- lib/metadata/lv_manip.c | 4 ++-- lib/metadata/metadata.c | 4 ++-- lib/metadata/metadata.h | 2 +- lib/metadata/pv_map.c | 2 +- tools/lvcreate.c | 1 - tools/lvrename.c | 2 +- tools/lvresize.c | 2 +- tools/toollib.c | 4 ++-- tools/vgmerge.c | 9 ++++++--- 14 files changed, 34 insertions(+), 34 deletions(-) diff --git a/lib/activate/activate.c b/lib/activate/activate.c index d8890dfac..87fba63c7 100644 --- a/lib/activate/activate.c +++ b/lib/activate/activate.c @@ -374,8 +374,7 @@ int activate_lvs_in_vg(struct volume_group *vg) int count = 0; list_iterate(lvh, &vg->lvs) { - lv = &(list_item(lvh, struct lv_list)->lv); - + lv = list_item(lvh, struct lv_list)->lv; count += (!lv_active(lv) && lv_activate(lv)); } @@ -405,8 +404,7 @@ int deactivate_lvs_in_vg(struct volume_group *vg) int count = 0; list_iterate(lvh, &vg->lvs) { - lv = &(list_item(lvh, struct lv_list)->lv); - + lv = list_item(lvh, struct lv_list)->lv; count += ((lv_active(lv) == 1) && lv_deactivate(lv)); } @@ -420,8 +418,7 @@ int lvs_in_vg_activated(struct volume_group *vg) int count = 0; list_iterate(lvh, &vg->lvs) { - lv = &(list_item(lvh, struct lv_list)->lv); - + lv = list_item(lvh, struct lv_list)->lv; count += (lv_active(lv) == 1); } @@ -435,8 +432,7 @@ int lvs_in_vg_opened(struct volume_group *vg) int count = 0; list_iterate(lvh, &vg->lvs) { - lv = &(list_item(lvh, struct lv_list)->lv); - + lv = list_item(lvh, struct lv_list)->lv; count += (lv_open_count(lv) == 1); } diff --git a/lib/format1/import-export.c b/lib/format1/import-export.c index 91bdb2af3..307d8432b 100644 --- a/lib/format1/import-export.c +++ b/lib/format1/import-export.c @@ -341,16 +341,17 @@ static struct logical_volume *_add_lv(struct pool *mem, struct volume_group *vg, struct lv_disk *lvd) { - struct lv_list *ll = pool_zalloc(mem, sizeof(*ll)); + struct lv_list *ll; struct logical_volume *lv; - if (!ll) { + if (!(ll = pool_zalloc(mem, sizeof(*ll))) || + !(ll->lv = pool_zalloc(mem, sizeof(*ll->lv)))) { stack; return NULL; } - lv = &ll->lv; + lv = ll->lv; - if (!import_lv(mem, &ll->lv, lvd)) { + if (!import_lv(mem, lv, lvd)) { stack; return NULL; } @@ -413,9 +414,9 @@ int export_lvs(struct disk_list *dl, struct volume_group *vg, return 0; } - export_lv(&lvdl->lvd, vg, &ll->lv, dev_dir); + export_lv(&lvdl->lvd, vg, ll->lv, dev_dir); lvdl->lvd.lv_number = lv_num; - if (!export_extents(dl, lv_num + 1, &ll->lv, pv)) { + if (!export_extents(dl, lv_num + 1, ll->lv, pv)) { stack; return 0; } diff --git a/lib/format1/import-extents.c b/lib/format1/import-extents.c index 9140d3c23..eda97966f 100644 --- a/lib/format1/import-extents.c +++ b/lib/format1/import-extents.c @@ -55,14 +55,14 @@ static struct hash_table *_create_lv_maps(struct pool *mem, goto bad; } - lvm->lv = &ll->lv; + lvm->lv = ll->lv; if (!(lvm->map = pool_zalloc(mem, sizeof(*lvm->map) - * ll->lv.le_count))) { + * ll->lv->le_count))) { stack; goto bad; } - if (!hash_insert(maps, ll->lv.name, lvm)) { + if (!hash_insert(maps, ll->lv->name, lvm)) { stack; goto bad; } diff --git a/lib/format_text/export.c b/lib/format_text/export.c index 923f7afbb..2b3393ede 100644 --- a/lib/format_text/export.c +++ b/lib/format_text/export.c @@ -334,7 +334,7 @@ static int _print_lvs(struct formatter *f, struct volume_group *vg) _inc_indent(f); list_iterate (lvh, &vg->lvs) { - lv = &list_item(lvh, struct lv_list)->lv; + lv = list_item(lvh, struct lv_list)->lv; _out(f, "%s {", lv->name); _inc_indent(f); diff --git a/lib/format_text/import.c b/lib/format_text/import.c index bb85c34f0..de8795b9e 100644 --- a/lib/format_text/import.c +++ b/lib/format_text/import.c @@ -339,12 +339,13 @@ static int _read_lv(struct pool *mem, struct lv_list *lvl; struct config_node *cn; - if (!(lvl = pool_zalloc(mem, sizeof(*lvl)))) { + if (!(lvl = pool_zalloc(mem, sizeof(*lvl))) || + !(lvl->lv = pool_zalloc(mem, sizeof(*lvl->lv)))) { stack; return 0; } - lv = &lvl->lv; + lv = lvl->lv; if (!(lv->name = pool_strdup(mem, lvn->key))) { stack; diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c index 19a3bd9c2..13a1712c2 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c @@ -345,7 +345,7 @@ static char *_generate_lv_name(struct volume_group *vg, int high = -1, i; list_iterate(lvh, &vg->lvs) { - lv = &(list_item(lvh, struct lv_list)->lv); + lv = (list_item(lvh, struct lv_list)->lv); if (sscanf(lv->name, "lvol%d", &i) != 1) continue; @@ -413,7 +413,7 @@ struct logical_volume *lv_create(const char *name, list_init(&ll->list); - lv = &ll->lv; + lv = ll->lv; strcpy(lv->id.uuid, ""); diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c index 332e3c019..13a41630d 100644 --- a/lib/metadata/metadata.c +++ b/lib/metadata/metadata.c @@ -262,7 +262,7 @@ struct lv_list *find_lv_in_vg(struct volume_group *vg, const char *lv_name) list_iterate(lvh, &vg->lvs) { lvl = list_item(lvh, struct lv_list); - if (!strcmp(lvl->lv.name, ptr)) + if (!strcmp(lvl->lv->name, ptr)) return lvl; } @@ -272,7 +272,7 @@ struct lv_list *find_lv_in_vg(struct volume_group *vg, const char *lv_name) struct logical_volume *find_lv(struct volume_group *vg, const char *lv_name) { struct lv_list *lvl = find_lv_in_vg(vg, lv_name); - return lvl ? &lvl->lv : NULL; + return lvl ? lvl->lv : NULL; } struct physical_volume *find_pv(struct volume_group *vg, struct device *dev) diff --git a/lib/metadata/metadata.h b/lib/metadata/metadata.h index b129ac8ad..0b222ef0c 100644 --- a/lib/metadata/metadata.h +++ b/lib/metadata/metadata.h @@ -140,7 +140,7 @@ struct pv_list { struct lv_list { struct list list; - struct logical_volume lv; + struct logical_volume *lv; }; struct cmd_context { diff --git a/lib/metadata/pv_map.c b/lib/metadata/pv_map.c index 67fed4be6..11b8d5f51 100644 --- a/lib/metadata/pv_map.c +++ b/lib/metadata/pv_map.c @@ -92,7 +92,7 @@ static int _fill_bitsets(struct volume_group *vg, struct list *maps) /* iterate through all the lv's setting bit's for used pe's */ list_iterate (lvh, &vg->lvs) { - lv = &(list_item(lvh, struct lv_list)->lv); + lv = list_item(lvh, struct lv_list)->lv; list_iterate (segh, &lv->segments) { seg = list_item(segh, struct stripe_segment); diff --git a/tools/lvcreate.c b/tools/lvcreate.c index 0a5be7e27..89106f46c 100644 --- a/tools/lvcreate.c +++ b/tools/lvcreate.c @@ -24,7 +24,6 @@ int lvcreate(int argc, char **argv) struct volume_group *vg; struct logical_volume *lv; struct list *pvh; - struct pv_list *pvl; char *lv_name = NULL; char *vg_name; char *st; diff --git a/tools/lvrename.c b/tools/lvrename.c index 5405e3577..15f5257b2 100644 --- a/tools/lvrename.c +++ b/tools/lvrename.c @@ -102,7 +102,7 @@ int lvrename(int argc, char **argv) return ECMD_FAILED; } - lv = &lvl->lv; + lv = lvl->lv; if (!archive(lv->vg)) return ECMD_FAILED; diff --git a/tools/lvresize.c b/tools/lvresize.c index 6adb20eb9..b828f7a51 100644 --- a/tools/lvresize.c +++ b/tools/lvresize.c @@ -114,7 +114,7 @@ int lvresize(int argc, char **argv) return ECMD_FAILED; } - lv = &lvl->lv; + lv = lvl->lv; if (size) { /* No of 512-byte sectors */ diff --git a/tools/toollib.c b/tools/toollib.c index 725800b7f..7a1c4de8f 100644 --- a/tools/toollib.c +++ b/tools/toollib.c @@ -46,7 +46,7 @@ int process_each_lv_in_vg(struct volume_group *vg, return ECMD_FAILED; } list_iterate(lvh, &vg->lvs) { - lv = &list_item(lvh, struct lv_list)->lv; + lv = list_item(lvh, struct lv_list)->lv; ret = process_single(lv); if (ret > ret_max) ret_max = ret; @@ -101,7 +101,7 @@ int process_each_lv(int argc, char **argv, continue; } - lv = &lvl->lv; + lv = lvl->lv; if ((ret = process_single(lv)) > ret_max) ret_max = ret; diff --git a/tools/vgmerge.c b/tools/vgmerge.c index 170e725a8..08c98d92e 100644 --- a/tools/vgmerge.c +++ b/tools/vgmerge.c @@ -70,7 +70,7 @@ int vgmerge_single(const char *vg_name_to, const char *vg_name_from) } if ((active = lvs_in_vg_activated(vg_from))) { - log_error("Logical volumes in %s must be inactive", + log_error("Logical volumes in %s must be inactive", vg_name_from); return ECMD_FAILED; } @@ -100,8 +100,11 @@ int vgmerge_single(const char *vg_name_to, const char *vg_name_from) /* Check no conflicts with LV names */ list_iterate(lvh1, &vg_to->lvs) { list_iterate(lvh2, &vg_from->lvs) { - char *name1 = list_item(lvh1, struct lv_list)->lv.name; - char *name2 = list_item(lvh2, struct lv_list)->lv.name; + char *name1 = list_item(lvh1, + struct lv_list)->lv->name; + + char *name2 = list_item(lvh2, + struct lv_list)->lv->name; if (!strcmp(name1, name2)) { log_error("Duplicate logical volume name %s " "in %s and %s", name1, vg_to->name,