From: Sascha Hauer <s.hauer@pengutronix.de>
To: Juergen Beisert <jbe@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 08/13] DISK: Add common partition handling for disk like media
Date: Thu, 17 Nov 2011 17:17:06 +0100 [thread overview]
Message-ID: <20111117161706.GN27267@pengutronix.de> (raw)
In-Reply-To: <1321435467-19148-9-git-send-email-jbe@pengutronix.de>
On Wed, Nov 16, 2011 at 10:24:22AM +0100, Juergen Beisert wrote:
> This covers disk like media like SD card, CF cards, regular hard disks and also
> USB mass storage devices. Most common used partition table is still of DOS type.
> This implementation is prepared to support more partition types in the future.
>
> Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
> ---
> common/Kconfig | 18 ++++
> common/Makefile | 2 +
> common/partitions.c | 229 +++++++++++++++++++++++++++++++++++++++++++++++++++
> include/disks.h | 2 +
> 4 files changed, 251 insertions(+), 0 deletions(-)
> create mode 100644 common/partitions.c
>
> diff --git a/common/Kconfig b/common/Kconfig
> index 8e96920..1318e7d 100644
> --- a/common/Kconfig
> +++ b/common/Kconfig
> @@ -406,6 +406,24 @@ config PARTITION
+
> +/**
> + * Try to collect partition information on the given block device
> + * @param blk Block device to examine
> + * @return 0 most of the time, negative value else
> + *
> + * It is not a failure if no partition information is found
> + */
> +int parse_partition_table(struct block_device *blk)
> +{
> + int i;
> + int rc = 0;
> +
> +#ifdef CONFIG_PARTITION_DISK_DOS
> + if (pdesc.used_entries == 0)
> + try_dos_partition(blk);
> +#endif
> +
> + if (pdesc.used_entries != 0) {
So every block device that comes in uses the same global variable. We
should support multiple block devices.
Also it should be possible to unregister the partitions on a block
device.
> + /* at least one partition description found */
> + for (i = 0; i < pdesc.used_entries; i++) {
> + rc = register_one_partition(blk, &pdesc.parts[i], i);
> + if (rc != 0)
> + dev_err(blk->dev,
> + "Failed to register partition %d on %s (%d)\n",
> + i, blk->cdev.name, rc);
> + if (rc != -ENODEV)
> + rc = 0;
> + }
> + }
> +
> + return rc;
> +}
> diff --git a/include/disks.h b/include/disks.h
> index ec136d4..9932750 100644
> --- a/include/disks.h
> +++ b/include/disks.h
> @@ -36,4 +36,6 @@ struct partition_entry {
> uint32_t partition_size; /*! Start of the partition in LBA notation */
> } __attribute__ ((packed));
>
> +extern int parse_partition_table(struct block_device*);
> +
> #endif /* DISKS_H */
> --
> 1.7.7.1
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2011-11-17 16:17 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-16 9:24 Rework of handling " Juergen Beisert
2011-11-16 9:24 ` [PATCH 01/13] USB Mass Storage driver: Fix compile time warning Juergen Beisert
2011-11-16 9:24 ` [PATCH 02/13] Create a unique cdev number for on demand devices Juergen Beisert
2011-11-16 9:24 ` [PATCH 03/13] ATA/DISK: Add generic disk support when enabling the BIOS disk driver Juergen Beisert
2011-11-16 9:24 ` [PATCH 04/13] ATA/DISK: Enabling write support does not belong to 'drive types' Juergen Beisert
2011-11-16 9:24 ` [PATCH 05/13] ATA/DISK: Reorganize file structure and names for future updates Juergen Beisert
2011-11-16 9:24 ` [PATCH 06/13] ATA/DISK: The BIOS based disk driver is not an interface Juergen Beisert
2011-11-16 9:24 ` [PATCH 07/13] ATA/DISK: Share important constants and structures Juergen Beisert
2011-11-16 9:24 ` [PATCH 08/13] DISK: Add common partition handling for disk like media Juergen Beisert
2011-11-17 16:17 ` Sascha Hauer [this message]
2011-11-18 8:26 ` Juergen Beisert
2011-11-18 8:51 ` Sascha Hauer
2011-11-21 10:05 ` Juergen Beisert
2011-11-21 11:30 ` Juergen Beisert
2011-11-16 9:24 ` [PATCH 09/13] Use generic block layer to access the drives and do partition parsing Juergen Beisert
2011-11-17 17:55 ` Sascha Hauer
2011-11-16 9:24 ` [PATCH 10/13] Remove 'disk_drive.c' as it is now replaced by generic partition handling Juergen Beisert
2011-11-16 9:24 ` [PATCH 11/13] ATA/DISK: Remove the now unused header <ata.h> Juergen Beisert
2011-11-16 9:24 ` [PATCH 12/13] ATA Disk Support: Add support for native ATA type drives Juergen Beisert
2011-11-17 20:46 ` Sascha Hauer
2011-11-24 11:28 ` Juergen Beisert
2011-11-16 9:24 ` [PATCH 13/13] Add driver for IDE like interfaces Juergen Beisert
2011-11-22 8:29 [PATCHv2] Rework of handling disk like media Juergen Beisert
2011-11-22 8:29 ` [PATCH 08/13] DISK: Add common partition handling for " Juergen Beisert
2011-11-24 12:43 [PATCHv3] Rework of handling " Juergen Beisert
2011-11-24 12:43 ` [PATCH 08/13] DISK: Add common partition handling for " Juergen Beisert
2011-11-24 12:48 ` Erwin Rol
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=20111117161706.GN27267@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=jbe@pengutronix.de \
/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