Re: [PATCHv6] UBI: new module ubiblk: block layer on top of UBI

From: Ricard Wanderlof
Date: Mon Sep 26 2011 - 05:27:10 EST



On Thu, 22 Sep 2011, David Wagner wrote:

ubiblk is a read-only block layer on top of UBI. It presents UBI volumes as
...

I decided to try this out, as I've been looking for a flexible block-device-on-ubi scheme for using a cramfs or squashfs root file system over UBI without having to resort to gluebi (which in its current implementation is too inflexible for my needs).

This can't be considered a complete test, as I basically just booted the system a couple of times, using a cramfs file system residing in an UBI volume. I compiled ubiblk built in to the kernel, not as a module; furthermore, I'm running 2.6.35 for various reasons, so had to backport kstrtoul from 2.6.39 in order to get it to build.

But for what it's worth, it does confirm that it in fact works to set up a ubiblk device at boot time for the root filesystem.

There doesn't seem to be a userspace application for attaching/detaching ubiblk devices. I hacked together something based on ubinfo, I could post it, but perhaps something more thorough is forthcoming?

A couple of comments below:

+/**
+ * ubiblk_ctrl_ioctl - ioctl handling for proxying/unproxying a UBI volume
+ *
+ * @file: the file on which the ioctl was invoked (usunsed)
^^^^^^^ typo: unused
+ * @cmd: the ioctl type
+ * @arg: additional command informations
+ */
+static long ubiblk_ctrl_ioctl(struct file *file, unsigned int cmd,
+ unsigned long arg)


+/**
+ * ubiblk_parse_volume_param - parse the "volume" module parameter
+ *
+ * @ubi_num: where to store the UBI device number
+ * @vol_id: where to store the volume ID
+ */
+static int __init ubiblk_parse_volume_param(int *ubi_num, int *vol_id)
+{
+ char *tokens[2] = {NULL, NULL};
+ char buf[VOL_PARAM_MAXLEN];
+ char *pbuf = buf;
+ int len = strlen(buf);
^^^ this needs to be volume, not buf.

/Ricard
--
Ricard Wolf Wanderlöf ricardw(at)axis.com
Axis Communications AB, Lund, Sweden www.axis.com
Phone +46 46 272 2016 Fax +46 46 13 61 30
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/