Skip to contentSkip to conversation

Fix LIST_INSERT breakage

PATCH In review Phil Oester 2 participants 3 messages Mar 24, 2004 – Mar 28, 2004 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix LIST_INSERT breakage

In 2.4.25, this patch was included:

http://linux.bkbits.net:8080/linux-2.4/cset@3fcc5cc99cChx6Q0shnhIlekWT1-5Q?nav=index.html|ChangeSet@-4M

which has a questionable change in LIST_INSERT due to the disappearing cmpfn. But it appears this macro is unused anywhere in the tree, so perhaps removing it is better than fixing it?

Phil Oester

linux/netfilter_ipv4/listhelp.h 2004-03-23 20:01:09.603032216 -0500 renamed from linux/netfilter_ipv4/listhelp.h-orig 2004-03-23 19:57:00.696775216 -0500 +0 -11
@@ -89,17 +89,6 @@
        list_add(new, head);
 }
 
-/* Insert according to ordering function; insert before first true. */
-#define LIST_INSERT(head, new, cmpfn)                          \
-do {                                                           \
-       struct list_head *__i;                                  \
-       ASSERT_WRITE_LOCK(head);                                \
-       list_for_each(__i, (head))                              \
-               if ((new), (typeof (new))__i)                   \
-                       break;                                  \
-       list_add((struct list_head *)(new), __i->prev);         \
-} while(0)
-
 /* If the field after the list_head is a nul-terminated string, you
    can use these functions. */
 static inline int __list_cmp_name(const void *i, const char *name)
#1 lore raw
Quoted 6 lines · Phil Oester

In 2.4.25, this patch was included:

http://linux.bkbits.net:8080/linux-2.4/cset@3fcc5cc99cChx6Q0shnhIlekWT1-5Q?nav=index.html|ChangeSet@-4M

which has a questionable change in LIST_INSERT due to the disappearing cmpfn.

Could you be more specific about your objections against that changeset?

Quoted 2 lines

But it appears this macro is unused anywhere in the tree, so perhaps removing it is better than fixing it?

mh, we also don't use it in patch-o-matic-ng. So we could remove it, true.

Quoted 1 line

Phil Oester

Signature · 5 lines
- Harald Welte <[email protected]>             http://www.netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie
#2 lore raw

LIST_INSERT takes a 'cmpfn' argument, and is used pre-change:

- for (__i = (head)->next; \
- !cmpfn((new), (typeof (new))__i) && __i != (head); \
- __i = __i->next); \

but not post-change:

+ list_for_each(__i, (head)) \
+ if ((new), (typeof (new))__i) \ <---
+ break; \

'if (cmpfn((new), ......' is probably what was intended?

But either way, it is unused and thus moot.

Phil

Quoted 9 lines · Harald Welte
Quoted 6 lines · Phil Oester

In 2.4.25, this patch was included:

http://linux.bkbits.net:8080/linux-2.4/cset@3fcc5cc99cChx6Q0shnhIlekWT1-5Q?nav=index.html|ChangeSet@-4M

which has a questionable change in LIST_INSERT due to the disappearing cmpfn.

Could you be more specific about your objections against that changeset?