Commit e92ad99c authored by Patrick McHardy's avatar Patrick McHardy Committed by David S. Miller

[NETFILTER]: nf_log: minor cleanups

- rename nf_logging to nf_loggers since its an array of registered loggers

- rename nf_log_unregister_logger() to nf_log_unregister() to make it
  symetrical to nf_log_register() and convert all users
Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9b73534d
...@@ -172,8 +172,8 @@ struct nf_logger { ...@@ -172,8 +172,8 @@ struct nf_logger {
/* Function to register/unregister log function. */ /* Function to register/unregister log function. */
int nf_log_register(int pf, struct nf_logger *logger); int nf_log_register(int pf, struct nf_logger *logger);
void nf_log_unregister(struct nf_logger *logger);
void nf_log_unregister_pf(int pf); void nf_log_unregister_pf(int pf);
void nf_log_unregister_logger(struct nf_logger *logger);
/* Calls the registered backend logging function */ /* Calls the registered backend logging function */
void nf_log_packet(int pf, void nf_log_packet(int pf,
......
...@@ -208,7 +208,7 @@ static int __init ebt_log_init(void) ...@@ -208,7 +208,7 @@ static int __init ebt_log_init(void)
static void __exit ebt_log_fini(void) static void __exit ebt_log_fini(void)
{ {
nf_log_unregister_logger(&ebt_log_logger); nf_log_unregister(&ebt_log_logger);
ebt_unregister_watcher(&log); ebt_unregister_watcher(&log);
} }
......
...@@ -323,7 +323,7 @@ static void __exit ebt_ulog_fini(void) ...@@ -323,7 +323,7 @@ static void __exit ebt_ulog_fini(void)
ebt_ulog_buff_t *ub; ebt_ulog_buff_t *ub;
int i; int i;
nf_log_unregister_logger(&ebt_ulog_logger); nf_log_unregister(&ebt_ulog_logger);
ebt_unregister_watcher(&ulog); ebt_unregister_watcher(&ulog);
for (i = 0; i < EBT_ULOG_MAXNLGROUPS; i++) { for (i = 0; i < EBT_ULOG_MAXNLGROUPS; i++) {
ub = &ulog_buffers[i]; ub = &ulog_buffers[i];
......
...@@ -489,7 +489,7 @@ static int __init ipt_log_init(void) ...@@ -489,7 +489,7 @@ static int __init ipt_log_init(void)
static void __exit ipt_log_fini(void) static void __exit ipt_log_fini(void)
{ {
nf_log_unregister_logger(&ipt_log_logger); nf_log_unregister(&ipt_log_logger);
xt_unregister_target(&ipt_log_reg); xt_unregister_target(&ipt_log_reg);
} }
......
...@@ -419,7 +419,7 @@ static void __exit ipt_ulog_fini(void) ...@@ -419,7 +419,7 @@ static void __exit ipt_ulog_fini(void)
DEBUGP("ipt_ULOG: cleanup_module\n"); DEBUGP("ipt_ULOG: cleanup_module\n");
if (nflog) if (nflog)
nf_log_unregister_logger(&ipt_ulog_logger); nf_log_unregister(&ipt_ulog_logger);
xt_unregister_target(&ipt_ulog_reg); xt_unregister_target(&ipt_ulog_reg);
sock_release(nflognl->sk_socket); sock_release(nflognl->sk_socket);
......
...@@ -501,7 +501,7 @@ static int __init ip6t_log_init(void) ...@@ -501,7 +501,7 @@ static int __init ip6t_log_init(void)
static void __exit ip6t_log_fini(void) static void __exit ip6t_log_fini(void)
{ {
nf_log_unregister_logger(&ip6t_logger); nf_log_unregister(&ip6t_logger);
xt_unregister_target(&ip6t_log_reg); xt_unregister_target(&ip6t_log_reg);
} }
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#define NF_LOG_PREFIXLEN 128 #define NF_LOG_PREFIXLEN 128
static struct nf_logger *nf_logging[NPROTO]; /* = NULL */ static struct nf_logger *nf_loggers[NPROTO];
static DEFINE_MUTEX(nf_log_mutex); static DEFINE_MUTEX(nf_log_mutex);
/* return EBUSY if somebody else is registered, EEXIST if the same logger /* return EBUSY if somebody else is registered, EEXIST if the same logger
...@@ -32,9 +32,9 @@ int nf_log_register(int pf, struct nf_logger *logger) ...@@ -32,9 +32,9 @@ int nf_log_register(int pf, struct nf_logger *logger)
if (ret < 0) if (ret < 0)
return ret; return ret;
if (!nf_logging[pf]) if (!nf_loggers[pf])
rcu_assign_pointer(nf_logging[pf], logger); rcu_assign_pointer(nf_loggers[pf], logger);
else if (nf_logging[pf] == logger) else if (nf_loggers[pf] == logger)
ret = -EEXIST; ret = -EEXIST;
else else
ret = -EBUSY; ret = -EBUSY;
...@@ -49,7 +49,7 @@ void nf_log_unregister_pf(int pf) ...@@ -49,7 +49,7 @@ void nf_log_unregister_pf(int pf)
if (pf >= NPROTO) if (pf >= NPROTO)
return; return;
mutex_lock(&nf_log_mutex); mutex_lock(&nf_log_mutex);
rcu_assign_pointer(nf_logging[pf], NULL); rcu_assign_pointer(nf_loggers[pf], NULL);
mutex_unlock(&nf_log_mutex); mutex_unlock(&nf_log_mutex);
/* Give time to concurrent readers. */ /* Give time to concurrent readers. */
...@@ -57,20 +57,20 @@ void nf_log_unregister_pf(int pf) ...@@ -57,20 +57,20 @@ void nf_log_unregister_pf(int pf)
} }
EXPORT_SYMBOL(nf_log_unregister_pf); EXPORT_SYMBOL(nf_log_unregister_pf);
void nf_log_unregister_logger(struct nf_logger *logger) void nf_log_unregister(struct nf_logger *logger)
{ {
int i; int i;
mutex_lock(&nf_log_mutex); mutex_lock(&nf_log_mutex);
for (i = 0; i < NPROTO; i++) { for (i = 0; i < NPROTO; i++) {
if (nf_logging[i] == logger) if (nf_loggers[i] == logger)
rcu_assign_pointer(nf_logging[i], NULL); rcu_assign_pointer(nf_loggers[i], NULL);
} }
mutex_unlock(&nf_log_mutex); mutex_unlock(&nf_log_mutex);
synchronize_rcu(); synchronize_rcu();
} }
EXPORT_SYMBOL(nf_log_unregister_logger); EXPORT_SYMBOL(nf_log_unregister);
void nf_log_packet(int pf, void nf_log_packet(int pf,
unsigned int hooknum, unsigned int hooknum,
...@@ -85,7 +85,7 @@ void nf_log_packet(int pf, ...@@ -85,7 +85,7 @@ void nf_log_packet(int pf,
struct nf_logger *logger; struct nf_logger *logger;
rcu_read_lock(); rcu_read_lock();
logger = rcu_dereference(nf_logging[pf]); logger = rcu_dereference(nf_loggers[pf]);
if (logger) { if (logger) {
va_start(args, fmt); va_start(args, fmt);
vsnprintf(prefix, sizeof(prefix), fmt, args); vsnprintf(prefix, sizeof(prefix), fmt, args);
...@@ -132,7 +132,7 @@ static int seq_show(struct seq_file *s, void *v) ...@@ -132,7 +132,7 @@ static int seq_show(struct seq_file *s, void *v)
loff_t *pos = v; loff_t *pos = v;
const struct nf_logger *logger; const struct nf_logger *logger;
logger = rcu_dereference(nf_logging[*pos]); logger = rcu_dereference(nf_loggers[*pos]);
if (!logger) if (!logger)
return seq_printf(s, "%2lld NONE\n", *pos); return seq_printf(s, "%2lld NONE\n", *pos);
......
...@@ -1077,7 +1077,7 @@ static int __init nfnetlink_log_init(void) ...@@ -1077,7 +1077,7 @@ static int __init nfnetlink_log_init(void)
static void __exit nfnetlink_log_fini(void) static void __exit nfnetlink_log_fini(void)
{ {
nf_log_unregister_logger(&nfulnl_logger); nf_log_unregister(&nfulnl_logger);
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
remove_proc_entry("nfnetlink_log", proc_net_netfilter); remove_proc_entry("nfnetlink_log", proc_net_netfilter);
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment