commit 80592f5

Michael Forney  ·  2026-05-05 23:32:52 +0000 UTC
parent 55ab240
e2fsprogs: Fix a few issues with cproc
4 files changed,  +208, -2
+1, -1
1@@ -1,6 +1,6 @@
2 set('version', '1.46.4')
3 cflags{
4-	'-std=c99', '-Wall',
5+	'-Wall',
6 	'-Wno-address-of-packed-member', '-Wno-format-truncation',
7 	'-Wno-unused-variable', '-Wno-stringop-truncation',
8 	'-Wno-stringop-overflow', '-Wno-unused-label',
+132, -0
  1@@ -0,0 +1,132 @@
  2+From 24e33084b41cce0a56be3eba45e5b42580769066 Mon Sep 17 00:00:00 2001
  3+From: Michael Forney <mforney@mforney.org>
  4+Date: Tue, 5 May 2026 16:22:54 -0700
  5+Subject: [PATCH] Use C23-compatible struct attribute location
  6+
  7+---
  8+ lib/ext2fs/ext2_fs.h       |  8 ++++----
  9+ lib/ext2fs/rbtree.h        |  6 +++---
 10+ lib/support/quotaio_tree.h |  4 ++--
 11+ lib/support/quotaio_v2.h   | 12 ++++++------
 12+ 4 files changed, 15 insertions(+), 15 deletions(-)
 13+
 14+diff --git a/lib/ext2fs/ext2_fs.h b/lib/ext2fs/ext2_fs.h
 15+index 01d2573b..755cf956 100644
 16+--- a/lib/ext2fs/ext2_fs.h
 17++++ b/lib/ext2fs/ext2_fs.h
 18+@@ -633,19 +633,19 @@ struct ext2_inode *EXT2_INODE(struct ext2_inode_large *large_inode)
 19+  * Policy provided via an ioctl on the topmost directory. This
 20+  * structure is also in the kernel.
 21+  */
 22+-struct ext4_encryption_policy {
 23++struct __attribute__((__packed__)) ext4_encryption_policy {
 24+   char version;
 25+   char contents_encryption_mode;
 26+   char filenames_encryption_mode;
 27+   char flags;
 28+   char master_key_descriptor[EXT4_KEY_DESCRIPTOR_SIZE];
 29+-} __attribute__((__packed__));
 30++};
 31+ 
 32+-struct ext4_encryption_key {
 33++struct __attribute__((__packed__)) ext4_encryption_key {
 34+         __u32 mode;
 35+         char raw[EXT4_MAX_KEY_SIZE];
 36+         __u32 size;
 37+-} __attribute__((__packed__));
 38++};
 39+ 
 40+ /*
 41+  * Structure of the super block
 42+diff --git a/lib/ext2fs/rbtree.h b/lib/ext2fs/rbtree.h
 43+index f718ad24..d9116d91 100644
 44+--- a/lib/ext2fs/rbtree.h
 45++++ b/lib/ext2fs/rbtree.h
 46+@@ -98,15 +98,15 @@ static inline struct page * rb_insert_page_cache(struct inode * inode,
 47+ #include <stdint.h>
 48+ #include "compiler.h"
 49+ 
 50+-struct rb_node
 51++/* The alignment might seem pointless, but allegedly CRIS needs it */
 52++struct __attribute__((aligned(sizeof(long)))) rb_node
 53+ {
 54+ 	uintptr_t  rb_parent_color;
 55+ #define	RB_RED		0
 56+ #define	RB_BLACK	1
 57+ 	struct rb_node *rb_right;
 58+ 	struct rb_node *rb_left;
 59+-} __attribute__((aligned(sizeof(long))));
 60+-    /* The alignment might seem pointless, but allegedly CRIS needs it */
 61++};
 62+ 
 63+ struct rb_root
 64+ {
 65+diff --git a/lib/support/quotaio_tree.h b/lib/support/quotaio_tree.h
 66+index b0b7257f..6499ae92 100644
 67+--- a/lib/support/quotaio_tree.h
 68++++ b/lib/support/quotaio_tree.h
 69+@@ -19,7 +19,7 @@ typedef __u32 qid_t;        /* Type in which we store ids in memory */
 70+  *  Structure of header of block with quota structures. It is padded to 16 bytes
 71+  *  so there will be space for exactly 21 quota-entries in a block
 72+  */
 73+-struct qt_disk_dqdbheader {
 74++struct __attribute__((packed)) qt_disk_dqdbheader {
 75+ 	__le32 dqdh_next_free;	/* Number of next block with free
 76+ 					 * entry */
 77+ 	__le32 dqdh_prev_free; /* Number of previous block with free
 78+@@ -27,7 +27,7 @@ struct qt_disk_dqdbheader {
 79+ 	__le16 dqdh_entries; /* Number of valid entries in block */
 80+ 	__le16 dqdh_pad1;
 81+ 	__le32 dqdh_pad2;
 82+-} __attribute__ ((packed));
 83++};
 84+ 
 85+ struct dquot;
 86+ struct quota_handle;
 87+diff --git a/lib/support/quotaio_v2.h b/lib/support/quotaio_v2.h
 88+index de2db278..36237363 100644
 89+--- a/lib/support/quotaio_v2.h
 90++++ b/lib/support/quotaio_v2.h
 91+@@ -15,16 +15,16 @@
 92+ /* Supported version of quota-tree format */
 93+ #define V2_VERSION 1
 94+ 
 95+-struct v2_disk_dqheader {
 96++struct __attribute__ ((packed)) v2_disk_dqheader {
 97+ 	__le32 dqh_magic;	/* Magic number identifying file */
 98+ 	__le32 dqh_version;	/* File version */
 99+-} __attribute__ ((packed));
100++};
101+ 
102+ /* Flags for version specific files */
103+ #define V2_DQF_MASK  0x0000	/* Mask for all valid ondisk flags */
104+ 
105+ /* Header with type and version specific information */
106+-struct v2_disk_dqinfo {
107++struct __attribute__ ((packed)) v2_disk_dqinfo {
108+ 	__le32 dqi_bgrace;	/* Time before block soft limit becomes
109+ 				 * hard limit */
110+ 	__le32 dqi_igrace;	/* Time before inode soft limit becomes
111+@@ -34,9 +34,9 @@ struct v2_disk_dqinfo {
112+ 	__le32 dqi_free_blk;	/* Number of first free block in the list */
113+ 	__le32 dqi_free_entry;	/* Number of block with at least one
114+ 					 * free entry */
115+-} __attribute__ ((packed));
116++};
117+ 
118+-struct v2r1_disk_dqblk {
119++struct __attribute__ ((packed)) v2r1_disk_dqblk {
120+ 	__le32 dqb_id;	/* id this quota applies to */
121+ 	__le32 dqb_pad;
122+ 	__le64 dqb_ihardlimit;	/* absolute limit on allocated inodes */
123+@@ -49,6 +49,6 @@ struct v2r1_disk_dqblk {
124+ 	__le64 dqb_curspace;	/* current space occupied (in bytes) */
125+ 	__le64 dqb_btime;	/* time limit for excessive disk use */
126+ 	__le64 dqb_itime;	/* time limit for excessive inode use */
127+-} __attribute__ ((packed));
128++};
129+ 
130+ #endif
131+-- 
132+2.49.0
133+
+74, -0
 1@@ -0,0 +1,74 @@
 2+From f1314a4699e2e7bad5504ea860cdc5a0fe81225f Mon Sep 17 00:00:00 2001
 3+From: Michael Forney <mforney@mforney.org>
 4+Date: Tue, 5 May 2026 16:31:39 -0700
 5+Subject: [PATCH] Use C11 alignas instead of alignment attribute
 6+
 7+---
 8+ lib/ext2fs/rbtree.h | 6 ++++--
 9+ misc/tune2fs.c      | 7 ++++---
10+ 2 files changed, 8 insertions(+), 5 deletions(-)
11+
12+diff --git a/lib/ext2fs/rbtree.h b/lib/ext2fs/rbtree.h
13+index d9116d91..2809626f 100644
14+--- a/lib/ext2fs/rbtree.h
15++++ b/lib/ext2fs/rbtree.h
16+@@ -94,13 +94,15 @@ static inline struct page * rb_insert_page_cache(struct inode * inode,
17+ #ifndef	_LINUX_RBTREE_H
18+ #define	_LINUX_RBTREE_H
19+ 
20++#include <stdalign.h>
21+ #include <stdlib.h>
22+ #include <stdint.h>
23+ #include "compiler.h"
24+ 
25+-/* The alignment might seem pointless, but allegedly CRIS needs it */
26+-struct __attribute__((aligned(sizeof(long)))) rb_node
27++struct rb_node
28+ {
29++	/* The alignment might seem pointless, but allegedly CRIS needs it */
30++	alignas(long)
31+ 	uintptr_t  rb_parent_color;
32+ #define	RB_RED		0
33+ #define	RB_BLACK	1
34+diff --git a/misc/tune2fs.c b/misc/tune2fs.c
35+index 4200104e..ace381b7 100644
36+--- a/misc/tune2fs.c
37++++ b/misc/tune2fs.c
38+@@ -36,6 +36,7 @@ extern char *optarg;
39+ extern int optind;
40+ #endif
41+ #include <pwd.h>
42++#include <stdalign.h>
43+ #include <stdio.h>
44+ #ifdef HAVE_STDLIB_H
45+ #include <stdlib.h>
46+@@ -251,7 +252,7 @@ static int remove_journal_device(ext2_filsys fs)
47+ {
48+ 	char		*journal_path;
49+ 	ext2_filsys	jfs;
50+-	char		buf[SUPERBLOCK_SIZE] __attribute__ ((aligned(8)));
51++	alignas(8) char	buf[SUPERBLOCK_SIZE];
52+ 	journal_superblock_t	*jsb;
53+ 	int		i, nr_users;
54+ 	errcode_t	retval;
55+@@ -2868,7 +2869,7 @@ fs_update_journal_user(struct ext2_super_block *sb, __u8 old_uuid[UUID_SIZE])
56+ 	__u8 *j_uuid;
57+ 	char *journal_path;
58+ 	char uuid[UUID_STR_SIZE];
59+-	char buf[SUPERBLOCK_SIZE] __attribute__ ((aligned(8)));
60++	alignas(8) char buf[SUPERBLOCK_SIZE];
61+ 
62+ 	if (!ext2fs_has_feature_journal(sb) || uuid_is_null(sb->s_journal_uuid))
63+ 		return 0;
64+@@ -3269,7 +3270,7 @@ _("Warning: The journal is dirty. You may wish to replay the journal like:\n\n"
65+ 	if (U_flag) {
66+ 		int set_csum = 0;
67+ 		dgrp_t i;
68+-		char buf[SUPERBLOCK_SIZE] __attribute__ ((aligned(8)));
69++		alignas(8) char buf[SUPERBLOCK_SIZE];
70+ 		__u8 old_uuid[UUID_SIZE];
71+ 
72+ 		if (ext2fs_has_feature_stable_inodes(fs->super)) {
73+-- 
74+2.49.0
75+
+1, -1
1@@ -1 +1 @@
2-1.46.4 r2
3+1.46.4 r3