@@ -542,6 +542,18 @@ static int vol_cdev_ioctl(struct inode *inode, struct file *file,
err = ubi_leb_unmap(desc, lnum);
break;
}
+ case UBI_IOISMAP:
+ {
+ int32_t lnum;
+
+ err = get_user(lnum, (__user int32_t *)argp);
+ if (err) {
+ err = -EFAULT;
+ break;
+ }
+ err = ubi_is_mapped(desc, lnum);
+ break;
+ }
#endif
@@ -137,6 +137,8 @@
#define UBI_IOMAP _IOW(UBI_VOL_IOC_MAGIC, 3, struct ubi_map_req)
/* Unmap an eraseblock */
#define UBI_IOUNMAP _IOW(UBI_VOL_IOC_MAGIC, 4, int32_t)
+/* Check whether an eraseblock is mapped */
+#define UBI_IOISMAP _IOR(UBI_VOL_IOC_MAGIC, 5, int32_t)
/* Maximum MTD device name length supported by UBI */
#define MAX_UBI_MTD_NAME_LEN 127