]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: cleanup for zapi_msg.c split
authorQuentin Young <qlyoung@cumulusnetworks.com>
Mon, 23 Apr 2018 02:10:54 +0000 (22:10 -0400)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Mon, 23 Apr 2018 02:50:25 +0000 (22:50 -0400)
* 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 <qlyoung@cumulusnetworks.com>
zebra/label_manager.c
zebra/table_manager.c
zebra/zapi_msg.c
zebra/zapi_msg.h
zebra/zebra_mpls.c
zebra/zebra_ptm.c
zebra/zebra_pw.c
zebra/zebra_rnh.c
zebra/zserv.c
zebra/zserv.h

index b4b82ebd17361a61d9faf3603f1f795eaae21746..190ac1e57f7ec7571f4306a7fb1fe3642bd30e16 100644 (file)
@@ -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);
 }
 
 /**
index 4c5c16c88a3f23a0d0a5a7cb9d0ee34f6818c86d..cb8c384436977bb44228e598f2d5c710f0973ad2 100644 (file)
@@ -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);
 }
 
 /**
index ec35f344f31b5659dcc632fdce2cd23c7292d127..f613ee6de3064dba668e2bc74a7c51c31cdd3b91 100644 (file)
@@ -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.
index 771a0966acc285adb545eaaa30c5ecaa26447219..f50c9852662a5aa47d929d2aacaee473972104f8 100644 (file)
@@ -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.
index 115602f41f35994828d5aa8b490d18e5e4d1c086..3ad640653f92a972568ebbc69d98707c22b71895 100644 (file)
@@ -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);
 }
index 1c4f0ec841e63a95c224de46b2597332f043efde..f8b5a97ffb631af88d323e608f0dc2a4c0d33cc7 100644 (file)
@@ -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)
index f26226e75293c5a53ddae97cef5fef0c056e0e67..28e09fe1934470826c2898bf76c2c5df4bb5cb08 100644 (file)
@@ -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)
index 6b74a3c92c1d3e53b61acd4b171b2e93da18ab99..c05c89858ea9e90fb16ecfc08e33d824fbc6eaa7 100644 (file)
@@ -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,
index ffc6a19245704d71220355841c6a96f765b9f3f7..d3746214106bb33ef5f1d5aef841cf04130de501 100644 (file)
@@ -21,7 +21,8 @@
  */
 
 #include <zebra.h>
+
+/* clang-format off */
 #include <errno.h>                /* for errno */
 #include <netinet/in.h>           /* for sockaddr_in */
 #include <stdint.h>               /* for uint8_t */
 #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);
index b3f3cce7e87694724f6a4b25ca12fee7ea99edaa..05262490dd34a6e665ea95c10219a2d30b14aad9 100644 (file)
@@ -23,6 +23,7 @@
 #ifndef _ZEBRA_ZSERV_H
 #define _ZEBRA_ZSERV_H
 
+/* clang-format off */
 #include <stdint.h>           /* for uint32_t, uint8_t */
 #include <time.h>             /* 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 {