summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/eba.c
diff options
context:
space:
mode:
authorBoris Brezillon <boris.brezillon@free-electrons.com>2016-09-16 16:59:24 +0200
committerRichard Weinberger <richard@nod.at>2016-10-02 22:48:14 +0200
commit1f81a5ccaba51c8884db8f060b9f606c29db931d (patch)
tree1406f364990a4022f17c8b65b44141b23e15ab44 /drivers/mtd/ubi/eba.c
parent7554769641da272ea8821194c2efda08a11014b0 (diff)
downloadlinux-stable-1f81a5ccaba51c8884db8f060b9f606c29db931d.tar.gz
linux-stable-1f81a5ccaba51c8884db8f060b9f606c29db931d.tar.bz2
linux-stable-1f81a5ccaba51c8884db8f060b9f606c29db931d.zip
UBI: provide an helper to query LEB information
This is part of our attempt to hide EBA internals from other part of the implementation in order to easily adapt it to the MLC needs. Here we are creating an ubi_eba_leb_desc struct to hide the way we keep track of the LEB to PEB mapping. 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.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c
index 32045dd3d1db..f3ff8604b5e5 100644
--- a/drivers/mtd/ubi/eba.c
+++ b/drivers/mtd/ubi/eba.c
@@ -84,6 +84,23 @@ static int ubi_get_compat(const struct ubi_device *ubi, int vol_id)
}
/**
+ * ubi_eba_get_ldesc - get information about a LEB
+ * @vol: volume description object
+ * @lnum: logical eraseblock number
+ * @ldesc: the LEB descriptor to fill
+ *
+ * Used to query information about a specific LEB.
+ * It is currently only returning the physical position of the LEB, but will be
+ * extended to provide more information.
+ */
+void ubi_eba_get_ldesc(struct ubi_volume *vol, int lnum,
+ struct ubi_eba_leb_desc *ldesc)
+{
+ ldesc->lnum = lnum;
+ ldesc->pnum = vol->eba_tbl[lnum];
+}
+
+/**
* ltree_lookup - look up the lock tree.
* @ubi: UBI device description object
* @vol_id: volume ID