From 6a0ae483145159b0c903690c0313dbc03745c412 Mon Sep 17 00:00:00 2001 From: "/C=EU/ST=EU/CN=Jozsef Kadlecsik/emailAddress=kadlec@blackhole.kfki.hu" Date: Sat, 19 Jul 2008 20:48:19 +0000 Subject: Compatibility cleanup release: kernels >= 2.6.16 and 2.4.36.x are supported. --- ipset_nethash.c | 48 ++++++++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 18 deletions(-) (limited to 'ipset_nethash.c') diff --git a/ipset_nethash.c b/ipset_nethash.c index fda3dbe..1e7aa41 100644 --- a/ipset_nethash.c +++ b/ipset_nethash.c @@ -40,7 +40,8 @@ #define OPT_CREATE_RESIZE 0x04U /* Initialize the create. */ -void create_init(void *data) +static void +create_init(void *data) { struct ip_set_req_nethash_create *mydata = (struct ip_set_req_nethash_create *) data; @@ -54,7 +55,8 @@ void create_init(void *data) } /* Function which parses command options; returns true if it ate an option */ -int create_parse(int c, char *argv[], void *data, unsigned *flags) +static int +create_parse(int c, char *argv[], void *data, unsigned *flags) { struct ip_set_req_nethash_create *mydata = (struct ip_set_req_nethash_create *) data; @@ -106,7 +108,8 @@ int create_parse(int c, char *argv[], void *data, unsigned *flags) } /* Final check; exit if not ok. */ -void create_final(void *data, unsigned int flags) +static void +create_final(void *data, unsigned int flags) { #ifdef IPSET_DEBUG struct ip_set_req_nethash_create *mydata = @@ -118,15 +121,16 @@ void create_final(void *data, unsigned int flags) } /* Create commandline options */ -static struct option create_opts[] = { - {"hashsize", 1, 0, '1'}, - {"probes", 1, 0, '2'}, - {"resize", 1, 0, '3'}, - {0} +static const struct option create_opts[] = { + {.name = "hashsize", .has_arg = required_argument, .val = '1'}, + {.name = "probes", .has_arg = required_argument, .val = '2'}, + {.name = "resize", .has_arg = required_argument, .val = '3'}, + {NULL}, }; /* Add, del, test parser */ -ip_set_ip_t adt_parser(unsigned cmd, const char *optarg, void *data) +static ip_set_ip_t +adt_parser(unsigned cmd, const char *optarg, void *data) { struct ip_set_req_nethash *mydata = (struct ip_set_req_nethash *) data; @@ -161,7 +165,8 @@ ip_set_ip_t adt_parser(unsigned cmd, const char *optarg, void *data) * Print and save */ -void initheader(struct set *set, const void *data) +static void +initheader(struct set *set, const void *data) { struct ip_set_req_nethash_create *header = (struct ip_set_req_nethash_create *) data; @@ -174,7 +179,8 @@ void initheader(struct set *set, const void *data) map->resize = header->resize; } -void printheader(struct set *set, unsigned options) +static void +printheader(struct set *set, unsigned options) { struct ip_set_nethash *mysetdata = (struct ip_set_nethash *) set->settype->header; @@ -186,7 +192,8 @@ void printheader(struct set *set, unsigned options) static char buf[20]; -static char * unpack_ip_tostring(ip_set_ip_t ip, unsigned options) +static char * +unpack_ip_tostring(ip_set_ip_t ip, unsigned options) { int i, j = 3; unsigned char a, b; @@ -237,7 +244,8 @@ static char * unpack_ip_tostring(ip_set_ip_t ip, unsigned options) return buf; } -void printips(struct set *set, void *data, size_t len, unsigned options) +static void +printips(struct set *set, void *data, size_t len, unsigned options) { size_t offset = 0; ip_set_ip_t *ip; @@ -250,7 +258,8 @@ void printips(struct set *set, void *data, size_t len, unsigned options) } } -void saveheader(struct set *set, unsigned options) +static void +saveheader(struct set *set, unsigned options) { struct ip_set_nethash *mysetdata = (struct ip_set_nethash *) set->settype->header; @@ -261,7 +270,8 @@ void saveheader(struct set *set, unsigned options) } /* Print save for an IP */ -void saveips(struct set *set, void *data, size_t len, unsigned options) +static void +saveips(struct set *set, void *data, size_t len, unsigned options) { size_t offset = 0; ip_set_ip_t *ip; @@ -275,12 +285,14 @@ void saveips(struct set *set, void *data, size_t len, unsigned options) } } -static char * net_tostring(struct set *set, ip_set_ip_t ip, unsigned options) +static char * +net_tostring(struct set *set, ip_set_ip_t ip, unsigned options) { return unpack_ip_tostring(ip, options); } -static void parse_net(const char *str, ip_set_ip_t *ip) +static void +parse_net(const char *str, ip_set_ip_t *ip) { char *saved = strdup(str); char *ptr, *tmp = saved; @@ -302,7 +314,7 @@ static void parse_net(const char *str, ip_set_ip_t *ip) *ip = pack(*ip, cidr); } -void usage(void) +static void usage(void) { printf ("-N set nethash [--hashsize hashsize] [--probes probes ]\n" -- cgit v1.2.3