diff options
author | Boris Brezillon <boris.brezillon@free-electrons.com> | 2016-09-16 14:59:23 (GMT) |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2016-10-02 20:48:14 (GMT) |
commit | 7554769641da272ea8821194c2efda08a11014b0 (patch) | |
tree | b6d086adee9f4b35879e85e435e9585222193b5a /drivers/mtd/ubi/eba.c | |
parent | 9a5f09ac0ab83e4a965a24edd6cf7cb0303c6dc9 (diff) | |
download | linux-7554769641da272ea8821194c2efda08a11014b0.tar.xz |
UBI: provide an helper to check whether a LEB is mapped or not
This is part of the process of hiding UBI EBA's internal to other part of
the UBI implementation, so that we can add new information to the EBA
table without having to patch different places in the UBI code.
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'drivers/mtd/ubi/eba.c')
-rw-r--r-- | drivers/mtd/ubi/eba.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c index 180eb00..32045dd 100644 --- a/drivers/mtd/ubi/eba.c +++ b/drivers/mtd/ubi/eba.c @@ -312,6 +312,18 @@ static void leb_write_unlock(struct ubi_device *ubi, int vol_id, int lnum) } /** + * ubi_eba_is_mapped - check if a LEB is mapped. + * @vol: volume description object + * @lnum: logical eraseblock number + * + * This function returns true if the LEB is mapped, false otherwise. + */ +bool ubi_eba_is_mapped(struct ubi_volume *vol, int lnum) +{ + return vol->eba_tbl[lnum] >= 0; +} + +/** * ubi_eba_unmap_leb - un-map logical eraseblock. * @ubi: UBI device description object * @vol: volume description object |