1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

o test program for reading a vg

This commit is contained in:
Joe Thornber 2001-10-08 08:47:27 +00:00
parent 25d42d50a8
commit d81ec60d19
6 changed files with 61 additions and 10 deletions

View File

@ -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

View File

@ -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;

View File

@ -2,7 +2,6 @@
* Copyright (C) 2001 Sistina Software (UK) Limited.
*
* This file is released under the GPL.
*
*/
#include "disk-rep.h"

View File

@ -2,7 +2,6 @@
* Copyright (C) 2001 Sistina Software (UK) Limited.
*
* This file is released under the GPL.
*
*/
#ifndef LVM_FORMAT1_H

View File

@ -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 */

View File

@ -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;
}