mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 2/4] cdev: store dos partition type in struct cdev
Date: Mon, 30 Sep 2013 11:43:06 +0200	[thread overview]
Message-ID: <1380534188-1734-3-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1380534188-1734-1-git-send-email-s.hauer@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 common/partitions.c        | 4 +++-
 common/partitions/dos.c    | 7 +++++--
 common/partitions/parser.h | 1 +
 include/driver.h           | 1 +
 4 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/common/partitions.c b/common/partitions.c
index 38032a3..694c6f6 100644
--- a/common/partitions.c
+++ b/common/partitions.c
@@ -63,6 +63,8 @@ static int register_one_partition(struct block_device *blk,
 		goto out;
 	}
 
+	cdev->dos_partition_type = part->dos_partition_type;
+
 	free(partition_name);
 
 	if (!part->name[0])
@@ -84,7 +86,7 @@ static int register_one_partition(struct block_device *blk,
 	ret = 0;
 out:
 	free(partition_name);
-	return 0;
+	return ret;
 }
 
 static struct partition_parser *partition_parser_get_by_filetype(uint8_t *buf)
diff --git a/common/partitions/dos.c b/common/partitions/dos.c
index 29f1375..31b1ed6 100644
--- a/common/partitions/dos.c
+++ b/common/partitions/dos.c
@@ -138,10 +138,13 @@ static void dos_partition(void *buf, struct block_device *blk,
 	for (i = 0; i < 4; i++) {
 		pentry.first_sec = get_unaligned_le32(&table[i].partition_start);
 		pentry.size = get_unaligned_le32(&table[i].partition_size);
+		pentry.dos_partition_type = table[i].type;
 
 		if (pentry.first_sec != 0) {
-			pd->parts[pd->used_entries].first_sec = pentry.first_sec;
-			pd->parts[pd->used_entries].size = pentry.size;
+			int n = pd->used_entries;
+			pd->parts[n].first_sec = pentry.first_sec;
+			pd->parts[n].size = pentry.size;
+			pd->parts[n].dos_partition_type = pentry.dos_partition_type;
 			pd->used_entries++;
 		} else {
 			dev_dbg(blk->dev, "Skipping empty partition %d\n", i);
diff --git a/common/partitions/parser.h b/common/partitions/parser.h
index f5bdbd1..8d39452 100644
--- a/common/partitions/parser.h
+++ b/common/partitions/parser.h
@@ -16,6 +16,7 @@
 
 struct partition {
 	char name[MAX_PARTITION_NAME];
+	u8 dos_partition_type;
 	uint64_t first_sec;
 	uint64_t size;
 };
diff --git a/include/driver.h b/include/driver.h
index 9e4bffd..7f0532e 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -456,6 +456,7 @@ struct cdev {
 	unsigned int flags;
 	int open;
 	struct mtd_info *mtd;
+	u8 dos_partition_type;
 };
 
 int devfs_create(struct cdev *);
-- 
1.8.4.rc3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2013-09-30  9:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-30  9:43 bootloader specification for barebox Sascha Hauer
2013-09-30  9:43 ` [PATCH 1/4] add function to read single line files Sascha Hauer
2013-09-30  9:43 ` Sascha Hauer [this message]
2013-09-30  9:43 ` [PATCH 3/4] Implement bootloader spec support for barebox Sascha Hauer
2013-09-30  9:43 ` [PATCH 4/4] add kernel-install tool for bootloader Spec Sascha Hauer
2013-10-14  9:38 ` bootloader specification for barebox Jan Lübbe
2013-10-14  9:43   ` Robert P. J. Day
2013-10-14 10:05     ` Jan Lübbe
2013-10-14 10:07       ` Robert P. J. Day

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=1380534188-1734-3-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.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