Skip to content

Commit

Permalink
[NETFILTER]: kill listhelp.h
Browse files Browse the repository at this point in the history
Kill listhelp.h and use the list.h functions instead.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Patrick McHardy authored and David S. Miller committed Sep 22, 2006
1 parent 1bf38a3 commit df0933d
Show file tree
Hide file tree
Showing 15 changed files with 237 additions and 404 deletions.
4 changes: 0 additions & 4 deletions include/linux/netfilter/x_tables.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,6 @@ struct xt_counters_info

#include <linux/netdevice.h>

#define ASSERT_READ_LOCK(x)
#define ASSERT_WRITE_LOCK(x)
#include <linux/netfilter_ipv4/listhelp.h>

#ifdef CONFIG_COMPAT
#define COMPAT_TO_USER 1
#define COMPAT_FROM_USER -1
Expand Down
123 changes: 0 additions & 123 deletions include/linux/netfilter_ipv4/listhelp.h

This file was deleted.

76 changes: 45 additions & 31 deletions net/bridge/netfilter/ebtables.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,14 @@
#include <linux/vmalloc.h>
#include <linux/netfilter_bridge/ebtables.h>
#include <linux/spinlock.h>
#include <linux/mutex.h>
#include <asm/uaccess.h>
#include <linux/smp.h>
#include <linux/cpumask.h>
#include <net/sock.h>
/* needed for logical [in,out]-dev filtering */
#include "../br_private.h"

/* list_named_find */
#define ASSERT_READ_LOCK(x)
#define ASSERT_WRITE_LOCK(x)
#include <linux/netfilter_ipv4/listhelp.h>
#include <linux/mutex.h>

#define BUGPRINT(format, args...) printk("kernel msg: ebtables bug: please "\
"report to author: "format, ## args)
/* #define BUGPRINT(format, args...) */
Expand Down Expand Up @@ -278,18 +273,22 @@ static inline void *
find_inlist_lock_noload(struct list_head *head, const char *name, int *error,
struct mutex *mutex)
{
void *ret;
struct {
struct list_head list;
char name[EBT_FUNCTION_MAXNAMELEN];
} *e;

*error = mutex_lock_interruptible(mutex);
if (*error != 0)
return NULL;

ret = list_named_find(head, name);
if (!ret) {
*error = -ENOENT;
mutex_unlock(mutex);
list_for_each_entry(e, head, list) {
if (strcmp(e->name, name) == 0)
return e;
}
return ret;
*error = -ENOENT;
mutex_unlock(mutex);
return NULL;
}

#ifndef CONFIG_KMOD
Expand Down Expand Up @@ -1043,15 +1042,19 @@ static int do_replace(void __user *user, unsigned int len)

int ebt_register_target(struct ebt_target *target)
{
struct ebt_target *t;
int ret;

ret = mutex_lock_interruptible(&ebt_mutex);
if (ret != 0)
return ret;
if (!list_named_insert(&ebt_targets, target)) {
mutex_unlock(&ebt_mutex);
return -EEXIST;
list_for_each_entry(t, &ebt_targets, list) {
if (strcmp(t->name, target->name) == 0) {
mutex_unlock(&ebt_mutex);
return -EEXIST;
}
}
list_add(&target->list, &ebt_targets);
mutex_unlock(&ebt_mutex);

return 0;
Expand All @@ -1060,21 +1063,25 @@ int ebt_register_target(struct ebt_target *target)
void ebt_unregister_target(struct ebt_target *target)
{
mutex_lock(&ebt_mutex);
LIST_DELETE(&ebt_targets, target);
list_del(&target->list);
mutex_unlock(&ebt_mutex);
}

int ebt_register_match(struct ebt_match *match)
{
struct ebt_match *m;
int ret;

ret = mutex_lock_interruptible(&ebt_mutex);
if (ret != 0)
return ret;
if (!list_named_insert(&ebt_matches, match)) {
mutex_unlock(&ebt_mutex);
return -EEXIST;
list_for_each_entry(m, &ebt_matches, list) {
if (strcmp(m->name, match->name) == 0) {
mutex_unlock(&ebt_mutex);
return -EEXIST;
}
}
list_add(&match->list, &ebt_matches);
mutex_unlock(&ebt_mutex);

return 0;
Expand All @@ -1083,21 +1090,25 @@ int ebt_register_match(struct ebt_match *match)
void ebt_unregister_match(struct ebt_match *match)
{
mutex_lock(&ebt_mutex);
LIST_DELETE(&ebt_matches, match);
list_del(&match->list);
mutex_unlock(&ebt_mutex);
}

int ebt_register_watcher(struct ebt_watcher *watcher)
{
struct ebt_watcher *w;
int ret;

ret = mutex_lock_interruptible(&ebt_mutex);
if (ret != 0)
return ret;
if (!list_named_insert(&ebt_watchers, watcher)) {
mutex_unlock(&ebt_mutex);
return -EEXIST;
list_for_each_entry(w, &ebt_watchers, list) {
if (strcmp(w->name, watcher->name) == 0) {
mutex_unlock(&ebt_mutex);
return -EEXIST;
}
}
list_add(&watcher->list, &ebt_watchers);
mutex_unlock(&ebt_mutex);

return 0;
Expand All @@ -1106,13 +1117,14 @@ int ebt_register_watcher(struct ebt_watcher *watcher)
void ebt_unregister_watcher(struct ebt_watcher *watcher)
{
mutex_lock(&ebt_mutex);
LIST_DELETE(&ebt_watchers, watcher);
list_del(&watcher->list);
mutex_unlock(&ebt_mutex);
}

int ebt_register_table(struct ebt_table *table)
{
struct ebt_table_info *newinfo;
struct ebt_table *t;
int ret, i, countersize;

if (!table || !table->table ||!table->table->entries ||
Expand Down Expand Up @@ -1158,18 +1170,20 @@ int ebt_register_table(struct ebt_table *table)
if (ret != 0)
goto free_chainstack;

if (list_named_find(&ebt_tables, table->name)) {
ret = -EEXIST;
BUGPRINT("Table name already exists\n");
goto free_unlock;
list_for_each_entry(t, &ebt_tables, list) {
if (strcmp(t->name, table->name) == 0) {
ret = -EEXIST;
BUGPRINT("Table name already exists\n");
goto free_unlock;
}
}

/* Hold a reference count if the chains aren't empty */
if (newinfo->nentries && !try_module_get(table->me)) {
ret = -ENOENT;
goto free_unlock;
}
list_prepend(&ebt_tables, table);
list_add(&table->list, &ebt_tables);
mutex_unlock(&ebt_mutex);
return 0;
free_unlock:
Expand All @@ -1195,7 +1209,7 @@ void ebt_unregister_table(struct ebt_table *table)
return;
}
mutex_lock(&ebt_mutex);
LIST_DELETE(&ebt_tables, table);
list_del(&table->list);
mutex_unlock(&ebt_mutex);
vfree(table->private->entries);
if (table->private->chainstack) {
Expand Down Expand Up @@ -1465,7 +1479,7 @@ static int __init ebtables_init(void)
int ret;

mutex_lock(&ebt_mutex);
list_named_insert(&ebt_targets, &ebt_standard_target);
list_add(&ebt_standard_target.list, &ebt_targets);
mutex_unlock(&ebt_mutex);
if ((ret = nf_register_sockopt(&ebt_sockopts)) < 0)
return ret;
Expand Down
2 changes: 0 additions & 2 deletions net/ipv4/netfilter/arp_tables.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ do { \
#define ARP_NF_ASSERT(x)
#endif

#include <linux/netfilter_ipv4/listhelp.h>

static inline int arp_devaddr_compare(const struct arpt_devaddr_info *ap,
char *hdr_addr, int len)
{
Expand Down
Loading

0 comments on commit df0933d

Please sign in to comment.