mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 03:36:19 +00:00
mtd: add OOB ioctls for >4GiB devices
Signed-off-by: Kevin Cernekee <kpc.mtd@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
This commit is contained in:
parent
9771854040
commit
aea7cea9fa
3 changed files with 39 additions and 0 deletions
|
@ -607,6 +607,34 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case MEMWRITEOOB64:
|
||||||
|
{
|
||||||
|
struct mtd_oob_buf64 buf;
|
||||||
|
struct mtd_oob_buf64 __user *buf_user = argp;
|
||||||
|
|
||||||
|
if (copy_from_user(&buf, argp, sizeof(buf)))
|
||||||
|
ret = -EFAULT;
|
||||||
|
else
|
||||||
|
ret = mtd_do_writeoob(file, mtd, buf.start, buf.length,
|
||||||
|
(void __user *)(uintptr_t)buf.usr_ptr,
|
||||||
|
&buf_user->length);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case MEMREADOOB64:
|
||||||
|
{
|
||||||
|
struct mtd_oob_buf64 buf;
|
||||||
|
struct mtd_oob_buf64 __user *buf_user = argp;
|
||||||
|
|
||||||
|
if (copy_from_user(&buf, argp, sizeof(buf)))
|
||||||
|
ret = -EFAULT;
|
||||||
|
else
|
||||||
|
ret = mtd_do_readoob(mtd, buf.start, buf.length,
|
||||||
|
(void __user *)(uintptr_t)buf.usr_ptr,
|
||||||
|
&buf_user->length);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case MEMLOCK:
|
case MEMLOCK:
|
||||||
{
|
{
|
||||||
struct erase_info_user einfo;
|
struct erase_info_user einfo;
|
||||||
|
|
|
@ -2411,6 +2411,8 @@ COMPATIBLE_IOCTL(ECCGETLAYOUT)
|
||||||
COMPATIBLE_IOCTL(ECCGETSTATS)
|
COMPATIBLE_IOCTL(ECCGETSTATS)
|
||||||
COMPATIBLE_IOCTL(MTDFILEMODE)
|
COMPATIBLE_IOCTL(MTDFILEMODE)
|
||||||
COMPATIBLE_IOCTL(MEMERASE64)
|
COMPATIBLE_IOCTL(MEMERASE64)
|
||||||
|
COMPATIBLE_IOCTL(MEMREADOOB64)
|
||||||
|
COMPATIBLE_IOCTL(MEMWRITEOOB64)
|
||||||
/* NBD */
|
/* NBD */
|
||||||
ULONG_IOCTL(NBD_SET_SOCK)
|
ULONG_IOCTL(NBD_SET_SOCK)
|
||||||
ULONG_IOCTL(NBD_SET_BLKSIZE)
|
ULONG_IOCTL(NBD_SET_BLKSIZE)
|
||||||
|
|
|
@ -23,6 +23,13 @@ struct mtd_oob_buf {
|
||||||
unsigned char __user *ptr;
|
unsigned char __user *ptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct mtd_oob_buf64 {
|
||||||
|
__u64 start;
|
||||||
|
__u32 pad;
|
||||||
|
__u32 length;
|
||||||
|
__u64 usr_ptr;
|
||||||
|
};
|
||||||
|
|
||||||
#define MTD_ABSENT 0
|
#define MTD_ABSENT 0
|
||||||
#define MTD_RAM 1
|
#define MTD_RAM 1
|
||||||
#define MTD_ROM 2
|
#define MTD_ROM 2
|
||||||
|
@ -101,6 +108,8 @@ struct otp_info {
|
||||||
#define ECCGETSTATS _IOR('M', 18, struct mtd_ecc_stats)
|
#define ECCGETSTATS _IOR('M', 18, struct mtd_ecc_stats)
|
||||||
#define MTDFILEMODE _IO('M', 19)
|
#define MTDFILEMODE _IO('M', 19)
|
||||||
#define MEMERASE64 _IOW('M', 20, struct erase_info_user64)
|
#define MEMERASE64 _IOW('M', 20, struct erase_info_user64)
|
||||||
|
#define MEMWRITEOOB64 _IOWR('M', 21, struct mtd_oob_buf64)
|
||||||
|
#define MEMREADOOB64 _IOWR('M', 22, struct mtd_oob_buf64)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Obsolete legacy interface. Keep it in order not to break userspace
|
* Obsolete legacy interface. Keep it in order not to break userspace
|
||||||
|
|
Loading…
Reference in a new issue