Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 153774
b: refs/heads/master
c: 0dc54e9
h: refs/heads/master
v: v3
  • Loading branch information
Kevin Cernekee authored and David Woodhouse committed May 29, 2009
1 parent d65c791 commit f77ec53
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 19fe7f1a00023d2aa97617655b7ea56eb72f4db8
refs/heads/master: 0dc54e9f33e2fbcea28356bc2c8c931cb307d3b3
29 changes: 21 additions & 8 deletions trunk/drivers/mtd/mtdchar.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
break;

case MEMERASE:
case MEMERASE64:
{
struct erase_info *erase;

Expand All @@ -427,20 +428,32 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
if (!erase)
ret = -ENOMEM;
else {
struct erase_info_user einfo;

wait_queue_head_t waitq;
DECLARE_WAITQUEUE(wait, current);

init_waitqueue_head(&waitq);

if (copy_from_user(&einfo, argp,
sizeof(struct erase_info_user))) {
kfree(erase);
return -EFAULT;
if (cmd == MEMERASE64) {
struct erase_info_user64 einfo64;

if (copy_from_user(&einfo64, argp,
sizeof(struct erase_info_user64))) {
kfree(erase);
return -EFAULT;
}
erase->addr = einfo64.start;
erase->len = einfo64.length;
} else {
struct erase_info_user einfo32;

if (copy_from_user(&einfo32, argp,
sizeof(struct erase_info_user))) {
kfree(erase);
return -EFAULT;
}
erase->addr = einfo32.start;
erase->len = einfo32.length;
}
erase->addr = einfo.start;
erase->len = einfo.length;
erase->mtd = mtd;
erase->callback = mtdchar_erase_callback;
erase->priv = (unsigned long)&waitq;
Expand Down
1 change: 1 addition & 0 deletions trunk/fs/compat_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2441,6 +2441,7 @@ COMPATIBLE_IOCTL(MEMGETREGIONCOUNT)
COMPATIBLE_IOCTL(MEMGETREGIONINFO)
COMPATIBLE_IOCTL(MEMGETBADBLOCK)
COMPATIBLE_IOCTL(MEMSETBADBLOCK)
COMPATIBLE_IOCTL(MEMERASE64)
/* NBD */
ULONG_IOCTL(NBD_SET_SOCK)
ULONG_IOCTL(NBD_SET_BLKSIZE)
Expand Down
6 changes: 6 additions & 0 deletions trunk/include/mtd/mtd-abi.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ struct erase_info_user {
__u32 length;
};

struct erase_info_user64 {
__u64 start;
__u64 length;
};

struct mtd_oob_buf {
__u32 start;
__u32 length;
Expand Down Expand Up @@ -95,6 +100,7 @@ struct otp_info {
#define ECCGETLAYOUT _IOR('M', 17, struct nand_ecclayout)
#define ECCGETSTATS _IOR('M', 18, struct mtd_ecc_stats)
#define MTDFILEMODE _IO('M', 19)
#define MEMERASE64 _IOW('M', 20, struct erase_info_user64)

/*
* Obsolete legacy interface. Keep it in order not to break userspace
Expand Down

0 comments on commit f77ec53

Please sign in to comment.