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>
This commit is contained in:

committed by
David Woodhouse

父節點
1df620637f
當前提交
9938424f0c
@@ -264,6 +264,14 @@ static int part_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
|
||||
return part->master->unlock(part->master, ofs + part->offset, len);
|
||||
}
|
||||
|
||||
static int part_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len)
|
||||
{
|
||||
struct mtd_part *part = PART(mtd);
|
||||
if ((len + ofs) > mtd->size)
|
||||
return -EINVAL;
|
||||
return part->master->is_locked(part->master, ofs + part->offset, len);
|
||||
}
|
||||
|
||||
static void part_sync(struct mtd_info *mtd)
|
||||
{
|
||||
struct mtd_part *part = PART(mtd);
|
||||
@@ -402,6 +410,8 @@ static struct mtd_part *add_one_partition(struct mtd_info *master,
|
||||
slave->mtd.lock = part_lock;
|
||||
if (master->unlock)
|
||||
slave->mtd.unlock = part_unlock;
|
||||
if (master->is_locked)
|
||||
slave->mtd.is_locked = part_is_locked;
|
||||
if (master->block_isbad)
|
||||
slave->mtd.block_isbad = part_block_isbad;
|
||||
if (master->block_markbad)
|
||||
|
Reference in New Issue
Block a user