Hi all,

ATM, you see code like this:

#define SUPERBLOCK \
    ((struct ext2_super_block *)(FSYS_BUF))
#define GROUP_DESC \
    ((struct ext2_group_desc *) \
     ((int)SUPERBLOCK + sizeof(struct ext2_super_block)))
#define INODE \
    ((struct ext2_inode *)((int)GROUP_DESC + EXT2_BLOCK_SIZE(SUPERBLOCK)))

Why not do it like this?

        struct ext2_buffer {
                struct ext2_super_block sb;
                struct ext2_group_desc gd;
                struct ext2_inode inode;
                ...
        };

        #define FS_STATE (* (struct ext2_buffer*) FSYS_BUF)

Then, access code looks like "FS_STATE.inode" rather than "INODE".
That looks nicer, IMHO, and it becomes obvious what FS_STATE actually
is.

Cheers,
Andrew



_______________________________________________
Bug-grub mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-grub

Reply via email to