From: Alan T. DeKok Date: Mon, 4 Mar 2024 02:07:22 +0000 (-0500) Subject: cleanups and clarifications X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eb3c1894dc0efd4a7a506ffc5bcd7696df35f24e;p=thirdparty%2Ffreeradius-server.git cleanups and clarifications --- diff --git a/src/lib/bio/queue.c b/src/lib/bio/queue.c index 4c9d8f100bf..2a54fd676fb 100644 --- a/src/lib/bio/queue.c +++ b/src/lib/bio/queue.c @@ -27,7 +27,6 @@ #include #include -typedef struct fr_bio_queue_entry_s fr_bio_queue_entry_t; typedef struct fr_bio_queue_list_s fr_bio_queue_list_t; typedef struct fr_bio_queue_s fr_bio_queue_t; @@ -53,14 +52,8 @@ struct fr_bio_queue_entry_s { FR_DLIST_ENTRY(fr_bio_queue_list) entry; //!< List entry. }; -struct fr_bio_queue_list_s { - FR_DLIST_HEAD(fr_bio_queue_list) saved; - FR_DLIST_HEAD(fr_bio_queue_list) free; -}; - FR_DLIST_FUNCS(fr_bio_queue_list, fr_bio_queue_entry_t, entry) - typedef struct fr_bio_queue_s { FR_BIO_COMMON; @@ -455,18 +448,17 @@ fr_bio_t *fr_bio_queue_alloc(TALLOC_CTX *ctx, size_t max_saved, * * There is no way to cancel all packets. The caller must find the lowest bio in the chain, and shutdown it. * e.g. by closing the socket via fr_bio_fd_close(). That function will take care of walking back up the - * chain, and shutdownting each bio. + * chain, and shutting down each bio. * * @param bio the #fr_bio_queue_t - * @param queue_ctx The context returned from #fr_bio_queue_saved_t + * @param item The context returned from #fr_bio_queue_saved_t * @return * - <0 no such packet was found in the list of saved packets, OR the packet cannot be cancelled. * - 0 the packet was cancelled. */ -int fr_bio_queue_cancel(fr_bio_t *bio, void *queue_ctx) +int fr_bio_queue_cancel(fr_bio_t *bio, fr_bio_queue_entry_t *item) { fr_bio_queue_t *my = talloc_get_type_abort(bio, fr_bio_queue_t); - fr_bio_queue_entry_t *item = queue_ctx; if (!(item >= &my->array[0]) && (item < &my->array[my->max_saved])) { return -1; diff --git a/src/lib/bio/queue.h b/src/lib/bio/queue.h index 124e68f1bdf..7e0cb8b9a89 100644 --- a/src/lib/bio/queue.h +++ b/src/lib/bio/queue.h @@ -27,8 +27,10 @@ */ RCSIDH(lib_bio_queue_h, "$Id$") +typedef struct fr_bio_queue_entry_s fr_bio_queue_entry_t; + typedef void (*fr_bio_queue_callback_t)(fr_bio_t *bio, void *packet_ctx, const void *buffer, size_t size); -typedef void (*fr_bio_queue_saved_t)(fr_bio_t *bio, void *packet_ctx, const void *buffer, size_t size, void *ctx); +typedef void (*fr_bio_queue_saved_t)(fr_bio_t *bio, void *packet_ctx, const void *buffer, size_t size, fr_bio_queue_entry_t *queue_ctx); fr_bio_t *fr_bio_queue_alloc(TALLOC_CTX *ctx, size_t max_saved, fr_bio_queue_saved_t saved, @@ -36,4 +38,4 @@ fr_bio_t *fr_bio_queue_alloc(TALLOC_CTX *ctx, size_t max_saved, fr_bio_queue_callback_t cancel, fr_bio_t *next) CC_HINT(nonnull(1,6)); -int fr_bio_queue_cancel(fr_bio_t *bio, void *queue_ctx) CC_HINT(nonnull); +int fr_bio_queue_cancel(fr_bio_t *bio, fr_bio_queue_entry_t *queue_ctx) CC_HINT(nonnull);