aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2017-08-16 11:53:48 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2017-08-16 11:53:48 +0200
commitdce39c98944ec6570dee5afc1e2edb16f87c1546 (patch)
tree6647e2765c24c37ed1612bbf837a785260b96a3f
parentc4367d72272f72f647d7847129164901f3d47955 (diff)
downloadbusybox-w32-dce39c98944ec6570dee5afc1e2edb16f87c1546.tar.gz
busybox-w32-dce39c98944ec6570dee5afc1e2edb16f87c1546.tar.bz2
busybox-w32-dce39c98944ec6570dee5afc1e2edb16f87c1546.zip
fsck_minix,mkfs_minix: fix "strict-aliasing" warnings
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--util-linux/fsck_minix.c9
-rw-r--r--util-linux/mkfs_minix.c11
2 files changed, 13 insertions, 7 deletions
diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c
index 608048983..c4612f251 100644
--- a/util-linux/fsck_minix.c
+++ b/util-linux/fsck_minix.c
@@ -173,7 +173,10 @@ struct globals {
173 173
174 /* Bigger stuff */ 174 /* Bigger stuff */
175 struct termios sv_termios; 175 struct termios sv_termios;
176 char superblock_buffer[BLOCK_SIZE]; 176 union {
177 char superblock_buffer[BLOCK_SIZE];
178 struct minix_superblock Super;
179 } u;
177 char add_zone_ind_blk[BLOCK_SIZE]; 180 char add_zone_ind_blk[BLOCK_SIZE];
178 char add_zone_dind_blk[BLOCK_SIZE]; 181 char add_zone_dind_blk[BLOCK_SIZE];
179 IF_FEATURE_MINIX2(char add_zone_tind_blk[BLOCK_SIZE];) 182 IF_FEATURE_MINIX2(char add_zone_tind_blk[BLOCK_SIZE];)
@@ -207,7 +210,7 @@ struct globals {
207#define name_depth (G.name_depth ) 210#define name_depth (G.name_depth )
208#define name_component (G.name_component ) 211#define name_component (G.name_component )
209#define sv_termios (G.sv_termios ) 212#define sv_termios (G.sv_termios )
210#define superblock_buffer (G.superblock_buffer ) 213#define superblock_buffer (G.u.superblock_buffer)
211#define add_zone_ind_blk (G.add_zone_ind_blk ) 214#define add_zone_ind_blk (G.add_zone_ind_blk )
212#define add_zone_dind_blk (G.add_zone_dind_blk ) 215#define add_zone_dind_blk (G.add_zone_dind_blk )
213#define add_zone_tind_blk (G.add_zone_tind_blk ) 216#define add_zone_tind_blk (G.add_zone_tind_blk )
@@ -247,7 +250,7 @@ enum {
247#define Inode1 (((struct minix1_inode *) inode_buffer)-1) 250#define Inode1 (((struct minix1_inode *) inode_buffer)-1)
248#define Inode2 (((struct minix2_inode *) inode_buffer)-1) 251#define Inode2 (((struct minix2_inode *) inode_buffer)-1)
249 252
250#define Super (*(struct minix_superblock *)(superblock_buffer)) 253#define Super (G.u.Super)
251 254
252#if ENABLE_FEATURE_MINIX2 255#if ENABLE_FEATURE_MINIX2
253# define ZONES ((unsigned)(version2 ? Super.s_zones : Super.s_nzones)) 256# define ZONES ((unsigned)(version2 ? Super.s_zones : Super.s_nzones))
diff --git a/util-linux/mkfs_minix.c b/util-linux/mkfs_minix.c
index 88647e9d8..69dfcd123 100644
--- a/util-linux/mkfs_minix.c
+++ b/util-linux/mkfs_minix.c
@@ -142,7 +142,10 @@ struct globals {
142 unsigned currently_testing; 142 unsigned currently_testing;
143 143
144 char root_block[BLOCK_SIZE]; 144 char root_block[BLOCK_SIZE];
145 char superblock_buffer[BLOCK_SIZE]; 145 union {
146 char superblock_buffer[BLOCK_SIZE];
147 struct minix_superblock SB;
148 } u;
146 char boot_block_buffer[512]; 149 char boot_block_buffer[512];
147 unsigned short good_blocks_table[MAX_GOOD_BLOCKS]; 150 unsigned short good_blocks_table[MAX_GOOD_BLOCKS];
148 /* check_blocks(): buffer[] was the biggest static in entire bbox */ 151 /* check_blocks(): buffer[] was the biggest static in entire bbox */
@@ -166,7 +169,7 @@ static ALWAYS_INLINE unsigned div_roundup(unsigned size, unsigned n)
166#define INODE_BUF1 (((struct minix1_inode*)G.inode_buffer) - 1) 169#define INODE_BUF1 (((struct minix1_inode*)G.inode_buffer) - 1)
167#define INODE_BUF2 (((struct minix2_inode*)G.inode_buffer) - 1) 170#define INODE_BUF2 (((struct minix2_inode*)G.inode_buffer) - 1)
168 171
169#define SB (*(struct minix_superblock*)G.superblock_buffer) 172#define SB (G.u.SB)
170 173
171#define SB_INODES (SB.s_ninodes) 174#define SB_INODES (SB.s_ninodes)
172#define SB_IMAPS (SB.s_imap_blocks) 175#define SB_IMAPS (SB.s_imap_blocks)
@@ -234,7 +237,7 @@ static void write_tables(void)
234 xlseek(dev_fd, BLOCK_SIZE, SEEK_SET); 237 xlseek(dev_fd, BLOCK_SIZE, SEEK_SET);
235 238
236 msg_eol = "can't write superblock"; 239 msg_eol = "can't write superblock";
237 xwrite(dev_fd, G.superblock_buffer, BLOCK_SIZE); 240 xwrite(dev_fd, G.u.superblock_buffer, BLOCK_SIZE);
238 241
239 msg_eol = "can't write inode map"; 242 msg_eol = "can't write inode map";
240 xwrite(dev_fd, G.inode_map, SB_IMAPS * BLOCK_SIZE); 243 xwrite(dev_fd, G.inode_map, SB_IMAPS * BLOCK_SIZE);
@@ -541,7 +544,7 @@ static void setup_tables(void)
541 unsigned sb_zmaps; 544 unsigned sb_zmaps;
542 unsigned i; 545 unsigned i;
543 546
544 /* memset(G.superblock_buffer, 0, BLOCK_SIZE); */ 547 /* memset(G.u.superblock_buffer, 0, BLOCK_SIZE); */
545 /* memset(G.boot_block_buffer, 0, 512); */ 548 /* memset(G.boot_block_buffer, 0, 512); */
546 SB_MAGIC = G.magic; 549 SB_MAGIC = G.magic;
547 SB_ZONE_SIZE = 0; 550 SB_ZONE_SIZE = 0;