modprobe and lists

Bernhard Fischer rep.nop at aon.at
Fri May 19 13:13:27 UTC 2006


On Fri, May 19, 2006 at 02:57:56PM +0200, Yann E. MORIN wrote:
>On Friday 19 May 2006 141, Bernhard Fischer wrote:
>> On Fri, May 19, 2006 at 01:35:02PM +0200, Yann E. MORIN wrote:
>> >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.
>
>OK, I'll (try to) do it.
>
>> Apart from modprobe, which other applet(s) need doubly-linked lists?
>
>No idea... :-/

at least editors/ed.c needs DLLIST too.
>
>> >2) "llist" stands for "linked list". Should we add reverse link to that type
>> >   or create "dllist" (standing fo "doubly-linked list") ?
>
>> 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);
>
>OK, I'll try something like that, with a config option in the menu:
>  Busybox Settings -> Busybox Library Tuning -> Support doubly linked lists
>
>CONFIG_DLLIST will:
>  - default to 'n'
>  - be visible only is CONFIG_BUILD_LIBBUSYBOX is set
>  - be select'ed by all applets that need it (for now CONFIG_MODPROBE)
>
>Then enclose code with USE_DLLIST( ... ).

Excellent, Thanks.



More information about the busybox mailing list