Linux Audio

Check our new training course

Loading...
v4.6
 
  1/**
  2 * ldm - Part of the Linux-NTFS project.
  3 *
  4 * Copyright (C) 2001,2002 Richard Russon <ldm@flatcap.org>
  5 * Copyright (c) 2001-2007 Anton Altaparmakov
  6 * Copyright (C) 2001,2002 Jakob Kemi <jakob.kemi@telia.com>
  7 *
  8 * Documentation is available at http://www.linux-ntfs.org/doku.php?id=downloads 
  9 *
 10 * This program is free software; you can redistribute it and/or modify it
 11 * under the terms of the GNU General Public License as published by the Free
 12 * Software Foundation; either version 2 of the License, or (at your option)
 13 * any later version.
 14 *
 15 * This program is distributed in the hope that it will be useful,
 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 18 * GNU General Public License for more details.
 19 *
 20 * You should have received a copy of the GNU General Public License
 21 * along with this program (in the main directory of the Linux-NTFS source
 22 * in the file COPYING); if not, write to the Free Software Foundation,
 23 * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 24 */
 25
 26#ifndef _FS_PT_LDM_H_
 27#define _FS_PT_LDM_H_
 28
 29#include <linux/types.h>
 30#include <linux/list.h>
 31#include <linux/genhd.h>
 32#include <linux/fs.h>
 33#include <asm/unaligned.h>
 34#include <asm/byteorder.h>
 35
 36struct parsed_partitions;
 37
 38/* Magic numbers in CPU format. */
 39#define MAGIC_VMDB	0x564D4442		/* VMDB */
 40#define MAGIC_VBLK	0x56424C4B		/* VBLK */
 41#define MAGIC_PRIVHEAD	0x5052495648454144ULL	/* PRIVHEAD */
 42#define MAGIC_TOCBLOCK	0x544F43424C4F434BULL	/* TOCBLOCK */
 43
 44/* The defined vblk types. */
 45#define VBLK_VOL5		0x51		/* Volume,     version 5 */
 46#define VBLK_CMP3		0x32		/* Component,  version 3 */
 47#define VBLK_PRT3		0x33		/* Partition,  version 3 */
 48#define VBLK_DSK3		0x34		/* Disk,       version 3 */
 49#define VBLK_DSK4		0x44		/* Disk,       version 4 */
 50#define VBLK_DGR3		0x35		/* Disk Group, version 3 */
 51#define VBLK_DGR4		0x45		/* Disk Group, version 4 */
 52
 53/* vblk flags indicating extra information will be present */
 54#define	VBLK_FLAG_COMP_STRIPE	0x10
 55#define	VBLK_FLAG_PART_INDEX	0x08
 56#define	VBLK_FLAG_DGR3_IDS	0x08
 57#define	VBLK_FLAG_DGR4_IDS	0x08
 58#define	VBLK_FLAG_VOLU_ID1	0x08
 59#define	VBLK_FLAG_VOLU_ID2	0x20
 60#define	VBLK_FLAG_VOLU_SIZE	0x80
 61#define	VBLK_FLAG_VOLU_DRIVE	0x02
 62
 63/* size of a vblk's static parts */
 64#define VBLK_SIZE_HEAD		16
 65#define VBLK_SIZE_CMP3		22		/* Name and version */
 66#define VBLK_SIZE_DGR3		12
 67#define VBLK_SIZE_DGR4		44
 68#define VBLK_SIZE_DSK3		12
 69#define VBLK_SIZE_DSK4		45
 70#define VBLK_SIZE_PRT3		28
 71#define VBLK_SIZE_VOL5		58
 72
 73/* component types */
 74#define COMP_STRIPE		0x01		/* Stripe-set */
 75#define COMP_BASIC		0x02		/* Basic disk */
 76#define COMP_RAID		0x03		/* Raid-set */
 77
 78/* Other constants. */
 79#define LDM_DB_SIZE		2048		/* Size in sectors (= 1MiB). */
 80
 81#define OFF_PRIV1		6		/* Offset of the first privhead
 82						   relative to the start of the
 83						   device in sectors */
 84
 85/* Offsets to structures within the LDM Database in sectors. */
 86#define OFF_PRIV2		1856		/* Backup private headers. */
 87#define OFF_PRIV3		2047
 88
 89#define OFF_TOCB1		1		/* Tables of contents. */
 90#define OFF_TOCB2		2
 91#define OFF_TOCB3		2045
 92#define OFF_TOCB4		2046
 93
 94#define OFF_VMDB		17		/* List of partitions. */
 95
 96#define LDM_PARTITION		0x42		/* Formerly SFS (Landis). */
 97
 98#define TOC_BITMAP1		"config"	/* Names of the two defined */
 99#define TOC_BITMAP2		"log"		/* bitmaps in the TOCBLOCK. */
100
101/* Borrowed from msdos.c */
102#define SYS_IND(p)		(get_unaligned(&(p)->sys_ind))
103
104struct frag {				/* VBLK Fragment handling */
105	struct list_head list;
106	u32		group;
107	u8		num;		/* Total number of records */
108	u8		rec;		/* This is record number n */
109	u8		map;		/* Which portions are in use */
110	u8		data[0];
111};
112
113/* In memory LDM database structures. */
114
115#define GUID_SIZE		16
116
117struct privhead {			/* Offsets and sizes are in sectors. */
118	u16	ver_major;
119	u16	ver_minor;
120	u64	logical_disk_start;
121	u64	logical_disk_size;
122	u64	config_start;
123	u64	config_size;
124	u8	disk_id[GUID_SIZE];
125};
126
127struct tocblock {			/* We have exactly two bitmaps. */
128	u8	bitmap1_name[16];
129	u64	bitmap1_start;
130	u64	bitmap1_size;
131	u8	bitmap2_name[16];
132	u64	bitmap2_start;
133	u64	bitmap2_size;
134};
135
136struct vmdb {				/* VMDB: The database header */
137	u16	ver_major;
138	u16	ver_minor;
139	u32	vblk_size;
140	u32	vblk_offset;
141	u32	last_vblk_seq;
142};
143
144struct vblk_comp {			/* VBLK Component */
145	u8	state[16];
146	u64	parent_id;
147	u8	type;
148	u8	children;
149	u16	chunksize;
150};
151
152struct vblk_dgrp {			/* VBLK Disk Group */
153	u8	disk_id[64];
154};
155
156struct vblk_disk {			/* VBLK Disk */
157	u8	disk_id[GUID_SIZE];
158	u8	alt_name[128];
159};
160
161struct vblk_part {			/* VBLK Partition */
162	u64	start;
163	u64	size;			/* start, size and vol_off in sectors */
164	u64	volume_offset;
165	u64	parent_id;
166	u64	disk_id;
167	u8	partnum;
168};
169
170struct vblk_volu {			/* VBLK Volume */
171	u8	volume_type[16];
172	u8	volume_state[16];
173	u8	guid[16];
174	u8	drive_hint[4];
175	u64	size;
176	u8	partition_type;
177};
178
179struct vblk_head {			/* VBLK standard header */
180	u32 group;
181	u16 rec;
182	u16 nrec;
183};
184
185struct vblk {				/* Generalised VBLK */
186	u8	name[64];
187	u64	obj_id;
188	u32	sequence;
189	u8	flags;
190	u8	type;
191	union {
192		struct vblk_comp comp;
193		struct vblk_dgrp dgrp;
194		struct vblk_disk disk;
195		struct vblk_part part;
196		struct vblk_volu volu;
197	} vblk;
198	struct list_head list;
199};
200
201struct ldmdb {				/* Cache of the database */
202	struct privhead ph;
203	struct tocblock toc;
204	struct vmdb     vm;
205	struct list_head v_dgrp;
206	struct list_head v_disk;
207	struct list_head v_volu;
208	struct list_head v_comp;
209	struct list_head v_part;
210};
211
212int ldm_partition(struct parsed_partitions *state);
213
214#endif /* _FS_PT_LDM_H_ */
215
v5.9
  1// SPDX-License-Identifier: GPL-2.0-or-later
  2/**
  3 * ldm - Part of the Linux-NTFS project.
  4 *
  5 * Copyright (C) 2001,2002 Richard Russon <ldm@flatcap.org>
  6 * Copyright (c) 2001-2007 Anton Altaparmakov
  7 * Copyright (C) 2001,2002 Jakob Kemi <jakob.kemi@telia.com>
  8 *
  9 * Documentation is available at http://www.linux-ntfs.org/doku.php?id=downloads 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 10 */
 11
 12#ifndef _FS_PT_LDM_H_
 13#define _FS_PT_LDM_H_
 14
 15#include <linux/types.h>
 16#include <linux/list.h>
 17#include <linux/genhd.h>
 18#include <linux/fs.h>
 19#include <asm/unaligned.h>
 20#include <asm/byteorder.h>
 21
 22struct parsed_partitions;
 23
 24/* Magic numbers in CPU format. */
 25#define MAGIC_VMDB	0x564D4442		/* VMDB */
 26#define MAGIC_VBLK	0x56424C4B		/* VBLK */
 27#define MAGIC_PRIVHEAD	0x5052495648454144ULL	/* PRIVHEAD */
 28#define MAGIC_TOCBLOCK	0x544F43424C4F434BULL	/* TOCBLOCK */
 29
 30/* The defined vblk types. */
 31#define VBLK_VOL5		0x51		/* Volume,     version 5 */
 32#define VBLK_CMP3		0x32		/* Component,  version 3 */
 33#define VBLK_PRT3		0x33		/* Partition,  version 3 */
 34#define VBLK_DSK3		0x34		/* Disk,       version 3 */
 35#define VBLK_DSK4		0x44		/* Disk,       version 4 */
 36#define VBLK_DGR3		0x35		/* Disk Group, version 3 */
 37#define VBLK_DGR4		0x45		/* Disk Group, version 4 */
 38
 39/* vblk flags indicating extra information will be present */
 40#define	VBLK_FLAG_COMP_STRIPE	0x10
 41#define	VBLK_FLAG_PART_INDEX	0x08
 42#define	VBLK_FLAG_DGR3_IDS	0x08
 43#define	VBLK_FLAG_DGR4_IDS	0x08
 44#define	VBLK_FLAG_VOLU_ID1	0x08
 45#define	VBLK_FLAG_VOLU_ID2	0x20
 46#define	VBLK_FLAG_VOLU_SIZE	0x80
 47#define	VBLK_FLAG_VOLU_DRIVE	0x02
 48
 49/* size of a vblk's static parts */
 50#define VBLK_SIZE_HEAD		16
 51#define VBLK_SIZE_CMP3		22		/* Name and version */
 52#define VBLK_SIZE_DGR3		12
 53#define VBLK_SIZE_DGR4		44
 54#define VBLK_SIZE_DSK3		12
 55#define VBLK_SIZE_DSK4		45
 56#define VBLK_SIZE_PRT3		28
 57#define VBLK_SIZE_VOL5		58
 58
 59/* component types */
 60#define COMP_STRIPE		0x01		/* Stripe-set */
 61#define COMP_BASIC		0x02		/* Basic disk */
 62#define COMP_RAID		0x03		/* Raid-set */
 63
 64/* Other constants. */
 65#define LDM_DB_SIZE		2048		/* Size in sectors (= 1MiB). */
 66
 67#define OFF_PRIV1		6		/* Offset of the first privhead
 68						   relative to the start of the
 69						   device in sectors */
 70
 71/* Offsets to structures within the LDM Database in sectors. */
 72#define OFF_PRIV2		1856		/* Backup private headers. */
 73#define OFF_PRIV3		2047
 74
 75#define OFF_TOCB1		1		/* Tables of contents. */
 76#define OFF_TOCB2		2
 77#define OFF_TOCB3		2045
 78#define OFF_TOCB4		2046
 79
 80#define OFF_VMDB		17		/* List of partitions. */
 81
 82#define LDM_PARTITION		0x42		/* Formerly SFS (Landis). */
 83
 84#define TOC_BITMAP1		"config"	/* Names of the two defined */
 85#define TOC_BITMAP2		"log"		/* bitmaps in the TOCBLOCK. */
 86
 87/* Borrowed from msdos.c */
 88#define SYS_IND(p)		(get_unaligned(&(p)->sys_ind))
 89
 90struct frag {				/* VBLK Fragment handling */
 91	struct list_head list;
 92	u32		group;
 93	u8		num;		/* Total number of records */
 94	u8		rec;		/* This is record number n */
 95	u8		map;		/* Which portions are in use */
 96	u8		data[];
 97};
 98
 99/* In memory LDM database structures. */
100
 
 
101struct privhead {			/* Offsets and sizes are in sectors. */
102	u16	ver_major;
103	u16	ver_minor;
104	u64	logical_disk_start;
105	u64	logical_disk_size;
106	u64	config_start;
107	u64	config_size;
108	uuid_t	disk_id;
109};
110
111struct tocblock {			/* We have exactly two bitmaps. */
112	u8	bitmap1_name[16];
113	u64	bitmap1_start;
114	u64	bitmap1_size;
115	u8	bitmap2_name[16];
116	u64	bitmap2_start;
117	u64	bitmap2_size;
118};
119
120struct vmdb {				/* VMDB: The database header */
121	u16	ver_major;
122	u16	ver_minor;
123	u32	vblk_size;
124	u32	vblk_offset;
125	u32	last_vblk_seq;
126};
127
128struct vblk_comp {			/* VBLK Component */
129	u8	state[16];
130	u64	parent_id;
131	u8	type;
132	u8	children;
133	u16	chunksize;
134};
135
136struct vblk_dgrp {			/* VBLK Disk Group */
137	u8	disk_id[64];
138};
139
140struct vblk_disk {			/* VBLK Disk */
141	uuid_t	disk_id;
142	u8	alt_name[128];
143};
144
145struct vblk_part {			/* VBLK Partition */
146	u64	start;
147	u64	size;			/* start, size and vol_off in sectors */
148	u64	volume_offset;
149	u64	parent_id;
150	u64	disk_id;
151	u8	partnum;
152};
153
154struct vblk_volu {			/* VBLK Volume */
155	u8	volume_type[16];
156	u8	volume_state[16];
157	u8	guid[16];
158	u8	drive_hint[4];
159	u64	size;
160	u8	partition_type;
161};
162
163struct vblk_head {			/* VBLK standard header */
164	u32 group;
165	u16 rec;
166	u16 nrec;
167};
168
169struct vblk {				/* Generalised VBLK */
170	u8	name[64];
171	u64	obj_id;
172	u32	sequence;
173	u8	flags;
174	u8	type;
175	union {
176		struct vblk_comp comp;
177		struct vblk_dgrp dgrp;
178		struct vblk_disk disk;
179		struct vblk_part part;
180		struct vblk_volu volu;
181	} vblk;
182	struct list_head list;
183};
184
185struct ldmdb {				/* Cache of the database */
186	struct privhead ph;
187	struct tocblock toc;
188	struct vmdb     vm;
189	struct list_head v_dgrp;
190	struct list_head v_disk;
191	struct list_head v_volu;
192	struct list_head v_comp;
193	struct list_head v_part;
194};
 
 
195
196#endif /* _FS_PT_LDM_H_ */
197