diff options
| author | Ezequiel Garcia <ezequiel.garcia@free-electrons.com> | 2014-02-25 11:25:22 -0500 |
|---|---|---|
| committer | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2014-02-28 09:29:48 -0500 |
| commit | 9d54c8a33eec78289b1b3f6e10874719c27ce0a7 (patch) | |
| tree | ba34d64d9dcc1b923f0556da5678ab854b4c529d /include/uapi/mtd | |
| parent | 5547fec74a566e1f5e00a937b9a367f7c6a94a8b (diff) | |
UBI: R/O block driver on top of UBI volumes
This commit introduces read-only block device emulation on top of UBI volumes.
Given UBI takes care of wear leveling and bad block management it's possible
to add a thin layer to enable block device access to UBI volumes.
This allows to use a block-oriented filesystem on a flash device.
The UBI block devices are meant to be used in conjunction with any
regular, block-oriented file system (e.g. ext4), although it's primarily
targeted at read-only file systems, such as squashfs.
Block devices are created upon user request through new ioctls:
UBI_IOCVOLATTBLK to attach and UBI_IOCVOLDETBLK to detach.
Also, a new UBI module parameter is added 'ubi.block'. This parameter is
needed in order to attach a block device on boot-up time, allowing to
mount the rootfs on a ubiblock device.
For instance, you could have these kernel parameters:
ubi.mtd=5 ubi.block=0,0 root=/dev/ubiblock0_0
Or, if you compile ubi as a module:
$ modprobe ubi mtd=/dev/mtd5 block=/dev/ubi0_0
Artem: amend commentaries and massage the patch a little bit.
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Diffstat (limited to 'include/uapi/mtd')
| -rw-r--r-- | include/uapi/mtd/ubi-user.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/uapi/mtd/ubi-user.h b/include/uapi/mtd/ubi-user.h index 723c324590c1..b98585ad3346 100644 --- a/include/uapi/mtd/ubi-user.h +++ b/include/uapi/mtd/ubi-user.h | |||
| @@ -134,6 +134,13 @@ | |||
| 134 | * used. A pointer to a &struct ubi_set_vol_prop_req object is expected to be | 134 | * used. A pointer to a &struct ubi_set_vol_prop_req object is expected to be |
| 135 | * passed. The object describes which property should be set, and to which value | 135 | * passed. The object describes which property should be set, and to which value |
| 136 | * it should be set. | 136 | * it should be set. |
| 137 | * | ||
| 138 | * Block devices on UBI volumes | ||
| 139 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 140 | * | ||
| 141 | * To attach or detach a block device from an UBI volume the %UBI_IOCVOLATTBLK | ||
| 142 | * and %UBI_IOCVOLDETBLK ioctl commands should be used, respectively. | ||
| 143 | * These commands take no arguments. | ||
| 137 | */ | 144 | */ |
| 138 | 145 | ||
| 139 | /* | 146 | /* |
| @@ -191,6 +198,10 @@ | |||
| 191 | /* Set an UBI volume property */ | 198 | /* Set an UBI volume property */ |
| 192 | #define UBI_IOCSETVOLPROP _IOW(UBI_VOL_IOC_MAGIC, 6, \ | 199 | #define UBI_IOCSETVOLPROP _IOW(UBI_VOL_IOC_MAGIC, 6, \ |
| 193 | struct ubi_set_vol_prop_req) | 200 | struct ubi_set_vol_prop_req) |
| 201 | /* Attach a block device to an UBI volume */ | ||
| 202 | #define UBI_IOCVOLATTBLK _IO(UBI_VOL_IOC_MAGIC, 7) | ||
| 203 | /* Detach a block device from an UBI volume */ | ||
| 204 | #define UBI_IOCVOLDETBLK _IO(UBI_VOL_IOC_MAGIC, 8) | ||
| 194 | 205 | ||
| 195 | /* Maximum MTD device name length supported by UBI */ | 206 | /* Maximum MTD device name length supported by UBI */ |
| 196 | #define MAX_UBI_MTD_NAME_LEN 127 | 207 | #define MAX_UBI_MTD_NAME_LEN 127 |
