diff --git a/lib/Makefile.in b/lib/Makefile.in index 5deda011f..8e18895fc 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -14,6 +14,7 @@ SOURCES=\ dev-mgr/dev-cache.c \ device/dev-cache.c \ device/dev-io.c \ + format1/format1.c \ log/log.c \ mm/dbg_malloc.c \ mm/pool.c diff --git a/lib/format1/disk-rep.h b/lib/format1/disk-rep.h index 72ecaa6c7..3284c3590 100644 --- a/lib/format1/disk-rep.h +++ b/lib/format1/disk-rep.h @@ -101,6 +101,7 @@ struct lv_list { struct disk_list { struct device *dev; struct list_head list; + struct pv_disk pv; struct vg_disk vg; struct list_head uuids; diff --git a/lib/format1/format1.c b/lib/format1/format1.c index a93de0f96..c7351bb29 100644 --- a/lib/format1/format1.c +++ b/lib/format1/format1.c @@ -2,7 +2,6 @@ * Copyright (C) 2001 Sistina Software (UK) Limited. * * This file is released under the GPL. - * */ #include "disk-rep.h" diff --git a/lib/format1/format1.h b/lib/format1/format1.h index 44a3f87a9..2cfa4620c 100644 --- a/lib/format1/format1.h +++ b/lib/format1/format1.h @@ -2,7 +2,6 @@ * Copyright (C) 2001 Sistina Software (UK) Limited. * * This file is released under the GPL. - * */ #ifndef LVM_FORMAT1_H diff --git a/lib/metadata/metadata.h b/lib/metadata/metadata.h index 21d6035ae..096073107 100644 --- a/lib/metadata/metadata.h +++ b/lib/metadata/metadata.h @@ -117,18 +117,22 @@ struct pv_list { /* ownership of returned objects passes */ struct io_space { - /* Returns list of names of all vgs - vg component only, not full path*/ + /* Returns list of names of all vgs - vg + component only, not full path*/ struct name_list *(*get_vgs)(struct io_space *is); - /* Returns list of fully-populated pv structures */ + /* Returns list of fully-populated pv + structures */ struct pv_list *(*get_pvs)(struct io_space *is); - /* Return PV with given name (may be full or relative path) */ + /* Return PV with given name (may be full + or relative path) */ struct physical_volume *(*pv_read)(struct io_space *is, - const char *pv_name); + const char *pv_name); /* Write a PV structure to disk. */ - /* Fails if the PV is in a VG ie pv->vg_name must be null */ + /* Fails if the PV is in a VG ie + pv->vg_name must be null */ int (*pv_write)(struct io_space *is, struct physical_volume *pv); /* if vg_name doesn't contain any slash, this function adds prefix */ @@ -136,9 +140,9 @@ struct io_space { const char *vg_name); /* Write out complete VG metadata. */ - /* Ensure *internal* consistency before writing anything. - * eg. PEs can't refer to PVs not part of the VG - * Order write sequence to aid recovery if process is aborted + /* Ensure *internal* consistency before writing anything. + * eg. PEs can't refer to PVs not part of the VG + * Order write sequence to aid recovery if process is aborted * (eg flush entire set of changes to each disk in turn) * It is the responsibility of the caller to ensure external * consistency, eg by calling pv_write() if removing PVs from a VG diff --git a/old-tests/format1/read_vg_t.c b/old-tests/format1/read_vg_t.c new file mode 100644 index 000000000..cbe89c8af --- /dev/null +++ b/old-tests/format1/read_vg_t.c @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2001 Sistina Software (UK) Limited. + * + * This file is released under the GPL. + */ + +#include "log.h" +#include "format1.h" +#include + +int main(int argc, char **argv) +{ + struct io_space *ios; + struct volume_group *vg; + + if (argc != 2) { + fprintf(stderr, "usage: read_vg_t \n"); + exit(1); + } + + init_log(stderr); + init_debug(_LOG_DEBUG); + + if (!dev_cache_init()) { + fprintf(stderr, "init of dev-cache failed\n"); + exit(1); + } + + if (!dev_cache_add_dir("/dev")) { + fprintf(stderr, "couldn't add /dev to dir-cache\n"); + exit(1); + } + + ios = create_lvm_v1_format(NULL); + vg = ios->vg_read(ios, argv[1]); + + if (!vg) { + fprintf(stderr, "couldn't read vg %s\n", argv[1]); + exit(1); + } + + ios->destroy(ios); + + dump_memory(); + fin_log(); + return 0; +}