summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools
diff options
context:
space:
mode:
authorDarren Hart <dvhart@linux.intel.com>2012-04-04 07:54:00 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-05-31 21:11:45 +0100
commit56310cbc4cb4f61db36ce826730c4dc59a908332 (patch)
tree4fdd7fbadbf6806c6ddd4bde1dc424c2a1cd123d /meta/recipes-devtools
parent68cd8deadc2f4b30ed618d6a3afaed6b2c4c514b (diff)
downloadpoky-56310cbc4cb4f61db36ce826730c4dc59a908332.tar.gz
syslinux: Avoid using linux.ext2_fs.h if possible
Fixes [YOCTO 2236] With recent Linux kernel headers, such as 3.3 in Fedora 16, the linux/ext2_fs.h header has been removed. This causes compile failures for syslinux-native. Backport a fix to address this from syslinux-4.06-pre3. (From OE-Core rev: d61c5fc67780b552fcf3d78ebcf9bd3888af4e0a) Signed-off-by: Darren Hart <dvhart@linux.intel.com> CC: Ross Burton <ross.burton@intel.com> CC: Joshua Lock <josh@linux.intel.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com> Signed-off-by: Joshua Lock <josh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools')
-rw-r--r--meta/recipes-devtools/syslinux/files/libinstaller-Avoid-using-linux-ext2_fs.h.patch975
-rw-r--r--meta/recipes-devtools/syslinux/syslinux_4.03.bb5
2 files changed, 978 insertions, 2 deletions
diff --git a/meta/recipes-devtools/syslinux/files/libinstaller-Avoid-using-linux-ext2_fs.h.patch b/meta/recipes-devtools/syslinux/files/libinstaller-Avoid-using-linux-ext2_fs.h.patch
new file mode 100644
index 0000000000..c9852ef07a
--- /dev/null
+++ b/meta/recipes-devtools/syslinux/files/libinstaller-Avoid-using-linux-ext2_fs.h.patch
@@ -0,0 +1,975 @@
1From a1006762fa6f98750bb77d76dd992cb8ea9f9c99 Mon Sep 17 00:00:00 2001
2Message-Id: <a1006762fa6f98750bb77d76dd992cb8ea9f9c99.1333550572.git.dvhart@linux.intel.com>
3From: "H. Peter Anvin" <hpa@zytor.com>
4Date: Mon, 26 Mar 2012 22:51:09 -0700
5Subject: [PATCH] libinstaller: Avoid using <linux/ext2_fs.h>
6
7Don't use <linux/ext2_fs.h> if we can avoid it.
8
9Upstream-Status: Available in syslinux-4.06-pre3
10
11The ioctl constants have been globalized and moved to <linux/fs.h>.
12Use a private copy of ext2_fs.h from e2fsprogs with the ioctl
13constants removed for the data structures.
14
15Do at least attempt backward compatibility for old kernel headers, but
16no real hope of proper operation there...
17
18Signed-off-by: H. Peter Anvin <hpa@zytor.com>
19
20Massaged into 4.03.
21
22Integrated-by: Darren Hart <dvhart@linux.intel.com>
23---
24 libinstaller/ext2fs/ext2_fs.h | 856 +++++++++++++++++++++++++++++++++++++++++
25 libinstaller/linuxioctl.h | 29 ++-
26 libinstaller/syslxcom.c | 12 +-
27 3 files changed, 886 insertions(+), 11 deletions(-)
28 create mode 100644 libinstaller/ext2fs/ext2_fs.h
29
30Index: syslinux-4.03/libinstaller/ext2fs/ext2_fs.h
31===================================================================
32--- /dev/null
33+++ syslinux-4.03/libinstaller/ext2fs/ext2_fs.h
34@@ -0,0 +1,856 @@
35+/*
36+ * linux/include/linux/ext2_fs.h
37+ *
38+ * Copyright (C) 1992, 1993, 1994, 1995
39+ * Remy Card (card@masi.ibp.fr)
40+ * Laboratoire MASI - Institut Blaise Pascal
41+ * Universite Pierre et Marie Curie (Paris VI)
42+ *
43+ * from
44+ *
45+ * linux/include/linux/minix_fs.h
46+ *
47+ * Copyright (C) 1991, 1992 Linus Torvalds
48+ */
49+
50+#ifndef _EXT2FS_EXT2_FS_H
51+#define _EXT2FS_EXT2_FS_H
52+
53+#include <linux/types.h>
54+
55+/*
56+ * The second extended filesystem constants/structures
57+ */
58+
59+/*
60+ * Define EXT2FS_DEBUG to produce debug messages
61+ */
62+#undef EXT2FS_DEBUG
63+
64+/*
65+ * Define EXT2_PREALLOCATE to preallocate data blocks for expanding files
66+ */
67+#define EXT2_PREALLOCATE
68+#define EXT2_DEFAULT_PREALLOC_BLOCKS 8
69+
70+/*
71+ * The second extended file system version
72+ */
73+#define EXT2FS_DATE "95/08/09"
74+#define EXT2FS_VERSION "0.5b"
75+
76+/*
77+ * Special inode numbers
78+ */
79+#define EXT2_BAD_INO 1 /* Bad blocks inode */
80+#define EXT2_ROOT_INO 2 /* Root inode */
81+#define EXT4_USR_QUOTA_INO 3 /* User quota inode */
82+#define EXT4_GRP_QUOTA_INO 4 /* Group quota inode */
83+#define EXT2_BOOT_LOADER_INO 5 /* Boot loader inode */
84+#define EXT2_UNDEL_DIR_INO 6 /* Undelete directory inode */
85+#define EXT2_RESIZE_INO 7 /* Reserved group descriptors inode */
86+#define EXT2_JOURNAL_INO 8 /* Journal inode */
87+#define EXT2_EXCLUDE_INO 9 /* The "exclude" inode, for snapshots */
88+#define EXT4_REPLICA_INO 10 /* Used by non-upstream feature */
89+
90+/* First non-reserved inode for old ext2 filesystems */
91+#define EXT2_GOOD_OLD_FIRST_INO 11
92+
93+/*
94+ * The second extended file system magic number
95+ */
96+#define EXT2_SUPER_MAGIC 0xEF53
97+
98+#ifdef __KERNEL__
99+#define EXT2_SB(sb) (&((sb)->u.ext2_sb))
100+#else
101+/* Assume that user mode programs are passing in an ext2fs superblock, not
102+ * a kernel struct super_block. This will allow us to call the feature-test
103+ * macros from user land. */
104+#define EXT2_SB(sb) (sb)
105+#endif
106+
107+/*
108+ * Maximal count of links to a file
109+ */
110+#define EXT2_LINK_MAX 65000
111+
112+/*
113+ * Macro-instructions used to manage several block sizes
114+ */
115+#define EXT2_MIN_BLOCK_LOG_SIZE 10 /* 1024 */
116+#define EXT2_MAX_BLOCK_LOG_SIZE 16 /* 65536 */
117+#define EXT2_MIN_BLOCK_SIZE (1 << EXT2_MIN_BLOCK_LOG_SIZE)
118+#define EXT2_MAX_BLOCK_SIZE (1 << EXT2_MAX_BLOCK_LOG_SIZE)
119+#ifdef __KERNEL__
120+#define EXT2_BLOCK_SIZE(s) ((s)->s_blocksize)
121+#define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits)
122+#define EXT2_ADDR_PER_BLOCK_BITS(s) (EXT2_SB(s)->addr_per_block_bits)
123+#define EXT2_INODE_SIZE(s) (EXT2_SB(s)->s_inode_size)
124+#define EXT2_FIRST_INO(s) (EXT2_SB(s)->s_first_ino)
125+#else
126+#define EXT2_BLOCK_SIZE(s) (EXT2_MIN_BLOCK_SIZE << (s)->s_log_block_size)
127+#define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10)
128+#define EXT2_INODE_SIZE(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
129+ EXT2_GOOD_OLD_INODE_SIZE : (s)->s_inode_size)
130+#define EXT2_FIRST_INO(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
131+ EXT2_GOOD_OLD_FIRST_INO : (s)->s_first_ino)
132+#endif
133+#define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof(__u32))
134+
135+/*
136+ * Macro-instructions used to manage allocation clusters
137+ */
138+#define EXT2_MIN_CLUSTER_LOG_SIZE EXT2_MIN_BLOCK_LOG_SIZE
139+#define EXT2_MAX_CLUSTER_LOG_SIZE 29 /* 512MB */
140+#define EXT2_MIN_CLUSTER_SIZE EXT2_MIN_BLOCK_SIZE
141+#define EXT2_MAX_CLUSTER_SIZE (1 << EXT2_MAX_CLUSTER_LOG_SIZE)
142+#define EXT2_CLUSTER_SIZE(s) (EXT2_MIN_BLOCK_SIZE << \
143+ (s)->s_log_cluster_size)
144+#define EXT2_CLUSTER_SIZE_BITS(s) ((s)->s_log_cluster_size + 10)
145+
146+/*
147+ * Macro-instructions used to manage fragments
148+ *
149+ * Note: for backwards compatibility only, for the dump program.
150+ * Ext2/3/4 will never support fragments....
151+ */
152+#define EXT2_MIN_FRAG_SIZE EXT2_MIN_BLOCK_SIZE
153+#define EXT2_MAX_FRAG_SIZE EXT2_MAX_BLOCK_SIZE
154+#define EXT2_MIN_FRAG_LOG_SIZE EXT2_MIN_BLOCK_LOG_SIZE
155+#define EXT2_FRAG_SIZE(s) EXT2_BLOCK_SIZE(s)
156+#define EXT2_FRAGS_PER_BLOCK(s) 1
157+
158+/*
159+ * ACL structures
160+ */
161+struct ext2_acl_header /* Header of Access Control Lists */
162+{
163+ __u32 aclh_size;
164+ __u32 aclh_file_count;
165+ __u32 aclh_acle_count;
166+ __u32 aclh_first_acle;
167+};
168+
169+struct ext2_acl_entry /* Access Control List Entry */
170+{
171+ __u32 acle_size;
172+ __u16 acle_perms; /* Access permissions */
173+ __u16 acle_type; /* Type of entry */
174+ __u16 acle_tag; /* User or group identity */
175+ __u16 acle_pad1;
176+ __u32 acle_next; /* Pointer on next entry for the */
177+ /* same inode or on next free entry */
178+};
179+
180+/*
181+ * Structure of a blocks group descriptor
182+ */
183+struct ext2_group_desc
184+{
185+ __u32 bg_block_bitmap; /* Blocks bitmap block */
186+ __u32 bg_inode_bitmap; /* Inodes bitmap block */
187+ __u32 bg_inode_table; /* Inodes table block */
188+ __u16 bg_free_blocks_count; /* Free blocks count */
189+ __u16 bg_free_inodes_count; /* Free inodes count */
190+ __u16 bg_used_dirs_count; /* Directories count */
191+ __u16 bg_flags;
192+ __u32 bg_exclude_bitmap_lo; /* Exclude bitmap for snapshots */
193+ __u16 bg_block_bitmap_csum_lo;/* crc32c(s_uuid+grp_num+bitmap) LSB */
194+ __u16 bg_inode_bitmap_csum_lo;/* crc32c(s_uuid+grp_num+bitmap) LSB */
195+ __u16 bg_itable_unused; /* Unused inodes count */
196+ __u16 bg_checksum; /* crc16(s_uuid+grouo_num+group_desc)*/
197+};
198+
199+/*
200+ * Structure of a blocks group descriptor
201+ */
202+struct ext4_group_desc
203+{
204+ __u32 bg_block_bitmap; /* Blocks bitmap block */
205+ __u32 bg_inode_bitmap; /* Inodes bitmap block */
206+ __u32 bg_inode_table; /* Inodes table block */
207+ __u16 bg_free_blocks_count; /* Free blocks count */
208+ __u16 bg_free_inodes_count; /* Free inodes count */
209+ __u16 bg_used_dirs_count; /* Directories count */
210+ __u16 bg_flags; /* EXT4_BG_flags (INODE_UNINIT, etc) */
211+ __u32 bg_exclude_bitmap_lo; /* Exclude bitmap for snapshots */
212+ __u16 bg_block_bitmap_csum_lo;/* crc32c(s_uuid+grp_num+bitmap) LSB */
213+ __u16 bg_inode_bitmap_csum_lo;/* crc32c(s_uuid+grp_num+bitmap) LSB */
214+ __u16 bg_itable_unused; /* Unused inodes count */
215+ __u16 bg_checksum; /* crc16(sb_uuid+group+desc) */
216+ __u32 bg_block_bitmap_hi; /* Blocks bitmap block MSB */
217+ __u32 bg_inode_bitmap_hi; /* Inodes bitmap block MSB */
218+ __u32 bg_inode_table_hi; /* Inodes table block MSB */
219+ __u16 bg_free_blocks_count_hi;/* Free blocks count MSB */
220+ __u16 bg_free_inodes_count_hi;/* Free inodes count MSB */
221+ __u16 bg_used_dirs_count_hi; /* Directories count MSB */
222+ __u16 bg_itable_unused_hi; /* Unused inodes count MSB */
223+ __u32 bg_exclude_bitmap_hi; /* Exclude bitmap block MSB */
224+ __u16 bg_block_bitmap_csum_hi;/* crc32c(s_uuid+grp_num+bitmap) MSB */
225+ __u16 bg_inode_bitmap_csum_hi;/* crc32c(s_uuid+grp_num+bitmap) MSB */
226+ __u32 bg_reserved;
227+};
228+
229+#define EXT2_BG_INODE_UNINIT 0x0001 /* Inode table/bitmap not initialized */
230+#define EXT2_BG_BLOCK_UNINIT 0x0002 /* Block bitmap not initialized */
231+#define EXT2_BG_INODE_ZEROED 0x0004 /* On-disk itable initialized to zero */
232+
233+/*
234+ * Data structures used by the directory indexing feature
235+ *
236+ * Note: all of the multibyte integer fields are little endian.
237+ */
238+
239+/*
240+ * Note: dx_root_info is laid out so that if it should somehow get
241+ * overlaid by a dirent the two low bits of the hash version will be
242+ * zero. Therefore, the hash version mod 4 should never be 0.
243+ * Sincerely, the paranoia department.
244+ */
245+struct ext2_dx_root_info {
246+ __u32 reserved_zero;
247+ __u8 hash_version; /* 0 now, 1 at release */
248+ __u8 info_length; /* 8 */
249+ __u8 indirect_levels;
250+ __u8 unused_flags;
251+};
252+
253+#define EXT2_HASH_LEGACY 0
254+#define EXT2_HASH_HALF_MD4 1
255+#define EXT2_HASH_TEA 2
256+#define EXT2_HASH_LEGACY_UNSIGNED 3 /* reserved for userspace lib */
257+#define EXT2_HASH_HALF_MD4_UNSIGNED 4 /* reserved for userspace lib */
258+#define EXT2_HASH_TEA_UNSIGNED 5 /* reserved for userspace lib */
259+
260+#define EXT2_HASH_FLAG_INCOMPAT 0x1
261+
262+struct ext2_dx_entry {
263+ __u32 hash;
264+ __u32 block;
265+};
266+
267+struct ext2_dx_countlimit {
268+ __u16 limit;
269+ __u16 count;
270+};
271+
272+
273+/*
274+ * Macro-instructions used to manage group descriptors
275+ */
276+#define EXT2_MIN_DESC_SIZE 32
277+#define EXT2_MIN_DESC_SIZE_64BIT 64
278+#define EXT2_MAX_DESC_SIZE EXT2_MIN_BLOCK_SIZE
279+#define EXT2_DESC_SIZE(s) \
280+ ((EXT2_SB(s)->s_feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT) ? \
281+ (s)->s_desc_size : EXT2_MIN_DESC_SIZE)
282+
283+#define EXT2_BLOCKS_PER_GROUP(s) (EXT2_SB(s)->s_blocks_per_group)
284+#define EXT2_INODES_PER_GROUP(s) (EXT2_SB(s)->s_inodes_per_group)
285+#define EXT2_CLUSTERS_PER_GROUP(s) (EXT2_SB(s)->s_clusters_per_group)
286+#define EXT2_INODES_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s)/EXT2_INODE_SIZE(s))
287+/* limits imposed by 16-bit value gd_free_{blocks,inode}_count */
288+#define EXT2_MAX_BLOCKS_PER_GROUP(s) ((((unsigned) 1 << 16) - 8) * \
289+ (EXT2_CLUSTER_SIZE(s) / \
290+ EXT2_BLOCK_SIZE(s)))
291+#define EXT2_MAX_CLUSTERS_PER_GROUP(s) (((unsigned) 1 << 16) - 8)
292+#define EXT2_MAX_INODES_PER_GROUP(s) (((unsigned) 1 << 16) - \
293+ EXT2_INODES_PER_BLOCK(s))
294+#ifdef __KERNEL__
295+#define EXT2_DESC_PER_BLOCK(s) (EXT2_SB(s)->s_desc_per_block)
296+#define EXT2_DESC_PER_BLOCK_BITS(s) (EXT2_SB(s)->s_desc_per_block_bits)
297+#else
298+#define EXT2_DESC_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / EXT2_DESC_SIZE(s))
299+#endif
300+
301+/*
302+ * Constants relative to the data blocks
303+ */
304+#define EXT2_NDIR_BLOCKS 12
305+#define EXT2_IND_BLOCK EXT2_NDIR_BLOCKS
306+#define EXT2_DIND_BLOCK (EXT2_IND_BLOCK + 1)
307+#define EXT2_TIND_BLOCK (EXT2_DIND_BLOCK + 1)
308+#define EXT2_N_BLOCKS (EXT2_TIND_BLOCK + 1)
309+
310+/*
311+ * Inode flags
312+ */
313+#define EXT2_SECRM_FL 0x00000001 /* Secure deletion */
314+#define EXT2_UNRM_FL 0x00000002 /* Undelete */
315+#define EXT2_COMPR_FL 0x00000004 /* Compress file */
316+#define EXT2_SYNC_FL 0x00000008 /* Synchronous updates */
317+#define EXT2_IMMUTABLE_FL 0x00000010 /* Immutable file */
318+#define EXT2_APPEND_FL 0x00000020 /* writes to file may only append */
319+#define EXT2_NODUMP_FL 0x00000040 /* do not dump file */
320+#define EXT2_NOATIME_FL 0x00000080 /* do not update atime */
321+/* Reserved for compression usage... */
322+#define EXT2_DIRTY_FL 0x00000100
323+#define EXT2_COMPRBLK_FL 0x00000200 /* One or more compressed clusters */
324+#define EXT2_NOCOMPR_FL 0x00000400 /* Access raw compressed data */
325+#define EXT2_ECOMPR_FL 0x00000800 /* Compression error */
326+/* End compression flags --- maybe not all used */
327+#define EXT2_BTREE_FL 0x00001000 /* btree format dir */
328+#define EXT2_INDEX_FL 0x00001000 /* hash-indexed directory */
329+#define EXT2_IMAGIC_FL 0x00002000
330+#define EXT3_JOURNAL_DATA_FL 0x00004000 /* file data should be journaled */
331+#define EXT2_NOTAIL_FL 0x00008000 /* file tail should not be merged */
332+#define EXT2_DIRSYNC_FL 0x00010000 /* Synchronous directory modifications */
333+#define EXT2_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/
334+#define EXT4_HUGE_FILE_FL 0x00040000 /* Set to each huge file */
335+#define EXT4_EXTENTS_FL 0x00080000 /* Inode uses extents */
336+#define EXT4_EA_INODE_FL 0x00200000 /* Inode used for large EA */
337+/* EXT4_EOFBLOCKS_FL 0x00400000 was here */
338+#define EXT4_SNAPFILE_FL 0x01000000 /* Inode is a snapshot */
339+#define EXT4_SNAPFILE_DELETED_FL 0x04000000 /* Snapshot is being deleted */
340+#define EXT4_SNAPFILE_SHRUNK_FL 0x08000000 /* Snapshot shrink has completed */
341+#define EXT2_RESERVED_FL 0x80000000 /* reserved for ext2 lib */
342+
343+#define EXT2_FL_USER_VISIBLE 0x004BDFFF /* User visible flags */
344+#define EXT2_FL_USER_MODIFIABLE 0x004B80FF /* User modifiable flags */
345+
346+/*
347+ * ioctl commands
348+ */
349+
350+/* Used for online resize */
351+struct ext2_new_group_input {
352+ __u32 group; /* Group number for this data */
353+ __u32 block_bitmap; /* Absolute block number of block bitmap */
354+ __u32 inode_bitmap; /* Absolute block number of inode bitmap */
355+ __u32 inode_table; /* Absolute block number of inode table start */
356+ __u32 blocks_count; /* Total number of blocks in this group */
357+ __u16 reserved_blocks; /* Number of reserved blocks in this group */
358+ __u16 unused; /* Number of reserved GDT blocks in group */
359+};
360+
361+struct ext4_new_group_input {
362+ __u32 group; /* Group number for this data */
363+ __u64 block_bitmap; /* Absolute block number of block bitmap */
364+ __u64 inode_bitmap; /* Absolute block number of inode bitmap */
365+ __u64 inode_table; /* Absolute block number of inode table start */
366+ __u32 blocks_count; /* Total number of blocks in this group */
367+ __u16 reserved_blocks; /* Number of reserved blocks in this group */
368+ __u16 unused;
369+};
370+
371+#ifdef __GNU__ /* Needed for the Hurd */
372+#define _IOT_ext2_new_group_input _IOT (_IOTS(__u32), 5, _IOTS(__u16), 2, 0, 0)
373+#endif
374+
375+#define EXT2_IOC_GETFLAGS _IOR('f', 1, long)
376+#define EXT2_IOC_SETFLAGS _IOW('f', 2, long)
377+#define EXT2_IOC_GETVERSION _IOR('v', 1, long)
378+#define EXT2_IOC_SETVERSION _IOW('v', 2, long)
379+#define EXT2_IOC_GETVERSION_NEW _IOR('f', 3, long)
380+#define EXT2_IOC_SETVERSION_NEW _IOW('f', 4, long)
381+#define EXT2_IOC_GROUP_EXTEND _IOW('f', 7, unsigned long)
382+#define EXT2_IOC_GROUP_ADD _IOW('f', 8,struct ext2_new_group_input)
383+#define EXT4_IOC_GROUP_ADD _IOW('f', 8,struct ext4_new_group_input)
384+#define EXT4_IOC_RESIZE_FS _IOW('f', 16, __u64)
385+
386+/*
387+ * Structure of an inode on the disk
388+ */
389+struct ext2_inode {
390+ __u16 i_mode; /* File mode */
391+ __u16 i_uid; /* Low 16 bits of Owner Uid */
392+ __u32 i_size; /* Size in bytes */
393+ __u32 i_atime; /* Access time */
394+ __u32 i_ctime; /* Inode change time */
395+ __u32 i_mtime; /* Modification time */
396+ __u32 i_dtime; /* Deletion Time */
397+ __u16 i_gid; /* Low 16 bits of Group Id */
398+ __u16 i_links_count; /* Links count */
399+ __u32 i_blocks; /* Blocks count */
400+ __u32 i_flags; /* File flags */
401+ union {
402+ struct {
403+ __u32 l_i_version; /* was l_i_reserved1 */
404+ } linux1;
405+ struct {
406+ __u32 h_i_translator;
407+ } hurd1;
408+ } osd1; /* OS dependent 1 */
409+ __u32 i_block[EXT2_N_BLOCKS];/* Pointers to blocks */
410+ __u32 i_generation; /* File version (for NFS) */
411+ __u32 i_file_acl; /* File ACL */
412+ __u32 i_size_high; /* Formerly i_dir_acl, directory ACL */
413+ __u32 i_faddr; /* Fragment address */
414+ union {
415+ struct {
416+ __u16 l_i_blocks_hi;
417+ __u16 l_i_file_acl_high;
418+ __u16 l_i_uid_high; /* these 2 fields */
419+ __u16 l_i_gid_high; /* were reserved2[0] */
420+ __u16 l_i_checksum_lo; /* crc32c(uuid+inum+inode) */
421+ __u16 l_i_reserved;
422+ } linux2;
423+ struct {
424+ __u8 h_i_frag; /* Fragment number */
425+ __u8 h_i_fsize; /* Fragment size */
426+ __u16 h_i_mode_high;
427+ __u16 h_i_uid_high;
428+ __u16 h_i_gid_high;
429+ __u32 h_i_author;
430+ } hurd2;
431+ } osd2; /* OS dependent 2 */
432+};
433+
434+/*
435+ * Permanent part of an large inode on the disk
436+ */
437+struct ext2_inode_large {
438+ __u16 i_mode; /* File mode */
439+ __u16 i_uid; /* Low 16 bits of Owner Uid */
440+ __u32 i_size; /* Size in bytes */
441+ __u32 i_atime; /* Access time */
442+ __u32 i_ctime; /* Inode Change time */
443+ __u32 i_mtime; /* Modification time */
444+ __u32 i_dtime; /* Deletion Time */
445+ __u16 i_gid; /* Low 16 bits of Group Id */
446+ __u16 i_links_count; /* Links count */
447+ __u32 i_blocks; /* Blocks count */
448+ __u32 i_flags; /* File flags */
449+ union {
450+ struct {
451+ __u32 l_i_version; /* was l_i_reserved1 */
452+ } linux1;
453+ struct {
454+ __u32 h_i_translator;
455+ } hurd1;
456+ } osd1; /* OS dependent 1 */
457+ __u32 i_block[EXT2_N_BLOCKS];/* Pointers to blocks */
458+ __u32 i_generation; /* File version (for NFS) */
459+ __u32 i_file_acl; /* File ACL */
460+ __u32 i_size_high; /* Formerly i_dir_acl, directory ACL */
461+ __u32 i_faddr; /* Fragment address */
462+ union {
463+ struct {
464+ __u16 l_i_blocks_hi;
465+ __u16 l_i_file_acl_high;
466+ __u16 l_i_uid_high; /* these 2 fields */
467+ __u16 l_i_gid_high; /* were reserved2[0] */
468+ __u16 l_i_checksum_lo; /* crc32c(uuid+inum+inode) */
469+ __u16 l_i_reserved;
470+ } linux2;
471+ struct {
472+ __u8 h_i_frag; /* Fragment number */
473+ __u8 h_i_fsize; /* Fragment size */
474+ __u16 h_i_mode_high;
475+ __u16 h_i_uid_high;
476+ __u16 h_i_gid_high;
477+ __u32 h_i_author;
478+ } hurd2;
479+ } osd2; /* OS dependent 2 */
480+ __u16 i_extra_isize;
481+ __u16 i_checksum_hi; /* crc32c(uuid+inum+inode) */
482+ __u32 i_ctime_extra; /* extra Change time (nsec << 2 | epoch) */
483+ __u32 i_mtime_extra; /* extra Modification time (nsec << 2 | epoch) */
484+ __u32 i_atime_extra; /* extra Access time (nsec << 2 | epoch) */
485+ __u32 i_crtime; /* File creation time */
486+ __u32 i_crtime_extra; /* extra File creation time (nsec << 2 | epoch)*/
487+ __u32 i_version_hi; /* high 32 bits for 64-bit version */
488+};
489+
490+#define i_dir_acl i_size_high
491+
492+#if defined(__KERNEL__) || defined(__linux__)
493+#define i_reserved1 osd1.linux1.l_i_reserved1
494+#define i_frag osd2.linux2.l_i_frag
495+#define i_fsize osd2.linux2.l_i_fsize
496+#define i_uid_low i_uid
497+#define i_gid_low i_gid
498+#define i_uid_high osd2.linux2.l_i_uid_high
499+#define i_gid_high osd2.linux2.l_i_gid_high
500+#else
501+#if defined(__GNU__)
502+
503+#define i_translator osd1.hurd1.h_i_translator
504+#define i_frag osd2.hurd2.h_i_frag;
505+#define i_fsize osd2.hurd2.h_i_fsize;
506+#define i_uid_high osd2.hurd2.h_i_uid_high
507+#define i_gid_high osd2.hurd2.h_i_gid_high
508+#define i_author osd2.hurd2.h_i_author
509+
510+#endif /* __GNU__ */
511+#endif /* defined(__KERNEL__) || defined(__linux__) */
512+
513+#define inode_uid(inode) ((inode).i_uid | (inode).osd2.linux2.l_i_uid_high << 16)
514+#define inode_gid(inode) ((inode).i_gid | (inode).osd2.linux2.l_i_gid_high << 16)
515+#define ext2fs_set_i_uid_high(inode,x) ((inode).osd2.linux2.l_i_uid_high = (x))
516+#define ext2fs_set_i_gid_high(inode,x) ((inode).osd2.linux2.l_i_gid_high = (x))
517+
518+/*
519+ * File system states
520+ */
521+#define EXT2_VALID_FS 0x0001 /* Unmounted cleanly */
522+#define EXT2_ERROR_FS 0x0002 /* Errors detected */
523+#define EXT3_ORPHAN_FS 0x0004 /* Orphans being recovered */
524+
525+/*
526+ * Misc. filesystem flags
527+ */
528+#define EXT2_FLAGS_SIGNED_HASH 0x0001 /* Signed dirhash in use */
529+#define EXT2_FLAGS_UNSIGNED_HASH 0x0002 /* Unsigned dirhash in use */
530+#define EXT2_FLAGS_TEST_FILESYS 0x0004 /* OK for use on development code */
531+#define EXT2_FLAGS_IS_SNAPSHOT 0x0010 /* This is a snapshot image */
532+#define EXT2_FLAGS_FIX_SNAPSHOT 0x0020 /* Snapshot inodes corrupted */
533+#define EXT2_FLAGS_FIX_EXCLUDE 0x0040 /* Exclude bitmaps corrupted */
534+
535+/*
536+ * Mount flags
537+ */
538+#define EXT2_MOUNT_CHECK 0x0001 /* Do mount-time checks */
539+#define EXT2_MOUNT_GRPID 0x0004 /* Create files with directory's group */
540+#define EXT2_MOUNT_DEBUG 0x0008 /* Some debugging messages */
541+#define EXT2_MOUNT_ERRORS_CONT 0x0010 /* Continue on errors */
542+#define EXT2_MOUNT_ERRORS_RO 0x0020 /* Remount fs ro on errors */
543+#define EXT2_MOUNT_ERRORS_PANIC 0x0040 /* Panic on errors */
544+#define EXT2_MOUNT_MINIX_DF 0x0080 /* Mimics the Minix statfs */
545+#define EXT2_MOUNT_NO_UID32 0x0200 /* Disable 32-bit UIDs */
546+
547+#define clear_opt(o, opt) o &= ~EXT2_MOUNT_##opt
548+#define set_opt(o, opt) o |= EXT2_MOUNT_##opt
549+#define test_opt(sb, opt) (EXT2_SB(sb)->s_mount_opt & \
550+ EXT2_MOUNT_##opt)
551+/*
552+ * Maximal mount counts between two filesystem checks
553+ */
554+#define EXT2_DFL_MAX_MNT_COUNT 20 /* Allow 20 mounts */
555+#define EXT2_DFL_CHECKINTERVAL 0 /* Don't use interval check */
556+
557+/*
558+ * Behaviour when detecting errors
559+ */
560+#define EXT2_ERRORS_CONTINUE 1 /* Continue execution */
561+#define EXT2_ERRORS_RO 2 /* Remount fs read-only */
562+#define EXT2_ERRORS_PANIC 3 /* Panic */
563+#define EXT2_ERRORS_DEFAULT EXT2_ERRORS_CONTINUE
564+
565+#if (__GNUC__ >= 4)
566+#define ext4_offsetof(TYPE,MEMBER) __builtin_offsetof(TYPE,MEMBER)
567+#else
568+#define ext4_offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
569+#endif
570+
571+/*
572+ * Structure of the super block
573+ */
574+struct ext2_super_block {
575+ __u32 s_inodes_count; /* Inodes count */
576+ __u32 s_blocks_count; /* Blocks count */
577+ __u32 s_r_blocks_count; /* Reserved blocks count */
578+ __u32 s_free_blocks_count; /* Free blocks count */
579+ __u32 s_free_inodes_count; /* Free inodes count */
580+ __u32 s_first_data_block; /* First Data Block */
581+ __u32 s_log_block_size; /* Block size */
582+ __u32 s_log_cluster_size; /* Allocation cluster size */
583+ __u32 s_blocks_per_group; /* # Blocks per group */
584+ __u32 s_clusters_per_group; /* # Fragments per group */
585+ __u32 s_inodes_per_group; /* # Inodes per group */
586+ __u32 s_mtime; /* Mount time */
587+ __u32 s_wtime; /* Write time */
588+ __u16 s_mnt_count; /* Mount count */
589+ __s16 s_max_mnt_count; /* Maximal mount count */
590+ __u16 s_magic; /* Magic signature */
591+ __u16 s_state; /* File system state */
592+ __u16 s_errors; /* Behaviour when detecting errors */
593+ __u16 s_minor_rev_level; /* minor revision level */
594+ __u32 s_lastcheck; /* time of last check */
595+ __u32 s_checkinterval; /* max. time between checks */
596+ __u32 s_creator_os; /* OS */
597+ __u32 s_rev_level; /* Revision level */
598+ __u16 s_def_resuid; /* Default uid for reserved blocks */
599+ __u16 s_def_resgid; /* Default gid for reserved blocks */
600+ /*
601+ * These fields are for EXT2_DYNAMIC_REV superblocks only.
602+ *
603+ * Note: the difference between the compatible feature set and
604+ * the incompatible feature set is that if there is a bit set
605+ * in the incompatible feature set that the kernel doesn't
606+ * know about, it should refuse to mount the filesystem.
607+ *
608+ * e2fsck's requirements are more strict; if it doesn't know
609+ * about a feature in either the compatible or incompatible
610+ * feature set, it must abort and not try to meddle with
611+ * things it doesn't understand...
612+ */
613+ __u32 s_first_ino; /* First non-reserved inode */
614+ __u16 s_inode_size; /* size of inode structure */
615+ __u16 s_block_group_nr; /* block group # of this superblock */
616+ __u32 s_feature_compat; /* compatible feature set */
617+ __u32 s_feature_incompat; /* incompatible feature set */
618+ __u32 s_feature_ro_compat; /* readonly-compatible feature set */
619+ __u8 s_uuid[16]; /* 128-bit uuid for volume */
620+ char s_volume_name[16]; /* volume name */
621+ char s_last_mounted[64]; /* directory where last mounted */
622+ __u32 s_algorithm_usage_bitmap; /* For compression */
623+ /*
624+ * Performance hints. Directory preallocation should only
625+ * happen if the EXT2_FEATURE_COMPAT_DIR_PREALLOC flag is on.
626+ */
627+ __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/
628+ __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */
629+ __u16 s_reserved_gdt_blocks; /* Per group table for online growth */
630+ /*
631+ * Journaling support valid if EXT2_FEATURE_COMPAT_HAS_JOURNAL set.
632+ */
633+ __u8 s_journal_uuid[16]; /* uuid of journal superblock */
634+ __u32 s_journal_inum; /* inode number of journal file */
635+ __u32 s_journal_dev; /* device number of journal file */
636+ __u32 s_last_orphan; /* start of list of inodes to delete */
637+ __u32 s_hash_seed[4]; /* HTREE hash seed */
638+ __u8 s_def_hash_version; /* Default hash version to use */
639+ __u8 s_jnl_backup_type; /* Default type of journal backup */
640+ __u16 s_desc_size; /* Group desc. size: INCOMPAT_64BIT */
641+ __u32 s_default_mount_opts;
642+ __u32 s_first_meta_bg; /* First metablock group */
643+ __u32 s_mkfs_time; /* When the filesystem was created */
644+ __u32 s_jnl_blocks[17]; /* Backup of the journal inode */
645+ __u32 s_blocks_count_hi; /* Blocks count high 32bits */
646+ __u32 s_r_blocks_count_hi; /* Reserved blocks count high 32 bits*/
647+ __u32 s_free_blocks_hi; /* Free blocks count */
648+ __u16 s_min_extra_isize; /* All inodes have at least # bytes */
649+ __u16 s_want_extra_isize; /* New inodes should reserve # bytes */
650+ __u32 s_flags; /* Miscellaneous flags */
651+ __u16 s_raid_stride; /* RAID stride */
652+ __u16 s_mmp_update_interval; /* # seconds to wait in MMP checking */
653+ __u64 s_mmp_block; /* Block for multi-mount protection */
654+ __u32 s_raid_stripe_width; /* blocks on all data disks (N*stride)*/
655+ __u8 s_log_groups_per_flex; /* FLEX_BG group size */
656+ __u8 s_reserved_char_pad;
657+ __u16 s_reserved_pad; /* Padding to next 32bits */
658+ __u64 s_kbytes_written; /* nr of lifetime kilobytes written */
659+ __u32 s_snapshot_inum; /* Inode number of active snapshot */
660+ __u32 s_snapshot_id; /* sequential ID of active snapshot */
661+ __u64 s_snapshot_r_blocks_count; /* reserved blocks for active
662+ snapshot's future use */
663+ __u32 s_snapshot_list; /* inode number of the head of the on-disk snapshot list */
664+#define EXT4_S_ERR_START ext4_offsetof(struct ext2_super_block, s_error_count)
665+ __u32 s_error_count; /* number of fs errors */
666+ __u32 s_first_error_time; /* first time an error happened */
667+ __u32 s_first_error_ino; /* inode involved in first error */
668+ __u64 s_first_error_block; /* block involved of first error */
669+ __u8 s_first_error_func[32]; /* function where the error happened */
670+ __u32 s_first_error_line; /* line number where error happened */
671+ __u32 s_last_error_time; /* most recent time of an error */
672+ __u32 s_last_error_ino; /* inode involved in last error */
673+ __u32 s_last_error_line; /* line number where error happened */
674+ __u64 s_last_error_block; /* block involved of last error */
675+ __u8 s_last_error_func[32]; /* function where the error happened */
676+#define EXT4_S_ERR_END ext4_offsetof(struct ext2_super_block, s_mount_opts)
677+ __u8 s_mount_opts[64];
678+ __u32 s_usr_quota_inum; /* inode number of user quota file */
679+ __u32 s_grp_quota_inum; /* inode number of group quota file */
680+ __u32 s_overhead_blocks; /* overhead blocks/clusters in fs */
681+ __u32 s_reserved[108]; /* Padding to the end of the block */
682+ __u32 s_checksum; /* crc32c(superblock) */
683+};
684+
685+#define EXT4_S_ERR_LEN (EXT4_S_ERR_END - EXT4_S_ERR_START)
686+
687+/*
688+ * Codes for operating systems
689+ */
690+#define EXT2_OS_LINUX 0
691+#define EXT2_OS_HURD 1
692+#define EXT2_OBSO_OS_MASIX 2
693+#define EXT2_OS_FREEBSD 3
694+#define EXT2_OS_LITES 4
695+
696+/*
697+ * Revision levels
698+ */
699+#define EXT2_GOOD_OLD_REV 0 /* The good old (original) format */
700+#define EXT2_DYNAMIC_REV 1 /* V2 format w/ dynamic inode sizes */
701+
702+#define EXT2_CURRENT_REV EXT2_GOOD_OLD_REV
703+#define EXT2_MAX_SUPP_REV EXT2_DYNAMIC_REV
704+
705+#define EXT2_GOOD_OLD_INODE_SIZE 128
706+
707+/*
708+ * Journal inode backup types
709+ */
710+#define EXT3_JNL_BACKUP_BLOCKS 1
711+
712+/*
713+ * Feature set definitions
714+ */
715+
716+#define EXT2_HAS_COMPAT_FEATURE(sb,mask) \
717+ ( EXT2_SB(sb)->s_feature_compat & (mask) )
718+#define EXT2_HAS_RO_COMPAT_FEATURE(sb,mask) \
719+ ( EXT2_SB(sb)->s_feature_ro_compat & (mask) )
720+#define EXT2_HAS_INCOMPAT_FEATURE(sb,mask) \
721+ ( EXT2_SB(sb)->s_feature_incompat & (mask) )
722+
723+#define EXT2_FEATURE_COMPAT_DIR_PREALLOC 0x0001
724+#define EXT2_FEATURE_COMPAT_IMAGIC_INODES 0x0002
725+#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004
726+#define EXT2_FEATURE_COMPAT_EXT_ATTR 0x0008
727+#define EXT2_FEATURE_COMPAT_RESIZE_INODE 0x0010
728+#define EXT2_FEATURE_COMPAT_DIR_INDEX 0x0020
729+#define EXT2_FEATURE_COMPAT_LAZY_BG 0x0040
730+/* #define EXT2_FEATURE_COMPAT_EXCLUDE_INODE 0x0080 not used, legacy */
731+#define EXT2_FEATURE_COMPAT_EXCLUDE_BITMAP 0x0100
732+
733+
734+#define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001
735+#define EXT2_FEATURE_RO_COMPAT_LARGE_FILE 0x0002
736+/* #define EXT2_FEATURE_RO_COMPAT_BTREE_DIR 0x0004 not used */
737+#define EXT4_FEATURE_RO_COMPAT_HUGE_FILE 0x0008
738+#define EXT4_FEATURE_RO_COMPAT_GDT_CSUM 0x0010
739+#define EXT4_FEATURE_RO_COMPAT_DIR_NLINK 0x0020
740+#define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040
741+#define EXT4_FEATURE_RO_COMPAT_HAS_SNAPSHOT 0x0080
742+#define EXT4_FEATURE_RO_COMPAT_QUOTA 0x0100
743+#define EXT4_FEATURE_RO_COMPAT_BIGALLOC 0x0200
744+#define EXT4_FEATURE_RO_COMPAT_METADATA_CSUM 0x0400
745+#define EXT4_FEATURE_RO_COMPAT_REPLICA 0x0800
746+
747+#define EXT2_FEATURE_INCOMPAT_COMPRESSION 0x0001
748+#define EXT2_FEATURE_INCOMPAT_FILETYPE 0x0002
749+#define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004 /* Needs recovery */
750+#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008 /* Journal device */
751+#define EXT2_FEATURE_INCOMPAT_META_BG 0x0010
752+#define EXT3_FEATURE_INCOMPAT_EXTENTS 0x0040
753+#define EXT4_FEATURE_INCOMPAT_64BIT 0x0080
754+#define EXT4_FEATURE_INCOMPAT_MMP 0x0100
755+#define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200
756+#define EXT4_FEATURE_INCOMPAT_EA_INODE 0x0400
757+#define EXT4_FEATURE_INCOMPAT_DIRDATA 0x1000
758+
759+#define EXT2_FEATURE_COMPAT_SUPP 0
760+#define EXT2_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE| \
761+ EXT4_FEATURE_INCOMPAT_MMP)
762+#define EXT2_FEATURE_RO_COMPAT_SUPP (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER| \
763+ EXT2_FEATURE_RO_COMPAT_LARGE_FILE| \
764+ EXT4_FEATURE_RO_COMPAT_DIR_NLINK| \
765+ EXT2_FEATURE_RO_COMPAT_BTREE_DIR)
766+
767+/*
768+ * Default values for user and/or group using reserved blocks
769+ */
770+#define EXT2_DEF_RESUID 0
771+#define EXT2_DEF_RESGID 0
772+
773+/*
774+ * Default mount options
775+ */
776+#define EXT2_DEFM_DEBUG 0x0001
777+#define EXT2_DEFM_BSDGROUPS 0x0002
778+#define EXT2_DEFM_XATTR_USER 0x0004
779+#define EXT2_DEFM_ACL 0x0008
780+#define EXT2_DEFM_UID16 0x0010
781+#define EXT3_DEFM_JMODE 0x0060
782+#define EXT3_DEFM_JMODE_DATA 0x0020
783+#define EXT3_DEFM_JMODE_ORDERED 0x0040
784+#define EXT3_DEFM_JMODE_WBACK 0x0060
785+#define EXT4_DEFM_NOBARRIER 0x0100
786+#define EXT4_DEFM_BLOCK_VALIDITY 0x0200
787+#define EXT4_DEFM_DISCARD 0x0400
788+#define EXT4_DEFM_NODELALLOC 0x0800
789+
790+/*
791+ * Structure of a directory entry
792+ */
793+#define EXT2_NAME_LEN 255
794+
795+struct ext2_dir_entry {
796+ __u32 inode; /* Inode number */
797+ __u16 rec_len; /* Directory entry length */
798+ __u16 name_len; /* Name length */
799+ char name[EXT2_NAME_LEN]; /* File name */
800+};
801+
802+/*
803+ * The new version of the directory entry. Since EXT2 structures are
804+ * stored in intel byte order, and the name_len field could never be
805+ * bigger than 255 chars, it's safe to reclaim the extra byte for the
806+ * file_type field.
807+ */
808+struct ext2_dir_entry_2 {
809+ __u32 inode; /* Inode number */
810+ __u16 rec_len; /* Directory entry length */
811+ __u8 name_len; /* Name length */
812+ __u8 file_type;
813+ char name[EXT2_NAME_LEN]; /* File name */
814+};
815+
816+/*
817+ * Ext2 directory file types. Only the low 3 bits are used. The
818+ * other bits are reserved for now.
819+ */
820+#define EXT2_FT_UNKNOWN 0
821+#define EXT2_FT_REG_FILE 1
822+#define EXT2_FT_DIR 2
823+#define EXT2_FT_CHRDEV 3
824+#define EXT2_FT_BLKDEV 4
825+#define EXT2_FT_FIFO 5
826+#define EXT2_FT_SOCK 6
827+#define EXT2_FT_SYMLINK 7
828+
829+#define EXT2_FT_MAX 8
830+
831+/*
832+ * EXT2_DIR_PAD defines the directory entries boundaries
833+ *
834+ * NOTE: It must be a multiple of 4
835+ */
836+#define EXT2_DIR_PAD 4
837+#define EXT2_DIR_ROUND (EXT2_DIR_PAD - 1)
838+#define EXT2_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT2_DIR_ROUND) & \
839+ ~EXT2_DIR_ROUND)
840+
841+/*
842+ * This structure is used for multiple mount protection. It is written
843+ * into the block number saved in the s_mmp_block field in the superblock.
844+ * Programs that check MMP should assume that if SEQ_FSCK (or any unknown
845+ * code above SEQ_MAX) is present then it is NOT safe to use the filesystem,
846+ * regardless of how old the timestamp is.
847+ *
848+ * The timestamp in the MMP structure will be updated by e2fsck at some
849+ * arbitary intervals (start of passes, after every few groups of inodes
850+ * in pass1 and pass1b). There is no guarantee that e2fsck is updating
851+ * the MMP block in a timely manner, and the updates it does are purely
852+ * for the convenience of the sysadmin and not for automatic validation.
853+ *
854+ * Note: Only the mmp_seq value is used to determine whether the MMP block
855+ * is being updated. The mmp_time, mmp_nodename, and mmp_bdevname
856+ * fields are only for informational purposes for the administrator,
857+ * due to clock skew between nodes and hostname HA service takeover.
858+ */
859+#define EXT4_MMP_MAGIC 0x004D4D50U /* ASCII for MMP */
860+#define EXT4_MMP_SEQ_CLEAN 0xFF4D4D50U /* mmp_seq value for clean unmount */
861+#define EXT4_MMP_SEQ_FSCK 0xE24D4D50U /* mmp_seq value when being fscked */
862+#define EXT4_MMP_SEQ_MAX 0xE24D4D4FU /* maximum valid mmp_seq value */
863+
864+struct mmp_struct {
865+ __u32 mmp_magic; /* Magic number for MMP */
866+ __u32 mmp_seq; /* Sequence no. updated periodically */
867+ __u64 mmp_time; /* Time last updated */
868+ char mmp_nodename[64]; /* Node which last updated MMP block */
869+ char mmp_bdevname[32]; /* Bdev which last updated MMP block */
870+ __u16 mmp_check_interval; /* Changed mmp_check_interval */
871+ __u16 mmp_pad1;
872+ __u32 mmp_pad2[227];
873+};
874+
875+/*
876+ * Default interval for MMP update in seconds.
877+ */
878+#define EXT4_MMP_UPDATE_INTERVAL 5
879+
880+/*
881+ * Maximum interval for MMP update in seconds.
882+ */
883+#define EXT4_MMP_MAX_UPDATE_INTERVAL 300
884+
885+/*
886+ * Minimum interval for MMP checking in seconds.
887+ */
888+#define EXT4_MMP_MIN_CHECK_INTERVAL 5
889+
890+#endif /* _EXT2FS_EXT2_FS_H */
891Index: syslinux-4.03/libinstaller/linuxioctl.h
892===================================================================
893--- syslinux-4.03.orig/libinstaller/linuxioctl.h
894+++ syslinux-4.03/libinstaller/linuxioctl.h
895@@ -9,17 +9,33 @@
896
897 #include <sys/ioctl.h>
898
899+#ifdef __linux__
900+
901 #define statfs _kernel_statfs /* HACK to deal with broken 2.4 distros */
902
903 #include <linux/fd.h> /* Floppy geometry */
904 #include <linux/hdreg.h> /* Hard disk geometry */
905
906-#include <linux/fs.h> /* FIGETBSZ, FIBMAP, FS_IOC_FIEMAP */
907+#include <linux/fs.h> /* FIGETBSZ, FIBMAP, FS_IOC_* */
908 #include <linux/msdos_fs.h> /* FAT_IOCTL_SET_ATTRIBUTES */
909
910 #undef SECTOR_SIZE /* Defined in msdos_fs.h for no good reason */
911 #undef SECTOR_BITS
912-#include <linux/ext2_fs.h> /* EXT2_IOC_* */
913+
914+#ifndef FS_IOC_GETFLAGS
915+/* Old kernel headers, these were once ext2-specific... */
916+# include <linux/ext2_fs.h> /* EXT2_IOC_* */
917+
918+# define FS_IOC_GETFLAGS EXT2_IOC_GETFLAGS
919+# define FS_IOC_SETFLAGS EXT2_IOC_SETFLAGS
920+
921+# define FS_IMMUTABLE_FL EXT2_IMMUTABLE_FL
922+
923+#else
924+
925+# include <ext2fs/ext2_fs.h>
926+
927+#endif
928
929 #ifndef FAT_IOCTL_GET_ATTRIBUTES
930 # define FAT_IOCTL_GET_ATTRIBUTES _IOR('r', 0x10, __u32)
931@@ -37,11 +53,13 @@
932
933 #undef statfs
934
935-#if defined(__linux__) && !defined(BLKGETSIZE64)
936+#ifndef BLKGETSIZE64
937 /* This takes a u64, but the size field says size_t. Someone screwed big. */
938 # define BLKGETSIZE64 _IOR(0x12,114,size_t)
939 #endif
940
941 #include <linux/loop.h>
942
943+#endif /* __linux__ */
944+
945 #endif /* LIBINSTALLER_LINUXIOCTL_H */
946Index: syslinux-4.03/libinstaller/syslxcom.c
947===================================================================
948--- syslinux-4.03.orig/libinstaller/syslxcom.c
949+++ syslinux-4.03/libinstaller/syslxcom.c
950@@ -121,9 +121,9 @@ void clear_attributes(int fd)
951 {
952 int flags;
953
954- if (!ioctl(fd, EXT2_IOC_GETFLAGS, &flags)) {
955- flags &= ~EXT2_IMMUTABLE_FL;
956- ioctl(fd, EXT2_IOC_SETFLAGS, &flags);
957+ if (!ioctl(fd, FS_IOC_GETFLAGS, &flags)) {
958+ flags &= ~FS_IMMUTABLE_FL;
959+ ioctl(fd, FS_IOC_SETFLAGS, &flags);
960 }
961 break;
962 }
963@@ -151,9 +151,9 @@ void set_attributes(int fd)
964 {
965 int flags;
966
967- if (st.st_uid == 0 && !ioctl(fd, EXT2_IOC_GETFLAGS, &flags)) {
968- flags |= EXT2_IMMUTABLE_FL;
969- ioctl(fd, EXT2_IOC_SETFLAGS, &flags);
970+ if (st.st_uid == 0 && !ioctl(fd, FS_IOC_GETFLAGS, &flags)) {
971+ flags |= FS_IMMUTABLE_FL;
972+ ioctl(fd, FS_IOC_SETFLAGS, &flags);
973 }
974 break;
975 }
diff --git a/meta/recipes-devtools/syslinux/syslinux_4.03.bb b/meta/recipes-devtools/syslinux/syslinux_4.03.bb
index e76fe1faf8..a3eb5668d1 100644
--- a/meta/recipes-devtools/syslinux/syslinux_4.03.bb
+++ b/meta/recipes-devtools/syslinux/syslinux_4.03.bb
@@ -7,10 +7,11 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3 \
7# If you really want to run syslinux, you need mtools. We just want the 7# If you really want to run syslinux, you need mtools. We just want the
8# ldlinux.* stuff for now, so skip mtools-native 8# ldlinux.* stuff for now, so skip mtools-native
9DEPENDS = "nasm-native" 9DEPENDS = "nasm-native"
10PR = "r2" 10PR = "r3"
11 11
12SRC_URI = "${KERNELORG_MIRROR}/linux/utils/boot/syslinux/syslinux-${PV}.tar.bz2 \ 12SRC_URI = "${KERNELORG_MIRROR}/linux/utils/boot/syslinux/syslinux-${PV}.tar.bz2 \
13 file://cross-build.patch" 13 file://cross-build.patch \
14 file://libinstaller-Avoid-using-linux-ext2_fs.h.patch"
14 15
15SRC_URI[md5sum] = "a7ca38a0a5786b6efae8fb01a1ae8070" 16SRC_URI[md5sum] = "a7ca38a0a5786b6efae8fb01a1ae8070"
16SRC_URI[sha256sum] = "c65567e324f9d1f7f794ae8f9578a0292bbd47d7b8d895a004d2f0152d0bda38" 17SRC_URI[sha256sum] = "c65567e324f9d1f7f794ae8f9578a0292bbd47d7b8d895a004d2f0152d0bda38"