patch-2.4.20 linux-2.4.20/fs/partitions/ldm.h
Next file: linux-2.4.20/fs/partitions/msdos.c
Previous file: linux-2.4.20/fs/partitions/ldm.c
Back to the patch index
Back to the overall index
- Lines: 281
- Date:
Thu Nov 28 15:53:15 2002
- Orig file:
linux-2.4.19/fs/partitions/ldm.h
- Orig date:
Thu Nov 22 11:48:07 2001
diff -urN linux-2.4.19/fs/partitions/ldm.h linux-2.4.20/fs/partitions/ldm.h
@@ -1,10 +1,9 @@
-#ifndef _FS_PT_LDM_H_
-#define _FS_PT_LDM_H_
-/*
+/**
* ldm - Part of the Linux-NTFS project.
*
- * Copyright (C) 2001 Richard Russon <ldm@flatcap.org>
- * Copyright (C) 2001 Anton Altaparmakov <antona@users.sf.net>
+ * Copyright (C) 2001,2002 Richard Russon <ldm@flatcap.org>
+ * Copyright (C) 2001 Anton Altaparmakov <aia21@cantab.net>
+ * Copyright (C) 2001,2002 Jakob Kemi <jakob.kemi@telia.com>
*
* Documentation is available at http://linux-ntfs.sf.net/ldm
*
@@ -23,16 +22,18 @@
* in the file COPYING); if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+
+#ifndef _FS_PT_LDM_H_
+#define _FS_PT_LDM_H_
+
#include <linux/types.h>
+#include <linux/list.h>
+#include <linux/genhd.h>
+#include <linux/fs.h>
#include <asm/unaligned.h>
#include <asm/byteorder.h>
-#include <linux/genhd.h>
-/* Borrowed from kernel.h. */
-#define LDM_PREFIX "LDM: " /* Prefix our error messages with this. */
-#define LDM_CRIT KERN_CRIT LDM_PREFIX /* critical conditions */
-#define LDM_ERR KERN_ERR LDM_PREFIX /* error conditions */
-#define LDM_DEBUG KERN_DEBUG LDM_PREFIX /* debug-level messages */
+struct parsed_partitions;
/* Magic numbers in CPU format. */
#define MAGIC_VMDB 0x564D4442 /* VMDB */
@@ -41,41 +42,58 @@
#define MAGIC_TOCBLOCK 0x544F43424C4F434B /* TOCBLOCK */
/* The defined vblk types. */
-#define VBLK_COMP 0x32 /* Component */
-#define VBLK_PART 0x33 /* Partition */
-#define VBLK_DSK1 0x34 /* Disk */
-#define VBLK_DSK2 0x44 /* Disk */
-#define VBLK_DGR1 0x35 /* Disk Group */
-#define VBLK_DGR2 0x45 /* Disk Group */
-#define VBLK_VOLU 0x51 /* Volume */
+#define VBLK_VOL5 0x51 /* Volume, version 5 */
+#define VBLK_CMP3 0x32 /* Component, version 3 */
+#define VBLK_PRT3 0x33 /* Partition, version 3 */
+#define VBLK_DSK3 0x34 /* Disk, version 3 */
+#define VBLK_DSK4 0x44 /* Disk, version 4 */
+#define VBLK_DGR3 0x35 /* Disk Group, version 3 */
+#define VBLK_DGR4 0x45 /* Disk Group, version 4 */
+
+/* vblk flags indicating extra information will be present */
+#define VBLK_FLAG_COMP_STRIPE 0x10
+#define VBLK_FLAG_PART_INDEX 0x08
+#define VBLK_FLAG_DGR3_IDS 0x08
+#define VBLK_FLAG_DGR4_IDS 0x08
+#define VBLK_FLAG_VOLU_ID1 0x08
+#define VBLK_FLAG_VOLU_ID2 0x20
+#define VBLK_FLAG_VOLU_SIZE 0x80
+#define VBLK_FLAG_VOLU_DRIVE 0x02
+
+/* size of a vblk's static parts */
+#define VBLK_SIZE_HEAD 16
+#define VBLK_SIZE_CMP3 22 /* Name and version */
+#define VBLK_SIZE_DGR3 12
+#define VBLK_SIZE_DGR4 44
+#define VBLK_SIZE_DSK3 12
+#define VBLK_SIZE_DSK4 45
+#define VBLK_SIZE_PRT3 28
+#define VBLK_SIZE_VOL5 59
+
+/* component types */
+#define COMP_STRIPE 0x01 /* Stripe-set */
+#define COMP_BASIC 0x02 /* Basic disk */
+#define COMP_RAID 0x03 /* Raid-set */
/* Other constants. */
-#define LDM_BLOCKSIZE 1024 /* Size of block in bytes. */
#define LDM_DB_SIZE 2048 /* Size in sectors (= 1MiB). */
-#define LDM_FIRST_PART_OFFSET 4 /* Add this to first_part_minor
- to get to the first data
- partition device minor. */
-#define OFF_PRIVHEAD1 3 /* Offset of the first privhead
+#define OFF_PRIV1 6 /* Offset of the first privhead
relative to the start of the
- device in units of
- LDM_BLOCKSIZE. */
+ device in sectors */
-/* Offsets to structures within the LDM Database in units of LDM_BLOCKSIZE. */
-#define OFF_PRIVHEAD2 928 /* Backup private headers. */
-#define OFF_PRIVHEAD3 1023
-
-#define OFF_TOCBLOCK1 0 /* Tables of contents. */
-#define OFF_TOCBLOCK2 1
-#define OFF_TOCBLOCK3 1022
-#define OFF_TOCBLOCK4 1023
-
-#define OFF_VMDB 8 /* List of partitions. */
-#define OFF_VBLK 9
-
-#define WIN2K_DYNAMIC_PARTITION 0x42 /* Formerly SFS (Landis). */
-#define WIN2K_EXTENDED_PARTITION 0x05 /* A standard extended
- partition. */
+/* Offsets to structures within the LDM Database in sectors. */
+#define OFF_PRIV2 1856 /* Backup private headers. */
+#define OFF_PRIV3 2047
+
+#define OFF_TOCB1 1 /* Tables of contents. */
+#define OFF_TOCB2 2
+#define OFF_TOCB3 2045
+#define OFF_TOCB4 2046
+
+#define OFF_VMDB 17 /* List of partitions. */
+
+#define WIN2K_DYNAMIC_PARTITION 0x42 /* Formerly SFS (Landis). */
#define TOC_BITMAP1 "config" /* Names of the two defined */
#define TOC_BITMAP2 "log" /* bitmaps in the TOCBLOCK. */
@@ -85,49 +103,42 @@
#define BE32(x) ((u32)be32_to_cpu(get_unaligned((u32*)(x))))
#define BE64(x) ((u64)be64_to_cpu(get_unaligned((u64*)(x))))
-/* Borrowed from msdos.c. */
+/* Borrowed from msdos.c */
#define SYS_IND(p) (get_unaligned(&(p)->sys_ind))
-#define NR_SECTS(p) ({ __typeof__((p)->nr_sects) __a = \
- get_unaligned(&(p)->nr_sects); \
- le32_to_cpu(__a); \
- })
-
-#define START_SECT(p) ({ __typeof__((p)->start_sect) __a = \
- get_unaligned(&(p)->start_sect);\
- le32_to_cpu(__a); \
- })
-/* In memory LDM database structures. */
+struct frag { /* VBLK Fragment handling */
+ struct list_head list;
+ u32 group;
+ u8 num; /* Total number of records */
+ u8 rec; /* This is record number n */
+ u8 map; /* Which portions are in use */
+ u8 data[0];
+};
-#define DISK_ID_SIZE 64 /* Size in bytes. */
+/* In memory LDM database structures. */
-struct ldmdisk {
- u64 obj_id;
- u8 disk_id[DISK_ID_SIZE];
-};
+#define GUID_SIZE 16
-struct privhead { /* Offsets and sizes are in sectors. */
+struct privhead { /* Offsets and sizes are in sectors. */
u16 ver_major;
u16 ver_minor;
u64 logical_disk_start;
u64 logical_disk_size;
u64 config_start;
u64 config_size;
- u8 disk_id[DISK_ID_SIZE];
+ u8 disk_id[GUID_SIZE];
};
struct tocblock { /* We have exactly two bitmaps. */
u8 bitmap1_name[16];
u64 bitmap1_start;
u64 bitmap1_size;
- /*u64 bitmap1_flags;*/
u8 bitmap2_name[16];
u64 bitmap2_start;
u64 bitmap2_size;
- /*u64 bitmap2_flags;*/
};
-struct vmdb {
+struct vmdb { /* VMDB: The database header */
u16 ver_major;
u16 ver_minor;
u32 vblk_size;
@@ -135,23 +146,76 @@
u32 last_vblk_seq;
};
-struct vblk {
- u8 name[64];
- u8 vblk_type;
- u64 obj_id;
+struct vblk_comp { /* VBLK Component */
+ u8 state[16];
+ u64 parent_id;
+ u8 type;
+ u8 children;
+ u16 chunksize;
+};
+
+struct vblk_dgrp { /* VBLK Disk Group */
+ u8 disk_id[64];
+};
+
+struct vblk_disk { /* VBLK Disk */
+ u8 disk_id[GUID_SIZE];
+ u8 alt_name[128];
+};
+
+struct vblk_part { /* VBLK Partition */
+ u64 start;
+ u64 size; /* start, size and vol_off in sectors */
+ u64 volume_offset;
+ u64 parent_id;
u64 disk_id;
- u64 start_sector;
- u64 num_sectors;
+ u8 partnum;
+};
+
+struct vblk_volu { /* VBLK Volume */
+ u8 volume_type[16];
+ u8 volume_state[16];
+ u8 guid[16];
+ u8 drive_hint[4];
+ u64 size;
+ u8 partition_type;
};
-struct ldm_part {
- struct list_head part_list;
- unsigned long start;
- unsigned long size;
+struct vblk_head { /* VBLK standard header */
+ u32 group;
+ u16 rec;
+ u16 nrec;
+};
+
+struct vblk { /* Generalised VBLK */
+ u8 name[64];
+ u64 obj_id;
+ u32 sequence;
+ u8 flags;
+ u8 type;
+ union {
+ struct vblk_comp comp;
+ struct vblk_dgrp dgrp;
+ struct vblk_disk disk;
+ struct vblk_part part;
+ struct vblk_volu volu;
+ } vblk;
+ struct list_head list;
+};
+
+struct ldmdb { /* Cache of the database */
+ struct privhead ph;
+ struct tocblock toc;
+ struct vmdb vm;
+ struct list_head v_dgrp;
+ struct list_head v_disk;
+ struct list_head v_volu;
+ struct list_head v_comp;
+ struct list_head v_part;
};
-int ldm_partition(struct gendisk *hd, struct block_device *bdev,
- unsigned long first_sector, int first_part_minor);
+int ldm_partition (struct gendisk *hd, struct block_device *bdev,
+ unsigned long first_sector, int first_minor);
#endif /* _FS_PT_LDM_H_ */
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)