aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/ubi.h
diff options
context:
space:
mode:
authorRichard Weinberger <richard@nod.at>2014-10-28 11:18:42 -0400
committerRichard Weinberger <richard@nod.at>2015-03-26 17:47:35 -0400
commit23c482ef7b7611225f70efe46a3627b889cab1a4 (patch)
treebbefe1ebcbce164bcf7620c7b49861b793e39b0b /drivers/mtd/ubi/ubi.h
parent78d6d497a648cc04ae26b27af1e01ce3e41a9c72 (diff)
UBI: Add accessor functions for WL data structures
Fastmap need access to various WL data structures as fastmap tightly depends on WL. To make the access less invasive add accessor functions. Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'drivers/mtd/ubi/ubi.h')
-rw-r--r--drivers/mtd/ubi/ubi.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h
index adc633cb89c3..3d58c749f9f1 100644
--- a/drivers/mtd/ubi/ubi.h
+++ b/drivers/mtd/ubi/ubi.h
@@ -904,6 +904,42 @@ static inline int ubiblock_remove(struct ubi_volume_info *vi)
904} 904}
905#endif 905#endif
906 906
907/*
908 * ubi_for_each_free_peb - walk the UBI free RB tree.
909 * @ubi: UBI device description object
910 * @e: a pointer to a ubi_wl_entry to use as cursor
911 * @pos: a pointer to RB-tree entry type to use as a loop counter
912 */
913#define ubi_for_each_free_peb(ubi, e, tmp_rb) \
914 ubi_rb_for_each_entry((tmp_rb), (e), &(ubi)->free, u.rb)
915
916/*
917 * ubi_for_each_used_peb - walk the UBI used RB tree.
918 * @ubi: UBI device description object
919 * @e: a pointer to a ubi_wl_entry to use as cursor
920 * @pos: a pointer to RB-tree entry type to use as a loop counter
921 */
922#define ubi_for_each_used_peb(ubi, e, tmp_rb) \
923 ubi_rb_for_each_entry((tmp_rb), (e), &(ubi)->used, u.rb)
924
925/*
926 * ubi_for_each_scub_peb - walk the UBI scub RB tree.
927 * @ubi: UBI device description object
928 * @e: a pointer to a ubi_wl_entry to use as cursor
929 * @pos: a pointer to RB-tree entry type to use as a loop counter
930 */
931#define ubi_for_each_scrub_peb(ubi, e, tmp_rb) \
932 ubi_rb_for_each_entry((tmp_rb), (e), &(ubi)->scrub, u.rb)
933
934/*
935 * ubi_for_each_protected_peb - walk the UBI protection queue.
936 * @ubi: UBI device description object
937 * @i: a integer used as counter
938 * @e: a pointer to a ubi_wl_entry to use as cursor
939 */
940#define ubi_for_each_protected_peb(ubi, i, e) \
941 for ((i) = 0; (i) < UBI_PROT_QUEUE_LEN; (i)++) \
942 list_for_each_entry((e), &(ubi->pq[(i)]), u.list)
907 943
908/* 944/*
909 * ubi_rb_for_each_entry - walk an RB-tree. 945 * ubi_rb_for_each_entry - walk an RB-tree.