Setting up multiple 'blkmtd' devices

Jörn Engel joern at wohnheim.fh-wedel.de
Thu May 5 02:40:31 EDT 2005


On Thu, 5 May 2005 06:23:14 +0000, Ryan B. Lynch wrote:
> 
> I've been using the 'blkmtd' driver as a module, and I understand that 
> the only way to set up the device association and create a 
> 'dev/mtdblock/*' device is to load the module with the option 
> 'device=/dev/xxx'.
> 
> Couple of questions:
> 
>    - Is it possible to load more than one device during the 'modprobe' 
> command, with something like multiple "device=xxx" options?  I tried 
> that exactly, and it doesn't seem to work--it only loads the first 
> device listed.

Nope, but that should work for block2mtd.  If it doesn't work, it's a
bug and I'll fix it.

>    - Is it possible to set up additional blkmtd devices after the 
> module has loaded?  If I issue the command 'modprobe blkmtd 
> device=/dev/hdc1', is it possible to add another device later without 
> unloading the module?

Works for block2mtd.  If not, see above.

>    - When I've compiled the 'blkmtd' driver into the kernel, I 
> understand that I can associate the block device at boot time with the 
> boot parameter "blkmtd_device=/dev/xxx".  If I don't pass a 
> "blkmtd_device=" parameter at boot-time, is there any way to associate a 
> device later on?

For block2mtd there is.

>    - Given the compiled-in scenario for the 'blkmtd' driver, is it 
> possible to bring in multiple devices, regardless of whether the 
> boot-time parameter is passed?

dito

>    - Is there a userspace tool, along the lines of 'losetup' or 
> 'brctl', that allows you to manipulate/query blkmtd devices without 
> using the module options?

This doesn't exist for block2mtd yet.  Not sure if that's really
necessary.

> I hope these are straightforward enough.  Thanks for the time.

Blkmtd is old and completely broken wrt. parameter handling.  Imo,
it's unfixably broken, so I fixed things up in a new driver.  But I
broke things as well, so you need to apply a patch to 2.6.11 for it to
work.  Should be attached to this mail.

Jörn

-- 
He that composes himself is wiser than he that composes a book.
-- B. Franklin
-------------- next part --------------


Signed-off-by: Jörn Engel <joern at wohnheim.fh-wedel.de>
---

 drivers/mtd/devices/block2mtd.c |    3 +--
 1 files changed, 1 insertion(+), 2 deletions(-)

--- linux-2.6.11cow/drivers/mtd/devices/block2mtd.c~block2mtd_embarrassment	2005-03-07 21:19:16.000000000 +0100
+++ linux-2.6.11cow/drivers/mtd/devices/block2mtd.c	2005-03-07 21:24:47.000000000 +0100
@@ -4,7 +4,6 @@
  * block2mtd.c - create an mtd from a block device
  *
  * Copyright (C) 2001,2002	Simon Evans <spse at secret.org.uk>
- * Copyright (C) 2004		Gareth Bult <Gareth at Encryptec.net>
  * Copyright (C) 2004,2005	Jörn Engel <joern at wh.fh-wedel.de>
  *
  * Licence: GPL
@@ -157,7 +156,7 @@ static int block2mtd_read(struct mtd_inf
 	struct block2mtd_dev *dev = mtd->priv;
 	struct page *page;
 	int index = from >> PAGE_SHIFT;
-	int offset = from & (PAGE_SHIFT-1);
+	int offset = from & (PAGE_SIZE-1);
 	int cpylen;
 
 	if (from > mtd->size)


More information about the linux-mtd mailing list