summaryrefslogtreecommitdiffstats
path: root/old-tests/format1/read_vg_t.c
blob: cbe89c8af6d7ad43a112d5131a362d9c53e795dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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;
}