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

o _read_id function for import.c

This commit is contained in:
Joe Thornber 2002-01-10 18:12:26 +00:00
parent 7e56005011
commit c6cc24ea3f
6 changed files with 30 additions and 8 deletions

View File

@ -34,7 +34,6 @@ SOURCES=\
format_text/flags.c \
format_text/format-text.c \
format_text/import.c \
label/label.c \
log/log.c \
metadata/lv_manip.c \
metadata/merge.c \

View File

@ -7,6 +7,7 @@
#include "import-export.h"
#include "pool.h"
#include "log.h"
#include "uuid.h"
typedef int (*section_fn)(struct pool *mem,
@ -19,6 +20,29 @@ typedef int (*section_fn)(struct pool *mem,
#define _read_int64(root, path, result) \
get_config_uint64(root, path, '/', result)
static int _read_id(struct id *id, struct config_node *cn, const char *path)
{
struct config_value *cv;
if (!(cn = find_config_node(cn, path, '/'))) {
log_err("Couldn't find uuid.");
return 0;
}
cv = cn->v;
if (!cv || !cv->v.str) {
log_err("uuid must be a string.");
return 0;
}
if (!id_read_format(id, cv->v.str)) {
log_err("Invalid uuid.");
return 0;
}
return 1;
}
static int _read_pv(struct pool *mem,
struct volume_group *vg, struct config_node *pvn,
struct config_node *vgn)
@ -34,12 +58,10 @@ static int _read_pv(struct pool *mem,
pv = &pvl->pv;
/******** FIXME _read_id undefined
if (!_read_id(&pv->id, vgn, "id")) {
log_err("Couldn't read uuid for volume group.");
return 0;
}
*************/
/*
* FIXME: need label/vgcache code to convert the uuid
@ -167,14 +189,14 @@ static int _read_segment(struct pool *mem, struct volume_group *vg,
return 0;
}
/**********FIXME _find_pv undefined
#if 0
if (!(pv = _find_pv(cv->v.str, pv_hash))) {
log_err("Couldn't find physical volume (%s) for "
"segment '%s'.",
cn->v->v.str ? cn->v->v.str : "NULL", sn->key);
return 0;
}
*******************/
#endif
seg->area[s].pv = pv;

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2001 Sistina Software
* Copyright (C) 2002 Sistina Software
*
* This file is released under the LGPL.
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2001 Sistina Software (UK) Limited.
* Copyright (C) 2002 Sistina Software (UK) Limited.
*
* This file is released under the LGPL.
*/

View File

@ -5,6 +5,7 @@
*/
#include "log.h"
#include "metadata.h"
/*
* Returns success if the segments were