summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/syslinux
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/syslinux')
-rw-r--r--meta/recipes-devtools/syslinux/syslinux/0001-Add-extra-sector-count-from-section-entry-for-EFI-ca.patch104
-rw-r--r--meta/recipes-devtools/syslinux/syslinux/0001-ext2_fs.h-do-not-carry-an-outdated-copy.patch1197
-rw-r--r--meta/recipes-devtools/syslinux/syslinux_6.04-pre2.bb12
3 files changed, 1310 insertions, 3 deletions
diff --git a/meta/recipes-devtools/syslinux/syslinux/0001-Add-extra-sector-count-from-section-entry-for-EFI-ca.patch b/meta/recipes-devtools/syslinux/syslinux/0001-Add-extra-sector-count-from-section-entry-for-EFI-ca.patch
new file mode 100644
index 0000000000..5422d9b2de
--- /dev/null
+++ b/meta/recipes-devtools/syslinux/syslinux/0001-Add-extra-sector-count-from-section-entry-for-EFI-ca.patch
@@ -0,0 +1,104 @@
1From 79a26046d178ae132cb88ba75de7141bd169ff16 Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Sat, 26 Apr 2025 10:45:08 +0800
4Subject: [PATCH] Add extra sector count from section entry for EFI catalogue
5
6According to page 11: `Figure 5 - Section Entry' in El Torito Bootable
7CD-ROM Format Specification [1]. The sector count tooks 2 byte which
8means max sector count is 0xffff (65535), for 512-byte sector, the
9size of bootable image is no more than 32MB (65536 * 512 / 1024 / 1024)
10
11If the size of efi.img > 32MB, the partition table will be truncated
12in ISO, which caused UEFI system or grub-efi read efi.img broken
13occasionally.
14
15This patch extend efi_count, mac_count and count to 4 byte int, if
16Yocto defines `Selection criteria type = 2', add extra sector count
17to original sector count as total count; for other situation, still use
18original sector count as usual
19
20[1]https://pdos.csail.mit.edu/6.828/2017/readings/boot-cdrom.pdf
21
22Upstream-Status: Inappropriate [Yocto specific]
23
24Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
25---
26 utils/isohybrid.c | 48 ++++++++++++++++++++++++++++++++++++++++++-----
27 1 file changed, 43 insertions(+), 5 deletions(-)
28
29diff --git a/utils/isohybrid.c b/utils/isohybrid.c
30index a9e38d4..1bbfd45 100644
31--- a/utils/isohybrid.c
32+++ b/utils/isohybrid.c
33@@ -76,7 +76,7 @@ uint32_t de_lba = 0;
34 uint16_t de_seg = 0, de_count = 0, de_mbz2 = 0;
35 uint8_t de_boot = 0, de_media = 0, de_sys = 0, de_mbz1 = 0;
36 uint32_t efi_lba = 0, mac_lba = 0;
37-uint16_t efi_count = 0, mac_count = 0;
38+uint32_t efi_count = 0, mac_count = 0;
39 uint8_t efi_boot = 0, efi_media = 0, efi_sys = 0;
40
41 int apm_parts = 3;
42@@ -552,17 +552,55 @@ read_efi_section(const uint8_t *buf)
43 }
44
45 int
46-read_efi_catalogue(const uint8_t *buf, uint16_t *count, uint32_t *lba)
47+read_efi_catalogue(const uint8_t *buf, uint32_t *count, uint32_t *lba)
48 {
49+ uint16_t _count = 0;
50+
51+ // Jump to offset 6 byte
52 buf += 6;
53
54- memcpy(count, buf, 2);
55- *count = lendian_short(*count);
56+ *count = 0;
57+
58+ // Offset : 6-7 byte
59+ // Type : Word
60+ // Description: Sector Count, the number of virtual/emulated sectors
61+ // the system will store at Load Segment during the initial boot procedure
62+ memcpy(&_count, buf, 2);
63+ _count = lendian_short(_count);
64 buf += 2;
65
66+ // Offset : 8-0B byte
67+ // Type : D Word
68+ // Description: Load RBA. This is the start address of the virtual disk. CD’s use
69+ // Relative/Logical block addressing.
70 memcpy(lba, buf, 4);
71 *lba = lendian_int(*lba);
72- buf += 6;
73+ buf += 4;
74+
75+ // Offset : 0C byte
76+ // Type : Byte
77+ // Description: Selection criteria type. This defines a vendor unique format
78+ // for bytes 0D-1F.
79+ // The following formats have currently been assigned:
80+ // 0 - No selection criteria
81+ // 1 - Language and Version Information (IBM)
82+ // 2 - Save extra sector count to vendor unique selection criteria (Yocto)
83+ // 3-FF - Reserved
84+ unsigned char slection_criteria_type = *buf;
85+ buf += 1;
86+
87+ // Offset : 0D-0E-0F-10 byte
88+ // Type : D Word
89+ // Description: Selection criteria type = 2, reserved by Yocto,
90+ // save extra sector count to vendor unique selection criteria
91+ if (slection_criteria_type == 2) {
92+ memcpy(count, buf, 4);
93+ *count = lendian_int(*count);
94+ buf += 4;
95+ }
96+
97+ // total count = sector count + extra sector count
98+ *count += _count;
99
100 return 0;
101 }
102--
1032.34.1
104
diff --git a/meta/recipes-devtools/syslinux/syslinux/0001-ext2_fs.h-do-not-carry-an-outdated-copy.patch b/meta/recipes-devtools/syslinux/syslinux/0001-ext2_fs.h-do-not-carry-an-outdated-copy.patch
new file mode 100644
index 0000000000..299423b5a3
--- /dev/null
+++ b/meta/recipes-devtools/syslinux/syslinux/0001-ext2_fs.h-do-not-carry-an-outdated-copy.patch
@@ -0,0 +1,1197 @@
1From daf017bc98276fecce1893c7e4db70cbd8c8f7a0 Mon Sep 17 00:00:00 2001
2From: Alexander Kanavin <alex@linutronix.de>
3Date: Fri, 16 Aug 2024 16:59:21 +0200
4Subject: [PATCH] ext2_fs.h: do not carry an outdated copy
5
6This copy is no longer compatible with latest e2fsprogs
7(which installs a correct version).
8
9Upstream-Status: Inactive-Upstream
10Signed-off-by: Alexander Kanavin <alex@linutronix.de>
11---
12 core/fs/ext2/ext2_fs.h | 312 -------------
13 libinstaller/ext2fs/ext2_fs.h | 856 ----------------------------------
14 2 files changed, 1168 deletions(-)
15 delete mode 100644 core/fs/ext2/ext2_fs.h
16 delete mode 100644 libinstaller/ext2fs/ext2_fs.h
17
18diff --git a/core/fs/ext2/ext2_fs.h b/core/fs/ext2/ext2_fs.h
19deleted file mode 100644
20index d8d07eb..0000000
21--- a/core/fs/ext2/ext2_fs.h
22+++ /dev/null
23@@ -1,312 +0,0 @@
24-#ifndef __EXT2_FS_H
25-#define __EXT2_FS_H
26-
27-#include <stdint.h>
28-
29-#define EXT2_SUPER_MAGIC 0xEF53
30-
31-#define EXT2_GOOD_OLD_REV 0 // The good old (original) format
32-#define EXT2_DYNAMIC_REV 1 // V2 format w/ dynamic inode sizes
33-#define EXT2_GOOD_OLD_INODE_SIZE 128
34-
35-// Special inode numbers
36-#define EXT2_BAD_INO 1 // Bad blocks inode
37-#define EXT2_ROOT_INO 2 // Root inode
38-#define EXT2_BOOT_LOADER_INO 5 // Boot loader inode
39-#define EXT2_UNDEL_DIR_INO 6 // Undelete directory inode
40-#define EXT3_RESIZE_INO 7 // Reserved group descriptors inode
41-#define EXT3_JOURNAL_INO 8 // Journal inode
42-
43-// We're readonly, so we only care about incompat features.
44-#define EXT2_FEATURE_INCOMPAT_COMPRESSION 0x0001
45-#define EXT2_FEATURE_INCOMPAT_FILETYPE 0x0002
46-#define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004
47-#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008
48-#define EXT2_FEATURE_INCOMPAT_META_BG 0x0010
49-#define EXT2_FEATURE_INCOMPAT_ANY 0xffffffff
50-
51-#define EXT2_NDIR_BLOCKS 12
52-#define EXT2_IND_BLOCK EXT2_NDIR_BLOCKS
53-#define EXT2_DIND_BLOCK (EXT2_IND_BLOCK+1)
54-#define EXT2_TIND_BLOCK (EXT2_DIND_BLOCK+1)
55-#define EXT2_N_BLOCKS (EXT2_TIND_BLOCK+1)
56-
57-
58-/* for EXT4 extent */
59-#define EXT4_EXT_MAGIC 0xf30a
60-#define EXT4_EXTENTS_FLAG 0x00080000
61-
62-/*
63- * File types and file modes
64- */
65-#define S_IFDIR 0040000 // Directory
66-#define S_IFCHR 0020000 // Character device
67-#define S_IFBLK 0060000 // Block device
68-#define S_IFREG 0100000 // Regular file
69-#define S_IFIFO 0010000 // FIFO
70-#define S_IFLNK 0120000 // Symbolic link
71-#define S_IFSOCK 0140000 // Socket
72-
73-#define S_IFSHIFT 12
74-
75-#define T_IFDIR (S_IFDIR >> S_IFSHIFT)
76-#define T_IFCHR (S_IFCHR >> S_IFSHIFT)
77-#define T_IFBLK (S_IFBLK >> S_IFSHIFT)
78-#define T_IFREG (S_IFREG >> S_IFSHIFT)
79-#define T_IFIFO (S_IFIFO >> S_IFSHIFT)
80-#define T_IFLNK (S_IFLNK >> S_IFSHIFT)
81-#define T_IFSOCK (S_IFSOCK >> S_IFSHIFT)
82-
83-
84-#define ext2_group_desc_lg2size 5
85-
86-
87-
88-/*
89- * super block structure:
90- * include/linux/ext2_fs.h
91- */
92-struct ext2_super_block {
93- uint32_t s_inodes_count; /* Inodes count */
94- uint32_t s_blocks_count; /* Blocks count */
95- uint32_t s_r_blocks_count; /* Reserved blocks count */
96- uint32_t s_free_blocks_count; /* Free blocks count */
97- uint32_t s_free_inodes_count; /* Free inodes count */
98- uint32_t s_first_data_block; /* First Data Block */
99- uint32_t s_log_block_size; /* Block size */
100- uint32_t s_log_frag_size; /* Fragment size */
101- uint32_t s_blocks_per_group; /* # Blocks per group */
102- uint32_t s_frags_per_group; /* # Fragments per group */
103- uint32_t s_inodes_per_group; /* # Inodes per group */
104- uint32_t s_mtime; /* Mount time */
105- uint32_t s_wtime; /* Write time */
106- uint16_t s_mnt_count; /* Mount count */
107- int16_t s_max_mnt_count; /* Maximal mount count */
108- uint16_t s_magic; /* Magic signature */
109- uint16_t s_state; /* File system state */
110- uint16_t s_errors; /* Behaviour when detecting errors */
111- uint16_t s_minor_rev_level;
112- uint32_t s_lastcheck; /* time of last check */
113- uint32_t s_checkinterval; /* max. time between checks */
114- uint32_t s_creator_os; /* OS */
115- uint32_t s_rev_level; /* Revision level */
116- uint16_t s_def_resuid; /* Default uid for reserved blocks */
117- uint16_t s_def_resgid; /* Default gid for reserved blocks */
118-
119- uint32_t s_first_ino; /* First non-reserved inode */
120- uint16_t s_inode_size; /* size of inode structure */
121- uint16_t s_block_group_nr; /* block group # of this superblock */
122- uint32_t s_feature_compat; /* compatible feature set */
123- uint32_t s_feature_incompat; /* incompatible feature set */
124- uint32_t s_feature_ro_compat; /* readonly-compatible feature set */
125- uint8_t s_uuid[16]; /* 128-bit uuid for volume */
126- char s_volume_name[16]; /* volume name */
127- char s_last_mounted[64]; /* directory where last mounted */
128- uint32_t s_algorithm_usage_bitmap; /* For compression */
129- uint8_t s_prealloc_blocks; /* Nr of blocks to try to preallocate*/
130- uint8_t s_prealloc_dir_blocks;
131- uint16_t s_reserved_gdt_blocks; /* Per group desc for online growth */
132- /*
133- * Journaling support valid if EXT4_FEATURE_COMPAT_HAS_JOURNAL set.
134- */
135- uint8_t s_journal_uuid[16]; /* uuid of journal superblock */
136- uint32_t s_journal_inum; /* inode number of journal file */
137- uint32_t s_journal_dev; /* device number of journal file */
138- uint32_t s_last_orphan; /* start of list of inodes to delete */
139- uint32_t s_hash_seed[4]; /* HTREE hash seed */
140- uint8_t s_def_hash_version; /* Default hash version to use */
141- uint8_t s_reserved_char_pad;
142- uint16_t s_desc_size; /* size of group descriptor */
143- uint32_t s_default_mount_opts;
144- uint32_t s_first_meta_bg; /* First metablock block group */
145- uint32_t s_mkfs_time; /* When the filesystem was created */
146- uint32_t s_jnl_blocks[17]; /* Backup of the journal inode */
147- /* 64bit support valid if EXT4_FEATURE_COMPAT_64BIT */
148- uint32_t s_blocks_count_hi; /* Blocks count */
149- uint32_t s_r_blocks_count_hi; /* Reserved blocks count */
150- uint32_t s_free_blocks_count_hi;/* Free blocks count */
151- uint16_t s_min_extra_isize; /* All inodes have at least # bytes */
152- uint16_t s_want_extra_isize; /* New inodes should reserve # bytes */
153- uint32_t s_flags; /* Miscellaneous flags */
154- uint16_t s_raid_stride; /* RAID stride */
155- uint16_t s_mmp_interval; /* # seconds to wait in MMP checking */
156- uint64_t s_mmp_block; /* Block for multi-mount protection */
157- uint32_t s_raid_stripe_width; /* blocks on all data disks (N*stride)*/
158- uint8_t s_log_groups_per_flex; /* FLEX_BG group size */
159- uint8_t s_reserved_char_pad2;
160- uint16_t s_reserved_pad;
161- uint32_t s_reserved[162]; /* Padding to the end of the block */
162-};
163-
164-/*******************************************************************************
165-#ifndef DEPEND
166-#if ext2_super_block_size != 1024
167-#error ext2_super_block definition bogus
168-#endif
169-#endif
170-*******************************************************************************/
171-
172-/*
173- * ext2 group desc structure:
174- */
175-struct ext2_group_desc {
176- uint32_t bg_block_bitmap; /* Blocks bitmap block */
177- uint32_t bg_inode_bitmap; /* Inodes bitmap block */
178- uint32_t bg_inode_table; /* Inodes table block */
179- uint16_t bg_free_blocks_count; /* Free blocks count */
180- uint16_t bg_free_inodes_count; /* Free inodes count */
181- uint16_t bg_used_dirs_count; /* Directories count */
182- uint16_t bg_pad;
183- uint32_t bg_reserved[3];
184-};
185-
186-/*******************************************************************************
187-#ifndef DEPEND
188-#if ext2_group_desc_size != 32
189-#error ext2_group_desc definition bogus
190-#endif
191-#endif
192-*******************************************************************************/
193-
194-
195-/*
196- * ext2 inode structure:
197- */
198-struct ext2_inode {
199- uint16_t i_mode; /* File mode */
200- uint16_t i_uid; /* Owner Uid */
201- uint32_t i_size; /* 4: Size in bytes */
202- uint32_t i_atime; /* Access time */
203- uint32_t i_ctime; /* 12: Creation time */
204- uint32_t i_mtime; /* Modification time */
205- uint32_t i_dtime; /* 20: Deletion Time */
206- uint16_t i_gid; /* Group Id */
207- uint16_t i_links_count; /* 24: Links count */
208- uint32_t i_blocks; /* Blocks count */
209- uint32_t i_flags; /* 32: File flags */
210- uint32_t l_i_reserved1;
211- uint32_t i_block[EXT2_N_BLOCKS]; /* 40: Pointers to blocks */
212- uint32_t i_version; /* File version (for NFS) */
213- uint32_t i_file_acl; /* File ACL */
214- uint32_t i_dir_acl; /* Directory ACL */
215- uint32_t i_faddr; /* Fragment address */
216- uint8_t l_i_frag; /* Fragment number */
217- uint8_t l_i_fsize; /* Fragment size */
218- uint16_t i_pad1;
219- uint32_t l_i_reserved2[2];
220-};
221-
222-/*******************************************************************************
223-#ifndef DEPEND
224-#if ext2_inode_size != 128
225-#error ext2_inode definition bogus
226-#endif
227-#endif
228-*******************************************************************************/
229-
230-
231-#define EXT2_NAME_LEN 255
232-struct ext2_dir_entry {
233- unsigned int d_inode; /* Inode number */
234- unsigned short d_rec_len; /* Directory entry length */
235- unsigned char d_name_len; /* Name length */
236- unsigned char d_file_type;
237- char d_name[EXT2_NAME_LEN]; /* File name */
238-};
239-
240-/*******************************************************************************
241-#define EXT2_DIR_PAD 4
242-#define EXT2_DIR_ROUND (EXT2_DIR_PAD - 1)
243-#define EXT2_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT2_DIR_ROUND) & \
244- ~EXT2_DIR_ROUND)
245-*******************************************************************************/
246-
247-
248-
249-
250-
251-
252-/*
253- * This is the extent on-disk structure.
254- * It's used at the bottom of the tree.
255- */
256-struct ext4_extent {
257- uint32_t ee_block; /* first logical block extent covers */
258- uint16_t ee_len; /* number of blocks covered by extent */
259- uint16_t ee_start_hi; /* high 16 bits of physical block */
260- uint32_t ee_start_lo; /* low 32 bits of physical block */
261-};
262-
263-/*
264- * This is index on-disk structure.
265- * It's used at all the levels except the bottom.
266- */
267-struct ext4_extent_idx {
268- uint32_t ei_block; /* index covers logical blocks from 'block' */
269- uint32_t ei_leaf_lo; /* pointer to the physical block of the next *
270- * level. leaf or next index could be there */
271- uint16_t ei_leaf_hi; /* high 16 bits of physical block */
272- uint16_t ei_unused;
273-};
274-
275-/*
276- * Each block (leaves and indexes), even inode-stored has header.
277- */
278-struct ext4_extent_header {
279- uint16_t eh_magic; /* probably will support different formats */
280- uint16_t eh_entries; /* number of valid entries */
281- uint16_t eh_max; /* capacity of store in entries */
282- uint16_t eh_depth; /* has tree real underlying blocks? */
283- uint32_t eh_generation; /* generation of the tree */
284-};
285-
286-
287-
288-#define EXT4_FIRST_EXTENT(header) ( (struct ext4_extent *)(header + 1) )
289-#define EXT4_FIRST_INDEX(header) ( (struct ext4_extent_idx *) (header + 1) )
290-
291-
292-/*
293- * The ext2 super block information in memory
294- */
295-struct ext2_sb_info {
296- uint32_t s_inodes_per_block;/* Number of inodes per block */
297- uint32_t s_inodes_per_group;/* Number of inodes in a group */
298- uint32_t s_blocks_per_group;/* Number of blocks in a group */
299- uint32_t s_desc_per_block; /* Number of group descriptors per block */
300- uint32_t s_groups_count; /* Number of groups in the fs */
301- uint32_t s_first_data_block; /* First Data Block */
302- int s_inode_size;
303- uint8_t s_uuid[16]; /* 128-bit uuid for volume */
304- int s_desc_size; /* size of group descriptor */
305-};
306-
307-static inline struct ext2_sb_info *EXT2_SB(struct fs_info *fs)
308-{
309- return fs->fs_info;
310-}
311-
312-#define EXT2_BLOCKS_PER_GROUP(fs) (EXT2_SB(fs)->s_blocks_per_group)
313-#define EXT2_INODES_PER_GROUP(fs) (EXT2_SB(fs)->s_inodes_per_group)
314-#define EXT2_INODES_PER_BLOCK(fs) (EXT2_SB(fs)->s_inodes_per_block)
315-#define EXT2_DESC_PER_BLOCK(fs) (EXT2_SB(fs)->s_desc_per_block)
316-
317-/*
318- * ext2 private inode information
319- */
320-struct ext2_pvt_inode {
321- union {
322- uint32_t i_block[EXT2_N_BLOCKS];
323- struct ext4_extent_header i_extent_hdr;
324- };
325-};
326-
327-#define PVT(i) ((struct ext2_pvt_inode *)((i)->pvt))
328-
329-/*
330- * functions
331- */
332-block_t ext2_bmap(struct inode *, block_t, size_t *);
333-int ext2_next_extent(struct inode *, uint32_t);
334-
335-#endif /* ext2_fs.h */
336diff --git a/libinstaller/ext2fs/ext2_fs.h b/libinstaller/ext2fs/ext2_fs.h
337deleted file mode 100644
338index e52c9e1..0000000
339--- a/libinstaller/ext2fs/ext2_fs.h
340+++ /dev/null
341@@ -1,856 +0,0 @@
342-/*
343- * linux/include/linux/ext2_fs.h
344- *
345- * Copyright (C) 1992, 1993, 1994, 1995
346- * Remy Card (card@masi.ibp.fr)
347- * Laboratoire MASI - Institut Blaise Pascal
348- * Universite Pierre et Marie Curie (Paris VI)
349- *
350- * from
351- *
352- * linux/include/linux/minix_fs.h
353- *
354- * Copyright (C) 1991, 1992 Linus Torvalds
355- */
356-
357-#ifndef _EXT2FS_EXT2_FS_H
358-#define _EXT2FS_EXT2_FS_H
359-
360-#include <linux/types.h>
361-
362-/*
363- * The second extended filesystem constants/structures
364- */
365-
366-/*
367- * Define EXT2FS_DEBUG to produce debug messages
368- */
369-#undef EXT2FS_DEBUG
370-
371-/*
372- * Define EXT2_PREALLOCATE to preallocate data blocks for expanding files
373- */
374-#define EXT2_PREALLOCATE
375-#define EXT2_DEFAULT_PREALLOC_BLOCKS 8
376-
377-/*
378- * The second extended file system version
379- */
380-#define EXT2FS_DATE "95/08/09"
381-#define EXT2FS_VERSION "0.5b"
382-
383-/*
384- * Special inode numbers
385- */
386-#define EXT2_BAD_INO 1 /* Bad blocks inode */
387-#define EXT2_ROOT_INO 2 /* Root inode */
388-#define EXT4_USR_QUOTA_INO 3 /* User quota inode */
389-#define EXT4_GRP_QUOTA_INO 4 /* Group quota inode */
390-#define EXT2_BOOT_LOADER_INO 5 /* Boot loader inode */
391-#define EXT2_UNDEL_DIR_INO 6 /* Undelete directory inode */
392-#define EXT2_RESIZE_INO 7 /* Reserved group descriptors inode */
393-#define EXT2_JOURNAL_INO 8 /* Journal inode */
394-#define EXT2_EXCLUDE_INO 9 /* The "exclude" inode, for snapshots */
395-#define EXT4_REPLICA_INO 10 /* Used by non-upstream feature */
396-
397-/* First non-reserved inode for old ext2 filesystems */
398-#define EXT2_GOOD_OLD_FIRST_INO 11
399-
400-/*
401- * The second extended file system magic number
402- */
403-#define EXT2_SUPER_MAGIC 0xEF53
404-
405-#ifdef __KERNEL__
406-#define EXT2_SB(sb) (&((sb)->u.ext2_sb))
407-#else
408-/* Assume that user mode programs are passing in an ext2fs superblock, not
409- * a kernel struct super_block. This will allow us to call the feature-test
410- * macros from user land. */
411-#define EXT2_SB(sb) (sb)
412-#endif
413-
414-/*
415- * Maximal count of links to a file
416- */
417-#define EXT2_LINK_MAX 65000
418-
419-/*
420- * Macro-instructions used to manage several block sizes
421- */
422-#define EXT2_MIN_BLOCK_LOG_SIZE 10 /* 1024 */
423-#define EXT2_MAX_BLOCK_LOG_SIZE 16 /* 65536 */
424-#define EXT2_MIN_BLOCK_SIZE (1 << EXT2_MIN_BLOCK_LOG_SIZE)
425-#define EXT2_MAX_BLOCK_SIZE (1 << EXT2_MAX_BLOCK_LOG_SIZE)
426-#ifdef __KERNEL__
427-#define EXT2_BLOCK_SIZE(s) ((s)->s_blocksize)
428-#define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits)
429-#define EXT2_ADDR_PER_BLOCK_BITS(s) (EXT2_SB(s)->addr_per_block_bits)
430-#define EXT2_INODE_SIZE(s) (EXT2_SB(s)->s_inode_size)
431-#define EXT2_FIRST_INO(s) (EXT2_SB(s)->s_first_ino)
432-#else
433-#define EXT2_BLOCK_SIZE(s) (EXT2_MIN_BLOCK_SIZE << (s)->s_log_block_size)
434-#define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10)
435-#define EXT2_INODE_SIZE(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
436- EXT2_GOOD_OLD_INODE_SIZE : (s)->s_inode_size)
437-#define EXT2_FIRST_INO(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
438- EXT2_GOOD_OLD_FIRST_INO : (s)->s_first_ino)
439-#endif
440-#define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof(__u32))
441-
442-/*
443- * Macro-instructions used to manage allocation clusters
444- */
445-#define EXT2_MIN_CLUSTER_LOG_SIZE EXT2_MIN_BLOCK_LOG_SIZE
446-#define EXT2_MAX_CLUSTER_LOG_SIZE 29 /* 512MB */
447-#define EXT2_MIN_CLUSTER_SIZE EXT2_MIN_BLOCK_SIZE
448-#define EXT2_MAX_CLUSTER_SIZE (1 << EXT2_MAX_CLUSTER_LOG_SIZE)
449-#define EXT2_CLUSTER_SIZE(s) (EXT2_MIN_BLOCK_SIZE << \
450- (s)->s_log_cluster_size)
451-#define EXT2_CLUSTER_SIZE_BITS(s) ((s)->s_log_cluster_size + 10)
452-
453-/*
454- * Macro-instructions used to manage fragments
455- *
456- * Note: for backwards compatibility only, for the dump program.
457- * Ext2/3/4 will never support fragments....
458- */
459-#define EXT2_MIN_FRAG_SIZE EXT2_MIN_BLOCK_SIZE
460-#define EXT2_MAX_FRAG_SIZE EXT2_MAX_BLOCK_SIZE
461-#define EXT2_MIN_FRAG_LOG_SIZE EXT2_MIN_BLOCK_LOG_SIZE
462-#define EXT2_FRAG_SIZE(s) EXT2_BLOCK_SIZE(s)
463-#define EXT2_FRAGS_PER_BLOCK(s) 1
464-
465-/*
466- * ACL structures
467- */
468-struct ext2_acl_header /* Header of Access Control Lists */
469-{
470- __u32 aclh_size;
471- __u32 aclh_file_count;
472- __u32 aclh_acle_count;
473- __u32 aclh_first_acle;
474-};
475-
476-struct ext2_acl_entry /* Access Control List Entry */
477-{
478- __u32 acle_size;
479- __u16 acle_perms; /* Access permissions */
480- __u16 acle_type; /* Type of entry */
481- __u16 acle_tag; /* User or group identity */
482- __u16 acle_pad1;
483- __u32 acle_next; /* Pointer on next entry for the */
484- /* same inode or on next free entry */
485-};
486-
487-/*
488- * Structure of a blocks group descriptor
489- */
490-struct ext2_group_desc
491-{
492- __u32 bg_block_bitmap; /* Blocks bitmap block */
493- __u32 bg_inode_bitmap; /* Inodes bitmap block */
494- __u32 bg_inode_table; /* Inodes table block */
495- __u16 bg_free_blocks_count; /* Free blocks count */
496- __u16 bg_free_inodes_count; /* Free inodes count */
497- __u16 bg_used_dirs_count; /* Directories count */
498- __u16 bg_flags;
499- __u32 bg_exclude_bitmap_lo; /* Exclude bitmap for snapshots */
500- __u16 bg_block_bitmap_csum_lo;/* crc32c(s_uuid+grp_num+bitmap) LSB */
501- __u16 bg_inode_bitmap_csum_lo;/* crc32c(s_uuid+grp_num+bitmap) LSB */
502- __u16 bg_itable_unused; /* Unused inodes count */
503- __u16 bg_checksum; /* crc16(s_uuid+grouo_num+group_desc)*/
504-};
505-
506-/*
507- * Structure of a blocks group descriptor
508- */
509-struct ext4_group_desc
510-{
511- __u32 bg_block_bitmap; /* Blocks bitmap block */
512- __u32 bg_inode_bitmap; /* Inodes bitmap block */
513- __u32 bg_inode_table; /* Inodes table block */
514- __u16 bg_free_blocks_count; /* Free blocks count */
515- __u16 bg_free_inodes_count; /* Free inodes count */
516- __u16 bg_used_dirs_count; /* Directories count */
517- __u16 bg_flags; /* EXT4_BG_flags (INODE_UNINIT, etc) */
518- __u32 bg_exclude_bitmap_lo; /* Exclude bitmap for snapshots */
519- __u16 bg_block_bitmap_csum_lo;/* crc32c(s_uuid+grp_num+bitmap) LSB */
520- __u16 bg_inode_bitmap_csum_lo;/* crc32c(s_uuid+grp_num+bitmap) LSB */
521- __u16 bg_itable_unused; /* Unused inodes count */
522- __u16 bg_checksum; /* crc16(sb_uuid+group+desc) */
523- __u32 bg_block_bitmap_hi; /* Blocks bitmap block MSB */
524- __u32 bg_inode_bitmap_hi; /* Inodes bitmap block MSB */
525- __u32 bg_inode_table_hi; /* Inodes table block MSB */
526- __u16 bg_free_blocks_count_hi;/* Free blocks count MSB */
527- __u16 bg_free_inodes_count_hi;/* Free inodes count MSB */
528- __u16 bg_used_dirs_count_hi; /* Directories count MSB */
529- __u16 bg_itable_unused_hi; /* Unused inodes count MSB */
530- __u32 bg_exclude_bitmap_hi; /* Exclude bitmap block MSB */
531- __u16 bg_block_bitmap_csum_hi;/* crc32c(s_uuid+grp_num+bitmap) MSB */
532- __u16 bg_inode_bitmap_csum_hi;/* crc32c(s_uuid+grp_num+bitmap) MSB */
533- __u32 bg_reserved;
534-};
535-
536-#define EXT2_BG_INODE_UNINIT 0x0001 /* Inode table/bitmap not initialized */
537-#define EXT2_BG_BLOCK_UNINIT 0x0002 /* Block bitmap not initialized */
538-#define EXT2_BG_INODE_ZEROED 0x0004 /* On-disk itable initialized to zero */
539-
540-/*
541- * Data structures used by the directory indexing feature
542- *
543- * Note: all of the multibyte integer fields are little endian.
544- */
545-
546-/*
547- * Note: dx_root_info is laid out so that if it should somehow get
548- * overlaid by a dirent the two low bits of the hash version will be
549- * zero. Therefore, the hash version mod 4 should never be 0.
550- * Sincerely, the paranoia department.
551- */
552-struct ext2_dx_root_info {
553- __u32 reserved_zero;
554- __u8 hash_version; /* 0 now, 1 at release */
555- __u8 info_length; /* 8 */
556- __u8 indirect_levels;
557- __u8 unused_flags;
558-};
559-
560-#define EXT2_HASH_LEGACY 0
561-#define EXT2_HASH_HALF_MD4 1
562-#define EXT2_HASH_TEA 2
563-#define EXT2_HASH_LEGACY_UNSIGNED 3 /* reserved for userspace lib */
564-#define EXT2_HASH_HALF_MD4_UNSIGNED 4 /* reserved for userspace lib */
565-#define EXT2_HASH_TEA_UNSIGNED 5 /* reserved for userspace lib */
566-
567-#define EXT2_HASH_FLAG_INCOMPAT 0x1
568-
569-struct ext2_dx_entry {
570- __u32 hash;
571- __u32 block;
572-};
573-
574-struct ext2_dx_countlimit {
575- __u16 limit;
576- __u16 count;
577-};
578-
579-
580-/*
581- * Macro-instructions used to manage group descriptors
582- */
583-#define EXT2_MIN_DESC_SIZE 32
584-#define EXT2_MIN_DESC_SIZE_64BIT 64
585-#define EXT2_MAX_DESC_SIZE EXT2_MIN_BLOCK_SIZE
586-#define EXT2_DESC_SIZE(s) \
587- ((EXT2_SB(s)->s_feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT) ? \
588- (s)->s_desc_size : EXT2_MIN_DESC_SIZE)
589-
590-#define EXT2_BLOCKS_PER_GROUP(s) (EXT2_SB(s)->s_blocks_per_group)
591-#define EXT2_INODES_PER_GROUP(s) (EXT2_SB(s)->s_inodes_per_group)
592-#define EXT2_CLUSTERS_PER_GROUP(s) (EXT2_SB(s)->s_clusters_per_group)
593-#define EXT2_INODES_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s)/EXT2_INODE_SIZE(s))
594-/* limits imposed by 16-bit value gd_free_{blocks,inode}_count */
595-#define EXT2_MAX_BLOCKS_PER_GROUP(s) ((((unsigned) 1 << 16) - 8) * \
596- (EXT2_CLUSTER_SIZE(s) / \
597- EXT2_BLOCK_SIZE(s)))
598-#define EXT2_MAX_CLUSTERS_PER_GROUP(s) (((unsigned) 1 << 16) - 8)
599-#define EXT2_MAX_INODES_PER_GROUP(s) (((unsigned) 1 << 16) - \
600- EXT2_INODES_PER_BLOCK(s))
601-#ifdef __KERNEL__
602-#define EXT2_DESC_PER_BLOCK(s) (EXT2_SB(s)->s_desc_per_block)
603-#define EXT2_DESC_PER_BLOCK_BITS(s) (EXT2_SB(s)->s_desc_per_block_bits)
604-#else
605-#define EXT2_DESC_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / EXT2_DESC_SIZE(s))
606-#endif
607-
608-/*
609- * Constants relative to the data blocks
610- */
611-#define EXT2_NDIR_BLOCKS 12
612-#define EXT2_IND_BLOCK EXT2_NDIR_BLOCKS
613-#define EXT2_DIND_BLOCK (EXT2_IND_BLOCK + 1)
614-#define EXT2_TIND_BLOCK (EXT2_DIND_BLOCK + 1)
615-#define EXT2_N_BLOCKS (EXT2_TIND_BLOCK + 1)
616-
617-/*
618- * Inode flags
619- */
620-#define EXT2_SECRM_FL 0x00000001 /* Secure deletion */
621-#define EXT2_UNRM_FL 0x00000002 /* Undelete */
622-#define EXT2_COMPR_FL 0x00000004 /* Compress file */
623-#define EXT2_SYNC_FL 0x00000008 /* Synchronous updates */
624-#define EXT2_IMMUTABLE_FL 0x00000010 /* Immutable file */
625-#define EXT2_APPEND_FL 0x00000020 /* writes to file may only append */
626-#define EXT2_NODUMP_FL 0x00000040 /* do not dump file */
627-#define EXT2_NOATIME_FL 0x00000080 /* do not update atime */
628-/* Reserved for compression usage... */
629-#define EXT2_DIRTY_FL 0x00000100
630-#define EXT2_COMPRBLK_FL 0x00000200 /* One or more compressed clusters */
631-#define EXT2_NOCOMPR_FL 0x00000400 /* Access raw compressed data */
632-#define EXT2_ECOMPR_FL 0x00000800 /* Compression error */
633-/* End compression flags --- maybe not all used */
634-#define EXT2_BTREE_FL 0x00001000 /* btree format dir */
635-#define EXT2_INDEX_FL 0x00001000 /* hash-indexed directory */
636-#define EXT2_IMAGIC_FL 0x00002000
637-#define EXT3_JOURNAL_DATA_FL 0x00004000 /* file data should be journaled */
638-#define EXT2_NOTAIL_FL 0x00008000 /* file tail should not be merged */
639-#define EXT2_DIRSYNC_FL 0x00010000 /* Synchronous directory modifications */
640-#define EXT2_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/
641-#define EXT4_HUGE_FILE_FL 0x00040000 /* Set to each huge file */
642-#define EXT4_EXTENTS_FL 0x00080000 /* Inode uses extents */
643-#define EXT4_EA_INODE_FL 0x00200000 /* Inode used for large EA */
644-/* EXT4_EOFBLOCKS_FL 0x00400000 was here */
645-#define EXT4_SNAPFILE_FL 0x01000000 /* Inode is a snapshot */
646-#define EXT4_SNAPFILE_DELETED_FL 0x04000000 /* Snapshot is being deleted */
647-#define EXT4_SNAPFILE_SHRUNK_FL 0x08000000 /* Snapshot shrink has completed */
648-#define EXT2_RESERVED_FL 0x80000000 /* reserved for ext2 lib */
649-
650-#define EXT2_FL_USER_VISIBLE 0x004BDFFF /* User visible flags */
651-#define EXT2_FL_USER_MODIFIABLE 0x004B80FF /* User modifiable flags */
652-
653-/*
654- * ioctl commands
655- */
656-
657-/* Used for online resize */
658-struct ext2_new_group_input {
659- __u32 group; /* Group number for this data */
660- __u32 block_bitmap; /* Absolute block number of block bitmap */
661- __u32 inode_bitmap; /* Absolute block number of inode bitmap */
662- __u32 inode_table; /* Absolute block number of inode table start */
663- __u32 blocks_count; /* Total number of blocks in this group */
664- __u16 reserved_blocks; /* Number of reserved blocks in this group */
665- __u16 unused; /* Number of reserved GDT blocks in group */
666-};
667-
668-struct ext4_new_group_input {
669- __u32 group; /* Group number for this data */
670- __u64 block_bitmap; /* Absolute block number of block bitmap */
671- __u64 inode_bitmap; /* Absolute block number of inode bitmap */
672- __u64 inode_table; /* Absolute block number of inode table start */
673- __u32 blocks_count; /* Total number of blocks in this group */
674- __u16 reserved_blocks; /* Number of reserved blocks in this group */
675- __u16 unused;
676-};
677-
678-#ifdef __GNU__ /* Needed for the Hurd */
679-#define _IOT_ext2_new_group_input _IOT (_IOTS(__u32), 5, _IOTS(__u16), 2, 0, 0)
680-#endif
681-
682-#define EXT2_IOC_GETFLAGS _IOR('f', 1, long)
683-#define EXT2_IOC_SETFLAGS _IOW('f', 2, long)
684-#define EXT2_IOC_GETVERSION _IOR('v', 1, long)
685-#define EXT2_IOC_SETVERSION _IOW('v', 2, long)
686-#define EXT2_IOC_GETVERSION_NEW _IOR('f', 3, long)
687-#define EXT2_IOC_SETVERSION_NEW _IOW('f', 4, long)
688-#define EXT2_IOC_GROUP_EXTEND _IOW('f', 7, unsigned long)
689-#define EXT2_IOC_GROUP_ADD _IOW('f', 8,struct ext2_new_group_input)
690-#define EXT4_IOC_GROUP_ADD _IOW('f', 8,struct ext4_new_group_input)
691-#define EXT4_IOC_RESIZE_FS _IOW('f', 16, __u64)
692-
693-/*
694- * Structure of an inode on the disk
695- */
696-struct ext2_inode {
697- __u16 i_mode; /* File mode */
698- __u16 i_uid; /* Low 16 bits of Owner Uid */
699- __u32 i_size; /* Size in bytes */
700- __u32 i_atime; /* Access time */
701- __u32 i_ctime; /* Inode change time */
702- __u32 i_mtime; /* Modification time */
703- __u32 i_dtime; /* Deletion Time */
704- __u16 i_gid; /* Low 16 bits of Group Id */
705- __u16 i_links_count; /* Links count */
706- __u32 i_blocks; /* Blocks count */
707- __u32 i_flags; /* File flags */
708- union {
709- struct {
710- __u32 l_i_version; /* was l_i_reserved1 */
711- } linux1;
712- struct {
713- __u32 h_i_translator;
714- } hurd1;
715- } osd1; /* OS dependent 1 */
716- __u32 i_block[EXT2_N_BLOCKS];/* Pointers to blocks */
717- __u32 i_generation; /* File version (for NFS) */
718- __u32 i_file_acl; /* File ACL */
719- __u32 i_size_high; /* Formerly i_dir_acl, directory ACL */
720- __u32 i_faddr; /* Fragment address */
721- union {
722- struct {
723- __u16 l_i_blocks_hi;
724- __u16 l_i_file_acl_high;
725- __u16 l_i_uid_high; /* these 2 fields */
726- __u16 l_i_gid_high; /* were reserved2[0] */
727- __u16 l_i_checksum_lo; /* crc32c(uuid+inum+inode) */
728- __u16 l_i_reserved;
729- } linux2;
730- struct {
731- __u8 h_i_frag; /* Fragment number */
732- __u8 h_i_fsize; /* Fragment size */
733- __u16 h_i_mode_high;
734- __u16 h_i_uid_high;
735- __u16 h_i_gid_high;
736- __u32 h_i_author;
737- } hurd2;
738- } osd2; /* OS dependent 2 */
739-};
740-
741-/*
742- * Permanent part of an large inode on the disk
743- */
744-struct ext2_inode_large {
745- __u16 i_mode; /* File mode */
746- __u16 i_uid; /* Low 16 bits of Owner Uid */
747- __u32 i_size; /* Size in bytes */
748- __u32 i_atime; /* Access time */
749- __u32 i_ctime; /* Inode Change time */
750- __u32 i_mtime; /* Modification time */
751- __u32 i_dtime; /* Deletion Time */
752- __u16 i_gid; /* Low 16 bits of Group Id */
753- __u16 i_links_count; /* Links count */
754- __u32 i_blocks; /* Blocks count */
755- __u32 i_flags; /* File flags */
756- union {
757- struct {
758- __u32 l_i_version; /* was l_i_reserved1 */
759- } linux1;
760- struct {
761- __u32 h_i_translator;
762- } hurd1;
763- } osd1; /* OS dependent 1 */
764- __u32 i_block[EXT2_N_BLOCKS];/* Pointers to blocks */
765- __u32 i_generation; /* File version (for NFS) */
766- __u32 i_file_acl; /* File ACL */
767- __u32 i_size_high; /* Formerly i_dir_acl, directory ACL */
768- __u32 i_faddr; /* Fragment address */
769- union {
770- struct {
771- __u16 l_i_blocks_hi;
772- __u16 l_i_file_acl_high;
773- __u16 l_i_uid_high; /* these 2 fields */
774- __u16 l_i_gid_high; /* were reserved2[0] */
775- __u16 l_i_checksum_lo; /* crc32c(uuid+inum+inode) */
776- __u16 l_i_reserved;
777- } linux2;
778- struct {
779- __u8 h_i_frag; /* Fragment number */
780- __u8 h_i_fsize; /* Fragment size */
781- __u16 h_i_mode_high;
782- __u16 h_i_uid_high;
783- __u16 h_i_gid_high;
784- __u32 h_i_author;
785- } hurd2;
786- } osd2; /* OS dependent 2 */
787- __u16 i_extra_isize;
788- __u16 i_checksum_hi; /* crc32c(uuid+inum+inode) */
789- __u32 i_ctime_extra; /* extra Change time (nsec << 2 | epoch) */
790- __u32 i_mtime_extra; /* extra Modification time (nsec << 2 | epoch) */
791- __u32 i_atime_extra; /* extra Access time (nsec << 2 | epoch) */
792- __u32 i_crtime; /* File creation time */
793- __u32 i_crtime_extra; /* extra File creation time (nsec << 2 | epoch)*/
794- __u32 i_version_hi; /* high 32 bits for 64-bit version */
795-};
796-
797-#define i_dir_acl i_size_high
798-
799-#if defined(__KERNEL__) || defined(__linux__)
800-#define i_reserved1 osd1.linux1.l_i_reserved1
801-#define i_frag osd2.linux2.l_i_frag
802-#define i_fsize osd2.linux2.l_i_fsize
803-#define i_uid_low i_uid
804-#define i_gid_low i_gid
805-#define i_uid_high osd2.linux2.l_i_uid_high
806-#define i_gid_high osd2.linux2.l_i_gid_high
807-#else
808-#if defined(__GNU__)
809-
810-#define i_translator osd1.hurd1.h_i_translator
811-#define i_frag osd2.hurd2.h_i_frag;
812-#define i_fsize osd2.hurd2.h_i_fsize;
813-#define i_uid_high osd2.hurd2.h_i_uid_high
814-#define i_gid_high osd2.hurd2.h_i_gid_high
815-#define i_author osd2.hurd2.h_i_author
816-
817-#endif /* __GNU__ */
818-#endif /* defined(__KERNEL__) || defined(__linux__) */
819-
820-#define inode_uid(inode) ((inode).i_uid | (inode).osd2.linux2.l_i_uid_high << 16)
821-#define inode_gid(inode) ((inode).i_gid | (inode).osd2.linux2.l_i_gid_high << 16)
822-#define ext2fs_set_i_uid_high(inode,x) ((inode).osd2.linux2.l_i_uid_high = (x))
823-#define ext2fs_set_i_gid_high(inode,x) ((inode).osd2.linux2.l_i_gid_high = (x))
824-
825-/*
826- * File system states
827- */
828-#define EXT2_VALID_FS 0x0001 /* Unmounted cleanly */
829-#define EXT2_ERROR_FS 0x0002 /* Errors detected */
830-#define EXT3_ORPHAN_FS 0x0004 /* Orphans being recovered */
831-
832-/*
833- * Misc. filesystem flags
834- */
835-#define EXT2_FLAGS_SIGNED_HASH 0x0001 /* Signed dirhash in use */
836-#define EXT2_FLAGS_UNSIGNED_HASH 0x0002 /* Unsigned dirhash in use */
837-#define EXT2_FLAGS_TEST_FILESYS 0x0004 /* OK for use on development code */
838-#define EXT2_FLAGS_IS_SNAPSHOT 0x0010 /* This is a snapshot image */
839-#define EXT2_FLAGS_FIX_SNAPSHOT 0x0020 /* Snapshot inodes corrupted */
840-#define EXT2_FLAGS_FIX_EXCLUDE 0x0040 /* Exclude bitmaps corrupted */
841-
842-/*
843- * Mount flags
844- */
845-#define EXT2_MOUNT_CHECK 0x0001 /* Do mount-time checks */
846-#define EXT2_MOUNT_GRPID 0x0004 /* Create files with directory's group */
847-#define EXT2_MOUNT_DEBUG 0x0008 /* Some debugging messages */
848-#define EXT2_MOUNT_ERRORS_CONT 0x0010 /* Continue on errors */
849-#define EXT2_MOUNT_ERRORS_RO 0x0020 /* Remount fs ro on errors */
850-#define EXT2_MOUNT_ERRORS_PANIC 0x0040 /* Panic on errors */
851-#define EXT2_MOUNT_MINIX_DF 0x0080 /* Mimics the Minix statfs */
852-#define EXT2_MOUNT_NO_UID32 0x0200 /* Disable 32-bit UIDs */
853-
854-#define clear_opt(o, opt) o &= ~EXT2_MOUNT_##opt
855-#define set_opt(o, opt) o |= EXT2_MOUNT_##opt
856-#define test_opt(sb, opt) (EXT2_SB(sb)->s_mount_opt & \
857- EXT2_MOUNT_##opt)
858-/*
859- * Maximal mount counts between two filesystem checks
860- */
861-#define EXT2_DFL_MAX_MNT_COUNT 20 /* Allow 20 mounts */
862-#define EXT2_DFL_CHECKINTERVAL 0 /* Don't use interval check */
863-
864-/*
865- * Behaviour when detecting errors
866- */
867-#define EXT2_ERRORS_CONTINUE 1 /* Continue execution */
868-#define EXT2_ERRORS_RO 2 /* Remount fs read-only */
869-#define EXT2_ERRORS_PANIC 3 /* Panic */
870-#define EXT2_ERRORS_DEFAULT EXT2_ERRORS_CONTINUE
871-
872-#if (__GNUC__ >= 4)
873-#define ext4_offsetof(TYPE,MEMBER) __builtin_offsetof(TYPE,MEMBER)
874-#else
875-#define ext4_offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
876-#endif
877-
878-/*
879- * Structure of the super block
880- */
881-struct ext2_super_block {
882- __u32 s_inodes_count; /* Inodes count */
883- __u32 s_blocks_count; /* Blocks count */
884- __u32 s_r_blocks_count; /* Reserved blocks count */
885- __u32 s_free_blocks_count; /* Free blocks count */
886- __u32 s_free_inodes_count; /* Free inodes count */
887- __u32 s_first_data_block; /* First Data Block */
888- __u32 s_log_block_size; /* Block size */
889- __u32 s_log_cluster_size; /* Allocation cluster size */
890- __u32 s_blocks_per_group; /* # Blocks per group */
891- __u32 s_clusters_per_group; /* # Fragments per group */
892- __u32 s_inodes_per_group; /* # Inodes per group */
893- __u32 s_mtime; /* Mount time */
894- __u32 s_wtime; /* Write time */
895- __u16 s_mnt_count; /* Mount count */
896- __s16 s_max_mnt_count; /* Maximal mount count */
897- __u16 s_magic; /* Magic signature */
898- __u16 s_state; /* File system state */
899- __u16 s_errors; /* Behaviour when detecting errors */
900- __u16 s_minor_rev_level; /* minor revision level */
901- __u32 s_lastcheck; /* time of last check */
902- __u32 s_checkinterval; /* max. time between checks */
903- __u32 s_creator_os; /* OS */
904- __u32 s_rev_level; /* Revision level */
905- __u16 s_def_resuid; /* Default uid for reserved blocks */
906- __u16 s_def_resgid; /* Default gid for reserved blocks */
907- /*
908- * These fields are for EXT2_DYNAMIC_REV superblocks only.
909- *
910- * Note: the difference between the compatible feature set and
911- * the incompatible feature set is that if there is a bit set
912- * in the incompatible feature set that the kernel doesn't
913- * know about, it should refuse to mount the filesystem.
914- *
915- * e2fsck's requirements are more strict; if it doesn't know
916- * about a feature in either the compatible or incompatible
917- * feature set, it must abort and not try to meddle with
918- * things it doesn't understand...
919- */
920- __u32 s_first_ino; /* First non-reserved inode */
921- __u16 s_inode_size; /* size of inode structure */
922- __u16 s_block_group_nr; /* block group # of this superblock */
923- __u32 s_feature_compat; /* compatible feature set */
924- __u32 s_feature_incompat; /* incompatible feature set */
925- __u32 s_feature_ro_compat; /* readonly-compatible feature set */
926- __u8 s_uuid[16]; /* 128-bit uuid for volume */
927- char s_volume_name[16]; /* volume name */
928- char s_last_mounted[64]; /* directory where last mounted */
929- __u32 s_algorithm_usage_bitmap; /* For compression */
930- /*
931- * Performance hints. Directory preallocation should only
932- * happen if the EXT2_FEATURE_COMPAT_DIR_PREALLOC flag is on.
933- */
934- __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/
935- __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */
936- __u16 s_reserved_gdt_blocks; /* Per group table for online growth */
937- /*
938- * Journaling support valid if EXT2_FEATURE_COMPAT_HAS_JOURNAL set.
939- */
940- __u8 s_journal_uuid[16]; /* uuid of journal superblock */
941- __u32 s_journal_inum; /* inode number of journal file */
942- __u32 s_journal_dev; /* device number of journal file */
943- __u32 s_last_orphan; /* start of list of inodes to delete */
944- __u32 s_hash_seed[4]; /* HTREE hash seed */
945- __u8 s_def_hash_version; /* Default hash version to use */
946- __u8 s_jnl_backup_type; /* Default type of journal backup */
947- __u16 s_desc_size; /* Group desc. size: INCOMPAT_64BIT */
948- __u32 s_default_mount_opts;
949- __u32 s_first_meta_bg; /* First metablock group */
950- __u32 s_mkfs_time; /* When the filesystem was created */
951- __u32 s_jnl_blocks[17]; /* Backup of the journal inode */
952- __u32 s_blocks_count_hi; /* Blocks count high 32bits */
953- __u32 s_r_blocks_count_hi; /* Reserved blocks count high 32 bits*/
954- __u32 s_free_blocks_hi; /* Free blocks count */
955- __u16 s_min_extra_isize; /* All inodes have at least # bytes */
956- __u16 s_want_extra_isize; /* New inodes should reserve # bytes */
957- __u32 s_flags; /* Miscellaneous flags */
958- __u16 s_raid_stride; /* RAID stride */
959- __u16 s_mmp_update_interval; /* # seconds to wait in MMP checking */
960- __u64 s_mmp_block; /* Block for multi-mount protection */
961- __u32 s_raid_stripe_width; /* blocks on all data disks (N*stride)*/
962- __u8 s_log_groups_per_flex; /* FLEX_BG group size */
963- __u8 s_reserved_char_pad;
964- __u16 s_reserved_pad; /* Padding to next 32bits */
965- __u64 s_kbytes_written; /* nr of lifetime kilobytes written */
966- __u32 s_snapshot_inum; /* Inode number of active snapshot */
967- __u32 s_snapshot_id; /* sequential ID of active snapshot */
968- __u64 s_snapshot_r_blocks_count; /* reserved blocks for active
969- snapshot's future use */
970- __u32 s_snapshot_list; /* inode number of the head of the on-disk snapshot list */
971-#define EXT4_S_ERR_START ext4_offsetof(struct ext2_super_block, s_error_count)
972- __u32 s_error_count; /* number of fs errors */
973- __u32 s_first_error_time; /* first time an error happened */
974- __u32 s_first_error_ino; /* inode involved in first error */
975- __u64 s_first_error_block; /* block involved of first error */
976- __u8 s_first_error_func[32]; /* function where the error happened */
977- __u32 s_first_error_line; /* line number where error happened */
978- __u32 s_last_error_time; /* most recent time of an error */
979- __u32 s_last_error_ino; /* inode involved in last error */
980- __u32 s_last_error_line; /* line number where error happened */
981- __u64 s_last_error_block; /* block involved of last error */
982- __u8 s_last_error_func[32]; /* function where the error happened */
983-#define EXT4_S_ERR_END ext4_offsetof(struct ext2_super_block, s_mount_opts)
984- __u8 s_mount_opts[64];
985- __u32 s_usr_quota_inum; /* inode number of user quota file */
986- __u32 s_grp_quota_inum; /* inode number of group quota file */
987- __u32 s_overhead_blocks; /* overhead blocks/clusters in fs */
988- __u32 s_reserved[108]; /* Padding to the end of the block */
989- __u32 s_checksum; /* crc32c(superblock) */
990-};
991-
992-#define EXT4_S_ERR_LEN (EXT4_S_ERR_END - EXT4_S_ERR_START)
993-
994-/*
995- * Codes for operating systems
996- */
997-#define EXT2_OS_LINUX 0
998-#define EXT2_OS_HURD 1
999-#define EXT2_OBSO_OS_MASIX 2
1000-#define EXT2_OS_FREEBSD 3
1001-#define EXT2_OS_LITES 4
1002-
1003-/*
1004- * Revision levels
1005- */
1006-#define EXT2_GOOD_OLD_REV 0 /* The good old (original) format */
1007-#define EXT2_DYNAMIC_REV 1 /* V2 format w/ dynamic inode sizes */
1008-
1009-#define EXT2_CURRENT_REV EXT2_GOOD_OLD_REV
1010-#define EXT2_MAX_SUPP_REV EXT2_DYNAMIC_REV
1011-
1012-#define EXT2_GOOD_OLD_INODE_SIZE 128
1013-
1014-/*
1015- * Journal inode backup types
1016- */
1017-#define EXT3_JNL_BACKUP_BLOCKS 1
1018-
1019-/*
1020- * Feature set definitions
1021- */
1022-
1023-#define EXT2_HAS_COMPAT_FEATURE(sb,mask) \
1024- ( EXT2_SB(sb)->s_feature_compat & (mask) )
1025-#define EXT2_HAS_RO_COMPAT_FEATURE(sb,mask) \
1026- ( EXT2_SB(sb)->s_feature_ro_compat & (mask) )
1027-#define EXT2_HAS_INCOMPAT_FEATURE(sb,mask) \
1028- ( EXT2_SB(sb)->s_feature_incompat & (mask) )
1029-
1030-#define EXT2_FEATURE_COMPAT_DIR_PREALLOC 0x0001
1031-#define EXT2_FEATURE_COMPAT_IMAGIC_INODES 0x0002
1032-#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004
1033-#define EXT2_FEATURE_COMPAT_EXT_ATTR 0x0008
1034-#define EXT2_FEATURE_COMPAT_RESIZE_INODE 0x0010
1035-#define EXT2_FEATURE_COMPAT_DIR_INDEX 0x0020
1036-#define EXT2_FEATURE_COMPAT_LAZY_BG 0x0040
1037-/* #define EXT2_FEATURE_COMPAT_EXCLUDE_INODE 0x0080 not used, legacy */
1038-#define EXT2_FEATURE_COMPAT_EXCLUDE_BITMAP 0x0100
1039-
1040-
1041-#define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001
1042-#define EXT2_FEATURE_RO_COMPAT_LARGE_FILE 0x0002
1043-/* #define EXT2_FEATURE_RO_COMPAT_BTREE_DIR 0x0004 not used */
1044-#define EXT4_FEATURE_RO_COMPAT_HUGE_FILE 0x0008
1045-#define EXT4_FEATURE_RO_COMPAT_GDT_CSUM 0x0010
1046-#define EXT4_FEATURE_RO_COMPAT_DIR_NLINK 0x0020
1047-#define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040
1048-#define EXT4_FEATURE_RO_COMPAT_HAS_SNAPSHOT 0x0080
1049-#define EXT4_FEATURE_RO_COMPAT_QUOTA 0x0100
1050-#define EXT4_FEATURE_RO_COMPAT_BIGALLOC 0x0200
1051-#define EXT4_FEATURE_RO_COMPAT_METADATA_CSUM 0x0400
1052-#define EXT4_FEATURE_RO_COMPAT_REPLICA 0x0800
1053-
1054-#define EXT2_FEATURE_INCOMPAT_COMPRESSION 0x0001
1055-#define EXT2_FEATURE_INCOMPAT_FILETYPE 0x0002
1056-#define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004 /* Needs recovery */
1057-#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008 /* Journal device */
1058-#define EXT2_FEATURE_INCOMPAT_META_BG 0x0010
1059-#define EXT3_FEATURE_INCOMPAT_EXTENTS 0x0040
1060-#define EXT4_FEATURE_INCOMPAT_64BIT 0x0080
1061-#define EXT4_FEATURE_INCOMPAT_MMP 0x0100
1062-#define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200
1063-#define EXT4_FEATURE_INCOMPAT_EA_INODE 0x0400
1064-#define EXT4_FEATURE_INCOMPAT_DIRDATA 0x1000
1065-
1066-#define EXT2_FEATURE_COMPAT_SUPP 0
1067-#define EXT2_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE| \
1068- EXT4_FEATURE_INCOMPAT_MMP)
1069-#define EXT2_FEATURE_RO_COMPAT_SUPP (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER| \
1070- EXT2_FEATURE_RO_COMPAT_LARGE_FILE| \
1071- EXT4_FEATURE_RO_COMPAT_DIR_NLINK| \
1072- EXT2_FEATURE_RO_COMPAT_BTREE_DIR)
1073-
1074-/*
1075- * Default values for user and/or group using reserved blocks
1076- */
1077-#define EXT2_DEF_RESUID 0
1078-#define EXT2_DEF_RESGID 0
1079-
1080-/*
1081- * Default mount options
1082- */
1083-#define EXT2_DEFM_DEBUG 0x0001
1084-#define EXT2_DEFM_BSDGROUPS 0x0002
1085-#define EXT2_DEFM_XATTR_USER 0x0004
1086-#define EXT2_DEFM_ACL 0x0008
1087-#define EXT2_DEFM_UID16 0x0010
1088-#define EXT3_DEFM_JMODE 0x0060
1089-#define EXT3_DEFM_JMODE_DATA 0x0020
1090-#define EXT3_DEFM_JMODE_ORDERED 0x0040
1091-#define EXT3_DEFM_JMODE_WBACK 0x0060
1092-#define EXT4_DEFM_NOBARRIER 0x0100
1093-#define EXT4_DEFM_BLOCK_VALIDITY 0x0200
1094-#define EXT4_DEFM_DISCARD 0x0400
1095-#define EXT4_DEFM_NODELALLOC 0x0800
1096-
1097-/*
1098- * Structure of a directory entry
1099- */
1100-#define EXT2_NAME_LEN 255
1101-
1102-struct ext2_dir_entry {
1103- __u32 inode; /* Inode number */
1104- __u16 rec_len; /* Directory entry length */
1105- __u16 name_len; /* Name length */
1106- char name[EXT2_NAME_LEN]; /* File name */
1107-};
1108-
1109-/*
1110- * The new version of the directory entry. Since EXT2 structures are
1111- * stored in intel byte order, and the name_len field could never be
1112- * bigger than 255 chars, it's safe to reclaim the extra byte for the
1113- * file_type field.
1114- */
1115-struct ext2_dir_entry_2 {
1116- __u32 inode; /* Inode number */
1117- __u16 rec_len; /* Directory entry length */
1118- __u8 name_len; /* Name length */
1119- __u8 file_type;
1120- char name[EXT2_NAME_LEN]; /* File name */
1121-};
1122-
1123-/*
1124- * Ext2 directory file types. Only the low 3 bits are used. The
1125- * other bits are reserved for now.
1126- */
1127-#define EXT2_FT_UNKNOWN 0
1128-#define EXT2_FT_REG_FILE 1
1129-#define EXT2_FT_DIR 2
1130-#define EXT2_FT_CHRDEV 3
1131-#define EXT2_FT_BLKDEV 4
1132-#define EXT2_FT_FIFO 5
1133-#define EXT2_FT_SOCK 6
1134-#define EXT2_FT_SYMLINK 7
1135-
1136-#define EXT2_FT_MAX 8
1137-
1138-/*
1139- * EXT2_DIR_PAD defines the directory entries boundaries
1140- *
1141- * NOTE: It must be a multiple of 4
1142- */
1143-#define EXT2_DIR_PAD 4
1144-#define EXT2_DIR_ROUND (EXT2_DIR_PAD - 1)
1145-#define EXT2_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT2_DIR_ROUND) & \
1146- ~EXT2_DIR_ROUND)
1147-
1148-/*
1149- * This structure is used for multiple mount protection. It is written
1150- * into the block number saved in the s_mmp_block field in the superblock.
1151- * Programs that check MMP should assume that if SEQ_FSCK (or any unknown
1152- * code above SEQ_MAX) is present then it is NOT safe to use the filesystem,
1153- * regardless of how old the timestamp is.
1154- *
1155- * The timestamp in the MMP structure will be updated by e2fsck at some
1156- * arbitary intervals (start of passes, after every few groups of inodes
1157- * in pass1 and pass1b). There is no guarantee that e2fsck is updating
1158- * the MMP block in a timely manner, and the updates it does are purely
1159- * for the convenience of the sysadmin and not for automatic validation.
1160- *
1161- * Note: Only the mmp_seq value is used to determine whether the MMP block
1162- * is being updated. The mmp_time, mmp_nodename, and mmp_bdevname
1163- * fields are only for informational purposes for the administrator,
1164- * due to clock skew between nodes and hostname HA service takeover.
1165- */
1166-#define EXT4_MMP_MAGIC 0x004D4D50U /* ASCII for MMP */
1167-#define EXT4_MMP_SEQ_CLEAN 0xFF4D4D50U /* mmp_seq value for clean unmount */
1168-#define EXT4_MMP_SEQ_FSCK 0xE24D4D50U /* mmp_seq value when being fscked */
1169-#define EXT4_MMP_SEQ_MAX 0xE24D4D4FU /* maximum valid mmp_seq value */
1170-
1171-struct mmp_struct {
1172- __u32 mmp_magic; /* Magic number for MMP */
1173- __u32 mmp_seq; /* Sequence no. updated periodically */
1174- __u64 mmp_time; /* Time last updated */
1175- char mmp_nodename[64]; /* Node which last updated MMP block */
1176- char mmp_bdevname[32]; /* Bdev which last updated MMP block */
1177- __u16 mmp_check_interval; /* Changed mmp_check_interval */
1178- __u16 mmp_pad1;
1179- __u32 mmp_pad2[227];
1180-};
1181-
1182-/*
1183- * Default interval for MMP update in seconds.
1184- */
1185-#define EXT4_MMP_UPDATE_INTERVAL 5
1186-
1187-/*
1188- * Maximum interval for MMP update in seconds.
1189- */
1190-#define EXT4_MMP_MAX_UPDATE_INTERVAL 300
1191-
1192-/*
1193- * Minimum interval for MMP checking in seconds.
1194- */
1195-#define EXT4_MMP_MIN_CHECK_INTERVAL 5
1196-
1197-#endif /* _EXT2FS_EXT2_FS_H */
diff --git a/meta/recipes-devtools/syslinux/syslinux_6.04-pre2.bb b/meta/recipes-devtools/syslinux/syslinux_6.04-pre2.bb
index c8e7f25d2b..449a75ebf8 100644
--- a/meta/recipes-devtools/syslinux/syslinux_6.04-pre2.bb
+++ b/meta/recipes-devtools/syslinux/syslinux_6.04-pre2.bb
@@ -22,9 +22,10 @@ SRC_URI = "https://www.zytor.com/pub/syslinux/Testing/6.04/syslinux-${PV}.tar.xz
22 file://0012-libinstaller-Fix-build-with-glibc-2.36.patch \ 22 file://0012-libinstaller-Fix-build-with-glibc-2.36.patch \
23 file://0013-remove-clean-script.patch \ 23 file://0013-remove-clean-script.patch \
24 file://0014-Fix-reproducibility-issues.patch \ 24 file://0014-Fix-reproducibility-issues.patch \
25" 25 file://0001-ext2_fs.h-do-not-carry-an-outdated-copy.patch \
26 file://0001-Add-extra-sector-count-from-section-entry-for-EFI-ca.patch \
27 "
26 28
27SRC_URI[md5sum] = "2b31c78f087f99179feb357da312d7ec"
28SRC_URI[sha256sum] = "4441a5d593f85bb6e8d578cf6653fb4ec30f9e8f4a2315a3d8f2d0a8b3fadf94" 29SRC_URI[sha256sum] = "4441a5d593f85bb6e8d578cf6653fb4ec30f9e8f4a2315a3d8f2d0a8b3fadf94"
29 30
30# remove at next version upgrade or when output changes 31# remove at next version upgrade or when output changes
@@ -48,7 +49,7 @@ TARGET_LDFLAGS = ""
48SECURITY_LDFLAGS = "" 49SECURITY_LDFLAGS = ""
49LDFLAGS_SECTION_REMOVAL = "" 50LDFLAGS_SECTION_REMOVAL = ""
50 51
51CFLAGS:append = " -DNO_INLINE_FUNCS -Wno-error=implicit-function-declaration" 52CFLAGS += "-DNO_INLINE_FUNCS -Wno-error=implicit-function-declaration -idirafter ${STAGING_INCDIR}"
52 53
53EXTRA_OEMAKE = " \ 54EXTRA_OEMAKE = " \
54 BINDIR=${bindir} SBINDIR=${sbindir} LIBDIR=${libdir} \ 55 BINDIR=${bindir} SBINDIR=${sbindir} LIBDIR=${libdir} \
@@ -129,3 +130,8 @@ FILES:${PN}-staticdev += "${datadir}/${BPN}/com32/lib*.a ${libdir}/${BPN}/com32/
129FILES:${PN}-misc = "${datadir}/${BPN}/* ${libdir}/${BPN}/* ${bindir}/*" 130FILES:${PN}-misc = "${datadir}/${BPN}/* ${libdir}/${BPN}/* ${bindir}/*"
130 131
131BBCLASSEXTEND = "native nativesdk" 132BBCLASSEXTEND = "native nativesdk"
133
134# com32/lib/../include/stdarg.h:9:15: fatal error: 'stdarg.h' file not found
135# 9 | #include_next <stdarg.h>
136# | ^~~~~~~~~~
137TOOLCHAIN = "gcc"