diff options
author | Joe Thornber <thornber@redhat.com> | 2001-10-09 08:58:52 +0000 |
---|---|---|
committer | Joe Thornber <thornber@redhat.com> | 2001-10-09 08:58:52 +0000 |
commit | 47bd29840ddc6c0a8753fd96a73ccd7da4ae7b5d (patch) | |
tree | b5f0af06577c1f725b04cd130040ab0c1430356e /old-tests | |
parent | 4c9c080e07f3d08b84ba011b2c1074c3e24439df (diff) | |
download | lvm2-47bd29840ddc6c0a8753fd96a73ccd7da4ae7b5d.tar.gz lvm2-47bd29840ddc6c0a8753fd96a73ccd7da4ae7b5d.tar.xz lvm2-47bd29840ddc6c0a8753fd96a73ccd7da4ae7b5d.zip |
o pv_Read works
Diffstat (limited to 'old-tests')
-rw-r--r-- | old-tests/format1/Makefile.in | 9 | ||||
-rw-r--r-- | old-tests/format1/read_pv_t.c | 73 |
2 files changed, 80 insertions, 2 deletions
diff --git a/old-tests/format1/Makefile.in b/old-tests/format1/Makefile.in index 978f0715..9461e10d 100644 --- a/old-tests/format1/Makefile.in +++ b/old-tests/format1/Makefile.in @@ -11,11 +11,13 @@ VPATH = @srcdir@ SOURCES=\ read_vg_t.c \ pretty_print.c \ - get_pvs_t.c + get_pvs_t.c \ + read_pv_t.c TARGETS=\ read_vg_t \ - get_pvs_t + get_pvs_t \ + read_pv_t include ../../make.tmpl @@ -25,3 +27,6 @@ read_vg_t: read_vg_t.o pretty_print.o $(top_srcdir)/lib/liblvm.a get_pvs_t: get_pvs_t.o pretty_print.o $(top_srcdir)/lib/liblvm.a $(CC) -o get_pvs_t get_pvs_t.o pretty_print.o -L$(top_srcdir)/lib -llvm +read_pv_t: read_pv_t.o pretty_print.o $(top_srcdir)/lib/liblvm.a + $(CC) -o read_pv_t read_pv_t.o pretty_print.o -L$(top_srcdir)/lib -llvm + diff --git a/old-tests/format1/read_pv_t.c b/old-tests/format1/read_pv_t.c new file mode 100644 index 00000000..991d3835 --- /dev/null +++ b/old-tests/format1/read_pv_t.c @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2001 Sistina Software (UK) Limited. + * + * This file is released under the GPL. + */ + +#include "log.h" +#include "format1.h" +#include "dbg_malloc.h" +#include "pool.h" +#include "pretty_print.h" +#include "list.h" + +#include <stdio.h> + +int main(int argc, char **argv) +{ + struct io_space *ios; + struct physical_volume *pv; + struct pool *mem; + struct device *dev; + + if (argc != 2) { + fprintf(stderr, "usage: read_pv_t <device>\n"); + exit(1); + } + + init_log(stderr); + init_debug(_LOG_INFO); + + if (!dev_cache_init()) { + fprintf(stderr, "init of dev-cache failed\n"); + exit(1); + } + + if (!dev_cache_add_dir("/dev/loop")) { + fprintf(stderr, "couldn't add /dev to dir-cache\n"); + exit(1); + } + + if (!(mem = pool_create(10 * 1024))) { + fprintf(stderr, "couldn't create pool\n"); + exit(1); + } + + ios = create_lvm1_format("/dev", mem, NULL); + + if (!ios) { + fprintf(stderr, "failed to create io_space for format1\n"); + exit(1); + } + + if (!(dev = dev_cache_get(argv[1], NULL))) { + fprintf(stderr, "couldn't get device %s\n", argv[1]); + exit(1); + } + + pv = ios->pv_read(ios, dev); + + if (!pv) { + fprintf(stderr, "couldn't read pv %s\n", dev->name); + exit(1); + } + + dump_pv(pv, stdout); + ios->destroy(ios); + + pool_destroy(mem); + dev_cache_exit(); + dump_memory(); + fin_log(); + return 0; +} |