diff options
-rw-r--r-- | fs/jffs2/super.c | 14 | ||||
-rw-r--r-- | include/linux/jffs2.h | 14 |
2 files changed, 20 insertions, 8 deletions
diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c index ffd8e84b22cc..5f73de586928 100644 --- a/fs/jffs2/super.c +++ b/fs/jffs2/super.c | |||
@@ -320,6 +320,18 @@ static int __init init_jffs2_fs(void) | |||
320 | { | 320 | { |
321 | int ret; | 321 | int ret; |
322 | 322 | ||
323 | /* Paranoia checks for on-medium structures. If we ask GCC | ||
324 | to pack them with __attribute__((packed)) then it _also_ | ||
325 | assumes that they're not aligned -- so it emits crappy | ||
326 | code on some architectures. Ideally we want an attribute | ||
327 | which means just 'no padding', without the alignment | ||
328 | thing. But GCC doesn't have that -- we have to just | ||
329 | hope the structs are the right sizes, instead. */ | ||
330 | BUG_ON(sizeof(struct jffs2_unknown_node) != 12); | ||
331 | BUG_ON(sizeof(struct jffs2_raw_dirent) != 40); | ||
332 | BUG_ON(sizeof(struct jffs2_raw_inode) != 68); | ||
333 | BUG_ON(sizeof(struct jffs2_raw_summary) != 32); | ||
334 | |||
323 | printk(KERN_INFO "JFFS2 version 2.2." | 335 | printk(KERN_INFO "JFFS2 version 2.2." |
324 | #ifdef CONFIG_JFFS2_FS_WRITEBUFFER | 336 | #ifdef CONFIG_JFFS2_FS_WRITEBUFFER |
325 | " (NAND)" | 337 | " (NAND)" |
@@ -327,7 +339,7 @@ static int __init init_jffs2_fs(void) | |||
327 | #ifdef CONFIG_JFFS2_SUMMARY | 339 | #ifdef CONFIG_JFFS2_SUMMARY |
328 | " (SUMMARY) " | 340 | " (SUMMARY) " |
329 | #endif | 341 | #endif |
330 | " (C) 2001-2003 Red Hat, Inc.\n"); | 342 | " (C) 2001-2006 Red Hat, Inc.\n"); |
331 | 343 | ||
332 | jffs2_inode_cachep = kmem_cache_create("jffs2_i", | 344 | jffs2_inode_cachep = kmem_cache_create("jffs2_i", |
333 | sizeof(struct jffs2_inode_info), | 345 | sizeof(struct jffs2_inode_info), |
diff --git a/include/linux/jffs2.h b/include/linux/jffs2.h index cf792bb3c726..228ad72f7dd8 100644 --- a/include/linux/jffs2.h +++ b/include/linux/jffs2.h | |||
@@ -82,15 +82,15 @@ | |||
82 | 82 | ||
83 | typedef struct { | 83 | typedef struct { |
84 | uint32_t v32; | 84 | uint32_t v32; |
85 | } __attribute__((packed)) jint32_t; | 85 | } jint32_t; |
86 | 86 | ||
87 | typedef struct { | 87 | typedef struct { |
88 | uint32_t m; | 88 | uint32_t m; |
89 | } __attribute__((packed)) jmode_t; | 89 | } jmode_t; |
90 | 90 | ||
91 | typedef struct { | 91 | typedef struct { |
92 | uint16_t v16; | 92 | uint16_t v16; |
93 | } __attribute__((packed)) jint16_t; | 93 | } jint16_t; |
94 | 94 | ||
95 | struct jffs2_unknown_node | 95 | struct jffs2_unknown_node |
96 | { | 96 | { |
@@ -99,7 +99,7 @@ struct jffs2_unknown_node | |||
99 | jint16_t nodetype; | 99 | jint16_t nodetype; |
100 | jint32_t totlen; /* So we can skip over nodes we don't grok */ | 100 | jint32_t totlen; /* So we can skip over nodes we don't grok */ |
101 | jint32_t hdr_crc; | 101 | jint32_t hdr_crc; |
102 | } __attribute__((packed)); | 102 | }; |
103 | 103 | ||
104 | struct jffs2_raw_dirent | 104 | struct jffs2_raw_dirent |
105 | { | 105 | { |
@@ -117,7 +117,7 @@ struct jffs2_raw_dirent | |||
117 | jint32_t node_crc; | 117 | jint32_t node_crc; |
118 | jint32_t name_crc; | 118 | jint32_t name_crc; |
119 | uint8_t name[0]; | 119 | uint8_t name[0]; |
120 | } __attribute__((packed)); | 120 | }; |
121 | 121 | ||
122 | /* The JFFS2 raw inode structure: Used for storage on physical media. */ | 122 | /* The JFFS2 raw inode structure: Used for storage on physical media. */ |
123 | /* The uid, gid, atime, mtime and ctime members could be longer, but | 123 | /* The uid, gid, atime, mtime and ctime members could be longer, but |
@@ -149,7 +149,7 @@ struct jffs2_raw_inode | |||
149 | jint32_t data_crc; /* CRC for the (compressed) data. */ | 149 | jint32_t data_crc; /* CRC for the (compressed) data. */ |
150 | jint32_t node_crc; /* CRC for the raw inode (excluding data) */ | 150 | jint32_t node_crc; /* CRC for the raw inode (excluding data) */ |
151 | uint8_t data[0]; | 151 | uint8_t data[0]; |
152 | } __attribute__((packed)); | 152 | }; |
153 | 153 | ||
154 | struct jffs2_raw_summary | 154 | struct jffs2_raw_summary |
155 | { | 155 | { |
@@ -163,7 +163,7 @@ struct jffs2_raw_summary | |||
163 | jint32_t sum_crc; /* summary information crc */ | 163 | jint32_t sum_crc; /* summary information crc */ |
164 | jint32_t node_crc; /* node crc */ | 164 | jint32_t node_crc; /* node crc */ |
165 | jint32_t sum[0]; /* inode summary info */ | 165 | jint32_t sum[0]; /* inode summary info */ |
166 | } __attribute__((packed)); | 166 | }; |
167 | 167 | ||
168 | union jffs2_node_union | 168 | union jffs2_node_union |
169 | { | 169 | { |