Message ID | 1417349988-9238-3-git-send-email-richard@nod.at |
---|---|
State | Accepted |
Headers | show |
On Sun, Nov 30, 2014 at 10:19 AM, Richard Weinberger <richard@nod.at> wrote: > +/* > + * ubi_for_each_free_peb - walk the UBI free RB tree. > + * @ubi: UBI device description object > + * @e: a pointer to a ubi_wl_entry to use as cursor > + * @pos: a pointer to RB-tree entry type to use as a loop counter tmp_rb instead? > + */ > +#define ubi_for_each_free_peb(ubi, e, tmp_rb) \ > + ubi_rb_for_each_entry((tmp_rb), (e), &(ubi)->free, u.rb) > + > +/* > + * ubi_for_each_used_peb - walk the UBI used RB tree. > + * @ubi: UBI device description object > + * @e: a pointer to a ubi_wl_entry to use as cursor > + * @pos: a pointer to RB-tree entry type to use as a loop counter > + */ tmp_rb instead? > +#define ubi_for_each_used_peb(ubi, e, tmp_rb) \
Am 30.11.2014 um 15:55 schrieb Fabio Estevam: > On Sun, Nov 30, 2014 at 10:19 AM, Richard Weinberger <richard@nod.at> wrote: > >> +/* >> + * ubi_for_each_free_peb - walk the UBI free RB tree. >> + * @ubi: UBI device description object >> + * @e: a pointer to a ubi_wl_entry to use as cursor >> + * @pos: a pointer to RB-tree entry type to use as a loop counter > > tmp_rb instead? > >> + */ >> +#define ubi_for_each_free_peb(ubi, e, tmp_rb) \ >> + ubi_rb_for_each_entry((tmp_rb), (e), &(ubi)->free, u.rb) >> + >> +/* >> + * ubi_for_each_used_peb - walk the UBI used RB tree. >> + * @ubi: UBI device description object >> + * @e: a pointer to a ubi_wl_entry to use as cursor >> + * @pos: a pointer to RB-tree entry type to use as a loop counter >> + */ > > tmp_rb instead? Correct. I need a generator script for such stuff. :) Thanks, //richard
diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h index d3ad165..4fe33fe 100644 --- a/drivers/mtd/ubi/ubi.h +++ b/drivers/mtd/ubi/ubi.h @@ -897,6 +897,42 @@ static inline int ubiblock_remove(struct ubi_volume_info *vi) } #endif +/* + * ubi_for_each_free_peb - walk the UBI free RB tree. + * @ubi: UBI device description object + * @e: a pointer to a ubi_wl_entry to use as cursor + * @pos: a pointer to RB-tree entry type to use as a loop counter + */ +#define ubi_for_each_free_peb(ubi, e, tmp_rb) \ + ubi_rb_for_each_entry((tmp_rb), (e), &(ubi)->free, u.rb) + +/* + * ubi_for_each_used_peb - walk the UBI used RB tree. + * @ubi: UBI device description object + * @e: a pointer to a ubi_wl_entry to use as cursor + * @pos: a pointer to RB-tree entry type to use as a loop counter + */ +#define ubi_for_each_used_peb(ubi, e, tmp_rb) \ + ubi_rb_for_each_entry((tmp_rb), (e), &(ubi)->used, u.rb) + +/* + * ubi_for_each_scub_peb - walk the UBI scub RB tree. + * @ubi: UBI device description object + * @e: a pointer to a ubi_wl_entry to use as cursor + * @pos: a pointer to RB-tree entry type to use as a loop counter + */ +#define ubi_for_each_scrub_peb(ubi, e, tmp_rb) \ + ubi_rb_for_each_entry((tmp_rb), (e), &(ubi)->scrub, u.rb) + +/* + * ubi_for_each_protected_peb - walk the UBI protection queue. + * @ubi: UBI device description object + * @i: a integer used as counter + * @e: a pointer to a ubi_wl_entry to use as cursor + */ +#define ubi_for_each_protected_peb(ubi, i, e) \ + for ((i) = 0; (i) < UBI_PROT_QUEUE_LEN; (i)++) \ + list_for_each_entry((e), &(ubi->pq[(i)]), u.list) /* * ubi_rb_for_each_entry - walk an RB-tree.
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> --- drivers/mtd/ubi/ubi.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)