From 5dfb716333ad12b86312ef5d8c824ea1ed3df26b Mon Sep 17 00:00:00 2001 From: Hans Dedecker Date: Fri, 13 Oct 2017 12:09:28 +0200 Subject: [PATCH] treewide: align function naming Signed-off-by: Hans Dedecker --- src/config.c | 18 +++++++++--------- src/dhcpv4.c | 4 ++-- src/dhcpv6-ia.c | 2 +- src/dhcpv6.c | 8 +++----- src/dhcpv6.h | 2 +- src/ndp.c | 4 ++-- src/odhcpd.c | 8 ++++---- src/odhcpd.h | 20 ++++++++++---------- src/router.c | 4 ++-- src/ubus.c | 2 +- 10 files changed, 35 insertions(+), 37 deletions(-) diff --git a/src/config.c b/src/config.c index 2c35aab..597d5c5 100644 --- a/src/config.c +++ b/src/config.c @@ -236,10 +236,10 @@ static void close_interface(struct interface *iface) if (iface->head.next) list_del(&iface->head); - setup_router_interface(iface, false); - setup_dhcpv6_interface(iface, false); - setup_ndp_interface(iface, false); - setup_dhcpv4_interface(iface, false); + router_setup_interface(iface, false); + dhcpv6_setup_interface(iface, false); + ndp_setup_interface(iface, false); + dhcpv4_setup_interface(iface, false); clean_interface(iface); free(iface->addr4); @@ -843,10 +843,10 @@ void odhcpd_reload(void) i->ndp = (master && master->ndp == MODE_RELAY) ? MODE_RELAY : MODE_DISABLED; - setup_router_interface(i, !i->ignore || i->ra != MODE_DISABLED); - setup_dhcpv6_interface(i, !i->ignore || i->dhcpv6 != MODE_DISABLED); - setup_ndp_interface(i, !i->ignore || i->ndp != MODE_DISABLED); - setup_dhcpv4_interface(i, !i->ignore || i->dhcpv4 != MODE_DISABLED); + router_setup_interface(i, !i->ignore || i->ra != MODE_DISABLED); + dhcpv6_setup_interface(i, !i->ignore || i->dhcpv6 != MODE_DISABLED); + ndp_setup_interface(i, !i->ignore || i->ndp != MODE_DISABLED); + dhcpv4_setup_interface(i, !i->ignore || i->dhcpv4 != MODE_DISABLED); } else close_interface(i); } @@ -887,7 +887,7 @@ void odhcpd_run(void) signal(SIGHUP, handle_signal); #ifdef WITH_UBUS - while (init_ubus()) + while (ubus_init()) sleep(1); #endif diff --git a/src/dhcpv4.c b/src/dhcpv4.c index 6b3d782..bfe70cb 100644 --- a/src/dhcpv4.c +++ b/src/dhcpv4.c @@ -58,13 +58,13 @@ struct odhcpd_ref_ip { }; /* Create socket and register events */ -int init_dhcpv4(void) +int dhcpv4_init(void) { uloop_timeout_set(&valid_until_timeout, 1000); return 0; } -int setup_dhcpv4_interface(struct interface *iface, bool enable) +int dhcpv4_setup_interface(struct interface *iface, bool enable) { if (iface->dhcpv4_event.uloop.fd > 0) { uloop_fd_delete(&iface->dhcpv4_event.uloop); diff --git a/src/dhcpv6-ia.c b/src/dhcpv6-ia.c index dd549e6..1a584c5 100644 --- a/src/dhcpv6-ia.c +++ b/src/dhcpv6-ia.c @@ -53,7 +53,7 @@ int dhcpv6_ia_init(void) return 0; } -int setup_dhcpv6_ia_interface(struct interface *iface, bool enable) +int dhcpv6_setup_ia_interface(struct interface *iface, bool enable) { if (!enable && iface->ia_assignments.next) { struct dhcpv6_assignment *c; diff --git a/src/dhcpv6.c b/src/dhcpv6.c index 902bdbf..b94e84d 100644 --- a/src/dhcpv6.c +++ b/src/dhcpv6.c @@ -34,16 +34,14 @@ static void handle_client_request(void *addr, void *data, size_t len, struct interface *iface, void *dest_addr); - // Create socket and register events -int init_dhcpv6(void) +int dhcpv6_init(void) { dhcpv6_ia_init(); return 0; } - -int setup_dhcpv6_interface(struct interface *iface, bool enable) +int dhcpv6_setup_interface(struct interface *iface, bool enable) { if (iface->dhcpv6_event.uloop.fd > 0) { uloop_fd_delete(&iface->dhcpv6_event.uloop); @@ -95,7 +93,7 @@ int setup_dhcpv6_interface(struct interface *iface, bool enable) odhcpd_register(&iface->dhcpv6_event); } - return setup_dhcpv6_ia_interface(iface, enable); + return dhcpv6_setup_ia_interface(iface, enable); } enum { diff --git a/src/dhcpv6.h b/src/dhcpv6.h index de815cf..fe05ae5 100644 --- a/src/dhcpv6.h +++ b/src/dhcpv6.h @@ -192,7 +192,7 @@ int dhcpv6_init_ia(struct interface *iface, int socket); ssize_t dhcpv6_handle_ia(uint8_t *buf, size_t buflen, struct interface *iface, const struct sockaddr_in6 *addr, const void *data, const uint8_t *end); int dhcpv6_ia_init(void); -int setup_dhcpv6_ia_interface(struct interface *iface, bool enable); +int dhcpv6_setup_ia_interface(struct interface *iface, bool enable); void dhcpv6_enum_ia_addrs(struct interface *iface, struct dhcpv6_assignment *c, time_t now, dhcpv6_binding_cb_handler_t func, void *arg); void dhcpv6_write_statefile(void); diff --git a/src/ndp.c b/src/ndp.c index 8ecc79b..22a9106 100644 --- a/src/ndp.c +++ b/src/ndp.c @@ -74,7 +74,7 @@ static const struct sock_fprog bpf_prog = {sizeof(bpf) / sizeof(*bpf), bpf}; // Initialize NDP-proxy -int init_ndp(void) +int ndp_init(void) { int val = 2; @@ -168,7 +168,7 @@ static void dump_addr_table(bool v6) nlmsg_free(msg); } -int setup_ndp_interface(struct interface *iface, bool enable) +int ndp_setup_interface(struct interface *iface, bool enable) { int ret = 0, procfd; bool dump_neigh = false; diff --git a/src/odhcpd.c b/src/odhcpd.c index f59d5a8..259b623 100644 --- a/src/odhcpd.c +++ b/src/odhcpd.c @@ -108,16 +108,16 @@ int main(int argc, char **argv) signal(SIGINT, sighandler); signal(SIGTERM, sighandler); - if (init_router()) + if (router_init()) return 4; - if (init_dhcpv6()) + if (dhcpv6_init()) return 4; - if (init_ndp()) + if (ndp_init()) return 4; - if (init_dhcpv4()) + if (dhcpv4_init()) return 4; odhcpd_run(); diff --git a/src/odhcpd.h b/src/odhcpd.h index 3d8f254..2d9e474 100644 --- a/src/odhcpd.h +++ b/src/odhcpd.h @@ -265,7 +265,7 @@ int config_parse_interface(void *data, size_t len, const char *iname, bool overw void dhcpv4_addr_update(struct interface *iface); #ifdef WITH_UBUS -int init_ubus(void); +int ubus_init(void); const char* ubus_get_ifname(const char *name); void ubus_apply_network(void); bool ubus_has_prefix(const char *name, const char *ifname); @@ -273,14 +273,14 @@ bool ubus_has_prefix(const char *name, const char *ifname); // Exported module initializers -int init_router(void); -int init_dhcpv6(void); -int init_dhcpv4(void); -int init_ndp(void); - -int setup_router_interface(struct interface *iface, bool enable); -int setup_dhcpv6_interface(struct interface *iface, bool enable); -int setup_ndp_interface(struct interface *iface, bool enable); -int setup_dhcpv4_interface(struct interface *iface, bool enable); +int router_init(void); +int dhcpv6_init(void); +int dhcpv4_init(void); +int ndp_init(void); + +int router_setup_interface(struct interface *iface, bool enable); +int dhcpv6_setup_interface(struct interface *iface, bool enable); +int ndp_setup_interface(struct interface *iface, bool enable); +int dhcpv4_setup_interface(struct interface *iface, bool enable); void odhcpd_reload(void); diff --git a/src/router.c b/src/router.c index 30f1609..b50df3a 100644 --- a/src/router.c +++ b/src/router.c @@ -41,7 +41,7 @@ static FILE *fp_route = NULL; #define TIME_LEFT(t1, now) ((t1) != UINT32_MAX ? (t1) - (now) : UINT32_MAX) -int init_router(void) +int router_init(void) { // Open ICMPv6 socket int sock = socket(AF_INET6, SOCK_RAW | SOCK_CLOEXEC, IPPROTO_ICMPV6); @@ -88,7 +88,7 @@ int init_router(void) } -int setup_router_interface(struct interface *iface, bool enable) +int router_setup_interface(struct interface *iface, bool enable) { if (!fp_route || router_event.uloop.fd < 0) return -1; diff --git a/src/ubus.c b/src/ubus.c index 6fbb98f..95eeff7 100644 --- a/src/ubus.c +++ b/src/ubus.c @@ -390,7 +390,7 @@ bool ubus_has_prefix(const char *name, const char *ifname) } -int init_ubus(void) +int ubus_init(void) { if (!(ubus = ubus_connect(NULL))) { syslog(LOG_ERR, "Unable to connect to ubus: %s", strerror(errno)); -- 2.30.2