UBI: add ioctl for map operation
[linux-3.10.git] / drivers / mtd / ubi / cdev.c
index 98cf31ed081438fc8ee05521cc7bc8c07f82a45d..055e3f563c13bad6d2e5bfcdc4f09d8ad5c16e13 100644 (file)
@@ -518,6 +518,20 @@ static int vol_cdev_ioctl(struct inode *inode, struct file *file,
                err = ubi_wl_flush(ubi);
                break;
        }
+
+       /* Logical eraseblock map command */
+       case UBI_IOCEBMAP:
+       {
+               struct ubi_map_req req;
+
+               err = copy_from_user(&req, argp, sizeof(struct ubi_map_req));
+               if (err) {
+                       err = -EFAULT;
+                       break;
+               }
+               err = ubi_leb_map(desc, req.lnum, req.dtype);
+               break;
+       }
 #endif
 
        default: