mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Randy Dunlap <randy.dunlap@oracle.com>
To: Ulf Hansson <ulf.hansson@stericsson.com>
Cc: Andries Brouwer <aeb@cwi.nl>,
	linux-kernel@vger.kernel.org, Jens Axboe <jens.axboe@oracle.com>
Subject: Re: [PATCH] Added commandline partitions for block devices
Date: Wed, 19 May 2010 12:46:08 -0700	[thread overview]
Message-ID: <20100519124608.485a6f68.randy.dunlap@oracle.com> (raw)
In-Reply-To: <1274256495-8699-1-git-send-email-ulf.hansson@stericsson.com>

On Wed, 19 May 2010 10:08:15 +0200 Ulf Hansson wrote:

> This adds an option to pass in block device partitions from the
> kernel cmdline.
> 
> The rationale is that in embedded systems we sometimes have no
> standard partition table available: often due to the fact that raw
> binary data is read out from the first sectors of the device by
> ROM code in ASICs. We have for a long time supplied custom partition
> information to embedded flash memories through the MTDparts interface
> which has similar semantics, and with the advent of embedded MMC
> block devices this now comes to standard block devices.
> 
> Acked-by: Linus Walleij <linus.walleij@stericsson.com>
> Signed-off-by: Ulf Hansson <ulf.hansson@stericsson.com>
> ---
>  fs/partitions/Kconfig        |   19 ++++++
>  fs/partitions/Makefile       |    1 +
>  fs/partitions/blkdev_parts.c |  127 ++++++++++++++++++++++++++++++++++++++++++
>  fs/partitions/blkdev_parts.h |   14 +++++
>  fs/partitions/check.c        |    4 +
>  5 files changed, 165 insertions(+), 0 deletions(-)
>  create mode 100755 fs/partitions/blkdev_parts.c
>  create mode 100755 fs/partitions/blkdev_parts.h
> 
> diff --git a/fs/partitions/Kconfig b/fs/partitions/Kconfig
> index cb5f0a3..097be19 100644
> --- a/fs/partitions/Kconfig
> +++ b/fs/partitions/Kconfig
> @@ -68,6 +68,25 @@ config ACORN_PARTITION_RISCIX
>  	  of machines called RISCiX.  If you say 'Y' here, Linux will be able
>  	  to read disks partitioned under RISCiX.
>  
> +config BLKDEV_PARTITION
> +	bool "Blockdev commandline partition support" if PARTITION_ADVANCED

	               command line

> +	default n
> +	help
> +	  Say Y if you like to setup partitions for block devices by reading
> +	  from the kernel command line (kernel boot arguments).
> +
> +	  The format of the partitions on the command line:
> +	  blkdevparts=<blkdev-def>[;<blkdev-def>]
> +	  <blkdev-def> := <blkdev-id>:<partdef>[,<partdef>]
> +	  <partdef>    := <size>[@<offset>]
> +
> +	  <blkdev-id>  := unique id used to map driver to blockdev name
> +	  <size>       := size in numbers of sectors
> +	  <offset>     := offset in sectors for partition to start at

Are MMC sectors always a known, fixed size?  512 bytes or 4096 bytes?


> +
> +	  Example:
> +	  blkdevparts=mmc0:1024@0,524288@1024;mmc1:8192@0,8192@8192
> +
>  config OSF_PARTITION
>  	bool "Alpha OSF partition support" if PARTITION_ADVANCED
>  	default y if ALPHA

> diff --git a/fs/partitions/blkdev_parts.c b/fs/partitions/blkdev_parts.c
> new file mode 100755
> index 0000000..48f4136
> --- /dev/null
> +++ b/fs/partitions/blkdev_parts.c
> @@ -0,0 +1,127 @@
> +/*
> + *
> + * Copyright (C) ST-Ericsson SA 2010
> + *
> + * Author: Ulf Hansson <ulf.hansson@stericsson.com> for ST-Ericsson
> + * License terms: GNU General Public License (GPL) version 2
> + *
> + * Create partitions for block devices by reading from the kernel
> + * command line (kernel boot arguments).
> + *
> + */
> +
> +#include "check.h"
> +#include "blkdev_parts.h"
> +
> +static char *cmdline;

> +int blkdev_partition(struct parsed_partitions *state, struct block_device *bdev)
> +{
> +	char blkdev_name[BDEVNAME_SIZE];
> +
> +	/* Check if there are any partitions to handle */
> +	if (cmdline == NULL)
> +		return 0;
> +
> +	/* Get the name of the blockdevice we are operating upon */
> +	if (bdevname(bdev, blkdev_name) == NULL) {
> +		printk(KERN_WARNING "Could not get a blkdev name\n");

Needs some message source id; maybe:
		printk(KERN_WARNING "blkdevparts: Could not get a blkdev name\n");

> +		return 0;
> +	}
> +
> +	/* Parse for partitions and add them to the state */
> +	return parse_blkdev_parts(blkdev_name, state);
> +}


---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

  reply	other threads:[~2010-05-19 19:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-19  8:08 Ulf Hansson
2010-05-19 19:46 ` Randy Dunlap [this message]
2010-05-20  8:54   ` Ulf HANSSON

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=20100519124608.485a6f68.randy.dunlap@oracle.com \
    --to=randy.dunlap@oracle.com \
    --cc=aeb@cwi.nl \
    --cc=jens.axboe@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ulf.hansson@stericsson.com \
    /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

all inboxes | Powered by JetHome®