You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1505 lines
46 KiB

# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../lvm/24-header.patch
# Copyright (C) 2004 - 2006 The T2 SDE Project
#
# More information can be found in the files COPYING and README.
#
# This patch file is dual-licensed. It is available under the license the
# patched project is licensed under, as long as it is an OpenSource license
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
# of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
# --- SDE-COPYRIGHT-NOTE-END ---
diff -urN 1.0.8-orig/asm/ioctl.h 1.0.8/asm/ioctl.h
--- 1.0.8-orig/asm/ioctl.h 1970-01-01 01:00:00.000000000 +0100
+++ 1.0.8/asm/ioctl.h 2004-09-30 22:11:26.419448359 +0200
@@ -0,0 +1,75 @@
+/* $Id: ioctl.h,v 1.5 1993/07/19 21:53:50 root Exp root $
+ *
+ * linux/ioctl.h for Linux by H.H. Bergman.
+ */
+
+#ifndef _ASMI386_IOCTL_H
+#define _ASMI386_IOCTL_H
+
+/* ioctl command encoding: 32 bits total, command in lower 16 bits,
+ * size of the parameter structure in the lower 14 bits of the
+ * upper 16 bits.
+ * Encoding the size of the parameter structure in the ioctl request
+ * is useful for catching programs compiled with old versions
+ * and to avoid overwriting user space outside the user buffer area.
+ * The highest 2 bits are reserved for indicating the ``access mode''.
+ * NOTE: This limits the max parameter size to 16kB -1 !
+ */
+
+/*
+ * The following is for compatibility across the various Linux
+ * platforms. The i386 ioctl numbering scheme doesn't really enforce
+ * a type field. De facto, however, the top 8 bits of the lower 16
+ * bits are indeed used as a type field, so we might just as well make
+ * this explicit here. Please be sure to use the decoding macros
+ * below from now on.
+ */
+#define _IOC_NRBITS 8
+#define _IOC_TYPEBITS 8
+#define _IOC_SIZEBITS 14
+#define _IOC_DIRBITS 2
+
+#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
+#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
+#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
+#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
+
+#define _IOC_NRSHIFT 0
+#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
+#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
+#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
+
+/*
+ * Direction bits.
+ */
+#define _IOC_NONE 0U
+#define _IOC_WRITE 1U
+#define _IOC_READ 2U
+
+#define _IOC(dir,type,nr,size) \
+ (((dir) << _IOC_DIRSHIFT) | \
+ ((type) << _IOC_TYPESHIFT) | \
+ ((nr) << _IOC_NRSHIFT) | \
+ ((size) << _IOC_SIZESHIFT))
+
+/* used to create numbers */
+#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
+#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
+#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
+#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
+
+/* used to decode ioctl numbers.. */
+#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
+#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
+#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
+#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
+
+/* ...and for the drivers/sound files... */
+
+#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
+#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
+#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
+#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
+#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
+
+#endif /* _ASMI386_IOCTL_H */
diff -urN 1.0.8-orig/linux/genhd.h 1.0.8/linux/genhd.h
--- 1.0.8-orig/linux/genhd.h 1970-01-01 01:00:00.000000000 +0100
+++ 1.0.8/linux/genhd.h 2004-09-30 22:09:05.360962069 +0200
@@ -0,0 +1,318 @@
+#ifndef _LINUX_GENHD_H
+#define _LINUX_GENHD_H
+
+/*
+ * genhd.h Copyright (C) 1992 Drew Eckhardt
+ * Generic hard disk header file by
+ * Drew Eckhardt
+ *
+ * <drew@colorado.edu>
+ */
+
+#include <linux/config.h>
+#include <linux/types.h>
+#include <linux/major.h>
+
+enum {
+/* These three have identical behaviour; use the second one if DOS fdisk gets
+ confused about extended/logical partitions starting past cylinder 1023. */
+ DOS_EXTENDED_PARTITION = 5,
+ LINUX_EXTENDED_PARTITION = 0x85,
+ WIN98_EXTENDED_PARTITION = 0x0f,
+
+ LINUX_SWAP_PARTITION = 0x82,
+ LINUX_RAID_PARTITION = 0xfd, /* autodetect RAID partition */
+
+ SOLARIS_X86_PARTITION = LINUX_SWAP_PARTITION,
+
+ DM6_PARTITION = 0x54, /* has DDO: use xlated geom & offset */
+ EZD_PARTITION = 0x55, /* EZ-DRIVE */
+ DM6_AUX1PARTITION = 0x51, /* no DDO: use xlated geom */
+ DM6_AUX3PARTITION = 0x53, /* no DDO: use xlated geom */
+
+ FREEBSD_PARTITION = 0xa5, /* FreeBSD Partition ID */
+ OPENBSD_PARTITION = 0xa6, /* OpenBSD Partition ID */
+ NETBSD_PARTITION = 0xa9, /* NetBSD Partition ID */
+ BSDI_PARTITION = 0xb7, /* BSDI Partition ID */
+/* Ours is not to wonder why.. */
+ BSD_PARTITION = FREEBSD_PARTITION,
+ MINIX_PARTITION = 0x81, /* Minix Partition ID */
+ PLAN9_PARTITION = 0x39, /* Plan 9 Partition ID */
+ UNIXWARE_PARTITION = 0x63, /* Partition ID, same as */
+ /* GNU_HURD and SCO Unix */
+};
+
+struct partition {
+ unsigned char boot_ind; /* 0x80 - active */
+ unsigned char head; /* starting head */
+ unsigned char sector; /* starting sector */
+ unsigned char cyl; /* starting cylinder */
+ unsigned char sys_ind; /* What partition type */
+ unsigned char end_head; /* end head */
+ unsigned char end_sector; /* end sector */
+ unsigned char end_cyl; /* end cylinder */
+ unsigned int start_sect; /* starting sector counting from 0 */
+ unsigned int nr_sects; /* nr of sectors in partition */
+} __attribute__((packed));
+
+#ifdef __KERNEL__
+# include <linux/devfs_fs_kernel.h>
+
+struct hd_struct {
+ unsigned long start_sect;
+ unsigned long nr_sects;
+ devfs_handle_t de; /* primary (master) devfs entry */
+#ifdef CONFIG_DEVFS_FS
+ int number;
+#endif /* CONFIG_DEVFS_FS */
+#ifdef CONFIG_BLK_STATS
+ /* Performance stats: */
+ unsigned int ios_in_flight;
+ unsigned int io_ticks;
+ unsigned int last_idle_time;
+ unsigned int last_queue_change;
+ unsigned int aveq;
+
+ unsigned int rd_ios;
+ unsigned int rd_merges;
+ unsigned int rd_ticks;
+ unsigned int rd_sectors;
+ unsigned int wr_ios;
+ unsigned int wr_merges;
+ unsigned int wr_ticks;
+ unsigned int wr_sectors;
+#endif /* CONFIG_BLK_STATS */
+};
+
+#define GENHD_FL_REMOVABLE 1
+
+struct gendisk {
+ int major; /* major number of driver */
+ const char *major_name; /* name of major driver */
+ int minor_shift; /* number of times minor is shifted to
+ get real minor */
+ int max_p; /* maximum partitions per device */
+
+ struct hd_struct *part; /* [indexed by minor] */
+ int *sizes; /* [idem], device size in blocks */
+ int nr_real; /* number of real devices */
+
+ void *real_devices; /* internal use */
+ struct gendisk *next;
+ struct block_device_operations *fops;
+
+ devfs_handle_t *de_arr; /* one per physical disc */
+ char *flags; /* one per physical disc */
+};
+
+/* drivers/block/genhd.c */
+extern struct gendisk *gendisk_head;
+
+extern void add_gendisk(struct gendisk *gp);
+extern void del_gendisk(struct gendisk *gp);
+extern struct gendisk *get_gendisk(kdev_t dev);
+extern int walk_gendisk(int (*walk)(struct gendisk *, void *), void *);
+
+#endif /* __KERNEL__ */
+
+#ifdef CONFIG_SOLARIS_X86_PARTITION
+
+#define SOLARIS_X86_NUMSLICE 8
+#define SOLARIS_X86_VTOC_SANE (0x600DDEEEUL)
+
+struct solaris_x86_slice {
+ ushort s_tag; /* ID tag of partition */
+ ushort s_flag; /* permission flags */
+ unsigned int s_start; /* start sector no of partition */
+ unsigned int s_size; /* # of blocks in partition */
+};
+
+struct solaris_x86_vtoc {
+ unsigned int v_bootinfo[3]; /* info needed by mboot (unsupported) */
+ unsigned int v_sanity; /* to verify vtoc sanity */
+ unsigned int v_version; /* layout version */
+ char v_volume[8]; /* volume name */
+ ushort v_sectorsz; /* sector size in bytes */
+ ushort v_nparts; /* number of partitions */
+ unsigned int v_reserved[10]; /* free space */
+ struct solaris_x86_slice
+ v_slice[SOLARIS_X86_NUMSLICE]; /* slice headers */
+ unsigned int timestamp[SOLARIS_X86_NUMSLICE]; /* timestamp (unsupported) */
+ char v_asciilabel[128]; /* for compatibility */
+};
+
+#endif /* CONFIG_SOLARIS_X86_PARTITION */
+
+#ifdef CONFIG_BSD_DISKLABEL
+/*
+ * BSD disklabel support by Yossi Gottlieb <yogo@math.tau.ac.il>
+ * updated by Marc Espie <Marc.Espie@openbsd.org>
+ */
+
+/* check against BSD src/sys/sys/disklabel.h for consistency */
+
+#define BSD_DISKMAGIC (0x82564557UL) /* The disk magic number */
+#define BSD_MAXPARTITIONS 8
+#define OPENBSD_MAXPARTITIONS 16
+#define BSD_FS_UNUSED 0 /* disklabel unused partition entry ID */
+struct bsd_disklabel {
+ __u32 d_magic; /* the magic number */
+ __s16 d_type; /* drive type */
+ __s16 d_subtype; /* controller/d_type specific */
+ char d_typename[16]; /* type name, e.g. "eagle" */
+ char d_packname[16]; /* pack identifier */
+ __u32 d_secsize; /* # of bytes per sector */
+ __u32 d_nsectors; /* # of data sectors per track */
+ __u32 d_ntracks; /* # of tracks per cylinder */
+ __u32 d_ncylinders; /* # of data cylinders per unit */
+ __u32 d_secpercyl; /* # of data sectors per cylinder */
+ __u32 d_secperunit; /* # of data sectors per unit */
+ __u16 d_sparespertrack; /* # of spare sectors per track */
+ __u16 d_sparespercyl; /* # of spare sectors per cylinder */
+ __u32 d_acylinders; /* # of alt. cylinders per unit */
+ __u16 d_rpm; /* rotational speed */
+ __u16 d_interleave; /* hardware sector interleave */
+ __u16 d_trackskew; /* sector 0 skew, per track */
+ __u16 d_cylskew; /* sector 0 skew, per cylinder */
+ __u32 d_headswitch; /* head switch time, usec */
+ __u32 d_trkseek; /* track-to-track seek, usec */
+ __u32 d_flags; /* generic flags */
+#define NDDATA 5
+ __u32 d_drivedata[NDDATA]; /* drive-type specific information */
+#define NSPARE 5
+ __u32 d_spare[NSPARE]; /* reserved for future use */
+ __u32 d_magic2; /* the magic number (again) */
+ __u16 d_checksum; /* xor of data incl. partitions */
+
+ /* filesystem and partition information: */
+ __u16 d_npartitions; /* number of partitions in following */
+ __u32 d_bbsize; /* size of boot area at sn0, bytes */
+ __u32 d_sbsize; /* max size of fs superblock, bytes */
+ struct bsd_partition { /* the partition table */
+ __u32 p_size; /* number of sectors in partition */
+ __u32 p_offset; /* starting sector */
+ __u32 p_fsize; /* filesystem basic fragment size */
+ __u8 p_fstype; /* filesystem type, see below */
+ __u8 p_frag; /* filesystem fragments per block */
+ __u16 p_cpg; /* filesystem cylinders per group */
+ } d_partitions[BSD_MAXPARTITIONS]; /* actually may be more */
+};
+
+#endif /* CONFIG_BSD_DISKLABEL */
+
+#ifdef CONFIG_UNIXWARE_DISKLABEL
+/*
+ * Unixware slices support by Andrzej Krzysztofowicz <ankry@mif.pg.gda.pl>
+ * and Krzysztof G. Baranowski <kgb@knm.org.pl>
+ */
+
+#define UNIXWARE_DISKMAGIC (0xCA5E600DUL) /* The disk magic number */
+#define UNIXWARE_DISKMAGIC2 (0x600DDEEEUL) /* The slice table magic nr */
+#define UNIXWARE_NUMSLICE 16
+#define UNIXWARE_FS_UNUSED 0 /* Unused slice entry ID */
+
+struct unixware_slice {
+ __u16 s_label; /* label */
+ __u16 s_flags; /* permission flags */
+ __u32 start_sect; /* starting sector */
+ __u32 nr_sects; /* number of sectors in slice */
+};
+
+struct unixware_disklabel {
+ __u32 d_type; /* drive type */
+ __u32 d_magic; /* the magic number */
+ __u32 d_version; /* version number */
+ char d_serial[12]; /* serial number of the device */
+ __u32 d_ncylinders; /* # of data cylinders per device */
+ __u32 d_ntracks; /* # of tracks per cylinder */
+ __u32 d_nsectors; /* # of data sectors per track */
+ __u32 d_secsize; /* # of bytes per sector */
+ __u32 d_part_start; /* # of first sector of this partition */
+ __u32 d_unknown1[12]; /* ? */
+ __u32 d_alt_tbl; /* byte offset of alternate table */
+ __u32 d_alt_len; /* byte length of alternate table */
+ __u32 d_phys_cyl; /* # of physical cylinders per device */
+ __u32 d_phys_trk; /* # of physical tracks per cylinder */
+ __u32 d_phys_sec; /* # of physical sectors per track */
+ __u32 d_phys_bytes; /* # of physical bytes per sector */
+ __u32 d_unknown2; /* ? */
+ __u32 d_unknown3; /* ? */
+ __u32 d_pad[8]; /* pad */
+
+ struct unixware_vtoc {
+ __u32 v_magic; /* the magic number */
+ __u32 v_version; /* version number */
+ char v_name[8]; /* volume name */
+ __u16 v_nslices; /* # of slices */
+ __u16 v_unknown1; /* ? */
+ __u32 v_reserved[10]; /* reserved */
+ struct unixware_slice
+ v_slice[UNIXWARE_NUMSLICE]; /* slice headers */
+ } vtoc;
+
+}; /* 408 */
+
+#endif /* CONFIG_UNIXWARE_DISKLABEL */
+
+#ifdef CONFIG_MINIX_SUBPARTITION
+# define MINIX_NR_SUBPARTITIONS 4
+#endif /* CONFIG_MINIX_SUBPARTITION */
+
+#ifdef __KERNEL__
+
+char *disk_name (struct gendisk *hd, int minor, char *buf);
+
+/*
+ * Account for the completion of an IO request (used by drivers which
+ * bypass the normal end_request processing)
+ */
+struct request;
+
+#ifdef CONFIG_BLK_STATS
+extern void disk_round_stats(struct hd_struct *hd);
+extern void req_new_io(struct request *req, int merge, int sectors);
+extern void req_merged_io(struct request *req);
+extern void req_finished_io(struct request *req);
+#else
+static inline void req_new_io(struct request *req, int merge, int sectors) { }
+static inline void req_merged_io(struct request *req) { }
+static inline void req_finished_io(struct request *req) { }
+#endif /* CONFIG_BLK_STATS */
+
+extern void devfs_register_partitions (struct gendisk *dev, int minor,
+ int unregister);
+
+
+
+/*
+ * FIXME: this should use genhd->minor_shift, but that is slow to look up.
+ */
+static inline unsigned int disk_index (kdev_t dev)
+{
+ int major = MAJOR(dev);
+ int minor = MINOR(dev);
+ unsigned int index;
+
+ switch (major) {
+ case DAC960_MAJOR+0:
+ index = (minor & 0x00f8) >> 3;
+ break;
+ case SCSI_DISK0_MAJOR:
+ index = (minor & 0x00f0) >> 4;
+ break;
+ case IDE0_MAJOR: /* same as HD_MAJOR */
+ case XT_DISK_MAJOR:
+ index = (minor & 0x0040) >> 6;
+ break;
+ case IDE1_MAJOR:
+ index = ((minor & 0x0040) >> 6) + 2;
+ break;
+ default:
+ return 0;
+ }
+ return index;
+}
+
+#endif
+
+#endif
diff -urN 1.0.8-orig/linux/kdev_t.h 1.0.8/linux/kdev_t.h
--- 1.0.8-orig/linux/kdev_t.h 1970-01-01 01:00:00.000000000 +0100
+++ 1.0.8/linux/kdev_t.h 2004-09-30 22:08:53.714820651 +0200
@@ -0,0 +1,123 @@
+#ifndef _LINUX_KDEV_T_H
+#define _LINUX_KDEV_T_H
+#if defined(__KERNEL__) || defined(_LVM_H_INCLUDE)
+/*
+As a preparation for the introduction of larger device numbers,
+we introduce a type kdev_t to hold them. No information about
+this type is known outside of this include file.
+
+Objects of type kdev_t designate a device. Outside of the kernel
+the corresponding things are objects of type dev_t - usually an
+integral type with the device major and minor in the high and low
+bits, respectively. Conversion is done by
+
+extern kdev_t to_kdev_t(int);
+
+It is up to the various file systems to decide how objects of type
+dev_t are stored on disk.
+The only other point of contact between kernel and outside world
+are the system calls stat and mknod, new versions of which will
+eventually have to be used in libc.
+
+[Unfortunately, the floppy control ioctls fail to hide the internal
+kernel structures, and the fd_device field of a struct floppy_drive_struct
+is user-visible. So, it remains a dev_t for the moment, with some ugly
+conversions in floppy.c.]
+
+Inside the kernel, we aim for a kdev_t type that is a pointer
+to a structure with information about the device (like major,
+minor, size, blocksize, sectorsize, name, read-only flag,
+struct file_operations etc.).
+
+However, for the time being we let kdev_t be almost the same as dev_t:
+
+typedef struct { unsigned short major, minor; } kdev_t;
+
+Admissible operations on an object of type kdev_t:
+- passing it along
+- comparing it for equality with another such object
+- storing it in ROOT_DEV, inode->i_dev, inode->i_rdev, sb->s_dev,
+ bh->b_dev, req->rq_dev, de->dc_dev, tty->device
+- using its bit pattern as argument in a hash function
+- finding its major and minor
+- complaining about it
+
+An object of type kdev_t is created only by the function MKDEV(),
+with the single exception of the constant 0 (no device).
+
+Right now the other information mentioned above is usually found
+in static arrays indexed by major or major,minor.
+
+An obstacle to immediately using
+ typedef struct { ... (* lots of information *) } *kdev_t
+is the case of mknod used to create a block device that the
+kernel doesn't know about at present (but first learns about
+when some module is inserted).
+
+aeb - 950811
+*/
+
+/* Since MINOR(dev) is used as index in static arrays,
+ the kernel is not quite ready yet for larger minors.
+ However, everything runs fine with an arbitrary kdev_t type. */
+
+#define MINORBITS 8
+#define MINORMASK ((1U << MINORBITS) - 1)
+
+typedef unsigned short kdev_t;
+
+#define MAJOR(dev) ((unsigned int) ((dev) >> MINORBITS))
+#define MINOR(dev) ((unsigned int) ((dev) & MINORMASK))
+#define HASHDEV(dev) ((unsigned int) (dev))
+#define NODEV 0
+#define MKDEV(ma,mi) (((ma) << MINORBITS) | (mi))
+#define B_FREE 0xffff /* yuk */
+
+extern const char * kdevname(kdev_t); /* note: returns pointer to static data! */
+
+/* 2.5.x compatibility */
+#define mk_kdev(a,b) MKDEV(a,b)
+#define major(d) MAJOR(d)
+#define minor(d) MINOR(d)
+#define kdev_same(a,b) ((a) == (b))
+#define kdev_none(d) (!(d))
+#define kdev_val(d) ((unsigned int)(d))
+#define val_to_kdev(d) ((kdev_t)(d))
+
+/*
+As long as device numbers in the outside world have 16 bits only,
+we use these conversions.
+*/
+
+static inline unsigned int kdev_t_to_nr(kdev_t dev) {
+ return (MAJOR(dev)<<8) | MINOR(dev);
+}
+
+static inline kdev_t to_kdev_t(int dev)
+{
+ int major, minor;
+#if 0
+ major = (dev >> 16);
+ if (!major) {
+ major = (dev >> 8);
+ minor = (dev & 0xff);
+ } else
+ minor = (dev & 0xffff);
+#else
+ major = (dev >> 8);
+ minor = (dev & 0xff);
+#endif
+ return MKDEV(major, minor);
+}
+
+#else /* __KERNEL__ || _LVM_H_INCLUDE */
+
+/*
+Some programs want their definitions of MAJOR and MINOR and MKDEV
+from the kernel sources. These must be the externally visible ones.
+*/
+#define MAJOR(dev) ((dev)>>8)
+#define MINOR(dev) ((dev) & 0xff)
+#define MKDEV(ma,mi) ((ma)<<8 | (mi))
+#endif /* __KERNEL__ || _LVM_H_INCLUDE */
+#endif
diff -urN 1.0.8-orig/linux/lvm.h 1.0.8/linux/lvm.h
--- 1.0.8-orig/linux/lvm.h 1970-01-01 01:00:00.000000000 +0100
+++ 1.0.8/linux/lvm.h 2004-09-30 22:08:45.037205472 +0200
@@ -0,0 +1,756 @@
+/*
+ * include/linux/lvm.h
+ * kernel/lvm.h
+ * tools/lib/lvm.h
+ *
+ * Copyright (C) 1997 - 2002 Heinz Mauelshagen, Sistina Software
+ *
+ * February-November 1997
+ * May-July 1998
+ * January-March,July,September,October,Dezember 1999
+ * January,February,July,November 2000
+ * January-March,June,July 2001
+ * May 2002
+ *
+ * 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
+ * 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
+ * 22/01/2001 - Change ulong to uint32_t
+ * 14/02/2001 - changed LVM_SNAPSHOT_MIN_CHUNK to 1 page
+ * 20/02/2001 - incremented IOP version to 11 because of incompatible
+ * change in VG activation (in order to support devfs better)
+ * 01/03/2001 - Revert to IOP10 and add VG_CREATE_OLD call for compatibility
+ * 08/03/2001 - new lv_t (in core) version number 5: changed page member
+ * to (struct kiobuf *) to use for COW exception table io
+ * 26/03/2001 - changed lv_v4 to lv_v5 in structure definition (HM)
+ * 21/06/2001 - changed BLOCK_SIZE back to 1024 for non S/390
+ * 22/06/2001 - added Andreas Dilger's PE on 4k boundary alignment enhancements
+ * 19/07/2001 - added rwsem compatibility macros for 2.2 kernels
+ * 13/11/2001 - reduced userspace inclusion of kernel headers to a minimum
+ *
+ */
+
+
+#ifndef _LVM_H_INCLUDE
+#define _LVM_H_INCLUDE
+
+#define LVM_RELEASE_NAME "1.0.5+"
+#define LVM_RELEASE_DATE "22/07/2002"
+
+#define _LVM_KERNEL_H_VERSION "LVM "LVM_RELEASE_NAME" ("LVM_RELEASE_DATE")"
+
+#include <linux/version.h>
+
+/*
+ * preprocessor definitions
+ */
+/* if you like emergency reset code in the driver */
+#define LVM_TOTAL_RESET
+
+#ifdef __KERNEL__
+#undef LVM_HD_NAME /* display nice names in /proc/partitions */
+
+/* lots of debugging output (see driver source)
+ #define DEBUG_LVM_GET_INFO
+ #define DEBUG
+ #define DEBUG_MAP
+ #define DEBUG_MAP_SIZE
+ #define DEBUG_IOCTL
+ #define DEBUG_READ
+ #define DEBUG_GENDISK
+ #define DEBUG_VG_CREATE
+ #define DEBUG_DEVICE
+ #define DEBUG_KFREE
+ */
+
+#include <linux/kdev_t.h>
+#include <linux/list.h>
+#include <asm/types.h>
+#include <linux/major.h>
+#else
+/* This prevents the need to include <linux/list.h> which
+ causes problems on some platforms. It's not nice but then
+ neither is the alternative. */
+struct list_head {
+ struct list_head *next, *prev;
+};
+#define __KERNEL__
+#include <linux/kdev_t.h>
+#undef __KERNEL__
+#endif /* #ifndef __KERNEL__ */
+
+
+#ifdef __KERNEL__
+#include <linux/spinlock.h>
+
+#include <asm/semaphore.h>
+#endif /* #ifdef __KERNEL__ */
+
+
+#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
+
+/* structure version */
+#define LVM_STRUCT_VERSION 1
+
+#define LVM_DIR_PREFIX "/dev/"
+
+/*
+ * 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 !!! */
+
+
+
+
+
+
+
+/*
+ * 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 0 /* minimum read ahead sectors */
+#define LVM_DEFAULT_READ_AHEAD 1024 /* sectors for 512k scsi segments */
+#define LVM_MAX_READ_AHEAD 1024 /* 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
+
+/*
+ * ioctls
+ * FIXME: the last parameter to _IO{W,R,WR} is a data type. The macro will
+ * expand this using sizeof(), so putting "1" there is misleading
+ * because sizeof(1) = sizeof(int) = sizeof(2) = 4 on a 32-bit machine!
+ */
+/* 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 */
+#if LVM_DRIVER_IOP_VERSION > 11
+#define LVM_LOCK_LVM _IO ( 0xfe, 0x9A)
+#else
+/* This is actually the same as _IO ( 0xff, 0x00), oops. Remove for IOP 12+ */
+#define LVM_LOCK_LVM _IO ( 0xfe, 0x100)
+#endif
+/* 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 /* " */
+
+#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 lv_COW_table_disk_v1 {
+ uint64_t pv_org_number;
+ uint64_t pv_org_rsector;
+ uint64_t pv_snap_number;
+ uint64_t pv_snap_rsector;
+} lv_COW_table_disk_t;
+
+/* remap physical sector/rdev pairs including hash */
+typedef struct lv_block_exception_v1 {
+ struct list_head hash;
+ uint32_t rsector_org;
+ kdev_t rdev_org;
+ uint32_t rsector_new;
+ kdev_t rdev_new;
+} lv_block_exception_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;
+
+
+/*
+ * physical volume structures
+ */
+
+/* core */
+typedef struct pv_v2 {
+ 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 block_device *bd;
+ char pv_uuid[UUID_LEN+1];
+
+#ifndef __KERNEL__
+ uint32_t pe_start; /* in sectors */
+#endif
+} pv_t;
+
+
+/* disk */
+typedef struct pv_disk_v2 {
+ 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;
+
+ /* new in struct version 2 */
+ uint32_t pe_start; /* in sectors */
+
+} pv_disk_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;
+#ifdef __KERNEL__
+ struct kiobuf *lv_iobuf;
+ struct kiobuf *lv_COW_table_iobuf;
+ struct rw_semaphore lv_lock;
+ struct list_head *lv_snapshot_hash_table;
+ uint32_t lv_snapshot_hash_table_size;
+ uint32_t lv_snapshot_hash_mask;
+ wait_queue_head_t lv_snapshot_wait;
+ int lv_snapshot_use_rate;
+ struct vg_v3 *vg;
+
+ uint lv_allocated_snapshot_le;
+#else
+ char dummy[200];
+#endif
+} lv_t;
+
+/* disk */
+typedef struct lv_disk_v3 {
+ 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_t;
+
+/*
+ * Structure Volume Group (VG) Version 1
+ */
+
+/* core */
+typedef struct vg_v3 {
+ 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 */
+#ifdef __KERNEL__
+ struct proc_dir_entry *vg_dir_pde;
+ struct proc_dir_entry *lv_subdir_pde;
+ struct proc_dir_entry *pv_subdir_pde;
+#else
+ char dummy1[200];
+#endif
+} vg_t;
+
+
+/* disk */
+typedef struct vg_disk_v2 {
+ 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_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;
+
+
+
+/* useful inlines */
+static inline ulong round_up(ulong n, ulong size) {
+ size--;
+ return (n + size) & ~size;
+}
+
+static inline ulong div_up(ulong n, ulong size) {
+ return round_up(n, size) / size;
+}
+
+/* FIXME: nasty capital letters */
+static int inline LVM_GET_COW_TABLE_CHUNKS_PER_PE(vg_t *vg, lv_t *lv) {
+ return vg->pe_size / lv->lv_chunk_size;
+}
+
+static int inline LVM_GET_COW_TABLE_ENTRIES_PER_PE(vg_t *vg, lv_t *lv) {
+ ulong chunks = vg->pe_size / lv->lv_chunk_size;
+ ulong entry_size = sizeof(lv_COW_table_disk_t);
+ ulong chunk_size = lv->lv_chunk_size * SECTOR_SIZE;
+ ulong entries = (vg->pe_size * SECTOR_SIZE) /
+ (entry_size + chunk_size);
+
+ if(chunks < 2)
+ return 0;
+
+ for(; entries; entries--)
+ if((div_up(entries * entry_size, chunk_size) + entries) <=
+ chunks)
+ break;
+
+ return entries;
+}
+
+
+#endif /* #ifndef _LVM_H_INCLUDE */
+
diff -urN 1.0.8-orig/linux/major.h 1.0.8/linux/major.h
--- 1.0.8-orig/linux/major.h 1970-01-01 01:00:00.000000000 +0100
+++ 1.0.8/linux/major.h 2004-09-30 22:08:49.775449320 +0200
@@ -0,0 +1,198 @@
+#ifndef _LINUX_MAJOR_H
+#define _LINUX_MAJOR_H
+
+/*
+ * This file has definitions for major device numbers.
+ * For the device number assignments, see Documentation/devices.txt.
+ */
+
+/* limits */
+
+/*
+ * Important: Don't change this to 256. Major number 255 is and must be
+ * reserved for future expansion into a larger dev_t space.
+ */
+#define MAX_CHRDEV 255
+#define MAX_BLKDEV 255
+
+#define UNNAMED_MAJOR 0
+#define MEM_MAJOR 1
+#define RAMDISK_MAJOR 1
+#define FLOPPY_MAJOR 2
+#define PTY_MASTER_MAJOR 2
+#define IDE0_MAJOR 3
+#define PTY_SLAVE_MAJOR 3
+#define HD_MAJOR IDE0_MAJOR
+#define TTY_MAJOR 4
+#define TTYAUX_MAJOR 5
+#define LP_MAJOR 6
+#define VCS_MAJOR 7
+#define LOOP_MAJOR 7
+#define SCSI_DISK0_MAJOR 8
+#define SCSI_TAPE_MAJOR 9
+#define MD_MAJOR 9
+#define MISC_MAJOR 10
+#define SCSI_CDROM_MAJOR 11
+#define MUX_MAJOR 11 /* PA-RISC only */
+#define QIC02_TAPE_MAJOR 12
+#define XT_DISK_MAJOR 13
+#define SOUND_MAJOR 14
+#define CDU31A_CDROM_MAJOR 15
+#define JOYSTICK_MAJOR 15
+#define GOLDSTAR_CDROM_MAJOR 16
+#define OPTICS_CDROM_MAJOR 17
+#define SANYO_CDROM_MAJOR 18
+#define CYCLADES_MAJOR 19
+#define CYCLADESAUX_MAJOR 20
+#define MITSUMI_X_CDROM_MAJOR 20
+#define MFM_ACORN_MAJOR 21 /* ARM Linux /dev/mfm */
+#define SCSI_GENERIC_MAJOR 21
+#define Z8530_MAJOR 34
+#define DIGI_MAJOR 23
+#define IDE1_MAJOR 22
+#define DIGICU_MAJOR 22
+#define MITSUMI_CDROM_MAJOR 23
+#define CDU535_CDROM_MAJOR 24
+#define STL_SERIALMAJOR 24
+#define MATSUSHITA_CDROM_MAJOR 25
+#define STL_CALLOUTMAJOR 25
+#define MATSUSHITA_CDROM2_MAJOR 26
+#define QIC117_TAPE_MAJOR 27
+#define MATSUSHITA_CDROM3_MAJOR 27
+#define MATSUSHITA_CDROM4_MAJOR 28
+#define STL_SIOMEMMAJOR 28
+#define ACSI_MAJOR 28
+#define AZTECH_CDROM_MAJOR 29
+#define GRAPHDEV_MAJOR 29 /* SparcLinux & Linux/68k /dev/fb */
+#define SHMIQ_MAJOR 85 /* Linux/mips, SGI /dev/shmiq */
+#define CM206_CDROM_MAJOR 32
+#define IDE2_MAJOR 33
+#define IDE3_MAJOR 34
+#define XPRAM_MAJOR 35 /* expanded storage on S/390 = "slow ram" */
+ /* proposed by Peter */
+#define NETLINK_MAJOR 36
+#define PS2ESDI_MAJOR 36
+#define IDETAPE_MAJOR 37
+#define Z2RAM_MAJOR 37
+#define APBLOCK_MAJOR 38 /* AP1000 Block device */
+#define DDV_MAJOR 39 /* AP1000 DDV block device */
+#define NBD_MAJOR 43 /* Network block device */
+#define RISCOM8_NORMAL_MAJOR 48
+#define DAC960_MAJOR 48 /* 48..55 */
+#define RISCOM8_CALLOUT_MAJOR 49
+#define MKISS_MAJOR 55
+#define DSP56K_MAJOR 55 /* DSP56001 processor device */
+
+#define IDE4_MAJOR 56
+#define IDE5_MAJOR 57
+
+#define LVM_BLK_MAJOR 58 /* Logical Volume Manager */
+
+#define SCSI_DISK1_MAJOR 65
+#define SCSI_DISK2_MAJOR 66
+#define SCSI_DISK3_MAJOR 67
+#define SCSI_DISK4_MAJOR 68
+#define SCSI_DISK5_MAJOR 69
+#define SCSI_DISK6_MAJOR 70
+#define SCSI_DISK7_MAJOR 71
+
+
+#define COMPAQ_SMART2_MAJOR 72
+#define COMPAQ_SMART2_MAJOR1 73
+#define COMPAQ_SMART2_MAJOR2 74
+#define COMPAQ_SMART2_MAJOR3 75
+#define COMPAQ_SMART2_MAJOR4 76
+#define COMPAQ_SMART2_MAJOR5 77
+#define COMPAQ_SMART2_MAJOR6 78
+#define COMPAQ_SMART2_MAJOR7 79
+
+#define SPECIALIX_NORMAL_MAJOR 75
+#define SPECIALIX_CALLOUT_MAJOR 76
+
+#define COMPAQ_CISS_MAJOR 104
+#define COMPAQ_CISS_MAJOR1 105
+#define COMPAQ_CISS_MAJOR2 106
+#define COMPAQ_CISS_MAJOR3 107
+#define COMPAQ_CISS_MAJOR4 108
+#define COMPAQ_CISS_MAJOR5 109
+#define COMPAQ_CISS_MAJOR6 110
+#define COMPAQ_CISS_MAJOR7 111
+
+#define ATARAID_MAJOR 114
+
+#define DASD_MAJOR 94 /* Official assignations from Peter */
+
+#define MDISK_MAJOR 95 /* Official assignations from Peter */
+
+#define I2O_MAJOR 80 /* 80->87 */
+
+#define IDE6_MAJOR 88
+#define IDE7_MAJOR 89
+#define IDE8_MAJOR 90
+#define IDE9_MAJOR 91
+
+#define UBD_MAJOR 98
+
+#define AURORA_MAJOR 79
+
+#define JSFD_MAJOR 99
+
+#define PHONE_MAJOR 100
+
+#define LVM_CHAR_MAJOR 109 /* Logical Volume Manager */
+
+#define UMEM_MAJOR 116 /* http://www.umem.com/ Battery Backed RAM */
+
+#define RTF_MAJOR 150
+#define RAW_MAJOR 162
+
+#define USB_ACM_MAJOR 166
+#define USB_ACM_AUX_MAJOR 167
+#define USB_CHAR_MAJOR 180
+
+#define UNIX98_PTY_MASTER_MAJOR 128
+#define UNIX98_PTY_MAJOR_COUNT 8
+#define UNIX98_PTY_SLAVE_MAJOR (UNIX98_PTY_MASTER_MAJOR+UNIX98_PTY_MAJOR_COUNT)
+
+#define VXVM_MAJOR 199 /* VERITAS volume i/o driver */
+#define VXSPEC_MAJOR 200 /* VERITAS volume config driver */
+#define VXDMP_MAJOR 201 /* VERITAS volume multipath driver */
+
+#define MSR_MAJOR 202
+#define CPUID_MAJOR 203
+
+#define OSST_MAJOR 206 /* OnStream-SCx0 SCSI tape */
+
+#define IBM_TTY3270_MAJOR 227 /* Official allocations now */
+#define IBM_FS3270_MAJOR 228
+
+/*
+ * Tests for SCSI devices.
+ */
+
+#define SCSI_DISK_MAJOR(M) ((M) == SCSI_DISK0_MAJOR || \
+ ((M) >= SCSI_DISK1_MAJOR && (M) <= SCSI_DISK7_MAJOR))
+
+#define SCSI_BLK_MAJOR(M) \
+ (SCSI_DISK_MAJOR(M) \
+ || (M) == SCSI_CDROM_MAJOR)
+
+static __inline__ int scsi_blk_major(int m) {
+ return SCSI_BLK_MAJOR(m);
+}
+
+/*
+ * Tests for IDE devices
+ */
+#define IDE_DISK_MAJOR(M) ((M) == IDE0_MAJOR || (M) == IDE1_MAJOR || \
+ (M) == IDE2_MAJOR || (M) == IDE3_MAJOR || \
+ (M) == IDE4_MAJOR || (M) == IDE5_MAJOR || \
+ (M) == IDE6_MAJOR || (M) == IDE7_MAJOR || \
+ (M) == IDE8_MAJOR || (M) == IDE9_MAJOR)
+
+static __inline__ int ide_blk_major(int m)
+{
+ return IDE_DISK_MAJOR(m);
+}
+
+#endif