You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge tag 'upstream-3.15-rc1' of git://git.infradead.org/linux-ubifs
Pull ubifs updates from Artem Bityutskiy: "This pull request includes the 'ubiblock' driver which provides R/O block access to UBI volumes. It is useful for those who want to use squashfs on top of raw flash devices. UBI will provide bit-flip handling and wear-levelling in this case (e.g., if there are other UBI volumes with R/W UBIFS too). The driver is actually pretty small and it is part of the UBI kernel subsystem. Delivered by Ezequiel Garcia, along with a piece of documentation on the MTD web site and the user-space tool for creating and removing block devices" * tag 'upstream-3.15-rc1' of git://git.infradead.org/linux-ubifs: UBI: block: Remove __initdata from ubiblock_param_ops UBI: make UBI_IOCVOLCRBLK take a parameter for future usage UBI: rename block device ioctls UBI: block: Use ENOSYS as return value when CONFIG_UBIBLOCK=n UBI: block: Add CONFIG_BLOCK dependency UBI: block: Use 'u64' for the 64-bit dividend UBI: block: Mark init-only symbol as __initdata UBI: block: do not use term "attach" UBI: R/O block driver on top of UBI volumes
This commit is contained in:
@@ -87,4 +87,20 @@ config MTD_UBI_GLUEBI
|
||||
work on top of UBI. Do not enable this unless you use legacy
|
||||
software.
|
||||
|
||||
config MTD_UBI_BLOCK
|
||||
bool "Read-only block devices on top of UBI volumes"
|
||||
default n
|
||||
depends on BLOCK
|
||||
help
|
||||
This option enables read-only UBI block devices support. UBI block
|
||||
devices will be layered on top of UBI volumes, which means that the
|
||||
UBI driver will transparently handle things like bad eraseblocks and
|
||||
bit-flips. You can put any block-oriented file system on top of UBI
|
||||
volumes in read-only mode (e.g., ext4), but it is probably most
|
||||
practical for read-only file systems, like squashfs.
|
||||
|
||||
When selected, this feature will be built in the UBI driver.
|
||||
|
||||
If in doubt, say "N".
|
||||
|
||||
endif # MTD_UBI
|
||||
|
||||
@@ -3,5 +3,6 @@ obj-$(CONFIG_MTD_UBI) += ubi.o
|
||||
ubi-y += vtbl.o vmt.o upd.o build.o cdev.o kapi.o eba.o io.o wl.o attach.o
|
||||
ubi-y += misc.o debug.o
|
||||
ubi-$(CONFIG_MTD_UBI_FASTMAP) += fastmap.o
|
||||
ubi-$(CONFIG_MTD_UBI_BLOCK) += block.o
|
||||
|
||||
obj-$(CONFIG_MTD_UBI_GLUEBI) += gluebi.o
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1298,6 +1298,15 @@ static int __init ubi_init(void)
|
||||
}
|
||||
}
|
||||
|
||||
err = ubiblock_init();
|
||||
if (err) {
|
||||
ubi_err("block: cannot initialize, error %d", err);
|
||||
|
||||
/* See comment above re-ubi_is_module(). */
|
||||
if (ubi_is_module())
|
||||
goto out_detach;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
out_detach:
|
||||
@@ -1326,6 +1335,8 @@ static void __exit ubi_exit(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
ubiblock_exit();
|
||||
|
||||
for (i = 0; i < UBI_MAX_DEVICES; i++)
|
||||
if (ubi_devices[i]) {
|
||||
mutex_lock(&ubi_devices_mutex);
|
||||
|
||||
@@ -561,6 +561,26 @@ static long vol_cdev_ioctl(struct file *file, unsigned int cmd,
|
||||
break;
|
||||
}
|
||||
|
||||
/* Create a R/O block device on top of the UBI volume */
|
||||
case UBI_IOCVOLCRBLK:
|
||||
{
|
||||
struct ubi_volume_info vi;
|
||||
|
||||
ubi_get_volume_info(desc, &vi);
|
||||
err = ubiblock_create(&vi);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Remove the R/O block device */
|
||||
case UBI_IOCVOLRMBLK:
|
||||
{
|
||||
struct ubi_volume_info vi;
|
||||
|
||||
ubi_get_volume_info(desc, &vi);
|
||||
err = ubiblock_remove(&vi);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
err = -ENOTTY;
|
||||
break;
|
||||
|
||||
@@ -864,6 +864,26 @@ int ubi_update_fastmap(struct ubi_device *ubi);
|
||||
int ubi_scan_fastmap(struct ubi_device *ubi, struct ubi_attach_info *ai,
|
||||
int fm_anchor);
|
||||
|
||||
/* block.c */
|
||||
#ifdef CONFIG_MTD_UBI_BLOCK
|
||||
int ubiblock_init(void);
|
||||
void ubiblock_exit(void);
|
||||
int ubiblock_create(struct ubi_volume_info *vi);
|
||||
int ubiblock_remove(struct ubi_volume_info *vi);
|
||||
#else
|
||||
static inline int ubiblock_init(void) { return 0; }
|
||||
static inline void ubiblock_exit(void) {}
|
||||
static inline int ubiblock_create(struct ubi_volume_info *vi)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
static inline int ubiblock_remove(struct ubi_volume_info *vi)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* ubi_rb_for_each_entry - walk an RB-tree.
|
||||
* @rb: a pointer to type 'struct rb_node' to use as a loop counter
|
||||
|
||||
Reference in New Issue
Block a user