summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/Makefile.in1
-rw-r--r--lib/format1/disk-rep.h1
-rw-r--r--lib/format1/format1.c1
-rw-r--r--lib/format1/format1.h1
-rw-r--r--lib/metadata/metadata.h20
-rw-r--r--old-tests/format1/read_vg_t.c47
6 files changed, 61 insertions, 10 deletions
diff --git a/lib/Makefile.in b/lib/Makefile.in
index 5deda011..8e18895f 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 72ecaa6c..3284c359 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 a93de0f9..c7351bb2 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 44a3f87a..2cfa4620 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 21d6035a..09607310 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 00000000..cbe89c8a
--- /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 <stdio.h>
+
+int main(int argc, char **argv)
+{
+ struct io_space *ios;
+ struct volume_group *vg;
+
+ if (argc != 2) {
+ fprintf(stderr, "usage: read_vg_t <vg_name>\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;
+}