From: Quentin Young Date: Mon, 23 Apr 2018 02:10:54 +0000 (-0400) Subject: zebra: cleanup for zapi_msg.c split X-Git-Tag: frr-5.0-dev~17^2~1 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=d8647095529884ad1d15e4966eb9cd69f5edb66c;p=mirror%2Ffrr.git zebra: cleanup for zapi_msg.c split * Rename client_connect and client_close hooks to zapi_client_connect and zapi_client_close * Remove some more unnecessary headers * Fix a copy-paste error in zapi_msg.[ch] header comments * Fix an inclusion comment in zserv.c Signed-off-by: Quentin Young --- diff --git a/zebra/label_manager.c b/zebra/label_manager.c index b4b82ebd17..190ac1e57f 100644 --- a/zebra/label_manager.c +++ b/zebra/label_manager.c @@ -290,7 +290,7 @@ void label_manager_init(char *lm_zserv_path) ibuf = stream_new(ZEBRA_MAX_PACKET_SIZ); obuf = stream_new(ZEBRA_MAX_PACKET_SIZ); - hook_register(client_close, release_daemon_label_chunks); + hook_register(zapi_client_close, release_daemon_label_chunks); } /** diff --git a/zebra/table_manager.c b/zebra/table_manager.c index 4c5c16c88a..cb8c384436 100644 --- a/zebra/table_manager.c +++ b/zebra/table_manager.c @@ -78,7 +78,7 @@ void table_manager_enable(ns_id_t ns_id) return; tbl_mgr.lc_list = list_new(); tbl_mgr.lc_list->del = delete_table_chunk; - hook_register(client_close, release_daemon_table_chunks); + hook_register(zapi_client_close, release_daemon_table_chunks); } /** diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c index ec35f344f3..f613ee6de3 100644 --- a/zebra/zapi_msg.c +++ b/zebra/zapi_msg.c @@ -1,5 +1,5 @@ /* - * Zebra API server. + * Zebra API message creation & consumption. * Portions: * Copyright (C) 1997-1999 Kunihiro Ishiguro * Copyright (C) 2015-2018 Cumulus Networks, Inc. diff --git a/zebra/zapi_msg.h b/zebra/zapi_msg.h index 771a0966ac..f50c985266 100644 --- a/zebra/zapi_msg.h +++ b/zebra/zapi_msg.h @@ -1,5 +1,5 @@ /* - * Zebra API server. + * Zebra API message creation & consumption. * Portions: * Copyright (C) 1997-1999 Kunihiro Ishiguro * Copyright (C) 2015-2018 Cumulus Networks, Inc. diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c index 115602f41f..3ad640653f 100644 --- a/zebra/zebra_mpls.c +++ b/zebra/zebra_mpls.c @@ -2916,5 +2916,5 @@ void zebra_mpls_init(void) if (!mpls_processq_init(&zebrad)) mpls_enabled = 1; - hook_register(client_close, zebra_mpls_cleanup_fecs_for_client); + hook_register(zapi_client_close, zebra_mpls_cleanup_fecs_for_client); } diff --git a/zebra/zebra_ptm.c b/zebra/zebra_ptm.c index 1c4f0ec841..f8b5a97ffb 100644 --- a/zebra/zebra_ptm.c +++ b/zebra/zebra_ptm.c @@ -126,7 +126,7 @@ void zebra_ptm_init(void) ptm_cb.ptm_sock = -1; - hook_register(client_close, zebra_ptm_bfd_client_deregister); + hook_register(zapi_client_close, zebra_ptm_bfd_client_deregister); } void zebra_ptm_finish(void) diff --git a/zebra/zebra_pw.c b/zebra/zebra_pw.c index f26226e752..28e09fe193 100644 --- a/zebra/zebra_pw.c +++ b/zebra/zebra_pw.c @@ -292,7 +292,7 @@ void zebra_pw_init(struct zebra_vrf *zvrf) RB_INIT(zebra_pw_head, &zvrf->pseudowires); RB_INIT(zebra_static_pw_head, &zvrf->static_pseudowires); - hook_register(client_close, zebra_pw_client_close); + hook_register(zapi_client_close, zebra_pw_client_close); } void zebra_pw_exit(struct zebra_vrf *zvrf) diff --git a/zebra/zebra_rnh.c b/zebra/zebra_rnh.c index 6b74a3c92c..c05c89858e 100644 --- a/zebra/zebra_rnh.c +++ b/zebra/zebra_rnh.c @@ -73,7 +73,7 @@ int zebra_rnh_ipv6_default_route = 0; void zebra_rnh_init(void) { - hook_register(client_close, zebra_client_cleanup_rnh); + hook_register(zapi_client_close, zebra_client_cleanup_rnh); } static inline struct route_table *get_rnh_table(vrf_id_t vrfid, int family, diff --git a/zebra/zserv.c b/zebra/zserv.c index ffc6a19245..d374621410 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -21,7 +21,8 @@ */ #include - + +/* clang-format off */ #include /* for errno */ #include /* for sockaddr_in */ #include /* for uint8_t */ @@ -53,12 +54,11 @@ #include "lib/zclient.h" /* for zmsghdr, ZEBRA_HEADER_SIZE, ZEBRA... */ #include "zebra/debug.h" /* for various debugging macros */ -#include "zebra/label_manager.h" /* for release_daemon_label_chunks, rele... */ #include "zebra/rib.h" /* for rib_score_proto */ -#include "zebra/table_manager.h" /* for release_daemon_table_chunks */ #include "zebra/zapi_msg.h" /* for zserv_handle_commands */ #include "zebra/zebra_vrf.h" /* for zebra_vrf_lookup_by_id, zvrf */ -#include "zebra/zserv.h" /* for zclient */ +#include "zebra/zserv.h" /* for zserv */ +/* clang-format on */ /* Event list of zebra. */ enum event { ZEBRA_READ, ZEBRA_WRITE }; @@ -80,13 +80,13 @@ int zebra_server_send_message(struct zserv *client, struct stream *msg) /* Lifecycle ---------------------------------------------------------------- */ /* Hooks for client connect / disconnect */ -DEFINE_HOOK(client_connect, (struct zserv *client), (client)); -DEFINE_KOOH(client_close, (struct zserv *client), (client)); +DEFINE_HOOK(zapi_client_connect, (struct zserv * client), (client)); +DEFINE_KOOH(zapi_client_close, (struct zserv * client), (client)); /* free zebra client information. */ static void zebra_client_free(struct zserv *client) { - hook_call(client_close, client); + hook_call(zapi_client_close, client); /* Close file descriptor. */ if (client->sock) { @@ -179,7 +179,7 @@ static void zebra_client_create(int sock) zebra_vrf_update_all(client); - hook_call(client_connect, client); + hook_call(zapi_client_connect, client); /* start read loop */ zebra_event(client, ZEBRA_READ); diff --git a/zebra/zserv.h b/zebra/zserv.h index b3f3cce7e8..05262490dd 100644 --- a/zebra/zserv.h +++ b/zebra/zserv.h @@ -23,6 +23,7 @@ #ifndef _ZEBRA_ZSERV_H #define _ZEBRA_ZSERV_H +/* clang-format off */ #include /* for uint32_t, uint8_t */ #include /* for time_t */ @@ -37,6 +38,7 @@ #include "lib/hook.h" /* for DECLARE_HOOK, DECLARE_KOOH */ #include "zebra/zebra_vrf.h" /* for zebra_vrf */ +/* clang-format on */ /* Default port information. */ #define ZEBRA_VTY_PORT 2601 @@ -143,8 +145,8 @@ struct zserv { struct zebra_vrf *zvrf /* Hooks for client connect / disconnect */ -DECLARE_HOOK(client_connect, (struct zserv *client), (client)); -DECLARE_KOOH(client_close, (struct zserv *client), (client)); +DECLARE_HOOK(zapi_client_connect, (struct zserv * client), (client)); +DECLARE_KOOH(zapi_client_close, (struct zserv * client), (client)); /* Zebra instance */ struct zebra_t {