mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
e6efb2b0bd
seems to be having trouble with the dependencies. o removed some files from the lib makefile that don't compile yet.
168 lines
3.8 KiB
C
168 lines
3.8 KiB
C
/*
|
|
* Copyright (C) 2001 Sistina Software
|
|
*
|
|
* This file is released under the GPL.
|
|
*
|
|
* This is the in core representation of a volume group and its
|
|
* associated physical and logical volumes.
|
|
*/
|
|
|
|
#ifndef _LVM_METADATA_H
|
|
#define _LVM_METADATA_H
|
|
|
|
#include <sys/types.h>
|
|
#include "dev-cache.h"
|
|
#include "list.h"
|
|
#include "lvm-types.h"
|
|
|
|
|
|
#define ID_LEN 32
|
|
#define NAME_LEN 128
|
|
|
|
/* Various flags */
|
|
/* Note that the bits no longer necessarily correspond to LVM1 disk format */
|
|
|
|
#define STATUS_ACTIVE 0x01 /* PV VG LV */
|
|
|
|
#define STATUS_EXPORTED 0x02 /* VG */
|
|
#define STATUS_EXTENDABLE 0x04 /* VG */
|
|
|
|
#define STATUS_ALLOCATED 0x02 /* PV */
|
|
|
|
#define STATUS_SPINDOWN 0x02 /* LV */
|
|
#define STATUS_BADBLOCK_ON 0x04 /* LV */
|
|
#define STATUS_ALLOC_STRICT 0x08 /* LV */
|
|
#define STATUS_ALLOC_CONTIGUOUS 0x10 /* LV */
|
|
|
|
#define ACCESS_READ 0x01 /* LV VG */
|
|
#define ACCESS_WRITE 0x02 /* LV VG */
|
|
|
|
#define ACCESS_SNAPSHOT 0x04 /* LV */
|
|
#define ACCESS_SNAPSHOT_ORG 0x08 /* LV */
|
|
|
|
#define ACCESS_CLUSTERED 0x04 /* VG */
|
|
#define ACCESS_SHARED 0x08 /* VG */
|
|
|
|
|
|
|
|
#define EXPORTED_TAG "PV_EXP" /* Identifier of exported PV */
|
|
#define IMPORTED_TAG "PV_IMP" /* Identifier of imported PV */
|
|
|
|
|
|
|
|
struct id {
|
|
uint8_t uuid[ID_LEN];
|
|
};
|
|
|
|
struct physical_volume {
|
|
struct id *id;
|
|
struct device *dev;
|
|
char *vg_name;
|
|
char *exported;
|
|
|
|
uint32_t status;
|
|
uint64_t size;
|
|
|
|
/* physical extents */
|
|
uint64_t pe_size;
|
|
uint64_t pe_start;
|
|
uint32_t pe_count;
|
|
uint32_t pe_allocated;
|
|
};
|
|
|
|
struct pe_specifier {
|
|
struct physical_volume *pv;
|
|
uint32_t pe;
|
|
};
|
|
|
|
struct logical_volume {
|
|
/* disk */
|
|
struct id *id;
|
|
char *name;
|
|
|
|
uint32_t access;
|
|
uint32_t status;
|
|
uint32_t open;
|
|
|
|
uint64_t size;
|
|
uint32_t le_count;
|
|
|
|
/* le -> pe mapping array */
|
|
struct pe_specifier *map;
|
|
};
|
|
|
|
struct volume_group {
|
|
struct id *id;
|
|
char *name;
|
|
|
|
uint32_t status;
|
|
uint32_t access;
|
|
|
|
uint64_t extent_size;
|
|
uint32_t extent_count;
|
|
uint32_t free_count;
|
|
|
|
uint32_t max_lv;
|
|
uint32_t max_pv;
|
|
|
|
/* physical volumes */
|
|
uint32_t pv_count;
|
|
struct physical_volume **pv;
|
|
|
|
/* logical volumes */
|
|
uint32_t lv_count;
|
|
struct logical_volume **lv;
|
|
};
|
|
|
|
struct string_list {
|
|
struct list_head list;
|
|
char * string;
|
|
};
|
|
|
|
struct pv_list {
|
|
struct list_head list;
|
|
struct physical_volume pv;
|
|
};
|
|
|
|
/* ownership of returned objects passes */
|
|
struct io_space {
|
|
struct string_list *(*get_vgs)(struct io_space *is);
|
|
struct pv_list *(*get_pvs)(struct io_space *is);
|
|
|
|
struct physical_volume *(*pv_read)(struct io_space *is,
|
|
struct device *dev);
|
|
int (*pv_write)(struct io_space *is, struct physical_volume *pv);
|
|
|
|
struct volume_group *(*vg_read)(struct io_space *is,
|
|
const char *vg_name);
|
|
int (*vg_write)(struct io_space *is, struct volume_group *vg);
|
|
void (*destroy)(struct io_space *is);
|
|
|
|
struct dev_filter *filter;
|
|
void *private;
|
|
};
|
|
|
|
/* FIXME: Move to other files */
|
|
struct io_space *create_text_format(struct dev_filter *filter,
|
|
const char *text_file);
|
|
struct io_space *create_lvm_v1_format(struct dev_filter *filter);
|
|
|
|
int id_eq(struct id *op1, struct id *op2);
|
|
|
|
struct volume_group *vg_create();
|
|
struct physical_volume *pv_create();
|
|
|
|
int vg_destroy(struct volume_group *vg);
|
|
|
|
int pv_add(struct volume_group *vg, struct physical_volume *pv);
|
|
int pv_remove(struct volume_group *vg, struct physical_volume *pv);
|
|
struct physical_volume *pv_find(struct volume_group *vg,
|
|
const char *pv_name);
|
|
|
|
int lv_add(struct volume_group *vg, struct logical_volume *lv);
|
|
int lv_remove(struct volume_group *vg, struct logical_volume *lv);
|
|
struct logical_volume *lv_find(struct volume_group *vg,
|
|
const char *lv_name);
|
|
|
|
#endif
|