mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Martin Blom <martin@blom.org>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] Allow subpartitions inside logical DOS partitions
Date: Mon, 10 Apr 2006 20:27:42 +0200	[thread overview]
Message-ID: <443AA39E.6010700@blom.org> (raw)


The following patch makes the subpartition scan in fs/partitions/msdos.c
scan all partitions, not only the primary ones.

Useful for the AROS/Amithlon subpartition patch (see separate mail).

Comments?



diff -ru linux-2.6.16/fs/partitions/check.h
logical-subpartitions/fs/partitions/check.h
--- linux-2.6.16/fs/partitions/check.h	2006-04-10 14:05:43.000000000 +0200
+++ logical-subpartitions/fs/partitions/check.h	2006-04-10
14:09:11.000000000 +0200
@@ -13,6 +13,7 @@
  		sector_t from;
  		sector_t size;
  		int flags;
+		int id;
  	} parts[MAX_PART];
  	int next;
  	int limit;
diff -ru linux-2.6.16/fs/partitions/msdos.c
logical-subpartitions/fs/partitions/msdos.c
--- linux-2.6.16/fs/partitions/msdos.c	2006-04-10 14:05:43.000000000 +0200
+++ logical-subpartitions/fs/partitions/msdos.c	2006-04-10
14:09:11.000000000 +0200
@@ -132,6 +132,7 @@
  			}

  			put_partition(state, state->next, next, size);
+			state->parts[state->next].id = SYS_IND(p);
  			if (SYS_IND(p) == LINUX_RAID_PARTITION)
  				state->parts[state->next].flags = 1;
  			loopct = 0;
@@ -384,7 +385,7 @@
  	Sector sect;
  	unsigned char *data;
  	struct partition *p;
-	int slot;
+	int slot, max_slot;

  	data = read_dev_sector(bdev, 0, &sect);
  	if (!data)
@@ -442,6 +443,7 @@
  			continue;
  		}
  		put_partition(state, slot, start, size);
+		state->parts[slot].id = SYS_IND(p);
  		if (SYS_IND(p) == LINUX_RAID_PARTITION)
  			state->parts[slot].flags = 1;
  		if (SYS_IND(p) == DM6_PARTITION)
@@ -453,12 +455,13 @@
  	printk("\n");

  	/* second pass - output for each on a separate line */
-	p = (struct partition *) (0x1be + data);
-	for (slot = 1 ; slot <= 4 ; slot++, p++) {
-		unsigned char id = SYS_IND(p);
+	for (slot = 1, max_slot = state->next ; slot < max_slot ; slot++) {
+		unsigned char id = (unsigned char) state->parts[slot].id;
+		u32 start = state->parts[slot].from;
+		u32 size = state->parts[slot].size;
  		int n;

-		if (!NR_SECTS(p))
+		if (!size)
  			continue;

  		for (n = 0; subtypes[n].parse && id != subtypes[n].id; n++)
@@ -466,8 +469,7 @@

  		if (!subtypes[n].parse)
  			continue;
-		subtypes[n].parse(state, bdev, START_SECT(p)*sector_size,
-						NR_SECTS(p)*sector_size, slot);
+		subtypes[n].parse(state, bdev, start, size, slot);
  	}
  	put_dev_sector(sect);
  	return 1;


-- 
---- Martin Blom --------------------------- martin@blom.org ----
Eccl 1:18                                 http://martin.blom.org/


                 reply	other threads:[~2006-04-10 18:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=443AA39E.6010700@blom.org \
    --to=martin@blom.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome