~ubuntu-branches/ubuntu/breezy/lvm2/breezy

« back to all changes in this revision

Viewing changes to test/format1/get_pvs_t.c

  • Committer: Bazaar Package Importer
  • Author(s): Patrick Caulfield
  • Date: 2004-11-03 09:37:56 UTC
  • Revision ID: james.westby@ubuntu.com-20041103093756-jt0nj8z0v8k1lyiv
Tags: upstream-2.00.25
ImportĀ upstreamĀ versionĀ 2.00.25

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
 
3
 * Copyright (C) 2004 Red Hat, Inc. All rights reserved.
 
4
 *
 
5
 * This file is part of LVM2.
 
6
 *
 
7
 * This copyrighted material is made available to anyone wishing to use,
 
8
 * modify, copy, or redistribute it subject to the terms and conditions
 
9
 * of the GNU General Public License v.2.
 
10
 *
 
11
 * You should have received a copy of the GNU General Public License
 
12
 * along with this program; if not, write to the Free Software Foundation,
 
13
 * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
14
 */
 
15
 
 
16
#include "log.h"
 
17
#include "format1.h"
 
18
#include "dbg_malloc.h"
 
19
#include "pool.h"
 
20
#include "pretty_print.h"
 
21
#include "list.h"
 
22
 
 
23
#include <stdio.h>
 
24
 
 
25
int main(int argc, char **argv)
 
26
{
 
27
        struct io_space *ios;
 
28
        struct list_head *pvs, *tmp;
 
29
        struct pool *mem;
 
30
 
 
31
        init_log(stderr);
 
32
        init_debug(_LOG_INFO);
 
33
 
 
34
        if (!dev_cache_init()) {
 
35
                fprintf(stderr, "init of dev-cache failed\n");
 
36
                exit(1);
 
37
        }
 
38
 
 
39
        if (!dev_cache_add_dir("/dev/loop")) {
 
40
                fprintf(stderr, "couldn't add /dev to dir-cache\n");
 
41
                exit(1);
 
42
        }
 
43
 
 
44
        if (!(mem = pool_create(10 * 1024))) {
 
45
                fprintf(stderr, "couldn't create pool\n");
 
46
                exit(1);
 
47
        }
 
48
 
 
49
        ios = create_lvm1_format("/dev", mem, NULL);
 
50
 
 
51
        if (!ios) {
 
52
                fprintf(stderr, "failed to create io_space for format1\n");
 
53
                exit(1);
 
54
        }
 
55
 
 
56
        pvs = ios->get_pvs(ios);
 
57
 
 
58
        if (!pvs) {
 
59
                fprintf(stderr, "couldn't read vg %s\n", argv[1]);
 
60
                exit(1);
 
61
        }
 
62
 
 
63
        list_for_each(tmp, pvs) {
 
64
                struct pv_list *pvl = list_entry(tmp, struct pv_list, list);
 
65
                dump_pv(&pvl->pv, stdout);
 
66
        }
 
67
 
 
68
        ios->destroy(ios);
 
69
 
 
70
        pool_destroy(mem);
 
71
        dev_cache_exit();
 
72
        dump_memory();
 
73
        fin_log();
 
74
        return 0;
 
75
}