1e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/*
2e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o * probe.h - constants and on-disk structures for extracting device data
3e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o *
4e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o * Copyright (C) 1999 by Andries Brouwer
550b380b4d4ab668bad45033e3a8aaf93c7f42844Theodore Ts'o * Copyright (C) 1999, 2000, 2003 by Theodore Ts'o
6e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o * Copyright (C) 2001 by Andreas Dilger
7e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o *
8e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o * %Begin-Header%
9e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o * This file may be redistributed under the terms of the
10e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o * GNU Lesser General Public License.
11e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o * %End-Header%
12e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o */
13e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o
14e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o#ifndef _BLKID_PROBE_H
15e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o#define _BLKID_PROBE_H
16e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o
17e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o#include <blkid/blkid_types.h>
18e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o
19e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'ostruct blkid_magic;
20e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o
21ca7498596f80896c8c495d5b0c3f20dd12ca9336Theodore Ts'o#define SB_BUFFER_SIZE		0x11000
22ca7498596f80896c8c495d5b0c3f20dd12ca9336Theodore Ts'o
23ca7498596f80896c8c495d5b0c3f20dd12ca9336Theodore Ts'ostruct blkid_probe {
24ca7498596f80896c8c495d5b0c3f20dd12ca9336Theodore Ts'o	int			fd;
25ca7498596f80896c8c495d5b0c3f20dd12ca9336Theodore Ts'o	blkid_cache		cache;
26ca7498596f80896c8c495d5b0c3f20dd12ca9336Theodore Ts'o	blkid_dev		dev;
27ca7498596f80896c8c495d5b0c3f20dd12ca9336Theodore Ts'o	unsigned char		*sbbuf;
28ca7498596f80896c8c495d5b0c3f20dd12ca9336Theodore Ts'o	size_t			sb_valid;
29ca7498596f80896c8c495d5b0c3f20dd12ca9336Theodore Ts'o	unsigned char		*buf;
30ca7498596f80896c8c495d5b0c3f20dd12ca9336Theodore Ts'o	size_t			buf_max;
31ca7498596f80896c8c495d5b0c3f20dd12ca9336Theodore Ts'o};
32ca7498596f80896c8c495d5b0c3f20dd12ca9336Theodore Ts'o
33efc6f628e15de95bcd13e4f0ee223cb42115d520Theodore Ts'otypedef int (*blkid_probe_t)(struct blkid_probe *probe,
3479dd234a799434b6dc8365c49e743f00eb09d2fdTheodore Ts'o			     struct blkid_magic *id, unsigned char *buf);
35e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o
36e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'ostruct blkid_magic {
37e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	const char	*bim_type;	/* type name for this magic */
38e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	long		bim_kboff;	/* kilobyte offset of superblock */
39e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	unsigned	bim_sboff;	/* byte offset within superblock */
40e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	unsigned	bim_len;	/* length of magic */
41d3f917989badf78d1f97654e46d60d1f3d25cd17Theodore Ts'o	const char	*bim_magic;	/* magic string */
42e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	blkid_probe_t	bim_probe;	/* probe function */
43e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o};
44e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o
45e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/*
46e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o * Structures for each of the content types we want to extract information
47e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o * from.  We do not necessarily need the magic field here, because we have
48e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o * already identified the content type before we get this far.  It may still
49e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o * be useful if there are probe functions which handle multiple content types.
50e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o */
51e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'ostruct ext2_super_block {
52e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u32		s_inodes_count;
53e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u32		s_blocks_count;
54e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u32		s_r_blocks_count;
55e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u32		s_free_blocks_count;
56e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u32		s_free_inodes_count;
57e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u32		s_first_data_block;
58e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u32		s_log_block_size;
59e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u32		s_dummy3[7];
60e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	unsigned char	s_magic[2];
61e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u16		s_state;
62e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u32		s_dummy5[8];
63e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u32		s_feature_compat;
64e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u32		s_feature_incompat;
65e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u32		s_feature_ro_compat;
66e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	unsigned char   s_uuid[16];
67d3f917989badf78d1f97654e46d60d1f3d25cd17Theodore Ts'o	char	   s_volume_name[16];
68ba5e38494e6b42d77f76d9ad18744388958eca7cTheodore Ts'o	char	s_last_mounted[64];
69ba5e38494e6b42d77f76d9ad18744388958eca7cTheodore Ts'o	__u32	s_algorithm_usage_bitmap;
70ba5e38494e6b42d77f76d9ad18744388958eca7cTheodore Ts'o	__u8	s_prealloc_blocks;
71ba5e38494e6b42d77f76d9ad18744388958eca7cTheodore Ts'o	__u8	s_prealloc_dir_blocks;
72ba5e38494e6b42d77f76d9ad18744388958eca7cTheodore Ts'o	__u16	s_reserved_gdt_blocks;
73ba5e38494e6b42d77f76d9ad18744388958eca7cTheodore Ts'o	__u8	s_journal_uuid[16];
74ba5e38494e6b42d77f76d9ad18744388958eca7cTheodore Ts'o	__u32	s_journal_inum;
75ba5e38494e6b42d77f76d9ad18744388958eca7cTheodore Ts'o	__u32	s_journal_dev;
76ba5e38494e6b42d77f76d9ad18744388958eca7cTheodore Ts'o	__u32	s_last_orphan;
77ba5e38494e6b42d77f76d9ad18744388958eca7cTheodore Ts'o	__u32	s_hash_seed[4];
78ba5e38494e6b42d77f76d9ad18744388958eca7cTheodore Ts'o	__u8	s_def_hash_version;
79ba5e38494e6b42d77f76d9ad18744388958eca7cTheodore Ts'o	__u8	s_jnl_backup_type;
80ba5e38494e6b42d77f76d9ad18744388958eca7cTheodore Ts'o	__u16	s_reserved_word_pad;
81ba5e38494e6b42d77f76d9ad18744388958eca7cTheodore Ts'o	__u32	s_default_mount_opts;
82ba5e38494e6b42d77f76d9ad18744388958eca7cTheodore Ts'o	__u32	s_first_meta_bg;
83ba5e38494e6b42d77f76d9ad18744388958eca7cTheodore Ts'o	__u32	s_mkfs_time;
84ba5e38494e6b42d77f76d9ad18744388958eca7cTheodore Ts'o	__u32	s_jnl_blocks[17];
852921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o	__u32	s_blocks_count_hi;
862921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o	__u32	s_r_blocks_count_hi;
872921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o	__u32	s_free_blocks_hi;
882921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o	__u16	s_min_extra_isize;
892921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o	__u16	s_want_extra_isize;
902921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o	__u32	s_flags;
912921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o	__u16   s_raid_stride;
922921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o	__u16   s_mmp_interval;
932921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o	__u64   s_mmp_block;
942921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o	__u32   s_raid_stripe_width;
952921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o	__u32   s_reserved[163];
96e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o};
972921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o
982921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o/* for s_flags */
992921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o#define EXT2_FLAGS_TEST_FILESYS		0x0004
1002921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o
1012921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o/* for s_feature_compat */
1022921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o#define EXT3_FEATURE_COMPAT_HAS_JOURNAL		0x0004
1032921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o
1042921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o/* for s_feature_ro_compat */
1052921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o#define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER	0x0001
1062921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o#define EXT2_FEATURE_RO_COMPAT_LARGE_FILE	0x0002
1072921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o#define EXT2_FEATURE_RO_COMPAT_BTREE_DIR	0x0004
1082921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o#define EXT4_FEATURE_RO_COMPAT_HUGE_FILE	0x0008
1092921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o#define EXT4_FEATURE_RO_COMPAT_GDT_CSUM		0x0010
1102921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o#define EXT4_FEATURE_RO_COMPAT_DIR_NLINK	0x0020
1112921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o#define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE	0x0040
112e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define EXT4_FEATURE_RO_COMPAT_QUOTA		0x0100
1132921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o
1142921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o/* for s_feature_incompat */
1152921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o#define EXT2_FEATURE_INCOMPAT_FILETYPE		0x0002
1162921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o#define EXT3_FEATURE_INCOMPAT_RECOVER		0x0004
1172921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV	0x0008
1182921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o#define EXT2_FEATURE_INCOMPAT_META_BG		0x0010
1192921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o#define EXT4_FEATURE_INCOMPAT_EXTENTS		0x0040 /* extents support */
1202921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o#define EXT4_FEATURE_INCOMPAT_64BIT		0x0080
1212921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o#define EXT4_FEATURE_INCOMPAT_MMP		0x0100
1222921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o#define EXT4_FEATURE_INCOMPAT_FLEX_BG		0x0200
1232921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o
1242921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o#define EXT2_FEATURE_RO_COMPAT_SUPP	(EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER| \
1252921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o					 EXT2_FEATURE_RO_COMPAT_LARGE_FILE| \
1262921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o					 EXT2_FEATURE_RO_COMPAT_BTREE_DIR)
1272921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o#define EXT2_FEATURE_INCOMPAT_SUPP	(EXT2_FEATURE_INCOMPAT_FILETYPE| \
1282921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o					 EXT2_FEATURE_INCOMPAT_META_BG)
1292921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o#define EXT2_FEATURE_INCOMPAT_UNSUPPORTED	~EXT2_FEATURE_INCOMPAT_SUPP
1302921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o#define EXT2_FEATURE_RO_COMPAT_UNSUPPORTED	~EXT2_FEATURE_RO_COMPAT_SUPP
1312921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o
1322921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o#define EXT3_FEATURE_RO_COMPAT_SUPP	(EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER| \
1332921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o					 EXT2_FEATURE_RO_COMPAT_LARGE_FILE| \
1342921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o					 EXT2_FEATURE_RO_COMPAT_BTREE_DIR)
1352921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o#define EXT3_FEATURE_INCOMPAT_SUPP	(EXT2_FEATURE_INCOMPAT_FILETYPE| \
1362921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o					 EXT3_FEATURE_INCOMPAT_RECOVER| \
1372921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o					 EXT2_FEATURE_INCOMPAT_META_BG)
1382921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o#define EXT3_FEATURE_INCOMPAT_UNSUPPORTED	~EXT3_FEATURE_INCOMPAT_SUPP
1392921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o#define EXT3_FEATURE_RO_COMPAT_UNSUPPORTED	~EXT3_FEATURE_RO_COMPAT_SUPP
1402921332fd88b843ffb828d9c18f05bfd171ace76Theodore Ts'o
141e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o
142e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'ostruct xfs_super_block {
143e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	unsigned char	xs_magic[4];
144e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u32		xs_blocksize;
145e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u64		xs_dblocks;
146e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u64		xs_rblocks;
14709a2ef8ddab7fed91b9ec8314e0a10e11d3c0323Theodore Ts'o	__u32		xs_dummy1[2];
148e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	unsigned char	xs_uuid[16];
149e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u32		xs_dummy2[15];
150d3f917989badf78d1f97654e46d60d1f3d25cd17Theodore Ts'o	char		xs_fname[12];
151e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u32		xs_dummy3[2];
152e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u64		xs_icount;
153e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u64		xs_ifree;
154e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u64		xs_fdblocks;
155e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o};
156e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o
157e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'ostruct reiserfs_super_block {
158e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u32		rs_blocks_count;
159e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u32		rs_free_blocks;
160e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u32		rs_root_block;
161e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u32		rs_journal_block;
162e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u32		rs_journal_dev;
163e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u32		rs_orig_journal_size;
164e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u32		rs_dummy2[5];
165e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u16		rs_blocksize;
166e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u16		rs_dummy3[3];
167e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	unsigned char	rs_magic[12];
168e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u32		rs_dummy4[5];
169e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	unsigned char	rs_uuid[16];
170d3f917989badf78d1f97654e46d60d1f3d25cd17Theodore Ts'o	char		rs_label[16];
171e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o};
172e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o
173bb626bcd546a039b39b9f25e65881b36b2abe24fTheodore Ts'ostruct reiser4_super_block {
174bb626bcd546a039b39b9f25e65881b36b2abe24fTheodore Ts'o	unsigned char	rs4_magic[16];
175bb626bcd546a039b39b9f25e65881b36b2abe24fTheodore Ts'o	__u16		rs4_dummy[2];
176bb626bcd546a039b39b9f25e65881b36b2abe24fTheodore Ts'o	unsigned char	rs4_uuid[16];
177bb626bcd546a039b39b9f25e65881b36b2abe24fTheodore Ts'o	unsigned char	rs4_label[16];
178bb626bcd546a039b39b9f25e65881b36b2abe24fTheodore Ts'o	__u64		rs4_dummy2;
179bb626bcd546a039b39b9f25e65881b36b2abe24fTheodore Ts'o};
180bb626bcd546a039b39b9f25e65881b36b2abe24fTheodore Ts'o
18109a2ef8ddab7fed91b9ec8314e0a10e11d3c0323Theodore Ts'ostruct jfs_super_block {
18209a2ef8ddab7fed91b9ec8314e0a10e11d3c0323Theodore Ts'o	unsigned char	js_magic[4];
18309a2ef8ddab7fed91b9ec8314e0a10e11d3c0323Theodore Ts'o	__u32		js_version;
18409a2ef8ddab7fed91b9ec8314e0a10e11d3c0323Theodore Ts'o	__u64		js_size;
185b41fb002257d4b997560cd77676b78219be03c24Theodore Ts'o	__u32		js_bsize;	/* 4: aggregate block size in bytes */
186b41fb002257d4b997560cd77676b78219be03c24Theodore Ts'o	__u16		js_l2bsize;	/* 2: log2 of s_bsize */
187b41fb002257d4b997560cd77676b78219be03c24Theodore Ts'o	__u16		js_l2bfactor;	/* 2: log2(s_bsize/hardware block size) */
188b41fb002257d4b997560cd77676b78219be03c24Theodore Ts'o	__u32		js_pbsize;	/* 4: hardware/LVM block size in bytes */
189b41fb002257d4b997560cd77676b78219be03c24Theodore Ts'o	__u16		js_l2pbsize;	/* 2: log2 of s_pbsize */
190b41fb002257d4b997560cd77676b78219be03c24Theodore Ts'o	__u16 		js_pad;		/* 2: padding necessary for alignment */
191b41fb002257d4b997560cd77676b78219be03c24Theodore Ts'o	__u32		js_dummy2[26];
19209a2ef8ddab7fed91b9ec8314e0a10e11d3c0323Theodore Ts'o	unsigned char	js_uuid[16];
19309a2ef8ddab7fed91b9ec8314e0a10e11d3c0323Theodore Ts'o	unsigned char	js_label[16];
19409a2ef8ddab7fed91b9ec8314e0a10e11d3c0323Theodore Ts'o	unsigned char	js_loguuid[16];
19509a2ef8ddab7fed91b9ec8314e0a10e11d3c0323Theodore Ts'o};
19609a2ef8ddab7fed91b9ec8314e0a10e11d3c0323Theodore Ts'o
19709a2ef8ddab7fed91b9ec8314e0a10e11d3c0323Theodore Ts'ostruct romfs_super_block {
19809a2ef8ddab7fed91b9ec8314e0a10e11d3c0323Theodore Ts'o	unsigned char	ros_magic[8];
19909a2ef8ddab7fed91b9ec8314e0a10e11d3c0323Theodore Ts'o	__u32		ros_dummy1[2];
20009a2ef8ddab7fed91b9ec8314e0a10e11d3c0323Theodore Ts'o	unsigned char	ros_volume[16];
20109a2ef8ddab7fed91b9ec8314e0a10e11d3c0323Theodore Ts'o};
20209a2ef8ddab7fed91b9ec8314e0a10e11d3c0323Theodore Ts'o
2034c4e3f784330978fa127edaa3936957d38c7e93aTheodore Ts'ostruct cramfs_super_block {
2044c4e3f784330978fa127edaa3936957d38c7e93aTheodore Ts'o	__u8		magic[4];
2054c4e3f784330978fa127edaa3936957d38c7e93aTheodore Ts'o	__u32		size;
2064c4e3f784330978fa127edaa3936957d38c7e93aTheodore Ts'o	__u32		flags;
2074c4e3f784330978fa127edaa3936957d38c7e93aTheodore Ts'o	__u32		future;
2084c4e3f784330978fa127edaa3936957d38c7e93aTheodore Ts'o	__u8		signature[16];
2094c4e3f784330978fa127edaa3936957d38c7e93aTheodore Ts'o	struct cramfs_info {
2104c4e3f784330978fa127edaa3936957d38c7e93aTheodore Ts'o		__u32		crc;
2114c4e3f784330978fa127edaa3936957d38c7e93aTheodore Ts'o		__u32		edition;
2124c4e3f784330978fa127edaa3936957d38c7e93aTheodore Ts'o		__u32		blocks;
2134c4e3f784330978fa127edaa3936957d38c7e93aTheodore Ts'o		__u32		files;
2144c4e3f784330978fa127edaa3936957d38c7e93aTheodore Ts'o	} info;
2154c4e3f784330978fa127edaa3936957d38c7e93aTheodore Ts'o	__u8		name[16];
2164c4e3f784330978fa127edaa3936957d38c7e93aTheodore Ts'o};
2174c4e3f784330978fa127edaa3936957d38c7e93aTheodore Ts'o
2187369f0ce5fdde7f8a1cc6e49211469b905c2c58fTheodore Ts'ostruct swap_id_block {
2197369f0ce5fdde7f8a1cc6e49211469b905c2c58fTheodore Ts'o/*	unsigned char	sws_boot[1024]; */
2207369f0ce5fdde7f8a1cc6e49211469b905c2c58fTheodore Ts'o	__u32		sws_version;
2217369f0ce5fdde7f8a1cc6e49211469b905c2c58fTheodore Ts'o	__u32		sws_lastpage;
2227369f0ce5fdde7f8a1cc6e49211469b905c2c58fTheodore Ts'o	__u32		sws_nrbad;
2237369f0ce5fdde7f8a1cc6e49211469b905c2c58fTheodore Ts'o	unsigned char	sws_uuid[16];
22412b3c8ec1d314b8775fc7d9cefd6bfff551f1de0Theodore Ts'o	char		sws_volume[16];
2257369f0ce5fdde7f8a1cc6e49211469b905c2c58fTheodore Ts'o	unsigned char	sws_pad[117];
2267369f0ce5fdde7f8a1cc6e49211469b905c2c58fTheodore Ts'o	__u32		sws_badpg;
2277369f0ce5fdde7f8a1cc6e49211469b905c2c58fTheodore Ts'o};
2287369f0ce5fdde7f8a1cc6e49211469b905c2c58fTheodore Ts'o
229e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/* Yucky misaligned values */
230e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'ostruct vfat_super_block {
231e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/* 00*/	unsigned char	vs_ignored[3];
232e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/* 03*/	unsigned char	vs_sysid[8];
233e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/* 0b*/	unsigned char	vs_sector_size[2];
234e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/* 0d*/	__u8		vs_cluster_size;
235e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/* 0e*/	__u16		vs_reserved;
236e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/* 10*/	__u8		vs_fats;
237e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/* 11*/	unsigned char	vs_dir_entries[2];
238e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/* 13*/	unsigned char	vs_sectors[2];
239e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/* 15*/	unsigned char	vs_media;
240e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/* 16*/	__u16		vs_fat_length;
241e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/* 18*/	__u16		vs_secs_track;
242e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/* 1a*/	__u16		vs_heads;
243e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/* 1c*/	__u32		vs_hidden;
244e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/* 20*/	__u32		vs_total_sect;
245e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/* 24*/	__u32		vs_fat32_length;
246e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/* 28*/	__u16		vs_flags;
247e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/* 2a*/	__u8		vs_version[2];
248e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/* 2c*/	__u32		vs_root_cluster;
249e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/* 30*/	__u16		vs_insfo_sector;
250e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/* 32*/	__u16		vs_backup_boot;
251e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/* 34*/	__u16		vs_reserved2[6];
252e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/* 40*/	unsigned char	vs_unknown[3];
253e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/* 43*/	unsigned char	vs_serno[4];
254ca7498596f80896c8c495d5b0c3f20dd12ca9336Theodore Ts'o/* 47*/	unsigned char	vs_label[11];
255e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/* 52*/	unsigned char   vs_magic[8];
256e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/* 5a*/	unsigned char	vs_dummy2[164];
257e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/*1fe*/	unsigned char	vs_pmagic[2];
258e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o};
259e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o
260e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/* Yucky misaligned values */
261e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'ostruct msdos_super_block {
262e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/* 00*/	unsigned char	ms_ignored[3];
263e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/* 03*/	unsigned char	ms_sysid[8];
264e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/* 0b*/	unsigned char	ms_sector_size[2];
265e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/* 0d*/	__u8		ms_cluster_size;
266e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/* 0e*/	__u16		ms_reserved;
267e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/* 10*/	__u8		ms_fats;
268e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/* 11*/	unsigned char	ms_dir_entries[2];
269e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/* 13*/	unsigned char	ms_sectors[2];
270e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/* 15*/	unsigned char	ms_media;
271e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/* 16*/	__u16		ms_fat_length;
272e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/* 18*/	__u16		ms_secs_track;
273e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/* 1a*/	__u16		ms_heads;
274e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/* 1c*/	__u32		ms_hidden;
275e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/* 20*/	__u32		ms_total_sect;
276e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/* 24*/	unsigned char	ms_unknown[3];
277e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/* 27*/	unsigned char	ms_serno[4];
278ca7498596f80896c8c495d5b0c3f20dd12ca9336Theodore Ts'o/* 2b*/	unsigned char	ms_label[11];
279e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/* 36*/	unsigned char   ms_magic[8];
280e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/* 3d*/	unsigned char	ms_dummy2[192];
281e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o/*1fe*/	unsigned char	ms_pmagic[2];
282e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o};
283e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o
284c4c740ff488dae232dd3a64fccd26ec7265165a4Karel Zakstruct vfat_dir_entry {
285c4c740ff488dae232dd3a64fccd26ec7265165a4Karel Zak	__u8	name[11];
286c4c740ff488dae232dd3a64fccd26ec7265165a4Karel Zak	__u8	attr;
287c4c740ff488dae232dd3a64fccd26ec7265165a4Karel Zak	__u16	time_creat;
288c4c740ff488dae232dd3a64fccd26ec7265165a4Karel Zak	__u16	date_creat;
289c4c740ff488dae232dd3a64fccd26ec7265165a4Karel Zak	__u16	time_acc;
290c4c740ff488dae232dd3a64fccd26ec7265165a4Karel Zak	__u16	date_acc;
291c4c740ff488dae232dd3a64fccd26ec7265165a4Karel Zak	__u16	cluster_high;
292c4c740ff488dae232dd3a64fccd26ec7265165a4Karel Zak	__u16	time_write;
293c4c740ff488dae232dd3a64fccd26ec7265165a4Karel Zak	__u16	date_write;
294c4c740ff488dae232dd3a64fccd26ec7265165a4Karel Zak	__u16	cluster_low;
295c4c740ff488dae232dd3a64fccd26ec7265165a4Karel Zak	__u32	size;
296c4c740ff488dae232dd3a64fccd26ec7265165a4Karel Zak};
297c4c740ff488dae232dd3a64fccd26ec7265165a4Karel Zak
298c4c740ff488dae232dd3a64fccd26ec7265165a4Karel Zak/* maximum number of clusters */
299c4c740ff488dae232dd3a64fccd26ec7265165a4Karel Zak#define FAT12_MAX 0xFF4
300c4c740ff488dae232dd3a64fccd26ec7265165a4Karel Zak#define FAT16_MAX 0xFFF4
301c4c740ff488dae232dd3a64fccd26ec7265165a4Karel Zak#define FAT32_MAX 0x0FFFFFF6
302c4c740ff488dae232dd3a64fccd26ec7265165a4Karel Zak
303e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'ostruct minix_super_block {
304e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u16		ms_ninodes;
305e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u16		ms_nzones;
306e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u16		ms_imap_blocks;
307e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u16		ms_zmap_blocks;
308e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u16		ms_firstdatazone;
309e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u16		ms_log_zone_size;
310e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u32		ms_max_size;
311e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	unsigned char	ms_magic[2];
312e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u16		ms_state;
313e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u32		ms_zones;
314e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o};
315e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o
316e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'ostruct mdp_superblock_s {
317e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u32 md_magic;
318e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u32 major_version;
319e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u32 minor_version;
320e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u32 patch_version;
321e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u32 gvalid_words;
322e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u32 set_uuid0;
323e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u32 ctime;
324e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u32 level;
325e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u32 size;
326e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u32 nr_disks;
327e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u32 raid_disks;
328e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u32 md_minor;
329e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u32 not_persistent;
330e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u32 set_uuid1;
331e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u32 set_uuid2;
332e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u32 set_uuid3;
333e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o};
334e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o
335e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'ostruct hfs_super_block {
336e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	char	h_magic[2];
337e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	char	h_dummy[18];
338e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o	__u32	h_blksize;
339e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o};
340e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o
3419387c281ef88cd1fba7cb1c9336b5ab00a2d82b4Theodore Ts'ostruct ocfs_volume_header {
3423838f7df134035089e8e8df317112e4fd645602dTheodore Ts'o	unsigned char	minor_version[4];
3433838f7df134035089e8e8df317112e4fd645602dTheodore Ts'o	unsigned char	major_version[4];
3443838f7df134035089e8e8df317112e4fd645602dTheodore Ts'o	unsigned char	signature[128];
34512b3c8ec1d314b8775fc7d9cefd6bfff551f1de0Theodore Ts'o	char		mount[128];
34612b3c8ec1d314b8775fc7d9cefd6bfff551f1de0Theodore Ts'o	unsigned char   mount_len[2];
3479387c281ef88cd1fba7cb1c9336b5ab00a2d82b4Theodore Ts'o};
3489387c281ef88cd1fba7cb1c9336b5ab00a2d82b4Theodore Ts'o
3499387c281ef88cd1fba7cb1c9336b5ab00a2d82b4Theodore Ts'ostruct ocfs_volume_label {
3503838f7df134035089e8e8df317112e4fd645602dTheodore Ts'o	unsigned char	disk_lock[48];
351efc6f628e15de95bcd13e4f0ee223cb42115d520Theodore Ts'o	char		label[64];
3523838f7df134035089e8e8df317112e4fd645602dTheodore Ts'o	unsigned char	label_len[2];
3533838f7df134035089e8e8df317112e4fd645602dTheodore Ts'o	unsigned char  vol_id[16];
3543838f7df134035089e8e8df317112e4fd645602dTheodore Ts'o	unsigned char  vol_id_len[2];
3559387c281ef88cd1fba7cb1c9336b5ab00a2d82b4Theodore Ts'o};
3569387c281ef88cd1fba7cb1c9336b5ab00a2d82b4Theodore Ts'o
3573838f7df134035089e8e8df317112e4fd645602dTheodore Ts'o#define ocfsmajor(o) ((__u32)o.major_version[0] \
3583838f7df134035089e8e8df317112e4fd645602dTheodore Ts'o                   + (((__u32) o.major_version[1]) << 8) \
3593838f7df134035089e8e8df317112e4fd645602dTheodore Ts'o                   + (((__u32) o.major_version[2]) << 16) \
3603838f7df134035089e8e8df317112e4fd645602dTheodore Ts'o                   + (((__u32) o.major_version[3]) << 24))
3613838f7df134035089e8e8df317112e4fd645602dTheodore Ts'o#define ocfslabellen(o)	((__u32)o.label_len[0] + (((__u32) o.label_len[1]) << 8))
3623838f7df134035089e8e8df317112e4fd645602dTheodore Ts'o#define ocfsmountlen(o)	((__u32)o.mount_len[0] + (((__u32) o.mount_len[1])<<8))
3639387c281ef88cd1fba7cb1c9336b5ab00a2d82b4Theodore Ts'o
3649387c281ef88cd1fba7cb1c9336b5ab00a2d82b4Theodore Ts'o#define OCFS_MAGIC "OracleCFS"
3659387c281ef88cd1fba7cb1c9336b5ab00a2d82b4Theodore Ts'o
366414846b126d4d751bd6b36df0a39dcb030e0feb3Theodore Ts'ostruct ocfs2_super_block {
3673838f7df134035089e8e8df317112e4fd645602dTheodore Ts'o	unsigned char  signature[8];
3683838f7df134035089e8e8df317112e4fd645602dTheodore Ts'o	unsigned char  s_dummy1[184];
3693838f7df134035089e8e8df317112e4fd645602dTheodore Ts'o	unsigned char  s_dummy2[80];
37012b3c8ec1d314b8775fc7d9cefd6bfff551f1de0Theodore Ts'o	char	       s_label[64];
3713838f7df134035089e8e8df317112e4fd645602dTheodore Ts'o	unsigned char  s_uuid[16];
372414846b126d4d751bd6b36df0a39dcb030e0feb3Theodore Ts'o};
373414846b126d4d751bd6b36df0a39dcb030e0feb3Theodore Ts'o
374414846b126d4d751bd6b36df0a39dcb030e0feb3Theodore Ts'o#define OCFS2_MIN_BLOCKSIZE             512
375414846b126d4d751bd6b36df0a39dcb030e0feb3Theodore Ts'o#define OCFS2_MAX_BLOCKSIZE             4096
376414846b126d4d751bd6b36df0a39dcb030e0feb3Theodore Ts'o
377414846b126d4d751bd6b36df0a39dcb030e0feb3Theodore Ts'o#define OCFS2_SUPER_BLOCK_BLKNO         2
378414846b126d4d751bd6b36df0a39dcb030e0feb3Theodore Ts'o
379414846b126d4d751bd6b36df0a39dcb030e0feb3Theodore Ts'o#define OCFS2_SUPER_BLOCK_SIGNATURE     "OCFSV2"
380414846b126d4d751bd6b36df0a39dcb030e0feb3Theodore Ts'o
3812c92375ea426768a6e37faf876b2b06f0bf781a6Theodore Ts'ostruct oracle_asm_disk_label {
3822c92375ea426768a6e37faf876b2b06f0bf781a6Theodore Ts'o	char dummy[32];
3832c92375ea426768a6e37faf876b2b06f0bf781a6Theodore Ts'o	char dl_tag[8];
3842c92375ea426768a6e37faf876b2b06f0bf781a6Theodore Ts'o	char dl_id[24];
3852c92375ea426768a6e37faf876b2b06f0bf781a6Theodore Ts'o};
3862c92375ea426768a6e37faf876b2b06f0bf781a6Theodore Ts'o
3872c92375ea426768a6e37faf876b2b06f0bf781a6Theodore Ts'o#define ORACLE_ASM_DISK_LABEL_MARKED    "ORCLDISK"
3882c92375ea426768a6e37faf876b2b06f0bf781a6Theodore Ts'o#define ORACLE_ASM_DISK_LABEL_OFFSET    32
3892c92375ea426768a6e37faf876b2b06f0bf781a6Theodore Ts'o
3903de5bf61060634c5c8c3a0d231e8a7246094a2c2Theodore Ts'ostruct iso_volume_descriptor {
39145a3fa873852ce407b5eda0f764c63bab04e4c0cTheodore Ts'o	unsigned char	vd_type;
39245a3fa873852ce407b5eda0f764c63bab04e4c0cTheodore Ts'o	unsigned char	vd_id[5];
39345a3fa873852ce407b5eda0f764c63bab04e4c0cTheodore Ts'o	unsigned char	vd_version;
39445a3fa873852ce407b5eda0f764c63bab04e4c0cTheodore Ts'o	unsigned char	flags;
39545a3fa873852ce407b5eda0f764c63bab04e4c0cTheodore Ts'o	unsigned char	system_id[32];
39645a3fa873852ce407b5eda0f764c63bab04e4c0cTheodore Ts'o	unsigned char	volume_id[32];
39745a3fa873852ce407b5eda0f764c63bab04e4c0cTheodore Ts'o	unsigned char	unused[8];
39845a3fa873852ce407b5eda0f764c63bab04e4c0cTheodore Ts'o	unsigned char	space_size[8];
39945a3fa873852ce407b5eda0f764c63bab04e4c0cTheodore Ts'o	unsigned char	escape_sequences[8];
4003de5bf61060634c5c8c3a0d231e8a7246094a2c2Theodore Ts'o};
4013de5bf61060634c5c8c3a0d231e8a7246094a2c2Theodore Ts'o
402b5517ca6678d590b52f38ad701fbaf6c9716b73dKarel Zak/* Common gfs/gfs2 constants: */
403b5517ca6678d590b52f38ad701fbaf6c9716b73dKarel Zak#define GFS_MAGIC               0x01161970
404b5517ca6678d590b52f38ad701fbaf6c9716b73dKarel Zak#define GFS_DEFAULT_BSIZE       4096
405b5517ca6678d590b52f38ad701fbaf6c9716b73dKarel Zak#define GFS_SUPERBLOCK_OFFSET	(0x10 * GFS_DEFAULT_BSIZE)
406b5517ca6678d590b52f38ad701fbaf6c9716b73dKarel Zak#define GFS_METATYPE_SB         1
407b5517ca6678d590b52f38ad701fbaf6c9716b73dKarel Zak#define GFS_FORMAT_SB           100
408b5517ca6678d590b52f38ad701fbaf6c9716b73dKarel Zak#define GFS_LOCKNAME_LEN        64
409b5517ca6678d590b52f38ad701fbaf6c9716b73dKarel Zak
410b5517ca6678d590b52f38ad701fbaf6c9716b73dKarel Zak/* gfs1 constants: */
411b5517ca6678d590b52f38ad701fbaf6c9716b73dKarel Zak#define GFS_FORMAT_FS           1309
412b5517ca6678d590b52f38ad701fbaf6c9716b73dKarel Zak#define GFS_FORMAT_MULTI        1401
413b5517ca6678d590b52f38ad701fbaf6c9716b73dKarel Zak/* gfs2 constants: */
414b5517ca6678d590b52f38ad701fbaf6c9716b73dKarel Zak#define GFS2_FORMAT_FS          1801
415b5517ca6678d590b52f38ad701fbaf6c9716b73dKarel Zak#define GFS2_FORMAT_MULTI       1900
416b5517ca6678d590b52f38ad701fbaf6c9716b73dKarel Zak
417b5517ca6678d590b52f38ad701fbaf6c9716b73dKarel Zakstruct gfs2_meta_header {
418b5517ca6678d590b52f38ad701fbaf6c9716b73dKarel Zak	__u32 mh_magic;
419b5517ca6678d590b52f38ad701fbaf6c9716b73dKarel Zak	__u32 mh_type;
420b5517ca6678d590b52f38ad701fbaf6c9716b73dKarel Zak	__u64 __pad0;          /* Was generation number in gfs1 */
421b5517ca6678d590b52f38ad701fbaf6c9716b73dKarel Zak	__u32 mh_format;
422b5517ca6678d590b52f38ad701fbaf6c9716b73dKarel Zak	__u32 __pad1;          /* Was incarnation number in gfs1 */
423b5517ca6678d590b52f38ad701fbaf6c9716b73dKarel Zak};
424b5517ca6678d590b52f38ad701fbaf6c9716b73dKarel Zak
425b5517ca6678d590b52f38ad701fbaf6c9716b73dKarel Zakstruct gfs2_inum {
426b5517ca6678d590b52f38ad701fbaf6c9716b73dKarel Zak	__u64 no_formal_ino;
427b5517ca6678d590b52f38ad701fbaf6c9716b73dKarel Zak	__u64 no_addr;
428b5517ca6678d590b52f38ad701fbaf6c9716b73dKarel Zak};
429b5517ca6678d590b52f38ad701fbaf6c9716b73dKarel Zak
430b5517ca6678d590b52f38ad701fbaf6c9716b73dKarel Zakstruct gfs2_sb {
431b5517ca6678d590b52f38ad701fbaf6c9716b73dKarel Zak	struct gfs2_meta_header sb_header;
432b5517ca6678d590b52f38ad701fbaf6c9716b73dKarel Zak
433b5517ca6678d590b52f38ad701fbaf6c9716b73dKarel Zak	__u32 sb_fs_format;
434b5517ca6678d590b52f38ad701fbaf6c9716b73dKarel Zak	__u32 sb_multihost_format;
435b5517ca6678d590b52f38ad701fbaf6c9716b73dKarel Zak	__u32  __pad0;  /* Was superblock flags in gfs1 */
436efc6f628e15de95bcd13e4f0ee223cb42115d520Theodore Ts'o
437b5517ca6678d590b52f38ad701fbaf6c9716b73dKarel Zak	__u32 sb_bsize;
438b5517ca6678d590b52f38ad701fbaf6c9716b73dKarel Zak	__u32 sb_bsize_shift;
439b5517ca6678d590b52f38ad701fbaf6c9716b73dKarel Zak	__u32 __pad1;   /* Was journal segment size in gfs1 */
440efc6f628e15de95bcd13e4f0ee223cb42115d520Theodore Ts'o
441b5517ca6678d590b52f38ad701fbaf6c9716b73dKarel Zak	struct gfs2_inum sb_master_dir; /* Was jindex dinode in gfs1 */
442b5517ca6678d590b52f38ad701fbaf6c9716b73dKarel Zak	struct gfs2_inum __pad2; /* Was rindex dinode in gfs1 */
443b5517ca6678d590b52f38ad701fbaf6c9716b73dKarel Zak	struct gfs2_inum sb_root_dir;
444efc6f628e15de95bcd13e4f0ee223cb42115d520Theodore Ts'o
445b5517ca6678d590b52f38ad701fbaf6c9716b73dKarel Zak	char sb_lockproto[GFS_LOCKNAME_LEN];
446b5517ca6678d590b52f38ad701fbaf6c9716b73dKarel Zak	char sb_locktable[GFS_LOCKNAME_LEN];
447b5517ca6678d590b52f38ad701fbaf6c9716b73dKarel Zak	/* In gfs1, quota and license dinodes followed */
448b5517ca6678d590b52f38ad701fbaf6c9716b73dKarel Zak};
449b5517ca6678d590b52f38ad701fbaf6c9716b73dKarel Zak
450cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'ostruct ntfs_super_block {
451cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'o	__u8	jump[3];
452cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'o	__u8	oem_id[8];
453cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'o	__u8	bios_parameter_block[25];
454cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'o	__u16	unused[2];
455cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'o	__u64	number_of_sectors;
456cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'o	__u64	mft_cluster_location;
457cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'o	__u64	mft_mirror_cluster_location;
458cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'o	__s8	cluster_per_mft_record;
459cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'o	__u8	reserved1[3];
460cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'o	__s8	cluster_per_index_record;
461cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'o	__u8	reserved2[3];
462cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'o	__u64	volume_serial;
463cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'o	__u16	checksum;
464cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'o};
465cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'o
466cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'ostruct master_file_table_record {
467cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'o	__u32	magic;
468cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'o	__u16	usa_ofs;
469cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'o	__u16	usa_count;
470cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'o	__u64	lsn;
471cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'o	__u16	sequence_number;
472cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'o	__u16	link_count;
473cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'o	__u16	attrs_offset;
474cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'o	__u16	flags;
475cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'o	__u32	bytes_in_use;
476cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'o	__u32	bytes_allocated;
477cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'o} __attribute__((__packed__));
478cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'o
479cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'ostruct file_attribute {
480cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'o	__u32	type;
481cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'o	__u32	len;
482cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'o	__u8	non_resident;
483cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'o	__u8	name_len;
484cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'o	__u16	name_offset;
485cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'o	__u16	flags;
486cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'o	__u16	instance;
487cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'o	__u32	value_len;
488cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'o	__u16	value_offset;
489cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'o} __attribute__((__packed__));
490cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'o
491cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'o#define MFT_RECORD_VOLUME			3
492cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'o#define MFT_RECORD_ATTR_VOLUME_NAME		0x60
493cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'o#define MFT_RECORD_ATTR_VOLUME_INFO		0x70
494cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'o#define MFT_RECORD_ATTR_OBJECT_ID		0x40
495cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'o#define MFT_RECORD_ATTR_END			0xffffffffu
496cb0c5d701a8852f72fe75c9bd223643fb5222399Theodore Ts'o
49769d742284d083c8f6ce7d9240019e21f2fbd9ed5Theodore Ts'o/* HFS / HFS+ */
49869d742284d083c8f6ce7d9240019e21f2fbd9ed5Theodore Ts'ostruct hfs_finder_info {
49969d742284d083c8f6ce7d9240019e21f2fbd9ed5Theodore Ts'o        __u32        boot_folder;
50069d742284d083c8f6ce7d9240019e21f2fbd9ed5Theodore Ts'o        __u32        start_app;
50169d742284d083c8f6ce7d9240019e21f2fbd9ed5Theodore Ts'o        __u32        open_folder;
50269d742284d083c8f6ce7d9240019e21f2fbd9ed5Theodore Ts'o        __u32        os9_folder;
50369d742284d083c8f6ce7d9240019e21f2fbd9ed5Theodore Ts'o        __u32        reserved;
50469d742284d083c8f6ce7d9240019e21f2fbd9ed5Theodore Ts'o        __u32        osx_folder;
50569d742284d083c8f6ce7d9240019e21f2fbd9ed5Theodore Ts'o        __u8         id[8];
50669d742284d083c8f6ce7d9240019e21f2fbd9ed5Theodore Ts'o} __attribute__((packed));
50769d742284d083c8f6ce7d9240019e21f2fbd9ed5Theodore Ts'o
50869d742284d083c8f6ce7d9240019e21f2fbd9ed5Theodore Ts'ostruct hfs_mdb {
50969d742284d083c8f6ce7d9240019e21f2fbd9ed5Theodore Ts'o        __u8         signature[2];
51069d742284d083c8f6ce7d9240019e21f2fbd9ed5Theodore Ts'o        __u32        cr_date;
51169d742284d083c8f6ce7d9240019e21f2fbd9ed5Theodore Ts'o        __u32        ls_Mod;
51269d742284d083c8f6ce7d9240019e21f2fbd9ed5Theodore Ts'o        __u16        atrb;
51369d742284d083c8f6ce7d9240019e21f2fbd9ed5Theodore Ts'o        __u16        nm_fls;
51469d742284d083c8f6ce7d9240019e21f2fbd9ed5Theodore Ts'o        __u16        vbm_st;
51569d742284d083c8f6ce7d9240019e21f2fbd9ed5Theodore Ts'o        __u16        alloc_ptr;
51669d742284d083c8f6ce7d9240019e21f2fbd9ed5Theodore Ts'o        __u16        nm_al_blks;
51769d742284d083c8f6ce7d9240019e21f2fbd9ed5Theodore Ts'o        __u32        al_blk_size;
51869d742284d083c8f6ce7d9240019e21f2fbd9ed5Theodore Ts'o        __u32        clp_size;
51969d742284d083c8f6ce7d9240019e21f2fbd9ed5Theodore Ts'o        __u16        al_bl_st;
52069d742284d083c8f6ce7d9240019e21f2fbd9ed5Theodore Ts'o        __u32        nxt_cnid;
52169d742284d083c8f6ce7d9240019e21f2fbd9ed5Theodore Ts'o        __u16        free_bks;
52269d742284d083c8f6ce7d9240019e21f2fbd9ed5Theodore Ts'o        __u8         label_len;
52369d742284d083c8f6ce7d9240019e21f2fbd9ed5Theodore Ts'o        __u8         label[27];
52469d742284d083c8f6ce7d9240019e21f2fbd9ed5Theodore Ts'o        __u32        vol_bkup;
52569d742284d083c8f6ce7d9240019e21f2fbd9ed5Theodore Ts'o        __u16        vol_seq_num;
52669d742284d083c8f6ce7d9240019e21f2fbd9ed5Theodore Ts'o        __u32        wr_cnt;
52769d742284d083c8f6ce7d9240019e21f2fbd9ed5Theodore Ts'o        __u32        xt_clump_size;
52869d742284d083c8f6ce7d9240019e21f2fbd9ed5Theodore Ts'o        __u32        ct_clump_size;
52969d742284d083c8f6ce7d9240019e21f2fbd9ed5Theodore Ts'o        __u16        num_root_dirs;
53069d742284d083c8f6ce7d9240019e21f2fbd9ed5Theodore Ts'o        __u32        file_count;
53169d742284d083c8f6ce7d9240019e21f2fbd9ed5Theodore Ts'o        __u32        dir_count;
53269d742284d083c8f6ce7d9240019e21f2fbd9ed5Theodore Ts'o        struct hfs_finder_info finder_info;
53369d742284d083c8f6ce7d9240019e21f2fbd9ed5Theodore Ts'o        __u8         embed_sig[2];
53469d742284d083c8f6ce7d9240019e21f2fbd9ed5Theodore Ts'o        __u16        embed_startblock;
53569d742284d083c8f6ce7d9240019e21f2fbd9ed5Theodore Ts'o        __u16        embed_blockcount;
53669d742284d083c8f6ce7d9240019e21f2fbd9ed5Theodore Ts'o} __attribute__((packed));
53769d742284d083c8f6ce7d9240019e21f2fbd9ed5Theodore Ts'o
5389c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o
5399c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o#define HFS_NODE_LEAF			0xff
5409c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o#define HFSPLUS_POR_CNID		1
5419c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o
5429c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'ostruct hfsplus_bnode_descriptor {
5439c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	__u32		next;
5449c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	__u32		prev;
5459c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	__u8		type;
5469c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	__u8		height;
5479c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	__u16		num_recs;
5489c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	__u16		reserved;
5499c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o} __attribute__((packed));
5509c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o
5519c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'ostruct hfsplus_bheader_record {
5529c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	__u16		depth;
5539c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	__u32		root;
5549c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	__u32		leaf_count;
5559c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	__u32		leaf_head;
5569c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	__u32		leaf_tail;
5579c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	__u16		node_size;
5589c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o} __attribute__((packed));
5599c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o
5609c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'ostruct hfsplus_catalog_key {
5619c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	__u16	key_len;
5629c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	__u32	parent_id;
5639c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	__u16	unicode_len;
5649c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	__u8		unicode[255 * 2];
5659c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o} __attribute__((packed));
5669c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o
5679c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'ostruct hfsplus_extent {
5689c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	__u32		start_block;
5699c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	__u32		block_count;
5709c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o} __attribute__((packed));
5719c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o
5729c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o#define HFSPLUS_EXTENT_COUNT		8
5739c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'ostruct hfsplus_fork {
5749c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	__u64		total_size;
5759c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	__u32		clump_size;
5769c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	__u32		total_blocks;
5779c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	struct hfsplus_extent extents[HFSPLUS_EXTENT_COUNT];
5789c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o} __attribute__((packed));
5799c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o
5809c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'ostruct hfsplus_vol_header {
5819c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	__u8		signature[2];
5829c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	__u16		version;
5839c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	__u32		attributes;
5849c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	__u32		last_mount_vers;
5859c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	__u32		reserved;
5869c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	__u32		create_date;
5879c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	__u32		modify_date;
5889c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	__u32		backup_date;
5899c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	__u32		checked_date;
5909c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	__u32		file_count;
5919c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	__u32		folder_count;
5929c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	__u32		blocksize;
5939c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	__u32		total_blocks;
5949c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	__u32		free_blocks;
5959c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	__u32		next_alloc;
5969c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	__u32		rsrc_clump_sz;
5979c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	__u32		data_clump_sz;
5989c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	__u32		next_cnid;
5999c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	__u32		write_count;
6009c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	__u64		encodings_bmp;
6019c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	struct hfs_finder_info finder_info;
6029c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	struct hfsplus_fork alloc_file;
6039c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	struct hfsplus_fork ext_file;
6049c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	struct hfsplus_fork cat_file;
6059c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	struct hfsplus_fork attr_file;
6069c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o	struct hfsplus_fork start_file;
6079c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o}  __attribute__((packed));
6089c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o
6099c460caae3dab7803c0e7d9399b47e790cf90661Theodore Ts'o
610a451d92f38188f7218a837a395b310354864b5a4Eric Sandeen/* this is lvm's label_header & pv_header combined. */
611a451d92f38188f7218a837a395b310354864b5a4Eric Sandeen
612a451d92f38188f7218a837a395b310354864b5a4Eric Sandeen#define LVM2_ID_LEN 32
613a451d92f38188f7218a837a395b310354864b5a4Eric Sandeen
614a451d92f38188f7218a837a395b310354864b5a4Eric Sandeenstruct lvm2_pv_label_header {
615a451d92f38188f7218a837a395b310354864b5a4Eric Sandeen	/* label_header */
616a451d92f38188f7218a837a395b310354864b5a4Eric Sandeen	__u8	id[8];		/* LABELONE */
617a451d92f38188f7218a837a395b310354864b5a4Eric Sandeen	__u64	sector_xl;	/* Sector number of this label */
618a451d92f38188f7218a837a395b310354864b5a4Eric Sandeen	__u32	crc_xl;		/* From next field to end of sector */
619a451d92f38188f7218a837a395b310354864b5a4Eric Sandeen	__u32	offset_xl;	/* Offset from start of struct to contents */
620a451d92f38188f7218a837a395b310354864b5a4Eric Sandeen	__u8	type[8];	/* LVM2 001 */
621a451d92f38188f7218a837a395b310354864b5a4Eric Sandeen	/* pv_header */
622a451d92f38188f7218a837a395b310354864b5a4Eric Sandeen	__u8	pv_uuid[LVM2_ID_LEN];
623a451d92f38188f7218a837a395b310354864b5a4Eric Sandeen} __attribute__ ((packed));
62469d742284d083c8f6ce7d9240019e21f2fbd9ed5Theodore Ts'o
625801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen
626801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen/*
627801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen * this is a very generous portion of the super block, giving us
628801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen * room to translate 14 chunks with 3 stripes each.
629801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen */
630801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen#define BTRFS_SYSTEM_CHUNK_ARRAY_SIZE 2048
631801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen#define BTRFS_LABEL_SIZE 256
632801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen#define BTRFS_UUID_SIZE 16
633801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen#define BTRFS_FSID_SIZE 16
634801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen#define BTRFS_CSUM_SIZE 32
635801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen
636801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeenstruct btrfs_dev_item {
637801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	/* the internal btrfs device id */
638801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	__u64 devid;
639801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen
640801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	/* size of the device */
641801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	__u64 total_bytes;
642801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen
643801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	/* bytes used */
644801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	__u64 bytes_used;
645801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen
646801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	/* optimal io alignment for this device */
647801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	__u32 io_align;
648801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen
649801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	/* optimal io width for this device */
650801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	__u32 io_width;
651801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen
652801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	/* minimal io size for this device */
653801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	__u32 sector_size;
654801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen
655801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	/* type and info about this device */
656801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	__u64 type;
657801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen
658801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	/* expected generation for this device */
659801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	__u64 generation;
660801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen
661801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	/*
662801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	 * starting byte of this partition on the device,
663801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	 * to allowr for stripe alignment in the future
664801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	 */
665801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	__u64 start_offset;
666801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen
667801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	/* grouping information for allocation decisions */
668801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	__u32 dev_group;
669801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen
670801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	/* seek speed 0-100 where 100 is fastest */
671801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	__u8 seek_speed;
672801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen
673801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	/* bandwidth 0-100 where 100 is fastest */
674801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	__u8 bandwidth;
675801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen
676801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	/* btrfs generated uuid for this device */
677801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	__u8 uuid[BTRFS_UUID_SIZE];
678801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen
679801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	/* uuid of FS who owns this device */
680801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	__u8 fsid[BTRFS_UUID_SIZE];
681801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen} __attribute__ ((__packed__));
682801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen
683801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen/*
684801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen * the super block basically lists the main trees of the FS
685801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen * it currently lacks any block count etc etc
686801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen */
687801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeenstruct btrfs_super_block {
688801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	__u8 csum[BTRFS_CSUM_SIZE];
689801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	/* the first 3 fields must match struct btrfs_header */
690801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	__u8 fsid[BTRFS_FSID_SIZE];    /* FS specific uuid */
691801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	__u64 bytenr; /* this block number */
692801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	__u64 flags;
693801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen
694801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	/* allowed to be different from the btrfs_header from here own down */
695801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	__u64 magic;
696801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	__u64 generation;
697801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	__u64 root;
698801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	__u64 chunk_root;
699801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	__u64 log_root;
700801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen
701801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	/* this will help find the new super based on the log root */
702801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	__u64 log_root_transid;
703801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	__u64 total_bytes;
704801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	__u64 bytes_used;
705801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	__u64 root_dir_objectid;
706801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	__u64 num_devices;
707801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	__u32 sectorsize;
708801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	__u32 nodesize;
709801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	__u32 leafsize;
710801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	__u32 stripesize;
711801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	__u32 sys_chunk_array_size;
712801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	__u64 chunk_root_generation;
713801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	__u64 compat_flags;
714801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	__u64 compat_ro_flags;
715801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	__u64 incompat_flags;
716801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	__u16 csum_type;
717801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	__u8 root_level;
718801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	__u8 chunk_root_level;
719801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	__u8 log_root_level;
720801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	struct btrfs_dev_item dev_item;
721801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen
722801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	char label[BTRFS_LABEL_SIZE];
723801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen
724801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	/* future expansion */
725801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	__u64 reserved[32];
726801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen	__u8 sys_chunk_array[BTRFS_SYSTEM_CHUNK_ARRAY_SIZE];
727801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen} __attribute__ ((__packed__));
728801b0053336cc5fe5b3447ddad58505352a6578eEric Sandeen
72976b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o/*
73076b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o * Byte swap functions
73176b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o */
73276b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o#ifdef __GNUC__
733ed78c021c3b111d8ab9a51aef5d5156e3004083fTheodore Ts'o#define _INLINE_ static __inline__
73476b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o#else				/* For Watcom C */
735ed78c021c3b111d8ab9a51aef5d5156e3004083fTheodore Ts'o#define _INLINE_ static inline
73676b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o#endif
73776b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o
738ed78c021c3b111d8ab9a51aef5d5156e3004083fTheodore Ts'ostatic __u16 blkid_swab16(__u16 val);
739ed78c021c3b111d8ab9a51aef5d5156e3004083fTheodore Ts'ostatic __u32 blkid_swab32(__u32 val);
740ed78c021c3b111d8ab9a51aef5d5156e3004083fTheodore Ts'ostatic __u64 blkid_swab64(__u64 val);
74150b380b4d4ab668bad45033e3a8aaf93c7f42844Theodore Ts'o
74276b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o#if ((defined __GNUC__) && \
74376b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o     (defined(__i386__) || defined(__i486__) || defined(__i586__)))
74476b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o
74576b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o#define _BLKID_HAVE_ASM_BITOPS_
74676b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o
74776b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o_INLINE_ __u32 blkid_swab32(__u32 val)
74876b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o{
74976b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o#ifdef EXT2FS_REQUIRE_486
75076b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o	__asm__("bswap %0" : "=r" (val) : "0" (val));
751e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o#else
75276b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o	__asm__("xchgb %b0,%h0\n\t"	/* swap lower bytes	*/
75376b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o		"rorl $16,%0\n\t"	/* swap words		*/
75476b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o		"xchgb %b0,%h0"		/* swap higher bytes	*/
75576b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o		:"=q" (val)
75676b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o		: "0" (val));
75776b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o#endif
75876b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o	return val;
75976b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o}
76076b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o
76176b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o_INLINE_ __u16 blkid_swab16(__u16 val)
76276b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o{
76376b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o	__asm__("xchgb %b0,%h0"		/* swap bytes		*/ \
76476b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o		: "=q" (val) \
76576b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o		:  "0" (val)); \
76676b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o		return val;
76776b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o}
76876b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o
76976b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o_INLINE_ __u64 blkid_swab64(__u64 val)
77076b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o{
77176b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o	return (blkid_swab32(val >> 32) |
77276b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o		(((__u64) blkid_swab32(val & 0xFFFFFFFFUL)) << 32));
77376b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o}
774e12f2ae74c2eb8997bf13adf8fdd7e7313971eaeTheodore Ts'o#endif
77576b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o
77676b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o#if !defined(_BLKID_HAVE_ASM_BITOPS_)
77776b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o
77876b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o_INLINE_  __u16 blkid_swab16(__u16 val)
77976b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o{
78076b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o	return (val >> 8) | (val << 8);
78176b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o}
78276b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o
78376b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o_INLINE_ __u32 blkid_swab32(__u32 val)
78476b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o{
78576b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o	return ((val>>24) | ((val>>8)&0xFF00) |
78676b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o		((val<<8)&0xFF0000) | (val<<24));
78776b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o}
78876b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o
789ed78c021c3b111d8ab9a51aef5d5156e3004083fTheodore Ts'o_INLINE_ __u64 blkid_swab64(__u64 val)
79076b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o{
79176b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o	return (blkid_swab32(val >> 32) |
79276b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o		(((__u64) blkid_swab32(val & 0xFFFFFFFFUL)) << 32));
79376b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o}
794efc6f628e15de95bcd13e4f0ee223cb42115d520Theodore Ts'o#endif
79576b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o
79676b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o
79776b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o
798bdc3514af41b5fbfea16c5192d5aade1da641cf4Matthias Andree#ifdef WORDS_BIGENDIAN
79976b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o#define blkid_le16(x) blkid_swab16(x)
80076b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o#define blkid_le32(x) blkid_swab32(x)
80176b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o#define blkid_le64(x) blkid_swab64(x)
80276b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o#define blkid_be16(x) (x)
80376b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o#define blkid_be32(x) (x)
80476b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o#define blkid_be64(x) (x)
80576b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o#else
80676b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o#define blkid_le16(x) (x)
80776b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o#define blkid_le32(x) (x)
80876b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o#define blkid_le64(x) (x)
80976b07bb1bc9cbcb70a94cb235954eaac993920adTheodore Ts'o#define