master hovercats/oakiss / pkg / e2fsprogs / patch / 0003-Use-C23-compatible-struct-attribute-location.patch
  1From 24e33084b41cce0a56be3eba45e5b42580769066 Mon Sep 17 00:00:00 2001
  2From: Michael Forney <mforney@mforney.org>
  3Date: Tue, 5 May 2026 16:22:54 -0700
  4Subject: [PATCH] Use C23-compatible struct attribute location
  5
  6---
  7 lib/ext2fs/ext2_fs.h       |  8 ++++----
  8 lib/ext2fs/rbtree.h        |  6 +++---
  9 lib/support/quotaio_tree.h |  4 ++--
 10 lib/support/quotaio_v2.h   | 12 ++++++------
 11 4 files changed, 15 insertions(+), 15 deletions(-)
 12
 13diff --git a/lib/ext2fs/ext2_fs.h b/lib/ext2fs/ext2_fs.h
 14index 01d2573b..755cf956 100644
 15--- a/lib/ext2fs/ext2_fs.h
 16+++ b/lib/ext2fs/ext2_fs.h
 17@@ -633,19 +633,19 @@ struct ext2_inode *EXT2_INODE(struct ext2_inode_large *large_inode)
 18  * Policy provided via an ioctl on the topmost directory. This
 19  * structure is also in the kernel.
 20  */
 21-struct ext4_encryption_policy {
 22+struct __attribute__((__packed__)) ext4_encryption_policy {
 23   char version;
 24   char contents_encryption_mode;
 25   char filenames_encryption_mode;
 26   char flags;
 27   char master_key_descriptor[EXT4_KEY_DESCRIPTOR_SIZE];
 28-} __attribute__((__packed__));
 29+};
 30 
 31-struct ext4_encryption_key {
 32+struct __attribute__((__packed__)) ext4_encryption_key {
 33         __u32 mode;
 34         char raw[EXT4_MAX_KEY_SIZE];
 35         __u32 size;
 36-} __attribute__((__packed__));
 37+};
 38 
 39 /*
 40  * Structure of the super block
 41diff --git a/lib/ext2fs/rbtree.h b/lib/ext2fs/rbtree.h
 42index f718ad24..d9116d91 100644
 43--- a/lib/ext2fs/rbtree.h
 44+++ b/lib/ext2fs/rbtree.h
 45@@ -98,15 +98,15 @@ static inline struct page * rb_insert_page_cache(struct inode * inode,
 46 #include <stdint.h>
 47 #include "compiler.h"
 48 
 49-struct rb_node
 50+/* The alignment might seem pointless, but allegedly CRIS needs it */
 51+struct __attribute__((aligned(sizeof(long)))) rb_node
 52 {
 53 	uintptr_t  rb_parent_color;
 54 #define	RB_RED		0
 55 #define	RB_BLACK	1
 56 	struct rb_node *rb_right;
 57 	struct rb_node *rb_left;
 58-} __attribute__((aligned(sizeof(long))));
 59-    /* The alignment might seem pointless, but allegedly CRIS needs it */
 60+};
 61 
 62 struct rb_root
 63 {
 64diff --git a/lib/support/quotaio_tree.h b/lib/support/quotaio_tree.h
 65index b0b7257f..6499ae92 100644
 66--- a/lib/support/quotaio_tree.h
 67+++ b/lib/support/quotaio_tree.h
 68@@ -19,7 +19,7 @@ typedef __u32 qid_t;        /* Type in which we store ids in memory */
 69  *  Structure of header of block with quota structures. It is padded to 16 bytes
 70  *  so there will be space for exactly 21 quota-entries in a block
 71  */
 72-struct qt_disk_dqdbheader {
 73+struct __attribute__((packed)) qt_disk_dqdbheader {
 74 	__le32 dqdh_next_free;	/* Number of next block with free
 75 					 * entry */
 76 	__le32 dqdh_prev_free; /* Number of previous block with free
 77@@ -27,7 +27,7 @@ struct qt_disk_dqdbheader {
 78 	__le16 dqdh_entries; /* Number of valid entries in block */
 79 	__le16 dqdh_pad1;
 80 	__le32 dqdh_pad2;
 81-} __attribute__ ((packed));
 82+};
 83 
 84 struct dquot;
 85 struct quota_handle;
 86diff --git a/lib/support/quotaio_v2.h b/lib/support/quotaio_v2.h
 87index de2db278..36237363 100644
 88--- a/lib/support/quotaio_v2.h
 89+++ b/lib/support/quotaio_v2.h
 90@@ -15,16 +15,16 @@
 91 /* Supported version of quota-tree format */
 92 #define V2_VERSION 1
 93 
 94-struct v2_disk_dqheader {
 95+struct __attribute__ ((packed)) v2_disk_dqheader {
 96 	__le32 dqh_magic;	/* Magic number identifying file */
 97 	__le32 dqh_version;	/* File version */
 98-} __attribute__ ((packed));
 99+};
100 
101 /* Flags for version specific files */
102 #define V2_DQF_MASK  0x0000	/* Mask for all valid ondisk flags */
103 
104 /* Header with type and version specific information */
105-struct v2_disk_dqinfo {
106+struct __attribute__ ((packed)) v2_disk_dqinfo {
107 	__le32 dqi_bgrace;	/* Time before block soft limit becomes
108 				 * hard limit */
109 	__le32 dqi_igrace;	/* Time before inode soft limit becomes
110@@ -34,9 +34,9 @@ struct v2_disk_dqinfo {
111 	__le32 dqi_free_blk;	/* Number of first free block in the list */
112 	__le32 dqi_free_entry;	/* Number of block with at least one
113 					 * free entry */
114-} __attribute__ ((packed));
115+};
116 
117-struct v2r1_disk_dqblk {
118+struct __attribute__ ((packed)) v2r1_disk_dqblk {
119 	__le32 dqb_id;	/* id this quota applies to */
120 	__le32 dqb_pad;
121 	__le64 dqb_ihardlimit;	/* absolute limit on allocated inodes */
122@@ -49,6 +49,6 @@ struct v2r1_disk_dqblk {
123 	__le64 dqb_curspace;	/* current space occupied (in bytes) */
124 	__le64 dqb_btime;	/* time limit for excessive disk use */
125 	__le64 dqb_itime;	/* time limit for excessive inode use */
126-} __attribute__ ((packed));
127+};
128 
129 #endif
130-- 
1312.49.0
132