mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
o change pv_read to take a name rather than a device
This commit is contained in:
parent
f2473d0efe
commit
b1713d284d
40
lib/activate/activate.c
Normal file
40
lib/activate/activate.c
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (C) 2001 Sistina Software (UK) Limited.
|
||||
*
|
||||
* This file is released under the GPL.
|
||||
*/
|
||||
|
||||
#include "activate.h"
|
||||
|
||||
struct kernel_interface {
|
||||
int already_mounted;
|
||||
char *mount_point;
|
||||
};
|
||||
|
||||
/*
|
||||
* Checks that device mapper has been compiled into the kernel.
|
||||
*/
|
||||
int _check_kernel(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int _find_mountpoint(char *buffer, int len)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
int _
|
||||
|
||||
int vg_activate(struct volume_group *vg)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int lv_activate(struct volume_group *vg, struct logical_volume *lv)
|
||||
{
|
||||
|
||||
}
|
||||
|
13
lib/activate/activate.h
Normal file
13
lib/activate/activate.h
Normal file
@ -0,0 +1,13 @@
|
||||
/*
|
||||
* Copyright (C) 2001 Sistina Software (UK) Limited.
|
||||
*
|
||||
* This file is released under the GPL.
|
||||
*/
|
||||
|
||||
#ifndef ACTIVATE_H
|
||||
#define ACTIVATE_H
|
||||
|
||||
int vg_activate(struct volume_group *vg);
|
||||
int lv_activate(struct volume_group *vg, struct logical_volume *lv);
|
||||
|
||||
#endif
|
@ -166,17 +166,23 @@ static int _vg_write(struct io_space *is, struct volume_group *vg)
|
||||
}
|
||||
|
||||
static struct physical_volume *_pv_read(struct io_space *is,
|
||||
struct device *dev)
|
||||
const char *name)
|
||||
{
|
||||
struct pool *mem = pool_create(1024);
|
||||
struct physical_volume *pv;
|
||||
struct disk_list *dl;
|
||||
struct device *dev;
|
||||
|
||||
if (!mem) {
|
||||
stack;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!(dev = dev_cache_get(name, is->filter))) {
|
||||
stack;
|
||||
goto bad;
|
||||
}
|
||||
|
||||
if (!(dl = read_pv(dev, mem, NULL))) {
|
||||
stack;
|
||||
goto bad;
|
||||
|
@ -132,7 +132,7 @@ struct io_space {
|
||||
/* Return PV with given name (may be full
|
||||
or relative path) */
|
||||
struct physical_volume *(*pv_read)(struct io_space *is,
|
||||
struct device *dev);
|
||||
const char *name);
|
||||
|
||||
/* Write a PV structure to disk. */
|
||||
/* Fails if the PV is in a VG ie
|
||||
|
@ -50,12 +50,7 @@ int main(int argc, char **argv)
|
||||
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);
|
||||
pv = ios->pv_read(ios, argv[1]);
|
||||
|
||||
if (!pv) {
|
||||
fprintf(stderr, "couldn't read pv %s\n", dev->name);
|
||||
|
@ -31,7 +31,7 @@ int main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!dev_cache_add_dir("/dev/loop")) {
|
||||
if (!dev_cache_add_dir("/dev/")) {
|
||||
fprintf(stderr, "couldn't add /dev to dir-cache\n");
|
||||
exit(1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user