⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lvm.h

📁 这是linux内核C源代码58的源程序
💻 H
📖 第 1 页 / 共 2 页
字号:
/* * include/linux/lvm.h * kernel/lvm.h * tools/lib/lvm.h * * Copyright (C) 1997 - 2000  Heinz Mauelshagen, Sistina Software * * February-November 1997 * May-July 1998 * January-March,July,September,October,Dezember 1999 * January,February,July,November 2000 * January 2001 * * lvm is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. *  * lvm is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. *  * You should have received a copy of the GNU General Public License * along with GNU CC; see the file COPYING.  If not, write to * the Free Software Foundation, 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA.  * *//* * Changelog * *    10/10/1997 - beginning of new structure creation *    12/05/1998 - incorporated structures from lvm_v1.h and deleted lvm_v1.h *    07/06/1998 - avoided LVM_KMALLOC_MAX define by using vmalloc/vfree *                 instead of kmalloc/kfree *    01/07/1998 - fixed wrong LVM_MAX_SIZE *    07/07/1998 - extended pe_t structure by ios member (for statistic) *    02/08/1998 - changes for official char/block major numbers *    07/08/1998 - avoided init_module() and cleanup_module() to be static *    29/08/1998 - seprated core and disk structure type definitions *    01/09/1998 - merged kernel integration version (mike) *    20/01/1999 - added LVM_PE_DISK_OFFSET macro for use in *                 vg_read_with_pv_and_lv(), pv_move_pe(), pv_show_pe_text()... *    18/02/1999 - added definition of time_disk_t structure for; *                 keeps time stamps on disk for nonatomic writes (future) *    15/03/1999 - corrected LV() and VG() macro definition to use argument *                 instead of minor *    03/07/1999 - define for genhd.c name handling *    23/07/1999 - implemented snapshot part *    08/12/1999 - changed LVM_LV_SIZE_MAX macro to reflect current 1TB limit *    01/01/2000 - extended lv_v2 core structure by wait_queue member *    12/02/2000 - integrated Andrea Arcagnelli's snapshot work *    14/02/2001 - changed LVM_SNAPSHOT_MIN_CHUNK to 1 page *    18/02/2000 - seperated user and kernel space parts by  *                 #ifdef them with __KERNEL__ *    08/03/2000 - implemented cluster/shared bits for vg_access *    26/06/2000 - implemented snapshot persistency and resizing support *    02/11/2000 - added hash table size member to lv structure *    12/11/2000 - removed unneeded timestamp definitions *    24/12/2000 - removed LVM_TO_{CORE,DISK}*, use cpu_{from, to}_le* *                 instead - Christoph Hellwig *    01/03/2001 - Rename VG_CREATE to VG_CREATE_OLD and add new VG_CREATE *    08/03/2001 - new lv_t (in core) version number 5: changed page member *                 to (struct kiobuf *) to use for COW exception table io *    23/03/2001 - Change a (presumably) mistyped pv_t* to an lv_t* *    26/03/2001 - changed lv_v4 to lv_v5 in structure definition [HM] * */#ifndef _LVM_H_INCLUDE#define _LVM_H_INCLUDE#define LVM_RELEASE_NAME "LVM 0.9.1_beta7(ish)"#define LVM_RELEASE_DATE "20 June 2001"#define _LVM_KERNEL_H_VERSION   "LVM "LVM_RELEASE_NAME" ("LVM_RELEASE_DATE")"#include <linux/config.h>#include <linux/version.h>/* * preprocessor definitions *//* if you like emergency reset code in the driver */#define	LVM_TOTAL_RESET#include <linux/kdev_t.h>#include <linux/list.h>#include <asm/types.h>#include <linux/major.h>#include <asm/page.h>#if !defined ( LVM_BLK_MAJOR) || !defined ( LVM_CHAR_MAJOR)#error Bad include/linux/major.h - LVM MAJOR undefined#endif#ifdef	BLOCK_SIZE#undef	BLOCK_SIZE#endif#ifdef CONFIG_ARCH_S390 #define BLOCK_SIZE	4096#else#define BLOCK_SIZE	1024#endif#ifndef	SECTOR_SIZE#define SECTOR_SIZE	512#endif#define LVM_STRUCT_VERSION	1	/* structure version */#define	LVM_DIR_PREFIX	"/dev/"#ifndef min#define min(a,b) (((a)<(b))?(a):(b))#endif#ifndef max#define max(a,b) (((a)>(b))?(a):(b))#endif/* set the default structure version */#if ( LVM_STRUCT_VERSION == 1)#define pv_t pv_v2_t#define lv_t lv_v5_t#define vg_t vg_v3_t#define pv_disk_t pv_disk_v2_t#define lv_disk_t lv_disk_v3_t#define vg_disk_t vg_disk_v2_t#define lv_block_exception_t lv_block_exception_v1_t#define lv_COW_table_disk_t lv_COW_table_disk_v1_t#endif/* * i/o protocol version * * defined here for the driver and defined seperate in the * user land tools/lib/liblvm.h * */#define	LVM_DRIVER_IOP_VERSION	        10#define LVM_NAME        "lvm"#define LVM_GLOBAL	"global"#define LVM_DIR		"lvm"#define LVM_VG_SUBDIR	"VGs"#define LVM_LV_SUBDIR	"LVs"#define LVM_PV_SUBDIR	"PVs"/* * VG/LV indexing macros *//* character minor maps directly to volume group */#define	VG_CHR(a) ( a)/* block minor indexes into a volume group/logical volume indirection table */#define	VG_BLK(a)	( vg_lv_map[a].vg_number)#define LV_BLK(a)	( vg_lv_map[a].lv_number)/* * absolute limits for VGs, PVs per VG and LVs per VG */#define ABS_MAX_VG	99#define ABS_MAX_PV	256#define ABS_MAX_LV	256	/* caused by 8 bit minor */#define MAX_VG  ABS_MAX_VG#define MAX_LV	ABS_MAX_LV#define	MAX_PV	ABS_MAX_PV#if ( MAX_VG > ABS_MAX_VG)#undef MAX_VG#define MAX_VG ABS_MAX_VG#endif#if ( MAX_LV > ABS_MAX_LV)#undef MAX_LV#define MAX_LV ABS_MAX_LV#endif/* * VGDA: default disk spaces and offsets * *   there's space after the structures for later extensions. * *   offset            what                                size *   ---------------   ----------------------------------  ------------ *   0                 physical volume structure           ~500 byte * *   1K                volume group structure              ~200 byte * *   6K                namelist of physical volumes        128 byte each * *   6k + n * ~300byte n logical volume structures         ~300 byte each * *   + m * 4byte       m physical extent alloc. structs    4 byte each * *   End of disk -     first physical extent               typically 4 megabyte *   PE total * *   PE size * * *//* DONT TOUCH THESE !!! *//* base of PV structure in disk partition */#define	LVM_PV_DISK_BASE  	0L/* size reserved for PV structure on disk */#define	LVM_PV_DISK_SIZE  	1024L/* base of VG structure in disk partition */#define	LVM_VG_DISK_BASE  	LVM_PV_DISK_SIZE/* size reserved for VG structure */#define	LVM_VG_DISK_SIZE  	( 9 * 512L)/* size reserved for timekeeping */#define	LVM_TIMESTAMP_DISK_BASE	( LVM_VG_DISK_BASE +  LVM_VG_DISK_SIZE)#define	LVM_TIMESTAMP_DISK_SIZE	512L	/* reserved for timekeeping *//* name list of physical volumes on disk */#define	LVM_PV_UUIDLIST_DISK_BASE ( LVM_TIMESTAMP_DISK_BASE + \                                    LVM_TIMESTAMP_DISK_SIZE)/* now for the dynamically calculated parts of the VGDA */#define	LVM_LV_DISK_OFFSET(a, b) ( (a)->lv_on_disk.base + \                                   sizeof ( lv_disk_t) * b)#define	LVM_DISK_SIZE(pv) 	 ( (pv)->pe_on_disk.base + \                                   (pv)->pe_on_disk.size)#define	LVM_PE_DISK_OFFSET(pe, pv)	( pe * pv->pe_size + \					  ( LVM_DISK_SIZE ( pv) / SECTOR_SIZE))#define	LVM_PE_ON_DISK_BASE(pv) \   { int rest; \     pv->pe_on_disk.base = pv->lv_on_disk.base + pv->lv_on_disk.size; \     if ( ( rest = pv->pe_on_disk.base % SECTOR_SIZE) != 0) \        pv->pe_on_disk.base += ( SECTOR_SIZE - rest); \   }/* END default disk spaces and offsets for PVs *//* * LVM_PE_T_MAX corresponds to: * * 8KB PE size can map a ~512 MB logical volume at the cost of 1MB memory, * * 128MB PE size can map a 8TB logical volume at the same cost of memory. * * Default PE size of 4 MB gives a maximum logical volume size of 256 GB. * * Maximum PE size of 16GB gives a maximum logical volume size of 1024 TB. * * AFAIK, the actual kernels limit this to 1 TB. * * Should be a sufficient spectrum ;*) *//* This is the usable size of pe_disk_t.le_num !!!        v     v */#define	LVM_PE_T_MAX		( ( 1 << ( sizeof ( uint16_t) * 8)) - 2)#define	LVM_LV_SIZE_MAX(a)	( ( long long) LVM_PE_T_MAX * (a)->pe_size > ( long long) 1024*1024/SECTOR_SIZE*1024*1024 ? ( long long) 1024*1024/SECTOR_SIZE*1024*1024 : ( long long) LVM_PE_T_MAX * (a)->pe_size)#define	LVM_MIN_PE_SIZE		( 8192L / SECTOR_SIZE) /* 8 KB in sectors */#define	LVM_MAX_PE_SIZE		( 16L * 1024L * 1024L / SECTOR_SIZE * 1024)	/* 16GB in sectors */#define	LVM_DEFAULT_PE_SIZE	( 4096L * 1024 / SECTOR_SIZE)	/* 4 MB in sectors */#define	LVM_DEFAULT_STRIPE_SIZE	16L	/* 16 KB  */#define	LVM_MIN_STRIPE_SIZE	( PAGE_SIZE/SECTOR_SIZE)	/* PAGESIZE in sectors */#define	LVM_MAX_STRIPE_SIZE	( 512L * 1024 / SECTOR_SIZE)	/* 512 KB in sectors */#define	LVM_MAX_STRIPES		128	/* max # of stripes */#define	LVM_MAX_SIZE            ( 1024LU * 1024 / SECTOR_SIZE * 1024 * 1024)	/* 1TB[sectors] */#define	LVM_MAX_MIRRORS    	2	/* future use */#define	LVM_MIN_READ_AHEAD	2	/* minimum read ahead sectors */#define	LVM_MAX_READ_AHEAD	120	/* maximum read ahead sectors */#define	LVM_MAX_LV_IO_TIMEOUT	60	/* seconds I/O timeout (future use) */#define	LVM_PARTITION           0xfe	/* LVM partition id */#define	LVM_NEW_PARTITION       0x8e	/* new LVM partition id (10/09/1999) */#define	LVM_PE_SIZE_PV_SIZE_REL	5	/* max relation PV size and PE size */#define	LVM_SNAPSHOT_MAX_CHUNK	1024	/* 1024 KB */#define	LVM_SNAPSHOT_DEF_CHUNK	64	/* 64  KB */#define	LVM_SNAPSHOT_MIN_CHUNK	(PAGE_SIZE/1024)	/* 4 or 8 KB */#define	UNDEF	-1#define FALSE	0#define TRUE	1#define LVM_GET_COW_TABLE_CHUNKS_PER_PE(vg, lv) ( \	vg->pe_size / lv->lv_chunk_size)#define LVM_GET_COW_TABLE_ENTRIES_PER_PE(vg, lv) ( \{ \	int COW_table_entries_per_PE; \	int COW_table_chunks_per_PE; \\	COW_table_entries_per_PE = LVM_GET_COW_TABLE_CHUNKS_PER_PE(vg, lv); \	COW_table_chunks_per_PE = ( COW_table_entries_per_PE * sizeof(lv_COW_table_disk_t) / SECTOR_SIZE + lv->lv_chunk_size - 1) / lv->lv_chunk_size; \	COW_table_entries_per_PE - COW_table_chunks_per_PE;})/* * ioctls *//* volume group */#define	VG_CREATE_OLD           _IOW ( 0xfe, 0x00, 1)#define	VG_REMOVE               _IOW ( 0xfe, 0x01, 1)#define	VG_EXTEND               _IOW ( 0xfe, 0x03, 1)#define	VG_REDUCE               _IOW ( 0xfe, 0x04, 1)#define	VG_STATUS               _IOWR ( 0xfe, 0x05, 1)#define	VG_STATUS_GET_COUNT     _IOWR ( 0xfe, 0x06, 1)#define	VG_STATUS_GET_NAMELIST  _IOWR ( 0xfe, 0x07, 1)#define	VG_SET_EXTENDABLE       _IOW ( 0xfe, 0x08, 1)#define	VG_RENAME		_IOW ( 0xfe, 0x09, 1)/* Since 0.9beta6 */#define	VG_CREATE               _IOW ( 0xfe, 0x0a, 1)/* logical volume */#define	LV_CREATE               _IOW ( 0xfe, 0x20, 1)#define	LV_REMOVE               _IOW ( 0xfe, 0x21, 1)#define	LV_ACTIVATE             _IO ( 0xfe, 0x22)#define	LV_DEACTIVATE           _IO ( 0xfe, 0x23)#define	LV_EXTEND               _IOW ( 0xfe, 0x24, 1)#define	LV_REDUCE               _IOW ( 0xfe, 0x25, 1)#define	LV_STATUS_BYNAME        _IOWR ( 0xfe, 0x26, 1)#define	LV_STATUS_BYINDEX       _IOWR ( 0xfe, 0x27, 1)#define LV_SET_ACCESS           _IOW ( 0xfe, 0x28, 1)#define LV_SET_ALLOCATION       _IOW ( 0xfe, 0x29, 1)#define LV_SET_STATUS           _IOW ( 0xfe, 0x2a, 1)#define LE_REMAP                _IOW ( 0xfe, 0x2b, 1)#define LV_SNAPSHOT_USE_RATE    _IOWR ( 0xfe, 0x2c, 1)#define	LV_STATUS_BYDEV		_IOWR ( 0xfe, 0x2e, 1)#define	LV_RENAME		_IOW ( 0xfe, 0x2f, 1)#define	LV_BMAP			_IOWR ( 0xfe, 0x30, 1)/* physical volume */#define	PV_STATUS               _IOWR ( 0xfe, 0x40, 1)#define	PV_CHANGE               _IOWR ( 0xfe, 0x41, 1)#define	PV_FLUSH                _IOW ( 0xfe, 0x42, 1)/* physical extent */#define	PE_LOCK_UNLOCK          _IOW ( 0xfe, 0x50, 1)/* i/o protocol version */#define	LVM_GET_IOP_VERSION     _IOR ( 0xfe, 0x98, 1)#ifdef LVM_TOTAL_RESET/* special reset function for testing purposes */#define	LVM_RESET               _IO ( 0xfe, 0x99)#endif/* lock the logical volume manager */#define	LVM_LOCK_LVM            _IO ( 0xfe, 0x100)/* END ioctls *//* * Status flags *//* volume group */#define	VG_ACTIVE            0x01	/* vg_status */#define	VG_EXPORTED          0x02	/*     "     */#define	VG_EXTENDABLE        0x04	/*     "     */#define	VG_READ              0x01	/* vg_access */#define	VG_WRITE             0x02	/*     "     */#define	VG_CLUSTERED         0x04	/*     "     */#define	VG_SHARED            0x08	/*     "     *//* logical volume */#define	LV_ACTIVE            0x01	/* lv_status */#define	LV_SPINDOWN          0x02	/*     "     */#define	LV_READ              0x01	/* lv_access */#define	LV_WRITE             0x02	/*     "     */#define	LV_SNAPSHOT          0x04	/*     "     */#define	LV_SNAPSHOT_ORG      0x08	/*     "     */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -