]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Simplify the isc_event API
authorOndřej Surý <ondrej@isc.org>
Tue, 26 Jul 2022 11:03:01 +0000 (13:03 +0200)
committerOndřej Surý <ondrej@isc.org>
Thu, 25 Aug 2022 10:24:25 +0000 (12:24 +0200)
The ev_tag field was never used, and has now been removed.

lib/dns/adb.c
lib/dns/catz.c
lib/dns/resolver.c
lib/dns/rpz.c
lib/dns/zone.c
lib/isc/event.c
lib/isc/include/isc/event.h
lib/isc/ratelimiter.c

index bca098f016e27ed4c1bc39d92bcfa7b43c39c83d..ef52a778d16c47a827615e70a086b71d1364b599 100644 (file)
@@ -1489,7 +1489,7 @@ new_adbfind(dns_adb_t *adb, in_port_t port) {
        ISC_LINK_INIT(find, plink);
        ISC_LIST_INIT(find->list);
        isc_mutex_init(&find->lock);
-       ISC_EVENT_INIT(&find->event, sizeof(isc_event_t), 0, 0, 0, NULL, NULL,
+       ISC_EVENT_INIT(&find->event, sizeof(isc_event_t), 0, 0, NULL, NULL,
                       NULL, NULL, find);
 
        find->magic = DNS_ADBFIND_MAGIC;
index c926be424c77f03bdc3fa319efabcb1f7aa2e6ed..8cf4e1cb9383db52cd79bd1b9b610bf9319f847a 100644 (file)
@@ -2065,7 +2065,7 @@ dns_catz_dbupdate_callback(dns_db_t *db, void *fn_arg) {
 
                        dns_db_currentversion(db, &zone->dbversion);
                        ISC_EVENT_INIT(&zone->updateevent,
-                                      sizeof(zone->updateevent), 0, NULL,
+                                      sizeof(zone->updateevent), 0,
                                       DNS_EVENT_CATZUPDATED,
                                       dns_catz_update_taskaction, zone, zone,
                                       NULL, NULL);
index 3155da1a54929cd7dc2028275f07da6e5425f17b..83293f7d675e318f3fd6ccabd2c1f6f001b09a9c 100644 (file)
@@ -4572,7 +4572,7 @@ fctx_start(isc_task_t *task, isc_event_t *event) {
         * Reset the control event for later use in shutting
         * down the fctx.
         */
-       ISC_EVENT_INIT(event, sizeof(*event), 0, NULL, DNS_EVENT_FETCHCONTROL,
+       ISC_EVENT_INIT(event, sizeof(*event), 0, DNS_EVENT_FETCHCONTROL,
                       fctx_doshutdown, fctx, NULL, NULL, NULL);
 
        UNLOCK(&fctx->bucket->lock);
@@ -10808,7 +10808,7 @@ dns_resolver_createfetch(dns_resolver_t *res, const dns_name_t *name,
                         */
                        event = &fctx->control_event;
                        fctx_addref(fctx);
-                       ISC_EVENT_INIT(event, sizeof(*event), 0, NULL,
+                       ISC_EVENT_INIT(event, sizeof(*event), 0,
                                       DNS_EVENT_FETCHCONTROL, fctx_start, fctx,
                                       NULL, NULL, NULL);
                        isc_task_send(fctx->restask, &event);
index 20632eefe9f3f3c53b3ea8a71e551ddbc1a43653..62b150f6d87a5e8ece0d5f2937810580b7e99a22 100644 (file)
@@ -1542,8 +1542,8 @@ dns_rpz_new_zone(dns_rpz_zones_t *rpzs, dns_rpz_zone_t **rpzp) {
 
        rpz_attach_rpzs(rpzs, &rpz->rpzs);
 
-       ISC_EVENT_INIT(&rpz->updateevent, sizeof(rpz->updateevent), 0, NULL, 0,
-                      NULL, NULL, NULL, NULL, NULL);
+       ISC_EVENT_INIT(&rpz->updateevent, sizeof(rpz->updateevent), 0, 0, NULL,
+                      NULL, NULL, NULL, NULL);
 
        rpz->num = rpzs->p.num_zones++;
        rpzs->zones[rpz->num] = rpz;
@@ -1609,11 +1609,10 @@ dns_rpz_dbupdate_callback(dns_db_t *db, void *fn_arg) {
 
                        dns_db_currentversion(rpz->db, &rpz->dbversion);
                        INSIST(!ISC_LINK_LINKED(&rpz->updateevent, ev_link));
-                       ISC_EVENT_INIT(&rpz->updateevent,
-                                      sizeof(rpz->updateevent), 0, NULL,
-                                      DNS_EVENT_RPZUPDATED,
-                                      dns_rpz_update_taskaction, rpz, rpz,
-                                      NULL, NULL);
+                       ISC_EVENT_INIT(
+                               &rpz->updateevent, sizeof(rpz->updateevent), 0,
+                               DNS_EVENT_RPZUPDATED, dns_rpz_update_taskaction,
+                               rpz, rpz, NULL, NULL);
                        event = &rpz->updateevent;
                        isc_task_send(rpz->rpzs->updater, &event);
                }
@@ -1696,8 +1695,8 @@ update_rpz_done_cb(void *data, isc_result_t result) {
                isc_event_t *event = NULL;
                INSIST(!ISC_LINK_LINKED(&rpz->updateevent, ev_link));
                ISC_EVENT_INIT(&rpz->updateevent, sizeof(rpz->updateevent), 0,
-                              NULL, DNS_EVENT_RPZUPDATED,
-                              dns_rpz_update_taskaction, rpz, rpz, NULL, NULL);
+                              DNS_EVENT_RPZUPDATED, dns_rpz_update_taskaction,
+                              rpz, rpz, NULL, NULL);
                event = &rpz->updateevent;
                isc_task_send(rpz->rpzs->updater, &event);
        }
index 600fad94e50fdc65c4c11bf8f507428b65f17733..4cc012cf88ee58c96bded562474e2bf4e42c0d18 100644 (file)
@@ -1211,7 +1211,7 @@ dns_zone_create(dns_zone_t **zonep, isc_mem_t *mctx, unsigned int tid) {
        /* Must be after magic is set. */
        dns_zone_setdbtype(zone, dbargc_default, dbargv_default);
 
-       ISC_EVENT_INIT(&zone->ctlevent, sizeof(zone->ctlevent), 0, NULL,
+       ISC_EVENT_INIT(&zone->ctlevent, sizeof(zone->ctlevent), 0,
                       DNS_EVENT_ZONECONTROL, zone_shutdown, zone, zone, NULL,
                       NULL);
        *zonep = zone;
index 294da352548654dff55b51da088475c35e27953b..cf5bdee558321dbf7675f7d7dcba0ce34b2262f0 100644 (file)
@@ -41,8 +41,8 @@ isc__event_allocate(isc_mem_t *mctx, void *sender, isc_eventtype_t type,
 
        event = isc_mem_get(mctx, size);
 
-       ISC_EVENT_INIT_PASS(event, size, 0, NULL, type, action, arg, sender,
-                           destroy, mctx);
+       ISC_EVENT_INIT_PASS(event, size, 0, type, action, arg, sender, destroy,
+                           mctx);
 
        return (event);
 }
index c3db54064862e7586a6314cd6767c5c9f59ab0a4..b7a8be35f0ca9d37585d6e35d84a74569bf01be9 100644 (file)
@@ -35,7 +35,6 @@ typedef void (*isc_eventdestructor_t)(isc_event_t *);
 #define ISC_EVENT_COMMON(ltype)                                 \
        size_t                ev_size;                          \
        unsigned int          ev_attributes;                    \
-       void                 *ev_tag;                           \
        isc_eventtype_t       ev_type;                          \
        isc_taskaction_t      ev_action;                        \
        void                 *ev_arg;                           \
@@ -50,32 +49,30 @@ typedef void (*isc_eventdestructor_t)(isc_event_t *);
        ISC_LINK(ltype) ev_link;                                \
        ISC_LINK(ltype) ev_ratelink
 
-#define ISC_EVENT_INIT(event, sz, at, ta, ty, ac, ar, sn, df, da)            \
-       ISC__EVENT_INIT(event, sz, at, ta, ty, ac, ar, sn, df, da, __func__, \
+#define ISC_EVENT_INIT(event, sz, at, ty, ac, ar, sn, df, da)            \
+       ISC__EVENT_INIT(event, sz, at, ty, ac, ar, sn, df, da, __func__, \
                        __FILE__, __LINE__)
 
-#define ISC_EVENT_INIT_PASS(event, sz, at, ta, ty, ac, ar, sn, df, da)         \
-       ISC__EVENT_INIT(event, sz, at, ta, ty, ac, ar, sn, df, da, func, file, \
-                       line)
-
-#define ISC__EVENT_INIT(event, sz, at, ta, ty, ac, ar, sn, df, da, fn, fl, ln) \
-       {                                                                      \
-               (event)->ev_size = (sz);                                       \
-               (event)->ev_attributes = (at);                                 \
-               (event)->ev_tag = (ta);                                        \
-               (event)->ev_type = (ty);                                       \
-               (event)->ev_action = (ac);                                     \
-               (event)->ev_arg = (ar);                                        \
-               (event)->ev_sender = (sn);                                     \
-               (event)->ev_destroy = (df);                                    \
-               (event)->ev_destroy_arg = (da);                                \
-               ISC_LINK_INIT((event), ev_link);                               \
-               ISC_LINK_INIT((event), ev_ratelink);                           \
-               strlcpy((event)->func, fn, sizeof((event)->func));             \
-               strlcpy((event)->file, fl, sizeof((event)->file));             \
-               (event)->line = ln;                                            \
-               (event)->backtrace_size = isc_backtrace(                       \
-                       (event)->backtrace, ISC__EVENT_TRACE_SIZE);            \
+#define ISC_EVENT_INIT_PASS(event, sz, at, ty, ac, ar, sn, df, da) \
+       ISC__EVENT_INIT(event, sz, at, ty, ac, ar, sn, df, da, func, file, line)
+
+#define ISC__EVENT_INIT(event, sz, at, ty, ac, ar, sn, df, da, fn, fl, ln) \
+       {                                                                  \
+               (event)->ev_size = (sz);                                   \
+               (event)->ev_attributes = (at);                             \
+               (event)->ev_type = (ty);                                   \
+               (event)->ev_action = (ac);                                 \
+               (event)->ev_arg = (ar);                                    \
+               (event)->ev_sender = (sn);                                 \
+               (event)->ev_destroy = (df);                                \
+               (event)->ev_destroy_arg = (da);                            \
+               ISC_LINK_INIT((event), ev_link);                           \
+               ISC_LINK_INIT((event), ev_ratelink);                       \
+               strlcpy((event)->func, fn, sizeof((event)->func));         \
+               strlcpy((event)->file, fl, sizeof((event)->file));         \
+               (event)->line = ln;                                        \
+               (event)->backtrace_size = isc_backtrace(                   \
+                       (event)->backtrace, ISC__EVENT_TRACE_SIZE);        \
        }
 
 #else
@@ -86,7 +83,6 @@ typedef void (*isc_eventdestructor_t)(isc_event_t *);
 #define ISC_EVENT_COMMON(ltype)               \
        size_t                ev_size;        \
        unsigned int          ev_attributes;  \
-       void                 *ev_tag;         \
        isc_eventtype_t       ev_type;        \
        isc_taskaction_t      ev_action;      \
        void                 *ev_arg;         \
@@ -96,19 +92,18 @@ typedef void (*isc_eventdestructor_t)(isc_event_t *);
        ISC_LINK(ltype) ev_link;              \
        ISC_LINK(ltype) ev_ratelink
 
-#define ISC_EVENT_INIT(event, sz, at, ta, ty, ac, ar, sn, df, da) \
-       {                                                         \
-               (event)->ev_size = (sz);                          \
-               (event)->ev_attributes = (at);                    \
-               (event)->ev_tag = (ta);                           \
-               (event)->ev_type = (ty);                          \
-               (event)->ev_action = (ac);                        \
-               (event)->ev_arg = (ar);                           \
-               (event)->ev_sender = (sn);                        \
-               (event)->ev_destroy = (df);                       \
-               (event)->ev_destroy_arg = (da);                   \
-               ISC_LINK_INIT((event), ev_link);                  \
-               ISC_LINK_INIT((event), ev_ratelink);              \
+#define ISC_EVENT_INIT(event, sz, at, ty, ac, ar, sn, df, da) \
+       {                                                     \
+               (event)->ev_size = (sz);                      \
+               (event)->ev_attributes = (at);                \
+               (event)->ev_type = (ty);                      \
+               (event)->ev_action = (ac);                    \
+               (event)->ev_arg = (ar);                       \
+               (event)->ev_sender = (sn);                    \
+               (event)->ev_destroy = (df);                   \
+               (event)->ev_destroy_arg = (da);               \
+               ISC_LINK_INIT((event), ev_link);              \
+               ISC_LINK_INIT((event), ev_ratelink);          \
        }
 
 #define ISC_EVENT_INIT_PASS ISC_EVENT_INIT
index 4a6bc909c74422ca97f1381972bf9c6c96ba92fc..138761720559913eab5edcbe38963a726c9c0332 100644 (file)
@@ -81,7 +81,7 @@ isc_ratelimiter_create(isc_mem_t *mctx, isc_timermgr_t *timermgr,
         */
        isc_refcount_increment(&rl->references);
 
-       ISC_EVENT_INIT(&rl->shutdownevent, sizeof(isc_event_t), 0, NULL,
+       ISC_EVENT_INIT(&rl->shutdownevent, sizeof(isc_event_t), 0,
                       ISC_RATELIMITEREVENT_SHUTDOWN,
                       ratelimiter_shutdowncomplete, rl, rl, NULL, NULL);