diff options
author | Richard Cochran <richardcochran@gmail.com> | 2010-06-14 18:10:33 +0200 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2010-08-02 10:03:41 +0200 |
commit | 9938424f0c4d208883cbf32083ec2bfcc220f85b (patch) | |
tree | e4f7581c7543673fe63c98f9804e934a77aeb7ef /drivers/mtd/mtdchar.c | |
parent | mtd: denali: add Kconfig dependency (diff) | |
download | linux-9938424f0c4d208883cbf32083ec2bfcc220f85b.tar.xz linux-9938424f0c4d208883cbf32083ec2bfcc220f85b.zip |
mtd: add an ioctl to query the lock status of a flash sector
This patchs adds a way for user space programs to find out whether a
flash sector is locked. An optional driver method in the mtd_info struct
provides the information.
Signed-off-by: Richard Cochran <richard.cochran@omicron.at>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/mtdchar.c')
-rw-r--r-- | drivers/mtd/mtdchar.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c index 8b223c0343ee..a8e69dd2b2e4 100644 --- a/drivers/mtd/mtdchar.c +++ b/drivers/mtd/mtdchar.c @@ -676,6 +676,20 @@ static int mtd_ioctl(struct inode *inode, struct file *file, break; } + case MEMISLOCKED: + { + struct erase_info_user einfo; + + if (copy_from_user(&einfo, argp, sizeof(einfo))) + return -EFAULT; + + if (!mtd->is_locked) + ret = -EOPNOTSUPP; + else + ret = mtd->is_locked(mtd, einfo.start, einfo.length); + break; + } + /* Legacy interface */ case MEMGETOOBSEL: { |