From c6132022905b10ac70223e8116f3903ea0039e75 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Sun, 1 Feb 2009 22:32:56 +0100 Subject: libxtables: prefix names and order it #2 This change affects: load_xtables_ko -> xtables_load_ko modprobe_program -> xtables_modprobe_program Now uses bool for the "quiet" flag. Signed-off-by: Jan Engelhardt Signed-off-by: Pablo Neira Ayuso --- include/xtables.h.in | 5 +++++ include/xtables/internal.h | 4 ---- ip6tables-restore.c | 5 +++-- ip6tables.c | 5 +++-- iptables-restore.c | 5 +++-- iptables.c | 5 +++-- xtables.c | 10 +++++----- 7 files changed, 22 insertions(+), 17 deletions(-) diff --git a/include/xtables.h.in b/include/xtables.h.in index e63d171e..2512d79f 100644 --- a/include/xtables.h.in +++ b/include/xtables.h.in @@ -140,9 +140,14 @@ struct xtables_target #endif }; +extern const char *xtables_modprobe_program; + extern void *xtables_calloc(size_t, size_t); extern void *xtables_malloc(size_t); +extern int xtables_insmod(const char *, const char *, bool); +extern int xtables_load_ko(const char *, bool); + /* Your shared library should call one of these. */ extern void xtables_register_match(struct xtables_match *me); extern void xtables_register_target(struct xtables_target *me); diff --git a/include/xtables/internal.h b/include/xtables/internal.h index 6b78d3a8..62fe2edb 100644 --- a/include/xtables/internal.h +++ b/include/xtables/internal.h @@ -43,10 +43,6 @@ struct xtables_rule_match { extern char *lib_dir; -extern const char *modprobe_program; -extern int xtables_insmod(const char *modname, const char *modprobe, int quiet); -extern int load_xtables_ko(const char *modprobe, int quiet); - /* This is decleared in ip[6]tables.c */ extern struct afinfo afinfo; diff --git a/ip6tables-restore.c b/ip6tables-restore.c index a84c2e3e..097711f3 100644 --- a/ip6tables-restore.c +++ b/ip6tables-restore.c @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -64,7 +65,7 @@ static struct ip6tc_handle *create_handle(const char *tablename) if (!handle) { /* try to insmod the module if iptc_init failed */ - load_xtables_ko(modprobe_program, 0); + xtables_load_ko(xtables_modprobe_program, false); handle = ip6tc_init(tablename); } @@ -165,7 +166,7 @@ int main(int argc, char *argv[]) noflush = 1; break; case 'M': - modprobe_program = optarg; + xtables_modprobe_program = optarg; break; } } diff --git a/ip6tables.c b/ip6tables.c index 59c10115..580a644a 100644 --- a/ip6tables.c +++ b/ip6tables.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -1769,7 +1770,7 @@ int do_command6(int argc, char *argv[], char **table, struct ip6tc_handle **hand break; case 'M': - modprobe_program = optarg; + xtables_modprobe_program = optarg; break; case 'c': @@ -1967,7 +1968,7 @@ int do_command6(int argc, char *argv[], char **table, struct ip6tc_handle **hand *handle = ip6tc_init(*table); /* try to insmod the module if iptc_init failed */ - if (!*handle && load_xtables_ko(modprobe_program, 0) != -1) + if (!*handle && xtables_load_ko(xtables_modprobe_program, false) != -1) *handle = ip6tc_init(*table); if (!*handle) diff --git a/iptables-restore.c b/iptables-restore.c index 7cc6d6dc..3fbc9087 100644 --- a/iptables-restore.c +++ b/iptables-restore.c @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -63,7 +64,7 @@ static struct iptc_handle *create_handle(const char *tablename) if (!handle) { /* try to insmod the module if iptc_init failed */ - load_xtables_ko(modprobe_program, 0); + xtables_load_ko(xtables_modprobe_program, false); handle = iptc_init(tablename); } @@ -167,7 +168,7 @@ main(int argc, char *argv[]) noflush = 1; break; case 'M': - modprobe_program = optarg; + xtables_modprobe_program = optarg; break; case 'T': tablename = optarg; diff --git a/iptables.c b/iptables.c index 0b7edd8d..61e7aaba 100644 --- a/iptables.c +++ b/iptables.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -1786,7 +1787,7 @@ int do_command(int argc, char *argv[], char **table, struct iptc_handle **handle break; case 'M': - modprobe_program = optarg; + xtables_modprobe_program = optarg; break; case 'c': @@ -1996,7 +1997,7 @@ int do_command(int argc, char *argv[], char **table, struct iptc_handle **handle *handle = iptc_init(*table); /* try to insmod the module if iptc_init failed */ - if (!*handle && load_xtables_ko(modprobe_program, 0) != -1) + if (!*handle && xtables_load_ko(xtables_modprobe_program, false) != -1) *handle = iptc_init(*table); if (!*handle) diff --git a/xtables.c b/xtables.c index 83c72eef..94ea7649 100644 --- a/xtables.c +++ b/xtables.c @@ -47,7 +47,7 @@ char *lib_dir; /* the path to command to load kernel module */ -const char *modprobe_program = NULL; +const char *xtables_modprobe_program; /* Keeping track of external matches and targets: linked lists. */ struct xtables_match *xtables_matches; @@ -108,7 +108,7 @@ static char *get_modprobe(void) return NULL; } -int xtables_insmod(const char *modname, const char *modprobe, int quiet) +int xtables_insmod(const char *modname, const char *modprobe, bool quiet) { char *buf = NULL; char *argv[4]; @@ -150,9 +150,9 @@ int xtables_insmod(const char *modname, const char *modprobe, int quiet) return -1; } -int load_xtables_ko(const char *modprobe, int quiet) +int xtables_load_ko(const char *modprobe, bool quiet) { - static int loaded = 0; + static bool loaded = false; static int ret = -1; if (!loaded) { @@ -502,7 +502,7 @@ static int compatible_revision(const char *name, u_int8_t revision, int opt) exit(1); } - load_xtables_ko(modprobe_program, 1); + xtables_load_ko(xtables_modprobe_program, true); strcpy(rev.name, name); rev.revision = revision; -- cgit v1.2.3