File: /usr/include/linux/lvm.h
1 /*
2 * include/linux/lvm.h
3 * kernel/lvm.h
4 * tools/lib/lvm.h
5 *
6 * Copyright (C) 1997 - 2000 Heinz Mauelshagen, Sistina Software
7 *
8 * February-November 1997
9 * May-July 1998
10 * January-March,July,September,October,Dezember 1999
11 * January,February,July,November 2000
12 * January 2001
13 *
14 * lvm is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2, or (at your option)
17 * any later version.
18 *
19 * lvm is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with GNU CC; see the file COPYING. If not, write to
26 * the Free Software Foundation, 59 Temple Place - Suite 330,
27 * Boston, MA 02111-1307, USA.
28 *
29 */
30
31 /*
32 * Changelog
33 *
34 * 10/10/1997 - beginning of new structure creation
35 * 12/05/1998 - incorporated structures from lvm_v1.h and deleted lvm_v1.h
36 * 07/06/1998 - avoided LVM_KMALLOC_MAX define by using vmalloc/vfree
37 * instead of kmalloc/kfree
38 * 01/07/1998 - fixed wrong LVM_MAX_SIZE
39 * 07/07/1998 - extended pe_t structure by ios member (for statistic)
40 * 02/08/1998 - changes for official char/block major numbers
41 * 07/08/1998 - avoided init_module() and cleanup_module() to be static
42 * 29/08/1998 - seprated core and disk structure type definitions
43 * 01/09/1998 - merged kernel integration version (mike)
44 * 20/01/1999 - added LVM_PE_DISK_OFFSET macro for use in
45 * vg_read_with_pv_and_lv(), pv_move_pe(), pv_show_pe_text()...
46 * 18/02/1999 - added definition of time_disk_t structure for;
47 * keeps time stamps on disk for nonatomic writes (future)
48 * 15/03/1999 - corrected LV() and VG() macro definition to use argument
49 * instead of minor
50 * 03/07/1999 - define for genhd.c name handling
51 * 23/07/1999 - implemented snapshot part
52 * 08/12/1999 - changed LVM_LV_SIZE_MAX macro to reflect current 1TB limit
53 * 01/01/2000 - extended lv_v2 core structure by wait_queue member
54 * 12/02/2000 - integrated Andrea Arcagnelli's snapshot work
55 * 18/02/2000 - seperated user and kernel space parts by
56 * #ifdef them with __KERNEL__
57 * 08/03/2000 - implemented cluster/shared bits for vg_access
58 * 26/06/2000 - implemented snapshot persistency and resizing support
59 * 02/11/2000 - added hash table size member to lv structure
60 * 12/11/2000 - removed unneeded timestamp definitions
61 * 24/12/2000 - removed LVM_TO_{CORE,DISK}*, use cpu_{from, to}_le*
62 * instead - Christoph Hellwig
63 *
64 */
65
66
67 #ifndef _LVM_H_INCLUDE
68 #define _LVM_H_INCLUDE
69
70 #define _LVM_KERNEL_H_VERSION "LVM 0.9.1_beta2 (18/01/2001)"
71
72 #include <linux/config.h>
73 #include <linux/version.h>
74
75 /*
76 * preprocessor definitions
77 */
78 /* if you like emergency reset code in the driver */
79 #define LVM_TOTAL_RESET
80
81 #ifdef __KERNEL__
82 #undef LVM_HD_NAME /* display nice names in /proc/partitions */
83
84 /* lots of debugging output (see driver source)
85 #define DEBUG_LVM_GET_INFO
86 #define DEBUG
87 #define DEBUG_MAP
88 #define DEBUG_MAP_SIZE
89 #define DEBUG_IOCTL
90 #define DEBUG_READ
91 #define DEBUG_GENDISK
92 #define DEBUG_VG_CREATE
93 #define DEBUG_LVM_BLK_OPEN
94 #define DEBUG_KFREE
95 */
96 #endif /* #ifdef __KERNEL__ */
97
98 #include <linux/kdev_t.h>
99 #include <linux/list.h>
100
101 #include <asm/types.h>
102 #include <linux/major.h>
103
104 #ifdef __KERNEL__
105 #include <linux/spinlock.h>
106
107 #include <asm/semaphore.h>
108 #endif /* #ifdef __KERNEL__ */
109
110 #include <asm/page.h>
111
112 #if !defined ( LVM_BLK_MAJOR) || !defined ( LVM_CHAR_MAJOR)
113 #error Bad include/linux/major.h - LVM MAJOR undefined
114 #endif
115
116 #ifdef BLOCK_SIZE
117 #undef BLOCK_SIZE
118 #endif
119
120 #ifdef CONFIG_ARCH_S390
121 #define BLOCK_SIZE 4096
122 #else
123 #define BLOCK_SIZE 1024
124 #endif
125
126 #ifndef SECTOR_SIZE
127 #define SECTOR_SIZE 512
128 #endif
129
130 #define LVM_STRUCT_VERSION 1 /* structure version */
131
132 #define LVM_DIR_PREFIX "/dev/"
133
134 #ifndef min
135 #define min(a,b) (((a)<(b))?(a):(b))
136 #endif
137 #ifndef max
138 #define max(a,b) (((a)>(b))?(a):(b))
139 #endif
140
141 /* set the default structure version */
142 #if ( LVM_STRUCT_VERSION == 1)
143 #define pv_t pv_v2_t
144 #define lv_t lv_v4_t
145 #define vg_t vg_v3_t
146 #define pv_disk_t pv_disk_v2_t
147 #define lv_disk_t lv_disk_v3_t
148 #define vg_disk_t vg_disk_v2_t
149 #define lv_block_exception_t lv_block_exception_v1_t
150 #define lv_COW_table_disk_t lv_COW_table_disk_v1_t
151 #endif
152
153
154
155 /*
156 * i/o protocol version
157 *
158 * defined here for the driver and defined seperate in the
159 * user land tools/lib/liblvm.h
160 *
161 */
162 #define LVM_DRIVER_IOP_VERSION 10
163
164 #define LVM_NAME "lvm"
165 #define LVM_GLOBAL "global"
166 #define LVM_DIR "lvm"
167 #define LVM_VG_SUBDIR "VGs"
168 #define LVM_LV_SUBDIR "LVs"
169 #define LVM_PV_SUBDIR "PVs"
170
171 /*
172 * VG/LV indexing macros
173 */
174 /* character minor maps directly to volume group */
175 #define VG_CHR(a) ( a)
176
177 /* block minor indexes into a volume group/logical volume indirection table */
178 #define VG_BLK(a) ( vg_lv_map[a].vg_number)
179 #define LV_BLK(a) ( vg_lv_map[a].lv_number)
180
181 /*
182 * absolute limits for VGs, PVs per VG and LVs per VG
183 */
184 #define ABS_MAX_VG 99
185 #define ABS_MAX_PV 256
186 #define ABS_MAX_LV 256 /* caused by 8 bit minor */
187
188 #define MAX_VG ABS_MAX_VG
189 #define MAX_LV ABS_MAX_LV
190 #define MAX_PV ABS_MAX_PV
191
192 #if ( MAX_VG > ABS_MAX_VG)
193 #undef MAX_VG
194 #define MAX_VG ABS_MAX_VG
195 #endif
196
197 #if ( MAX_LV > ABS_MAX_LV)
198 #undef MAX_LV
199 #define MAX_LV ABS_MAX_LV
200 #endif
201
202
203 /*
204 * VGDA: default disk spaces and offsets
205 *
206 * there's space after the structures for later extensions.
207 *
208 * offset what size
209 * --------------- ---------------------------------- ------------
210 * 0 physical volume structure ~500 byte
211 *
212 * 1K volume group structure ~200 byte
213 *
214 * 6K namelist of physical volumes 128 byte each
215 *
216 * 6k + n * ~300byte n logical volume structures ~300 byte each
217 *
218 * + m * 4byte m physical extent alloc. structs 4 byte each
219 *
220 * End of disk - first physical extent typically 4 megabyte
221 * PE total *
222 * PE size
223 *
224 *
225 */
226
227 /* DONT TOUCH THESE !!! */
228 /* base of PV structure in disk partition */
229 #define LVM_PV_DISK_BASE 0L
230
231 /* size reserved for PV structure on disk */
232 #define LVM_PV_DISK_SIZE 1024L
233
234 /* base of VG structure in disk partition */
235 #define LVM_VG_DISK_BASE LVM_PV_DISK_SIZE
236
237 /* size reserved for VG structure */
238 #define LVM_VG_DISK_SIZE ( 9 * 512L)
239
240 /* size reserved for timekeeping */
241 #define LVM_TIMESTAMP_DISK_BASE ( LVM_VG_DISK_BASE + LVM_VG_DISK_SIZE)
242 #define LVM_TIMESTAMP_DISK_SIZE 512L /* reserved for timekeeping */
243
244 /* name list of physical volumes on disk */
245 #define LVM_PV_UUIDLIST_DISK_BASE ( LVM_TIMESTAMP_DISK_BASE + \
246 LVM_TIMESTAMP_DISK_SIZE)
247
248 /* now for the dynamically calculated parts of the VGDA */
249 #define LVM_LV_DISK_OFFSET(a, b) ( (a)->lv_on_disk.base + \
250 sizeof ( lv_disk_t) * b)
251 #define LVM_DISK_SIZE(pv) ( (pv)->pe_on_disk.base + \
252 (pv)->pe_on_disk.size)
253 #define LVM_PE_DISK_OFFSET(pe, pv) ( pe * pv->pe_size + \
254 ( LVM_DISK_SIZE ( pv) / SECTOR_SIZE))
255 #define LVM_PE_ON_DISK_BASE(pv) \
256 { int rest; \
257 pv->pe_on_disk.base = pv->lv_on_disk.base + pv->lv_on_disk.size; \
258 if ( ( rest = pv->pe_on_disk.base % SECTOR_SIZE) != 0) \
259 pv->pe_on_disk.base += ( SECTOR_SIZE - rest); \
260 }
261 /* END default disk spaces and offsets for PVs */
262
263
264 /*
265 * LVM_PE_T_MAX corresponds to:
266 *
267 * 8KB PE size can map a ~512 MB logical volume at the cost of 1MB memory,
268 *
269 * 128MB PE size can map a 8TB logical volume at the same cost of memory.
270 *
271 * Default PE size of 4 MB gives a maximum logical volume size of 256 GB.
272 *
273 * Maximum PE size of 16GB gives a maximum logical volume size of 1024 TB.
274 *
275 * AFAIK, the actual kernels limit this to 1 TB.
276 *
277 * Should be a sufficient spectrum ;*)
278 */
279
280 /* This is the usable size of pe_disk_t.le_num !!! v v */
281 #define LVM_PE_T_MAX ( ( 1 << ( sizeof ( uint16_t) * 8)) - 2)
282
283 #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)
284 #define LVM_MIN_PE_SIZE ( 8192L / SECTOR_SIZE) /* 8 KB in sectors */
285 #define LVM_MAX_PE_SIZE ( 16L * 1024L * 1024L / SECTOR_SIZE * 1024) /* 16GB in sectors */
286 #define LVM_DEFAULT_PE_SIZE ( 4096L * 1024 / SECTOR_SIZE) /* 4 MB in sectors */
287 #define LVM_DEFAULT_STRIPE_SIZE 16L /* 16 KB */
288 #define LVM_MIN_STRIPE_SIZE ( PAGE_SIZE/SECTOR_SIZE) /* PAGESIZE in sectors */
289 #define LVM_MAX_STRIPE_SIZE ( 512L * 1024 / SECTOR_SIZE) /* 512 KB in sectors */
290 #define LVM_MAX_STRIPES 128 /* max # of stripes */
291 #define LVM_MAX_SIZE ( 1024LU * 1024 / SECTOR_SIZE * 1024 * 1024) /* 1TB[sectors] */
292 #define LVM_MAX_MIRRORS 2 /* future use */
293 #define LVM_MIN_READ_AHEAD 2 /* minimum read ahead sectors */
294 #define LVM_MAX_READ_AHEAD 120 /* maximum read ahead sectors */
295 #define LVM_MAX_LV_IO_TIMEOUT 60 /* seconds I/O timeout (future use) */
296 #define LVM_PARTITION 0xfe /* LVM partition id */
297 #define LVM_NEW_PARTITION 0x8e /* new LVM partition id (10/09/1999) */
298 #define LVM_PE_SIZE_PV_SIZE_REL 5 /* max relation PV size and PE size */
299
300 #define LVM_SNAPSHOT_MAX_CHUNK 1024 /* 1024 KB */
301 #define LVM_SNAPSHOT_DEF_CHUNK 64 /* 64 KB */
302 #define LVM_SNAPSHOT_MIN_CHUNK 1 /* 1 KB */
303
304 #define UNDEF -1
305 #define FALSE 0
306 #define TRUE 1
307
308
309 #define LVM_GET_COW_TABLE_CHUNKS_PER_PE(vg, lv) ( \
310 vg->pe_size / lv->lv_chunk_size)
311
312 #define LVM_GET_COW_TABLE_ENTRIES_PER_PE(vg, lv) ( \
313 { \
314 int COW_table_entries_per_PE; \
315 int COW_table_chunks_per_PE; \
316 \
317 COW_table_entries_per_PE = LVM_GET_COW_TABLE_CHUNKS_PER_PE(vg, lv); \
318 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; \
319 COW_table_entries_per_PE - COW_table_chunks_per_PE;})
320
321
322 /*
323 * ioctls
324 */
325 /* volume group */
326 #define VG_CREATE _IOW ( 0xfe, 0x00, 1)
327 #define VG_REMOVE _IOW ( 0xfe, 0x01, 1)
328
329 #define VG_EXTEND _IOW ( 0xfe, 0x03, 1)
330 #define VG_REDUCE _IOW ( 0xfe, 0x04, 1)
331
332 #define VG_STATUS _IOWR ( 0xfe, 0x05, 1)
333 #define VG_STATUS_GET_COUNT _IOWR ( 0xfe, 0x06, 1)
334 #define VG_STATUS_GET_NAMELIST _IOWR ( 0xfe, 0x07, 1)
335
336 #define VG_SET_EXTENDABLE _IOW ( 0xfe, 0x08, 1)
337 #define VG_RENAME _IOW ( 0xfe, 0x09, 1)
338
339
340 /* logical volume */
341 #define LV_CREATE _IOW ( 0xfe, 0x20, 1)
342 #define LV_REMOVE _IOW ( 0xfe, 0x21, 1)
343
344 #define LV_ACTIVATE _IO ( 0xfe, 0x22)
345 #define LV_DEACTIVATE _IO ( 0xfe, 0x23)
346
347 #define LV_EXTEND _IOW ( 0xfe, 0x24, 1)
348 #define LV_REDUCE _IOW ( 0xfe, 0x25, 1)
349
350 #define LV_STATUS_BYNAME _IOWR ( 0xfe, 0x26, 1)
351 #define LV_STATUS_BYINDEX _IOWR ( 0xfe, 0x27, 1)
352
353 #define LV_SET_ACCESS _IOW ( 0xfe, 0x28, 1)
354 #define LV_SET_ALLOCATION _IOW ( 0xfe, 0x29, 1)
355 #define LV_SET_STATUS _IOW ( 0xfe, 0x2a, 1)
356
357 #define LE_REMAP _IOW ( 0xfe, 0x2b, 1)
358
359 #define LV_SNAPSHOT_USE_RATE _IOWR ( 0xfe, 0x2c, 1)
360
361 #define LV_STATUS_BYDEV _IOWR ( 0xfe, 0x2e, 1)
362
363 #define LV_RENAME _IOW ( 0xfe, 0x2f, 1)
364
365 #define LV_BMAP _IOWR ( 0xfe, 0x30, 1)
366
367
368 /* physical volume */
369 #define PV_STATUS _IOWR ( 0xfe, 0x40, 1)
370 #define PV_CHANGE _IOWR ( 0xfe, 0x41, 1)
371 #define PV_FLUSH _IOW ( 0xfe, 0x42, 1)
372
373 /* physical extent */
374 #define PE_LOCK_UNLOCK _IOW ( 0xfe, 0x50, 1)
375
376 /* i/o protocol version */
377 #define LVM_GET_IOP_VERSION _IOR ( 0xfe, 0x98, 1)
378
379 #ifdef LVM_TOTAL_RESET
380 /* special reset function for testing purposes */
381 #define LVM_RESET _IO ( 0xfe, 0x99)
382 #endif
383
384 /* lock the logical volume manager */
385 #define LVM_LOCK_LVM _IO ( 0xfe, 0x100)
386 /* END ioctls */
387
388
389 /*
390 * Status flags
391 */
392 /* volume group */
393 #define VG_ACTIVE 0x01 /* vg_status */
394 #define VG_EXPORTED 0x02 /* " */
395 #define VG_EXTENDABLE 0x04 /* " */
396
397 #define VG_READ 0x01 /* vg_access */
398 #define VG_WRITE 0x02 /* " */
399 #define VG_CLUSTERED 0x04 /* " */
400 #define VG_SHARED 0x08 /* " */
401
402 /* logical volume */
403 #define LV_ACTIVE 0x01 /* lv_status */
404 #define LV_SPINDOWN 0x02 /* " */
405
406 #define LV_READ 0x01 /* lv_access */
407 #define LV_WRITE 0x02 /* " */
408 #define LV_SNAPSHOT 0x04 /* " */
409 #define LV_SNAPSHOT_ORG 0x08 /* " */
410
411 #define LV_BADBLOCK_ON 0x01 /* lv_badblock */
412
413 #define LV_STRICT 0x01 /* lv_allocation */
414 #define LV_CONTIGUOUS 0x02 /* " */
415
416 /* physical volume */
417 #define PV_ACTIVE 0x01 /* pv_status */
418 #define PV_ALLOCATABLE 0x02 /* pv_allocatable */
419
420
421 /*
422 * Structure definitions core/disk follow
423 *
424 * conditional conversion takes place on big endian architectures
425 * in functions * pv_copy_*(), vg_copy_*() and lv_copy_*()
426 *
427 */
428
429 #define NAME_LEN 128 /* don't change!!! */
430 #define UUID_LEN 32 /* don't change!!! */
431
432 /* copy on write tables in disk format */
433 typedef struct {
434 uint64_t pv_org_number;
435 uint64_t pv_org_rsector;
436 uint64_t pv_snap_number;
437 uint64_t pv_snap_rsector;
438 } lv_COW_table_disk_v1_t;
439
440 /* remap physical sector/rdev pairs including hash */
441 typedef struct {
442 struct list_head hash;
443 ulong rsector_org;
444 kdev_t rdev_org;
445 ulong rsector_new;
446 kdev_t rdev_new;
447 } lv_block_exception_v1_t;
448
449 /* disk stored pe information */
450 typedef struct {
451 uint16_t lv_num;
452 uint16_t le_num;
453 } pe_disk_t;
454
455 /* disk stored PV, VG, LV and PE size and offset information */
456 typedef struct {
457 uint32_t base;
458 uint32_t size;
459 } lvm_disk_data_t;
460
461
462 /*
463 * Structure Physical Volume (PV) Version 1
464 */
465
466 /* core */
467 typedef struct {
468 char id[2]; /* Identifier */
469 unsigned short version; /* HM lvm version */
470 lvm_disk_data_t pv_on_disk;
471 lvm_disk_data_t vg_on_disk;
472 lvm_disk_data_t pv_namelist_on_disk;
473 lvm_disk_data_t lv_on_disk;
474 lvm_disk_data_t pe_on_disk;
475 char pv_name[NAME_LEN];
476 char vg_name[NAME_LEN];
477 char system_id[NAME_LEN]; /* for vgexport/vgimport */
478 kdev_t pv_dev;
479 uint pv_number;
480 uint pv_status;
481 uint pv_allocatable;
482 uint pv_size; /* HM */
483 uint lv_cur;
484 uint pe_size;
485 uint pe_total;
486 uint pe_allocated;
487 uint pe_stale; /* for future use */
488 pe_disk_t *pe; /* HM */
489 struct inode *inode; /* HM */
490 } pv_v1_t;
491
492 /* core */
493 typedef struct {
494 char id[2]; /* Identifier */
495 unsigned short version; /* HM lvm version */
496 lvm_disk_data_t pv_on_disk;
497 lvm_disk_data_t vg_on_disk;
498 lvm_disk_data_t pv_uuidlist_on_disk;
499 lvm_disk_data_t lv_on_disk;
500 lvm_disk_data_t pe_on_disk;
501 char pv_name[NAME_LEN];
502 char vg_name[NAME_LEN];
503 char system_id[NAME_LEN]; /* for vgexport/vgimport */
504 kdev_t pv_dev;
505 uint pv_number;
506 uint pv_status;
507 uint pv_allocatable;
508 uint pv_size; /* HM */
509 uint lv_cur;
510 uint pe_size;
511 uint pe_total;
512 uint pe_allocated;
513 uint pe_stale; /* for future use */
514 pe_disk_t *pe; /* HM */
515 struct inode *inode; /* HM */
516 char pv_uuid[UUID_LEN+1];
517 } pv_v2_t;
518
519
520 /* disk */
521 typedef struct {
522 uint8_t id[2]; /* Identifier */
523 uint16_t version; /* HM lvm version */
524 lvm_disk_data_t pv_on_disk;
525 lvm_disk_data_t vg_on_disk;
526 lvm_disk_data_t pv_namelist_on_disk;
527 lvm_disk_data_t lv_on_disk;
528 lvm_disk_data_t pe_on_disk;
529 uint8_t pv_name[NAME_LEN];
530 uint8_t vg_name[NAME_LEN];
531 uint8_t system_id[NAME_LEN]; /* for vgexport/vgimport */
532 uint32_t pv_major;
533 uint32_t pv_number;
534 uint32_t pv_status;
535 uint32_t pv_allocatable;
536 uint32_t pv_size; /* HM */
537 uint32_t lv_cur;
538 uint32_t pe_size;
539 uint32_t pe_total;
540 uint32_t pe_allocated;
541 } pv_disk_v1_t;
542
543 /* disk */
544 typedef struct {
545 uint8_t id[2]; /* Identifier */
546 uint16_t version; /* HM lvm version */
547 lvm_disk_data_t pv_on_disk;
548 lvm_disk_data_t vg_on_disk;
549 lvm_disk_data_t pv_uuidlist_on_disk;
550 lvm_disk_data_t lv_on_disk;
551 lvm_disk_data_t pe_on_disk;
552 uint8_t pv_uuid[NAME_LEN];
553 uint8_t vg_name[NAME_LEN];
554 uint8_t system_id[NAME_LEN]; /* for vgexport/vgimport */
555 uint32_t pv_major;
556 uint32_t pv_number;
557 uint32_t pv_status;
558 uint32_t pv_allocatable;
559 uint32_t pv_size; /* HM */
560 uint32_t lv_cur;
561 uint32_t pe_size;
562 uint32_t pe_total;
563 uint32_t pe_allocated;
564 } pv_disk_v2_t;
565
566
567 /*
568 * Structures for Logical Volume (LV)
569 */
570
571 /* core PE information */
572 typedef struct {
573 kdev_t dev;
574 ulong pe; /* to be changed if > 2TB */
575 ulong reads;
576 ulong writes;
577 } pe_t;
578
579 typedef struct {
580 char lv_name[NAME_LEN];
581 kdev_t old_dev;
582 kdev_t new_dev;
583 ulong old_pe;
584 ulong new_pe;
585 } le_remap_req_t;
586
587 typedef struct lv_bmap {
588 ulong lv_block;
589 dev_t lv_dev;
590 } lv_bmap_t;
591
592 /*
593 * Structure Logical Volume (LV) Version 3
594 */
595
596 /* core */
597 typedef struct lv_v4 {
598 char lv_name[NAME_LEN];
599 char vg_name[NAME_LEN];
600 uint lv_access;
601 uint lv_status;
602 uint lv_open; /* HM */
603 kdev_t lv_dev; /* HM */
604 uint lv_number; /* HM */
605 uint lv_mirror_copies; /* for future use */
606 uint lv_recovery; /* " */
607 uint lv_schedule; /* " */
608 uint lv_size;
609 pe_t *lv_current_pe; /* HM */
610 uint lv_current_le; /* for future use */
611 uint lv_allocated_le;
612 uint lv_stripes;
613 uint lv_stripesize;
614 uint lv_badblock; /* for future use */
615 uint lv_allocation;
616 uint lv_io_timeout; /* for future use */
617 uint lv_read_ahead;
618
619 /* delta to version 1 starts here */
620 struct lv_v4 *lv_snapshot_org;
621 struct lv_v4 *lv_snapshot_prev;
622 struct lv_v4 *lv_snapshot_next;
623 lv_block_exception_t *lv_block_exception;
624 uint lv_remap_ptr;
625 uint lv_remap_end;
626 uint lv_chunk_size;
627 uint lv_snapshot_minor;
628 #ifdef __KERNEL__
629 struct kiobuf *lv_iobuf;
630 struct semaphore lv_snapshot_sem;
631 struct list_head *lv_snapshot_hash_table;
632 ulong lv_snapshot_hash_table_size;
633 ulong lv_snapshot_hash_mask;
634 struct page *lv_COW_table_page;
635 wait_queue_head_t lv_snapshot_wait;
636 int lv_snapshot_use_rate;
637 void *vg;
638
639 uint lv_allocated_snapshot_le;
640 #else
641 char dummy[200];
642 #endif
643 } lv_v4_t;
644
645 /* disk */
646 typedef struct {
647 uint8_t lv_name[NAME_LEN];
648 uint8_t vg_name[NAME_LEN];
649 uint32_t lv_access;
650 uint32_t lv_status;
651 uint32_t lv_open; /* HM */
652 uint32_t lv_dev; /* HM */
653 uint32_t lv_number; /* HM */
654 uint32_t lv_mirror_copies; /* for future use */
655 uint32_t lv_recovery; /* " */
656 uint32_t lv_schedule; /* " */
657 uint32_t lv_size;
658 uint32_t lv_snapshot_minor;/* minor number of original */
659 uint16_t lv_chunk_size; /* chunk size of snapshot */
660 uint16_t dummy;
661 uint32_t lv_allocated_le;
662 uint32_t lv_stripes;
663 uint32_t lv_stripesize;
664 uint32_t lv_badblock; /* for future use */
665 uint32_t lv_allocation;
666 uint32_t lv_io_timeout; /* for future use */
667 uint32_t lv_read_ahead; /* HM */
668 } lv_disk_v3_t;
669
670 /*
671 * Structure Volume Group (VG) Version 1
672 */
673
674 /* core */
675 typedef struct {
676 char vg_name[NAME_LEN]; /* volume group name */
677 uint vg_number; /* volume group number */
678 uint vg_access; /* read/write */
679 uint vg_status; /* active or not */
680 uint lv_max; /* maximum logical volumes */
681 uint lv_cur; /* current logical volumes */
682 uint lv_open; /* open logical volumes */
683 uint pv_max; /* maximum physical volumes */
684 uint pv_cur; /* current physical volumes FU */
685 uint pv_act; /* active physical volumes */
686 uint dummy; /* was obsolete max_pe_per_pv */
687 uint vgda; /* volume group descriptor arrays FU */
688 uint pe_size; /* physical extent size in sectors */
689 uint pe_total; /* total of physical extents */
690 uint pe_allocated; /* allocated physical extents */
691 uint pvg_total; /* physical volume groups FU */
692 struct proc_dir_entry *proc;
693 pv_t *pv[ABS_MAX_PV + 1]; /* physical volume struct pointers */
694 lv_t *lv[ABS_MAX_LV + 1]; /* logical volume struct pointers */
695 } vg_v1_t;
696
697 typedef struct {
698 char vg_name[NAME_LEN]; /* volume group name */
699 uint vg_number; /* volume group number */
700 uint vg_access; /* read/write */
701 uint vg_status; /* active or not */
702 uint lv_max; /* maximum logical volumes */
703 uint lv_cur; /* current logical volumes */
704 uint lv_open; /* open logical volumes */
705 uint pv_max; /* maximum physical volumes */
706 uint pv_cur; /* current physical volumes FU */
707 uint pv_act; /* active physical volumes */
708 uint dummy; /* was obsolete max_pe_per_pv */
709 uint vgda; /* volume group descriptor arrays FU */
710 uint pe_size; /* physical extent size in sectors */
711 uint pe_total; /* total of physical extents */
712 uint pe_allocated; /* allocated physical extents */
713 uint pvg_total; /* physical volume groups FU */
714 struct proc_dir_entry *proc;
715 pv_t *pv[ABS_MAX_PV + 1]; /* physical volume struct pointers */
716 lv_t *lv[ABS_MAX_LV + 1]; /* logical volume struct pointers */
717 char vg_uuid[UUID_LEN+1]; /* volume group UUID */
718 #ifdef __KERNEL__
719 struct proc_dir_entry *vg_dir_pde;
720 struct proc_dir_entry *lv_subdir_pde;
721 struct proc_dir_entry *pv_subdir_pde;
722 #else
723 char dummy1[200];
724 #endif
725 } vg_v3_t;
726
727
728 /* disk */
729 typedef struct {
730 uint8_t vg_name[NAME_LEN]; /* volume group name */
731 uint32_t vg_number; /* volume group number */
732 uint32_t vg_access; /* read/write */
733 uint32_t vg_status; /* active or not */
734 uint32_t lv_max; /* maximum logical volumes */
735 uint32_t lv_cur; /* current logical volumes */
736 uint32_t lv_open; /* open logical volumes */
737 uint32_t pv_max; /* maximum physical volumes */
738 uint32_t pv_cur; /* current physical volumes FU */
739 uint32_t pv_act; /* active physical volumes */
740 uint32_t dummy;
741 uint32_t vgda; /* volume group descriptor arrays FU */
742 uint32_t pe_size; /* physical extent size in sectors */
743 uint32_t pe_total; /* total of physical extents */
744 uint32_t pe_allocated; /* allocated physical extents */
745 uint32_t pvg_total; /* physical volume groups FU */
746 } vg_disk_v1_t;
747
748 typedef struct {
749 uint8_t vg_uuid[UUID_LEN]; /* volume group UUID */
750 uint8_t vg_name_dummy[NAME_LEN-UUID_LEN]; /* rest of v1 VG name */
751 uint32_t vg_number; /* volume group number */
752 uint32_t vg_access; /* read/write */
753 uint32_t vg_status; /* active or not */
754 uint32_t lv_max; /* maximum logical volumes */
755 uint32_t lv_cur; /* current logical volumes */
756 uint32_t lv_open; /* open logical volumes */
757 uint32_t pv_max; /* maximum physical volumes */
758 uint32_t pv_cur; /* current physical volumes FU */
759 uint32_t pv_act; /* active physical volumes */
760 uint32_t dummy;
761 uint32_t vgda; /* volume group descriptor arrays FU */
762 uint32_t pe_size; /* physical extent size in sectors */
763 uint32_t pe_total; /* total of physical extents */
764 uint32_t pe_allocated; /* allocated physical extents */
765 uint32_t pvg_total; /* physical volume groups FU */
766 } vg_disk_v2_t;
767
768
769 /*
770 * Request structures for ioctls
771 */
772
773 /* Request structure PV_STATUS_BY_NAME... */
774 typedef struct {
775 char pv_name[NAME_LEN];
776 pv_t *pv;
777 } pv_status_req_t, pv_change_req_t;
778
779 /* Request structure PV_FLUSH */
780 typedef struct {
781 char pv_name[NAME_LEN];
782 kdev_t pv_dev;
783 } pv_flush_req_t;
784
785
786 /* Request structure PE_MOVE */
787 typedef struct {
788 enum {
789 LOCK_PE, UNLOCK_PE
790 } lock;
791 struct {
792 kdev_t lv_dev;
793 kdev_t pv_dev;
794 ulong pv_offset;
795 } data;
796 } pe_lock_req_t;
797
798
799 /* Request structure LV_STATUS_BYNAME */
800 typedef struct {
801 char lv_name[NAME_LEN];
802 lv_t *lv;
803 } lv_status_byname_req_t, lv_req_t;
804
805 /* Request structure LV_STATUS_BYINDEX */
806 typedef struct {
807 ulong lv_index;
808 lv_t *lv;
809 /* Transfer size because user space and kernel space differ */
810 ushort size;
811 } lv_status_byindex_req_t;
812
813 /* Request structure LV_STATUS_BYDEV... */
814 typedef struct {
815 dev_t dev;
816 pv_t *lv;
817 } lv_status_bydev_req_t;
818
819
820 /* Request structure LV_SNAPSHOT_USE_RATE */
821 typedef struct {
822 int block;
823 int rate;
824 } lv_snapshot_use_rate_req_t;
825
826 #endif /* #ifndef _LVM_H_INCLUDE */
827