lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <D7863F70D6066D4AB4747A640C5C91A318EBB7C2C6@EXDCVYMBSTM005.EQ1STM.local>
Date:	Thu, 20 May 2010 10:54:29 +0200
From:	Ulf HANSSON <ulf.hansson@...ricsson.com>
To:	'Randy Dunlap' <randy.dunlap@...cle.com>
Cc:	Andries Brouwer <aeb@....nl>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Jens Axboe <jens.axboe@...cle.com>
Subject: RE: [PATCH] Added commandline partitions for block devices


> 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@...ricsson.com>
> > Signed-off-by: Ulf Hansson <ulf.hansson@...ricsson.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?

Yes, 512 bytes are always supported for MMC devices.

> 
> 
> > +
> > +	  Example:
> > +	  blkdevparts=mmc0:1024@0,524288@...4;mmc1:8192@0,8192@...2
> > +
> >  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@...ricsson.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");

Good point! :-)

> 
> > +		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 ***
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ