diff options
author | John Crispin <john@openwrt.org> | 2014-04-07 15:10:18 +0000 |
---|---|---|
committer | John Crispin <john@openwrt.org> | 2014-04-07 15:10:18 +0000 |
commit | 1978620045a5b482a5e8ba61e588992b8f57acab (patch) | |
tree | d14bc6a36609ba36ee4ad66e366d3f3742f8b168 /target/linux/generic/patches-3.10/413-mtd-ubi-forced-detach.patch | |
parent | 1d5ac958504df256ed307af56b0bdf5113096bd2 (diff) | |
download | mtk-20170518-1978620045a5b482a5e8ba61e588992b8f57acab.zip mtk-20170518-1978620045a5b482a5e8ba61e588992b8f57acab.tar.gz mtk-20170518-1978620045a5b482a5e8ba61e588992b8f57acab.tar.bz2 |
kernel: add a ubi forced detach ioctl
Signed-off-by: John Crispin <blogic@openwrt.org>
SVN-Revision: 40417
Diffstat (limited to 'target/linux/generic/patches-3.10/413-mtd-ubi-forced-detach.patch')
-rw-r--r-- | target/linux/generic/patches-3.10/413-mtd-ubi-forced-detach.patch | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/target/linux/generic/patches-3.10/413-mtd-ubi-forced-detach.patch b/target/linux/generic/patches-3.10/413-mtd-ubi-forced-detach.patch new file mode 100644 index 0000000..0d4fff1 --- /dev/null +++ b/target/linux/generic/patches-3.10/413-mtd-ubi-forced-detach.patch @@ -0,0 +1,41 @@ +--- a/drivers/mtd/ubi/cdev.c ++++ b/drivers/mtd/ubi/cdev.c +@@ -974,7 +974,7 @@ static long ubi_cdev_ioctl(struct file * + static long ctrl_cdev_ioctl(struct file *file, unsigned int cmd, + unsigned long arg) + { +- int err = 0; ++ int err = 0, force = 0; + void __user *argp = (void __user *)arg; + + if (!capable(CAP_SYS_RESOURCE)) +@@ -1024,6 +1024,10 @@ static long ctrl_cdev_ioctl(struct file + } + + /* Detach an MTD device command */ ++ case UBI_IOCFDET: ++ force = 1; ++ /* no break */ ++ + case UBI_IOCDET: + { + int ubi_num; +@@ -1036,7 +1040,7 @@ static long ctrl_cdev_ioctl(struct file + } + + mutex_lock(&ubi_devices_mutex); +- err = ubi_detach_mtd_dev(ubi_num, 0); ++ err = ubi_detach_mtd_dev(ubi_num, force); + mutex_unlock(&ubi_devices_mutex); + break; + } +--- a/include/uapi/mtd/ubi-user.h ++++ b/include/uapi/mtd/ubi-user.h +@@ -168,6 +168,7 @@ + #define UBI_IOCATT _IOW(UBI_CTRL_IOC_MAGIC, 64, struct ubi_attach_req) + /* Detach an MTD device */ + #define UBI_IOCDET _IOW(UBI_CTRL_IOC_MAGIC, 65, __s32) ++#define UBI_IOCFDET _IOW(UBI_CTRL_IOC_MAGIC, 99, __s32) + + /* ioctl commands of UBI volume character devices */ + |