Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fs/adfs: dir: modernise on-disk directory structures

Use __u8 and pack the structures for on-disk directories.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

authored by

Russell King and committed by
Al Viro
ae5df413 deed1bfd

+31 -27
+28 -24
fs/adfs/dir_f.h
··· 13 13 * Directory header 14 14 */ 15 15 struct adfs_dirheader { 16 - unsigned char startmasseq; 17 - unsigned char startname[4]; 18 - }; 16 + __u8 startmasseq; 17 + __u8 startname[4]; 18 + } __attribute__((packed)); 19 19 20 20 #define ADFS_NEWDIR_SIZE 2048 21 21 #define ADFS_NUM_DIR_ENTRIES 77 ··· 31 31 __u8 dirlen[4]; 32 32 __u8 dirinddiscadd[3]; 33 33 __u8 newdiratts; 34 - }; 34 + } __attribute__((packed)); 35 35 36 36 /* 37 37 * Directory tail 38 38 */ 39 + struct adfs_olddirtail { 40 + __u8 dirlastmask; 41 + char dirname[10]; 42 + __u8 dirparent[3]; 43 + char dirtitle[19]; 44 + __u8 reserved[14]; 45 + __u8 endmasseq; 46 + __u8 endname[4]; 47 + __u8 dircheckbyte; 48 + } __attribute__((packed)); 49 + 50 + struct adfs_newdirtail { 51 + __u8 dirlastmask; 52 + __u8 reserved[2]; 53 + __u8 dirparent[3]; 54 + char dirtitle[19]; 55 + char dirname[10]; 56 + __u8 endmasseq; 57 + __u8 endname[4]; 58 + __u8 dircheckbyte; 59 + } __attribute__((packed)); 60 + 39 61 union adfs_dirtail { 40 - struct { 41 - unsigned char dirlastmask; 42 - char dirname[10]; 43 - unsigned char dirparent[3]; 44 - char dirtitle[19]; 45 - unsigned char reserved[14]; 46 - unsigned char endmasseq; 47 - unsigned char endname[4]; 48 - unsigned char dircheckbyte; 49 - } old; 50 - struct { 51 - unsigned char dirlastmask; 52 - unsigned char reserved[2]; 53 - unsigned char dirparent[3]; 54 - char dirtitle[19]; 55 - char dirname[10]; 56 - unsigned char endmasseq; 57 - unsigned char endname[4]; 58 - unsigned char dircheckbyte; 59 - } new; 62 + struct adfs_olddirtail old; 63 + struct adfs_newdirtail new; 60 64 }; 61 65 62 66 #endif
+3 -3
fs/adfs/dir_fplus.h
··· 22 22 __le32 bigdirnamesize; 23 23 __le32 bigdirparent; 24 24 char bigdirname[1]; 25 - }; 25 + } __attribute__((packed, aligned(4))); 26 26 27 27 struct adfs_bigdirentry { 28 28 __le32 bigdirload; ··· 32 32 __le32 bigdirattr; 33 33 __le32 bigdirobnamelen; 34 34 __le32 bigdirobnameptr; 35 - }; 35 + } __attribute__((packed, aligned(4))); 36 36 37 37 struct adfs_bigdirtail { 38 38 __le32 bigdirendname; 39 39 __u8 bigdirendmasseq; 40 40 __u8 reserved[2]; 41 41 __u8 bigdircheckbyte; 42 - }; 42 + } __attribute__((packed, aligned(4)));