source: patches/grub-0.97-256byte_inode-1.patch@ 65a1d51

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 65a1d51 was ca9712f, checked in by Joe Ciccone <jciccone@…>, 16 years ago

Add the 256-byte innode patch to grub.

  • Property mode set to 100644
File size: 4.8 KB
  • stage2/fsys_ext2fs.c

    Submitted By: Jeremy Huntwork (jhuntwork at linuxfromscratch dot org)
    Date: 2008-04-03
    Initial Package Version: 0.97
    Upstream Status: Not sent. Development on 'GRUB legacy' abandoned for 'GRUB2'.
    Origin: http://bugs.debian.org/463123
    Description: Fixes GRUB to recognize ext2 filesystems created with 256-byte
    inodes.
    
    diff -Nrup a/stage2/fsys_ext2fs.c b/stage2/fsys_ext2fs.c
    a b struct ext2_super_block  
    7979    __u32 s_rev_level;          /* Revision level */
    8080    __u16 s_def_resuid;         /* Default uid for reserved blocks */
    8181    __u16 s_def_resgid;         /* Default gid for reserved blocks */
    82     __u32 s_reserved[235];      /* Padding to the end of the block */
     82    /*
     83     * These fields are for EXT2_DYNAMIC_REV superblocks only.
     84     *
     85     * Note: the difference between the compatible feature set and
     86     * the incompatible feature set is that if there is a bit set
     87     * in the incompatible feature set that the kernel doesn't
     88     * know about, it should refuse to mount the filesystem.
     89     *
     90     * e2fsck's requirements are more strict; if it doesn't know
     91     * about a feature in either the compatible or incompatible
     92     * feature set, it must abort and not try to meddle with
     93     * things it doesn't understand...
     94     */
     95    __u32 s_first_ino;          /* First non-reserved inode */
     96    __u16 s_inode_size;         /* size of inode structure */
     97    __u16 s_block_group_nr;     /* block group # of this superblock */
     98    __u32 s_feature_compat;     /* compatible feature set */
     99    __u32 s_feature_incompat;   /* incompatible feature set */
     100    __u32 s_feature_ro_compat;  /* readonly-compatible feature set */
     101    __u8  s_uuid[16];           /* 128-bit uuid for volume */
     102    char  s_volume_name[16];    /* volume name */
     103    char  s_last_mounted[64];   /* directory where last mounted */
     104    __u32 s_algorithm_usage_bitmap; /* For compression */
     105    /*
     106     * Performance hints.  Directory preallocation should only
     107     * happen if the EXT2_FEATURE_COMPAT_DIR_PREALLOC flag is on.
     108     */
     109    __u8  s_prealloc_blocks;    /* Nr of blocks to try to preallocate*/
     110    __u8  s_prealloc_dir_blocks;        /* Nr to preallocate for dirs */
     111    __u16 s_reserved_gdt_blocks;/* Per group table for online growth */
     112    /*
     113     * Journaling support valid if EXT2_FEATURE_COMPAT_HAS_JOURNAL set.
     114     */
     115    __u8 s_journal_uuid[16];    /* uuid of journal superblock */
     116    __u32 s_journal_inum;       /* inode number of journal file */
     117    __u32 s_journal_dev;        /* device number of journal file */
     118    __u32 s_last_orphan;        /* start of list of inodes to delete */
     119    __u32 s_hash_seed[4];       /* HTREE hash seed */
     120    __u8  s_def_hash_version;   /* Default hash version to use */
     121    __u8  s_jnl_backup_type;    /* Default type of journal backup */
     122    __u16 s_reserved_word_pad;
     123    __u32 s_default_mount_opts;
     124    __u32 s_first_meta_bg;      /* First metablock group */
     125    __u32 s_mkfs_time;          /* When the filesystem was created */
     126    __u32 s_jnl_blocks[17];     /* Backup of the journal inode */
     127    __u32 s_reserved[172];      /* Padding to the end of the block */
    83128  };
    84129
    85130struct ext2_group_desc
    struct ext2_dir_entry  
    218263#define EXT2_ADDR_PER_BLOCK(s)          (EXT2_BLOCK_SIZE(s) / sizeof (__u32))
    219264#define EXT2_ADDR_PER_BLOCK_BITS(s)             (log2(EXT2_ADDR_PER_BLOCK(s)))
    220265
     266#define EXT2_INODE_SIZE(s)              (SUPERBLOCK->s_inode_size)
     267#define EXT2_INODES_PER_BLOCK(s)        (EXT2_BLOCK_SIZE(s)/EXT2_INODE_SIZE(s))
     268
    221269/* linux/ext2_fs.h */
    222270#define EXT2_BLOCK_SIZE_BITS(s)        ((s)->s_log_block_size + 10)
    223271/* kind of from ext2/super.c */
    ext2fs_dir (char *dirname)  
    553601      gdp = GROUP_DESC;
    554602      ino_blk = gdp[desc].bg_inode_table +
    555603        (((current_ino - 1) % (SUPERBLOCK->s_inodes_per_group))
    556          >> log2 (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode)));
     604         >> log2 (EXT2_INODES_PER_BLOCK (SUPERBLOCK)));
    557605#ifdef E2DEBUG
    558606      printf ("inode table fsblock=%d\n", ino_blk);
    559607#endif /* E2DEBUG */
    ext2fs_dir (char *dirname)  
    565613      /* reset indirect blocks! */
    566614      mapblock2 = mapblock1 = -1;
    567615
    568       raw_inode = INODE +
    569         ((current_ino - 1)
    570          & (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode) - 1));
     616      raw_inode = (struct ext2_inode *)((char *)INODE +
     617        ((current_ino - 1) & (EXT2_INODES_PER_BLOCK (SUPERBLOCK) - 1)) *
     618        EXT2_INODE_SIZE (SUPERBLOCK));
    571619#ifdef E2DEBUG
    572620      printf ("ipb=%d, sizeof(inode)=%d\n",
    573               (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode)),
    574               sizeof (struct ext2_inode));
     621              EXT2_INODES_PER_BLOCK (SUPERBLOCK), EXT2_INODE_SIZE (SUPERBLOCK));
    575622      printf ("inode=%x, raw_inode=%x\n", INODE, raw_inode);
    576623      printf ("offset into inode table block=%d\n", (int) raw_inode - (int) INODE);
    577624      for (i = (unsigned char *) INODE; i <= (unsigned char *) raw_inode;
Note: See TracBrowser for help on using the repository browser.