Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 220687
Collapse All | Expand All

(-)grub-0.97-800/stage2/fsys_ext2fs.c (-7 / +59 lines)
Lines 79-85 Link Here
79
    __u32 s_rev_level;		/* Revision level */
79
    __u32 s_rev_level;		/* Revision level */
80
    __u16 s_def_resuid;		/* Default uid for reserved blocks */
80
    __u16 s_def_resuid;		/* Default uid for reserved blocks */
81
    __u16 s_def_resgid;		/* Default gid for reserved blocks */
81
    __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 */
83
  };
128
  };
84
129
85
struct ext2_group_desc
130
struct ext2_group_desc
Lines 218-223 Link Here
218
#define EXT2_ADDR_PER_BLOCK(s)          (EXT2_BLOCK_SIZE(s) / sizeof (__u32))
263
#define EXT2_ADDR_PER_BLOCK(s)          (EXT2_BLOCK_SIZE(s) / sizeof (__u32))
219
#define EXT2_ADDR_PER_BLOCK_BITS(s)		(log2(EXT2_ADDR_PER_BLOCK(s)))
264
#define EXT2_ADDR_PER_BLOCK_BITS(s)		(log2(EXT2_ADDR_PER_BLOCK(s)))
220
265
266
#define EXT2_GOOD_OLD_REV   0   /* The good old (original) format */
267
#define EXT2_DYNAMIC_REV    1   /* V2 format w/ dynamic inode sizes */
268
#define EXT2_GOOD_OLD_INODE_SIZE 128
269
#define EXT2_INODE_SIZE(s)  (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
270
                 EXT2_GOOD_OLD_INODE_SIZE : \
271
                 (s)->s_inode_size)
272
#define EXT2_INODES_PER_BLOCK(s)	(EXT2_BLOCK_SIZE(s)/EXT2_INODE_SIZE(s))
273
221
/* linux/ext2_fs.h */
274
/* linux/ext2_fs.h */
222
#define EXT2_BLOCK_SIZE_BITS(s)        ((s)->s_log_block_size + 10)
275
#define EXT2_BLOCK_SIZE_BITS(s)        ((s)->s_log_block_size + 10)
223
/* kind of from ext2/super.c */
276
/* kind of from ext2/super.c */
Lines 553-559 Link Here
553
      gdp = GROUP_DESC;
606
      gdp = GROUP_DESC;
554
      ino_blk = gdp[desc].bg_inode_table +
607
      ino_blk = gdp[desc].bg_inode_table +
555
	(((current_ino - 1) % (SUPERBLOCK->s_inodes_per_group))
608
	(((current_ino - 1) % (SUPERBLOCK->s_inodes_per_group))
556
	 >> log2 (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode)));
609
	 >> log2 (EXT2_INODES_PER_BLOCK (SUPERBLOCK)));
557
#ifdef E2DEBUG
610
#ifdef E2DEBUG
558
      printf ("inode table fsblock=%d\n", ino_blk);
611
      printf ("inode table fsblock=%d\n", ino_blk);
559
#endif /* E2DEBUG */
612
#endif /* E2DEBUG */
Lines 565-577 Link Here
565
      /* reset indirect blocks! */
618
      /* reset indirect blocks! */
566
      mapblock2 = mapblock1 = -1;
619
      mapblock2 = mapblock1 = -1;
567
620
568
      raw_inode = INODE +
621
      raw_inode = (struct ext2_inode *)((char *)INODE +
569
	((current_ino - 1)
622
	((current_ino - 1) & (EXT2_INODES_PER_BLOCK (SUPERBLOCK) - 1)) *
570
	 & (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode) - 1));
623
	EXT2_INODE_SIZE (SUPERBLOCK));
571
#ifdef E2DEBUG
624
#ifdef E2DEBUG
572
      printf ("ipb=%d, sizeof(inode)=%d\n",
625
      printf ("ipb=%d, sizeof(inode)=%d\n",
573
	      (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode)),
626
	      EXT2_INODES_PER_BLOCK (SUPERBLOCK), EXT2_INODE_SIZE (SUPERBLOCK));
574
	      sizeof (struct ext2_inode));
575
      printf ("inode=%x, raw_inode=%x\n", INODE, raw_inode);
627
      printf ("inode=%x, raw_inode=%x\n", INODE, raw_inode);
576
      printf ("offset into inode table block=%d\n", (int) raw_inode - (int) INODE);
628
      printf ("offset into inode table block=%d\n", (int) raw_inode - (int) INODE);
577
      for (i = (unsigned char *) INODE; i <= (unsigned char *) raw_inode;
629
      for (i = (unsigned char *) INODE; i <= (unsigned char *) raw_inode;

Return to bug 220687