diff options
author | Ingo Molnar <mingo@elte.hu> | 2006-03-25 01:41:10 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-03-25 01:41:10 -0800 |
commit | 9e19bb6d7a0959f5028d46e1ab99c50f0d36eda8 (patch) | |
tree | f6b3044e9bd57053f066f1dc087e1927d0088b43 /net | |
parent | cef2685e0053945ea0f3c02297386b040f486ea7 (diff) |
[NETFILTER] x_table.c: sem2mutex
Semaphore to mutex conversion.
The conversion was generated via scripts, and the result was validated
automatically via a script as well.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/netfilter/x_tables.c | 56 |
1 files changed, 29 insertions, 27 deletions
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c index 0a29a24d9a72..a657ab5394c3 100644 --- a/net/netfilter/x_tables.c +++ b/net/netfilter/x_tables.c @@ -21,10 +21,12 @@ #include <linux/seq_file.h> #include <linux/string.h> #include <linux/vmalloc.h> +#include <linux/mutex.h> #include <linux/netfilter/x_tables.h> #include <linux/netfilter_arp.h> + MODULE_LICENSE("GPL"); MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>"); MODULE_DESCRIPTION("[ip,ip6,arp]_tables backend module"); @@ -32,7 +34,7 @@ MODULE_DESCRIPTION("[ip,ip6,arp]_tables backend module"); #define SMP_ALIGN(x) (((x) + SMP_CACHE_BYTES-1) & ~(SMP_CACHE_BYTES-1)) struct xt_af { - struct semaphore mutex; + struct mutex mutex; struct list_head match; struct list_head target; struct list_head tables; @@ -64,11 +66,11 @@ xt_register_target(struct xt_target *target) { int ret, af = target->family; - ret = down_interruptible(&xt[af].mutex); + ret = mutex_lock_interruptible(&xt[af].mutex); if (ret != 0) return ret; list_add(&target->list, &xt[af].target); - up(&xt[af].mutex); + mutex_unlock(&xt[af].mutex); return ret; } EXPORT_SYMBOL(xt_register_target); @@ -78,9 +80,9 @@ xt_unregister_target(struct xt_target *target) { int af = target->family; - down(&xt[af].mutex); + mutex_lock(&xt[af].mutex); LIST_DELETE(&xt[af].target, target); - up(&xt[af].mutex); + mutex_unlock(&xt[af].mutex); } EXPORT_SYMBOL(xt_unregister_target); @@ -89,12 +91,12 @@ xt_register_match(struct xt_match *match) { int ret, af = match->family; - ret = down_interruptible(&xt[af].mutex); + ret = mutex_lock_interruptible(&xt[af].mutex); if (ret != 0) return ret; list_add(&match->list, &xt[af].match); - up(&xt[af].mutex); + mutex_unlock(&xt[af].mutex); return ret; } @@ -105,9 +107,9 @@ xt_unregister_match(struct xt_match *match) { int af = match->family; - down(&xt[af].mutex); + mutex_lock(&xt[af].mutex); LIST_DELETE(&xt[af].match, match); - up(&xt[af].mutex); + mutex_unlock(&xt[af].mutex); } EXPORT_SYMBOL(xt_unregister_match); @@ -124,21 +126,21 @@ struct xt_match *xt_find_match(int af, const char *name, u8 revision) struct xt_match *m; int err = 0; - if (down_interruptible(&xt[af].mutex) != 0) + if (mutex_lock_interruptible(&xt[af].mutex) != 0) return ERR_PTR(-EINTR); list_for_each_entry(m, &xt[af].match, list) { if (strcmp(m->name, name) == 0) { if (m->revision == revision) { if (try_module_get(m->me)) { - up(&xt[af].mutex); + mutex_unlock(&xt[af].mutex); return m; } } else err = -EPROTOTYPE; /* Found something. */ } } - up(&xt[af].mutex); + mutex_unlock(&xt[af].mutex); return ERR_PTR(err); } EXPORT_SYMBOL(xt_find_match); @@ -149,21 +151,21 @@ struct xt_target *xt_find_target(int af, const char *name, u8 revision) struct xt_target *t; int err = 0; - if (down_interruptible(&xt[af].mutex) != 0) + if (mutex_lock_interruptible(&xt[af].mutex) != 0) return ERR_PTR(-EINTR); list_for_each_entry(t, &xt[af].target, list) { if (strcmp(t->name, name) == 0) { if (t->revision == revision) { if (try_module_get(t->me)) { - up(&xt[af].mutex); + mutex_unlock(&xt[af].mutex); return t; } } else err = -EPROTOTYPE; /* Found something. */ } } - up(&xt[af].mutex); + mutex_unlock(&xt[af].mutex); return ERR_PTR(err); } EXPORT_SYMBOL(xt_find_target); @@ -218,7 +220,7 @@ int xt_find_revision(int af, const char *name, u8 revision, int target, { int have_rev, best = -1; - if (down_interruptible(&xt[af].mutex) != 0) { + if (mutex_lock_interruptible(&xt[af].mutex) != 0) { *err = -EINTR; return 1; } @@ -226,7 +228,7 @@ int xt_find_revision(int af, const char *name, u8 revision, int target, have_rev = target_revfn(af, name, revision, &best); else have_rev = match_revfn(af, name, revision, &best); - up(&xt[af].mutex); + mutex_unlock(&xt[af].mutex); /* Nothing at all? Return 0 to try loading module. */ if (best == -1) { @@ -352,20 +354,20 @@ struct xt_table *xt_find_table_lock(int af, const char *name) { struct xt_table *t; - if (down_interruptible(&xt[af].mutex) != 0) + if (mutex_lock_interruptible(&xt[af].mutex) != 0) return ERR_PTR(-EINTR); list_for_each_entry(t, &xt[af].tables, list) if (strcmp(t->name, name) == 0 && try_module_get(t->me)) return t; - up(&xt[af].mutex); + mutex_unlock(&xt[af].mutex); return NULL; } EXPORT_SYMBOL_GPL(xt_find_table_lock); void xt_table_unlock(struct xt_table *table) { - up(&xt[table->af].mutex); + mutex_unlock(&xt[table->af].mutex); } EXPORT_SYMBOL_GPL(xt_table_unlock); @@ -405,7 +407,7 @@ int xt_register_table(struct xt_table *table, int ret; struct xt_table_info *private; - ret = down_interruptible(&xt[table->af].mutex); + ret = mutex_lock_interruptible(&xt[table->af].mutex); if (ret != 0) return ret; @@ -431,7 +433,7 @@ int xt_register_table(struct xt_table *table, ret = 0; unlock: - up(&xt[table->af].mutex); + mutex_unlock(&xt[table->af].mutex); return ret; } EXPORT_SYMBOL_GPL(xt_register_table); @@ -440,10 +442,10 @@ void *xt_unregister_table(struct xt_table *table) { struct xt_table_info *private; - down(&xt[table->af].mutex); + mutex_lock(&xt[table->af].mutex); private = table->private; LIST_DELETE(&xt[table->af].tables, table); - up(&xt[table->af].mutex); + mutex_unlock(&xt[table->af].mutex); return private; } @@ -507,7 +509,7 @@ static void *xt_tgt_seq_start(struct seq_file *seq, loff_t *pos) if (!list) return NULL; - if (down_interruptible(&xt[af].mutex) != 0) + if (mutex_lock_interruptible(&xt[af].mutex) != 0) return NULL; return xt_get_idx(list, seq, *pos); @@ -536,7 +538,7 @@ static void xt_tgt_seq_stop(struct seq_file *seq, void *v) struct proc_dir_entry *pde = seq->private; u_int16_t af = (unsigned long)pde->data & 0xffff; - up(&xt[af].mutex); + mutex_unlock(&xt[af].mutex); } static int xt_name_seq_show(struct seq_file *seq, void *v) @@ -668,7 +670,7 @@ static int __init xt_init(void) return -ENOMEM; for (i = 0; i < NPROTO; i++) { - init_MUTEX(&xt[i].mutex); + mutex_init(&xt[i].mutex); INIT_LIST_HEAD(&xt[i].target); INIT_LIST_HEAD(&xt[i].match); INIT_LIST_HEAD(&xt[i].tables); |