I always disliked the unknown partition table messages you get when you
mke2fs a whole disk and don't bother with a table at all, so I fixed it.
Output before/after shown below:
Partition check:
hda: hda1 hda2
- hdd: unknown partition table
+ hdd: whole disk EXT2-fs, revision 1.0, 1k blocks, status: clean.
VFS: Mounted root (ext2 filesystem) readonly.
Freeing unused kernel memory: 32k freed
Note that I placed the check right before we give up and print the unknown
message, so all the other identification schemes get their chance to prod
at the disk first. Patch against 2.2.18 follows -- not necessarily
advocating it for 2.2 - just happened to be what I patched... :)
Paul.
--- linux-2.2.18/drivers/block/genhd.c~ Mon Dec 11 20:26:14 2000
+++ linux/drivers/block/genhd.c Tue Dec 12 08:11:12 2000
@@ -232,6 +232,39 @@
return ret;
}
+/*
+ * Lots of people put ext2 fs directly onto a whole disk, without a
+ * partition table. Looks kind of silly if we call a disk with our
+ * own filesystem "unknown". - Paul G.
+ */
+
+#ifdef CONFIG_EXT2_FS
+#include <linux/ext2_fs.h>
+
+static int ext2_partition(struct gendisk *hd, unsigned int dev, unsigned long
+first_sector)
+{
+ struct buffer_head *bh;
+ struct ext2_super_block *es;
+
+ if (!(bh = bread(dev, 1, get_ptable_blocksize(dev)))) {
+ printk("unable to read block one.\n");
+ return -1;
+ }
+ es = (struct ext2_super_block *) bh->b_data;
+ if (le16_to_cpu(es->s_magic) != EXT2_SUPER_MAGIC) {
+ brelse(bh);
+ return 0;
+ }
+ printk(" whole disk EXT2-fs, revision %d.%d, %dk blocks, status: %sclean.\n",
+ le32_to_cpu(es->s_rev_level),
+ le16_to_cpu(es->s_minor_rev_level),
+ 1<<le32_to_cpu(es->s_log_block_size),
+ le16_to_cpu(es->s_state) == EXT2_VALID_FS ? "" : "un");
+ brelse(bh);
+ return 1;
+}
+#endif
+
#ifdef CONFIG_MSDOS_PARTITION
/*
* Create devices for each logical partition in an extended partition.
@@ -1608,6 +1641,10 @@
#endif
#ifdef CONFIG_ARCH_S390
if (ibm_partition (hd, dev, first_sector))
+ return;
+#endif
+#ifdef CONFIG_EXT2_FS
+ if (ext2_partition(hd, dev, first_sector))
return;
#endif
printk(" unknown partition table\n");
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/