9
0
Fork 0

mtd: ubi: introduce barebox specific ioctl to get ubi_num

Code wishing to manipulate ubi devices from outside the ubi
layer needs the ubi_num as reference. Add an ioctl to get
the ubi_num from a filedescriptor.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2016-09-22 09:38:17 +02:00
parent 85dccb9298
commit 0f5b72a110
2 changed files with 5 additions and 0 deletions

View File

@ -299,6 +299,9 @@ static int ubi_cdev_ioctl(struct cdev *cdev, int cmd, void *buf)
if (!req->bytes)
req->bytes = (__s64)ubi->avail_pebs * ubi->leb_size;
return ubi_create_volume(ubi, req);
case UBI_IOCGETUBINUM:
*(u32 *)buf = ubi->ubi_num;
break;
};
return 0;

View File

@ -161,6 +161,8 @@
/* Re-name volumes */
#define UBI_IOCRNVOL _IOW(UBI_IOC_MAGIC, 3, struct ubi_rnvol_req)
#define UBI_IOCGETUBINUM _IOR(UBI_IOC_MAGIC, 32, __u32)
/* ioctl commands of the UBI control character device */
#define UBI_CTRL_IOC_MAGIC 'o'