]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
fs/adfs: dir: modernise on-disk directory structures
authorRussell King <rmk+kernel@armlinux.org.uk>
Mon, 9 Dec 2019 11:09:56 +0000 (11:09 +0000)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 21 Jan 2020 01:12:41 +0000 (20:12 -0500)
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>
fs/adfs/dir_f.h
fs/adfs/dir_fplus.h

index 5aec332b90f52317a4d00dc5ac4d4109e9fee946..a5393e6cf9f43e63f43fb8a75048e0d29905e294 100644 (file)
@@ -13,9 +13,9 @@
  * Directory header
  */
 struct adfs_dirheader {
-       unsigned char startmasseq;
-       unsigned char startname[4];
-};
+       __u8 startmasseq;
+       __u8 startname[4];
+} __attribute__((packed));
 
 #define ADFS_NEWDIR_SIZE       2048
 #define ADFS_NUM_DIR_ENTRIES   77
@@ -31,32 +31,36 @@ struct adfs_direntry {
        __u8 dirlen[4];
        __u8 dirinddiscadd[3];
        __u8 newdiratts;
-};
+} __attribute__((packed));
 
 /*
  * Directory tail
  */
+struct adfs_olddirtail {
+       __u8 dirlastmask;
+       char dirname[10];
+       __u8 dirparent[3];
+       char dirtitle[19];
+       __u8 reserved[14];
+       __u8 endmasseq;
+       __u8 endname[4];
+       __u8 dircheckbyte;
+} __attribute__((packed));
+
+struct adfs_newdirtail {
+       __u8 dirlastmask;
+       __u8 reserved[2];
+       __u8 dirparent[3];
+       char dirtitle[19];
+       char dirname[10];
+       __u8 endmasseq;
+       __u8 endname[4];
+       __u8 dircheckbyte;
+} __attribute__((packed));
+
 union adfs_dirtail {
-       struct {
-               unsigned char dirlastmask;
-               char dirname[10];
-               unsigned char dirparent[3];
-               char dirtitle[19];
-               unsigned char reserved[14];
-               unsigned char endmasseq;
-               unsigned char endname[4];
-               unsigned char dircheckbyte;
-       } old;
-       struct {
-               unsigned char dirlastmask;
-               unsigned char reserved[2];
-               unsigned char dirparent[3];
-               char dirtitle[19];
-               char dirname[10];
-               unsigned char endmasseq;
-               unsigned char endname[4];
-               unsigned char dircheckbyte;
-       } new;
+       struct adfs_olddirtail old;
+       struct adfs_newdirtail new;
 };
 
 #endif
index 4ec0931e36ad4d9ec6d565ed707451d787eecab9..d729b1591e5e9e2062de5daf95ce8cf98ed2307a 100644 (file)
@@ -22,7 +22,7 @@ struct adfs_bigdirheader {
        __le32  bigdirnamesize;
        __le32  bigdirparent;
        char    bigdirname[1];
-};
+} __attribute__((packed, aligned(4)));
 
 struct adfs_bigdirentry {
        __le32  bigdirload;
@@ -32,11 +32,11 @@ struct adfs_bigdirentry {
        __le32  bigdirattr;
        __le32  bigdirobnamelen;
        __le32  bigdirobnameptr;
-};
+} __attribute__((packed, aligned(4)));
 
 struct adfs_bigdirtail {
        __le32  bigdirendname;
        __u8    bigdirendmasseq;
        __u8    reserved[2];
        __u8    bigdircheckbyte;
-};
+} __attribute__((packed, aligned(4)));