📄 lvm.h
字号:
#define LV_BADBLOCK_ON 0x01 /* lv_badblock */#define LV_STRICT 0x01 /* lv_allocation */#define LV_CONTIGUOUS 0x02 /* " *//* physical volume */#define PV_ACTIVE 0x01 /* pv_status */#define PV_ALLOCATABLE 0x02 /* pv_allocatable *//* misc */#define LVM_SNAPSHOT_DROPPED_SECTOR 1/* * Structure definitions core/disk follow * * conditional conversion takes place on big endian architectures * in functions * pv_copy_*(), vg_copy_*() and lv_copy_*() * */#define NAME_LEN 128 /* don't change!!! */#define UUID_LEN 32 /* don't change!!! *//* copy on write tables in disk format */typedef struct { uint64_t pv_org_number; uint64_t pv_org_rsector; uint64_t pv_snap_number; uint64_t pv_snap_rsector;} lv_COW_table_disk_v1_t;/* remap physical sector/rdev pairs including hash */typedef struct { struct list_head hash; uint32_t rsector_org; kdev_t rdev_org; uint32_t rsector_new; kdev_t rdev_new;} lv_block_exception_v1_t;/* disk stored pe information */typedef struct { uint16_t lv_num; uint16_t le_num;} pe_disk_t;/* disk stored PV, VG, LV and PE size and offset information */typedef struct { uint32_t base; uint32_t size;} lvm_disk_data_t;/* * Structure Physical Volume (PV) Version 1 *//* core */typedef struct { char id[2]; /* Identifier */ unsigned short version; /* HM lvm version */ lvm_disk_data_t pv_on_disk; lvm_disk_data_t vg_on_disk; lvm_disk_data_t pv_namelist_on_disk; lvm_disk_data_t lv_on_disk; lvm_disk_data_t pe_on_disk; char pv_name[NAME_LEN]; char vg_name[NAME_LEN]; char system_id[NAME_LEN]; /* for vgexport/vgimport */ kdev_t pv_dev; uint pv_number; uint pv_status; uint pv_allocatable; uint pv_size; /* HM */ uint lv_cur; uint pe_size; uint pe_total; uint pe_allocated; uint pe_stale; /* for future use */ pe_disk_t *pe; /* HM */ struct inode *inode; /* HM */} pv_v1_t;/* core */typedef struct { char id[2]; /* Identifier */ unsigned short version; /* HM lvm version */ lvm_disk_data_t pv_on_disk; lvm_disk_data_t vg_on_disk; lvm_disk_data_t pv_uuidlist_on_disk; lvm_disk_data_t lv_on_disk; lvm_disk_data_t pe_on_disk; char pv_name[NAME_LEN]; char vg_name[NAME_LEN]; char system_id[NAME_LEN]; /* for vgexport/vgimport */ kdev_t pv_dev; uint pv_number; uint pv_status; uint pv_allocatable; uint pv_size; /* HM */ uint lv_cur; uint pe_size; uint pe_total; uint pe_allocated; uint pe_stale; /* for future use */ pe_disk_t *pe; /* HM */ struct inode *inode; /* HM */ char pv_uuid[UUID_LEN+1];} pv_v2_t;/* disk */typedef struct { uint8_t id[2]; /* Identifier */ uint16_t version; /* HM lvm version */ lvm_disk_data_t pv_on_disk; lvm_disk_data_t vg_on_disk; lvm_disk_data_t pv_namelist_on_disk; lvm_disk_data_t lv_on_disk; lvm_disk_data_t pe_on_disk; uint8_t pv_name[NAME_LEN]; uint8_t vg_name[NAME_LEN]; uint8_t system_id[NAME_LEN]; /* for vgexport/vgimport */ uint32_t pv_major; uint32_t pv_number; uint32_t pv_status; uint32_t pv_allocatable; uint32_t pv_size; /* HM */ uint32_t lv_cur; uint32_t pe_size; uint32_t pe_total; uint32_t pe_allocated;} pv_disk_v1_t;/* disk */typedef struct { uint8_t id[2]; /* Identifier */ uint16_t version; /* HM lvm version */ lvm_disk_data_t pv_on_disk; lvm_disk_data_t vg_on_disk; lvm_disk_data_t pv_uuidlist_on_disk; lvm_disk_data_t lv_on_disk; lvm_disk_data_t pe_on_disk; uint8_t pv_uuid[NAME_LEN]; uint8_t vg_name[NAME_LEN]; uint8_t system_id[NAME_LEN]; /* for vgexport/vgimport */ uint32_t pv_major; uint32_t pv_number; uint32_t pv_status; uint32_t pv_allocatable; uint32_t pv_size; /* HM */ uint32_t lv_cur; uint32_t pe_size; uint32_t pe_total; uint32_t pe_allocated;} pv_disk_v2_t;/* * Structures for Logical Volume (LV) *//* core PE information */typedef struct { kdev_t dev; uint32_t pe; /* to be changed if > 2TB */ uint32_t reads; uint32_t writes;} pe_t;typedef struct { char lv_name[NAME_LEN]; kdev_t old_dev; kdev_t new_dev; uint32_t old_pe; uint32_t new_pe;} le_remap_req_t;typedef struct lv_bmap { uint32_t lv_block; dev_t lv_dev;} lv_bmap_t;/* * Structure Logical Volume (LV) Version 3 *//* core */typedef struct lv_v5 { char lv_name[NAME_LEN]; char vg_name[NAME_LEN]; uint lv_access; uint lv_status; uint lv_open; /* HM */ kdev_t lv_dev; /* HM */ uint lv_number; /* HM */ uint lv_mirror_copies; /* for future use */ uint lv_recovery; /* " */ uint lv_schedule; /* " */ uint lv_size; pe_t *lv_current_pe; /* HM */ uint lv_current_le; /* for future use */ uint lv_allocated_le; uint lv_stripes; uint lv_stripesize; uint lv_badblock; /* for future use */ uint lv_allocation; uint lv_io_timeout; /* for future use */ uint lv_read_ahead; /* delta to version 1 starts here */ struct lv_v5 *lv_snapshot_org; struct lv_v5 *lv_snapshot_prev; struct lv_v5 *lv_snapshot_next; lv_block_exception_t *lv_block_exception; uint lv_remap_ptr; uint lv_remap_end; uint lv_chunk_size; uint lv_snapshot_minor; char dummy[200];} lv_v5_t;/* disk */typedef struct { uint8_t lv_name[NAME_LEN]; uint8_t vg_name[NAME_LEN]; uint32_t lv_access; uint32_t lv_status; uint32_t lv_open; /* HM */ uint32_t lv_dev; /* HM */ uint32_t lv_number; /* HM */ uint32_t lv_mirror_copies; /* for future use */ uint32_t lv_recovery; /* " */ uint32_t lv_schedule; /* " */ uint32_t lv_size; uint32_t lv_snapshot_minor;/* minor number of original */ uint16_t lv_chunk_size; /* chunk size of snapshot */ uint16_t dummy; uint32_t lv_allocated_le; uint32_t lv_stripes; uint32_t lv_stripesize; uint32_t lv_badblock; /* for future use */ uint32_t lv_allocation; uint32_t lv_io_timeout; /* for future use */ uint32_t lv_read_ahead; /* HM */} lv_disk_v3_t;/* * Structure Volume Group (VG) Version 1 *//* core */typedef struct { char vg_name[NAME_LEN]; /* volume group name */ uint vg_number; /* volume group number */ uint vg_access; /* read/write */ uint vg_status; /* active or not */ uint lv_max; /* maximum logical volumes */ uint lv_cur; /* current logical volumes */ uint lv_open; /* open logical volumes */ uint pv_max; /* maximum physical volumes */ uint pv_cur; /* current physical volumes FU */ uint pv_act; /* active physical volumes */ uint dummy; /* was obsolete max_pe_per_pv */ uint vgda; /* volume group descriptor arrays FU */ uint pe_size; /* physical extent size in sectors */ uint pe_total; /* total of physical extents */ uint pe_allocated; /* allocated physical extents */ uint pvg_total; /* physical volume groups FU */ struct proc_dir_entry *proc; pv_t *pv[ABS_MAX_PV + 1]; /* physical volume struct pointers */ lv_t *lv[ABS_MAX_LV + 1]; /* logical volume struct pointers */} vg_v1_t;typedef struct { char vg_name[NAME_LEN]; /* volume group name */ uint vg_number; /* volume group number */ uint vg_access; /* read/write */ uint vg_status; /* active or not */ uint lv_max; /* maximum logical volumes */ uint lv_cur; /* current logical volumes */ uint lv_open; /* open logical volumes */ uint pv_max; /* maximum physical volumes */ uint pv_cur; /* current physical volumes FU */ uint pv_act; /* active physical volumes */ uint dummy; /* was obsolete max_pe_per_pv */ uint vgda; /* volume group descriptor arrays FU */ uint pe_size; /* physical extent size in sectors */ uint pe_total; /* total of physical extents */ uint pe_allocated; /* allocated physical extents */ uint pvg_total; /* physical volume groups FU */ struct proc_dir_entry *proc; pv_t *pv[ABS_MAX_PV + 1]; /* physical volume struct pointers */ lv_t *lv[ABS_MAX_LV + 1]; /* logical volume struct pointers */ char vg_uuid[UUID_LEN+1]; /* volume group UUID */ char dummy1[200];} vg_v3_t;/* disk */typedef struct { uint8_t vg_name[NAME_LEN]; /* volume group name */ uint32_t vg_number; /* volume group number */ uint32_t vg_access; /* read/write */ uint32_t vg_status; /* active or not */ uint32_t lv_max; /* maximum logical volumes */ uint32_t lv_cur; /* current logical volumes */ uint32_t lv_open; /* open logical volumes */ uint32_t pv_max; /* maximum physical volumes */ uint32_t pv_cur; /* current physical volumes FU */ uint32_t pv_act; /* active physical volumes */ uint32_t dummy; uint32_t vgda; /* volume group descriptor arrays FU */ uint32_t pe_size; /* physical extent size in sectors */ uint32_t pe_total; /* total of physical extents */ uint32_t pe_allocated; /* allocated physical extents */ uint32_t pvg_total; /* physical volume groups FU */} vg_disk_v1_t;typedef struct { uint8_t vg_uuid[UUID_LEN]; /* volume group UUID */ uint8_t vg_name_dummy[NAME_LEN-UUID_LEN]; /* rest of v1 VG name */ uint32_t vg_number; /* volume group number */ uint32_t vg_access; /* read/write */ uint32_t vg_status; /* active or not */ uint32_t lv_max; /* maximum logical volumes */ uint32_t lv_cur; /* current logical volumes */ uint32_t lv_open; /* open logical volumes */ uint32_t pv_max; /* maximum physical volumes */ uint32_t pv_cur; /* current physical volumes FU */ uint32_t pv_act; /* active physical volumes */ uint32_t dummy; uint32_t vgda; /* volume group descriptor arrays FU */ uint32_t pe_size; /* physical extent size in sectors */ uint32_t pe_total; /* total of physical extents */ uint32_t pe_allocated; /* allocated physical extents */ uint32_t pvg_total; /* physical volume groups FU */} vg_disk_v2_t;/* * Request structures for ioctls *//* Request structure PV_STATUS_BY_NAME... */typedef struct { char pv_name[NAME_LEN]; pv_t *pv;} pv_status_req_t, pv_change_req_t;/* Request structure PV_FLUSH */typedef struct { char pv_name[NAME_LEN]; kdev_t pv_dev;} pv_flush_req_t;/* Request structure PE_MOVE */typedef struct { enum { LOCK_PE, UNLOCK_PE } lock; struct { kdev_t lv_dev; kdev_t pv_dev; uint32_t pv_offset; } data;} pe_lock_req_t;/* Request structure LV_STATUS_BYNAME */typedef struct { char lv_name[NAME_LEN]; lv_t *lv;} lv_status_byname_req_t, lv_req_t;/* Request structure LV_STATUS_BYINDEX */typedef struct { uint32_t lv_index; lv_t *lv; /* Transfer size because user space and kernel space differ */ ushort size;} lv_status_byindex_req_t;/* Request structure LV_STATUS_BYDEV... */typedef struct { dev_t dev; lv_t *lv;} lv_status_bydev_req_t;/* Request structure LV_SNAPSHOT_USE_RATE */typedef struct { int block; int rate;} lv_snapshot_use_rate_req_t;#endif /* #ifndef _LVM_H_INCLUDE */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -