From 305af4210bdf0c92a71c66b11b57d4a88e2ccc0d Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Thu, 4 Nov 2010 00:22:32 +0100 Subject: [PATCH] xt_mp2t: reduce mp2t_mt_reg from an array to single-level struct There's just one currently anyway. --- extensions/xt_mp2t.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/extensions/xt_mp2t.c b/extensions/xt_mp2t.c index 453d12f..d8b348b 100644 --- a/extensions/xt_mp2t.c +++ b/extensions/xt_mp2t.c @@ -1172,18 +1172,16 @@ xt_mp2t_match(const struct sk_buff *skb, struct xt_action_param *par) return res; } -static struct xt_match mp2t_mt_reg[] __read_mostly = { - { - .name = "mp2t", - .revision = 0, - .family = NFPROTO_IPV4, - .match = xt_mp2t_match, - .checkentry = xt_mp2t_mt_check, - .destroy = xt_mp2t_mt_destroy, - .proto = IPPROTO_UDP, - .matchsize = sizeof(struct xt_mp2t_mtinfo), - .me = THIS_MODULE, - }, +static struct xt_match mp2t_mt_reg __read_mostly = { + .name = "mp2t", + .revision = 0, + .family = NFPROTO_IPV4, + .match = xt_mp2t_match, + .checkentry = xt_mp2t_mt_check, + .destroy = xt_mp2t_mt_destroy, + .proto = IPPROTO_UDP, + .matchsize = sizeof(struct xt_mp2t_mtinfo), + .me = THIS_MODULE, }; @@ -1376,7 +1374,7 @@ static int __init mp2t_mt_init(void) msg_dbg(DRV, "Message level (msg_level): 0x%X", msg_level); /* Register the mp2t matches */ - err = xt_register_matches(mp2t_mt_reg, ARRAY_SIZE(mp2t_mt_reg)); + err = xt_register_match(&mp2t_mt_reg); if (err) { msg_err(DRV, "unable to register matches"); return err; @@ -1388,7 +1386,7 @@ static int __init mp2t_mt_init(void) if (!mp2t_procdir) { msg_err(DRV, "unable to create proc dir entry"); /* In case of error unregister the mp2t matches */ - xt_unregister_matches(mp2t_mt_reg, ARRAY_SIZE(mp2t_mt_reg)); + xt_unregister_match(&mp2t_mt_reg); err = -ENOMEM; } #endif @@ -1402,7 +1400,7 @@ static void __exit mp2t_mt_exit(void) remove_proc_entry(XT_MODULE_NAME, init_net.proc_net); - xt_unregister_matches(mp2t_mt_reg, ARRAY_SIZE(mp2t_mt_reg)); + xt_unregister_match(&mp2t_mt_reg); /* Its important to wait for all call_rcu_bh() callbacks to * finish before this module is deallocated as the code