Skip to contentSkip to conversation

Setting up multiple 'blkmtd' devices

DISCUSSION Ryan B. Lynch 2 participants 2 messages May 5, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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.

- 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?

- 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?

- 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?

- 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?

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

-Ryan

#1 lore raw
Quoted 6 lines · Ryan B. Lynch

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'.

Quoted 6 lines

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.

Quoted 4 lines

- 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.

Quoted 5 lines

- 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.

Quoted 3 lines

- 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

Quoted 3 lines

- 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.

Quoted 1 line

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

Signature · 2 lines
He that composes himself is wiser than he that composes a book.
-- B. Franklin

---

 drivers/mtd/devices/block2mtd.c |    3 +--
 1 files changed, 1 insertion(+), 2 deletions(-)
drivers/mtd/devices/block2mtd.c renamed from drivers/mtd/devices/block2mtd.c~block2mtd_embarrassment +1 -2
@@ -4,7 +4,6 @@
  * block2mtd.c - create an mtd from a block device
  *
  * Copyright (C) 2001,2002	Simon Evans <[email protected]>
- * Copyright (C) 2004		Gareth Bult <[email protected]>
  * Copyright (C) 2004,2005	Jörn Engel <[email protected]>
  *
  * 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)