modprobe and lists
Michael S. Zick
mszick at morethan.org
Fri May 19 13:20:41 UTC 2006
On Fri May 19 2006 07:12, Bernhard Fischer wrote:
> On Fri, May 19, 2006 at 01:35:02PM +0200, Yann E. MORIN wrote:
> >Hello all!
> >
> >modprobe is making use of lists, both single- and double-linked lists.
> >Currently, modprobe is implementing is own list management, when we have
> >(at least) single-linked list management in libbb.
> >
> >1) Would it be desireable that libbb implements both lists?
>
> I tend to think having both in libbb is worthwhile.
>
> Apart from modprobe, which other applet(s) need doubly-linked lists?
>
>
> >2) "llist" stands for "linked list". Should we add reverse link to that type
> > or create "dllist" (standing fo "doubly-linked list") ?
>
The choices are un-directional or bi-directional; single or double link; lists
A single linked, bi-directional list does not have a "next" or "previous" its
only "link" is both next and previous.
In tight memory situations that need a bi-directional, linked list; the
bi-directional, single-linked, list will save you an entry per element.
> What about
> Index: include/libbb.h
> ===================================================================
> --- include/libbb.h (revision 15121)
> +++ include/libbb.h (working copy)
> @@ -473,7 +473,10 @@
>
> typedef struct llist_s {
> char *data;
> - struct llist_s *link;
> + struct llist_s *next;
> +#ifdef __NEED_DLLIST
> + struct llist_s *prev;
> +#endif
> } llist_t;
> extern llist_t *llist_add_to(llist_t *old_head, char *new_item);
> extern llist_t *llist_add_to_end(llist_t *list_head, char *data);
>
> >
> >Once these two questions are answered, I'll code that, and submit a libbb
> >patch.
> >
> >Next, I'll work these lists into modprobe, and submit a patch.
Mike
More information about the busybox
mailing list