动态磁盘的结构相对普通分区表会有些复杂,这里贴出LDM的结构代码,仅供编程爱好者参考,如果大家想管理动态磁盘推荐大家使用DiskGenius来管理。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
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[GUID_SIZE]; }; struct tocblock { /* We have exactly two bitmaps. */ u8 bitmap1_name[16]; u64 bitmap1_start; u64 bitmap1_size; u8 bitmap2_name[16]; u64 bitmap2_start; u64 bitmap2_size; }; struct vmdb { /* VMDB: The database header */ u16 ver_major; u16 ver_minor; u32 vblk_size; u32 vblk_offset; u32 last_vblk_seq; }; 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; 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 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; }; |