bug-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

grub FSYS_BUF cleanup suggestion...


From: Andrew Clausen
Subject: grub FSYS_BUF cleanup suggestion...
Date: Mon, 10 Feb 2003 16:45:29 +1100
User-agent: Mutt/1.4i

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]