diff options
| author | 2020-02-18 18:11:27 +0000 | |
|---|---|---|
| committer | 2020-02-18 18:11:27 +0000 | |
| commit | 8b5538545d486ecceb041780b03e8ef5e76cedd6 (patch) | |
| tree | 97ecca45f41f25f5899a36b8e5e57742e8985ed8 /usr.bin/dig/lib/isc/include | |
| parent | Remove unused task, taskmgr, app, socket and socketmgr methods. (diff) | |
| download | wireguard-openbsd-8b5538545d486ecceb041780b03e8ef5e76cedd6.tar.xz wireguard-openbsd-8b5538545d486ecceb041780b03e8ef5e76cedd6.zip | |
Get rid of ISC_MAGIC and ISC_MAGIC_VALID macros.
While pulling on that it turns out we can / need git rid of a isc_task
-> isc__task, isc_taskmgr -> isc__taskmgr, isc_timer -> isc__timer and
isc_socket -> isc__socket indirection.
OK millert
Diffstat (limited to 'usr.bin/dig/lib/isc/include')
| -rw-r--r-- | usr.bin/dig/lib/isc/include/isc/app.h | 37 | ||||
| -rw-r--r-- | usr.bin/dig/lib/isc/include/isc/buffer.h | 15 | ||||
| -rw-r--r-- | usr.bin/dig/lib/isc/include/isc/magic.h | 42 | ||||
| -rw-r--r-- | usr.bin/dig/lib/isc/include/isc/socket.h | 37 | ||||
| -rw-r--r-- | usr.bin/dig/lib/isc/include/isc/task.h | 33 | ||||
| -rw-r--r-- | usr.bin/dig/lib/isc/include/isc/timer.h | 33 |
6 files changed, 5 insertions, 192 deletions
diff --git a/usr.bin/dig/lib/isc/include/isc/app.h b/usr.bin/dig/lib/isc/include/isc/app.h index e371d54b59d..d403b5c0ea3 100644 --- a/usr.bin/dig/lib/isc/include/isc/app.h +++ b/usr.bin/dig/lib/isc/include/isc/app.h @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: app.h,v 1.4 2020/02/18 18:10:17 florian Exp $ */ +/* $Id: app.h,v 1.5 2020/02/18 18:11:27 florian Exp $ */ #ifndef ISC_APP_H #define ISC_APP_H 1 @@ -77,7 +77,6 @@ */ #include <isc/eventclass.h> -#include <isc/magic.h> #include <isc/result.h> /*** @@ -90,24 +89,6 @@ typedef isc_event_t isc_appevent_t; #define ISC_APPEVENT_SHUTDOWN (ISC_EVENTCLASS_APP + 1) #define ISC_APPEVENT_LASTEVENT (ISC_EVENTCLASS_APP + 65535) -/*% - * This structure is actually just the common prefix of an application context - * implementation's version of an isc_appctx_t. - * \brief - * Direct use of this structure by clients is forbidden. app implementations - * may change the structure. 'magic' must be ISCAPI_APPCTX_MAGIC for any - * of the isc_app_ routines to work. app implementations must maintain - * all app context invariants. - */ -struct isc_appctx { - unsigned int impmagic; - unsigned int magic; -}; - -#define ISCAPI_APPCTX_MAGIC ISC_MAGIC('A','a','p','c') -#define ISCAPI_APPCTX_VALID(c) ((c) != NULL && \ - (c)->magic == ISCAPI_APPCTX_MAGIC) - isc_result_t isc_app_start(void); /*!< @@ -188,22 +169,6 @@ isc_app_shutdown(void); */ void -isc_app_finish(void); -/*!< - * \brief Finish an ISC library application. - * - * Notes: - *\li This call should be made at or near the end of main(). - * - * Requires: - *\li isc_app_start() has been called. - *\li 'ctx' is a valid application context (for app_ctxfinish()). - * - * Ensures: - *\li Any resources allocated by isc_app_start() have been released. - */ - -void isc_app_block(void); /*!< * \brief Indicate that a blocking operation will be performed. diff --git a/usr.bin/dig/lib/isc/include/isc/buffer.h b/usr.bin/dig/lib/isc/include/isc/buffer.h index 190a6496b24..acc84999da2 100644 --- a/usr.bin/dig/lib/isc/include/isc/buffer.h +++ b/usr.bin/dig/lib/isc/include/isc/buffer.h @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: buffer.h,v 1.5 2020/02/15 10:56:25 florian Exp $ */ +/* $Id: buffer.h,v 1.6 2020/02/18 18:11:27 florian Exp $ */ #ifndef ISC_BUFFER_H #define ISC_BUFFER_H 1 @@ -108,8 +108,6 @@ #include <inttypes.h> - -#include <isc/magic.h> #include <isc/types.h> /*! @@ -118,14 +116,6 @@ */ /* #define ISC_BUFFER_USEINLINE */ -/*@{*/ -/*! - *** Magic numbers - ***/ -#define ISC_BUFFER_MAGIC 0x42756621U /* Buf!. */ -#define ISC_BUFFER_VALID(b) ISC_MAGIC_VALID(b, ISC_BUFFER_MAGIC) -/*@}*/ - /* * The following macros MUST be used only on valid buffers. It is the * caller's responsibility to ensure this by using the ISC_BUFFER_VALID @@ -165,7 +155,6 @@ */ struct isc_buffer { - unsigned int magic; void *base; /*@{*/ /*! The following integers are byte offsets from 'base'. */ @@ -648,14 +637,12 @@ isc_buffer_copyregion(isc_buffer_t *b, const isc_region_t *r); (_b)->current = 0; \ (_b)->active = 0; \ ISC_LINK_INIT(_b, link); \ - (_b)->magic = ISC_BUFFER_MAGIC; \ } while (0) #define ISC__BUFFER_INITNULL(_b) ISC__BUFFER_INIT(_b, NULL, 0) #define ISC__BUFFER_INVALIDATE(_b) \ do { \ - (_b)->magic = 0; \ (_b)->base = NULL; \ (_b)->length = 0; \ (_b)->used = 0; \ diff --git a/usr.bin/dig/lib/isc/include/isc/magic.h b/usr.bin/dig/lib/isc/include/isc/magic.h deleted file mode 100644 index 02d1bd595ad..00000000000 --- a/usr.bin/dig/lib/isc/include/isc/magic.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE - * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: magic.h,v 1.1 2020/02/07 09:58:54 florian Exp $ */ - -#ifndef ISC_MAGIC_H -#define ISC_MAGIC_H 1 - - - -/*! \file isc/magic.h */ - -typedef struct { - unsigned int magic; -} isc__magic_t; - - -/*% - * To use this macro the magic number MUST be the first thing in the - * structure, and MUST be of type "unsigned int". - * The intent of this is to allow magic numbers to be checked even though - * the object is otherwise opaque. - */ -#define ISC_MAGIC_VALID(a,b) (((a) != NULL) && \ - (((const isc__magic_t *)(a))->magic == (b))) - -#define ISC_MAGIC(a, b, c, d) ((a) << 24 | (b) << 16 | (c) << 8 | (d)) - -#endif /* ISC_MAGIC_H */ diff --git a/usr.bin/dig/lib/isc/include/isc/socket.h b/usr.bin/dig/lib/isc/include/isc/socket.h index 23de1086474..3f15155163a 100644 --- a/usr.bin/dig/lib/isc/include/isc/socket.h +++ b/usr.bin/dig/lib/isc/include/isc/socket.h @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: socket.h,v 1.4 2020/02/18 18:10:17 florian Exp $ */ +/* $Id: socket.h,v 1.5 2020/02/18 18:11:27 florian Exp $ */ #ifndef ISC_SOCKET_H #define ISC_SOCKET_H 1 @@ -190,41 +190,6 @@ typedef enum { #define ISC_SOCKFDWATCH_WRITE 0x00000002 /*%< watch for writable */ /*@}*/ -/*% - * This structure is actually just the common prefix of a socket manager - * object implementation's version of an isc_socketmgr_t. - * \brief - * Direct use of this structure by clients is forbidden. socket implementations - * may change the structure. 'magic' must be ISCAPI_SOCKETMGR_MAGIC for any - * of the isc_socket_ routines to work. socket implementations must maintain - * all socket invariants. - * In effect, this definition is used only for non-BIND9 version ("export") - * of the library, and the export version does not work for win32. So, to avoid - * the definition conflict with win32/socket.c, we enable this definition only - * for non-Win32 (i.e. Unix) platforms. - */ -struct isc_socketmgr { - unsigned int impmagic; - unsigned int magic; -}; - -#define ISCAPI_SOCKETMGR_MAGIC ISC_MAGIC('A','s','m','g') -#define ISCAPI_SOCKETMGR_VALID(m) ((m) != NULL && \ - (m)->magic == ISCAPI_SOCKETMGR_MAGIC) - -/*% - * This is the common prefix of a socket object. The same note as - * that for the socketmgr structure applies. - */ -struct isc_socket { - unsigned int impmagic; - unsigned int magic; -}; - -#define ISCAPI_SOCKET_MAGIC ISC_MAGIC('A','s','c','t') -#define ISCAPI_SOCKET_VALID(s) ((s) != NULL && \ - (s)->magic == ISCAPI_SOCKET_MAGIC) - /*** *** Socket and Socket Manager Functions *** diff --git a/usr.bin/dig/lib/isc/include/isc/task.h b/usr.bin/dig/lib/isc/include/isc/task.h index d493d182d79..887f0f1183d 100644 --- a/usr.bin/dig/lib/isc/include/isc/task.h +++ b/usr.bin/dig/lib/isc/include/isc/task.h @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: task.h,v 1.5 2020/02/18 18:10:17 florian Exp $ */ +/* $Id: task.h,v 1.6 2020/02/18 18:11:27 florian Exp $ */ #ifndef ISC_TASK_H #define ISC_TASK_H 1 @@ -100,37 +100,6 @@ typedef enum { isc_taskmgrmode_privileged } isc_taskmgrmode_t; -/*% - * This structure is actually just the common prefix of a task manager - * object implementation's version of an isc_taskmgr_t. - * \brief - * Direct use of this structure by clients is forbidden. task implementations - * may change the structure. 'magic' must be ISCAPI_TASKMGR_MAGIC for any - * of the isc_task_ routines to work. task implementations must maintain - * all task invariants. - */ -struct isc_taskmgr { - unsigned int impmagic; - unsigned int magic; -}; - -#define ISCAPI_TASKMGR_MAGIC ISC_MAGIC('A','t','m','g') -#define ISCAPI_TASKMGR_VALID(m) ((m) != NULL && \ - (m)->magic == ISCAPI_TASKMGR_MAGIC) - -/*% - * This is the common prefix of a task object. The same note as - * that for the taskmgr structure applies. - */ -struct isc_task { - unsigned int impmagic; - unsigned int magic; -}; - -#define ISCAPI_TASK_MAGIC ISC_MAGIC('A','t','s','t') -#define ISCAPI_TASK_VALID(s) ((s) != NULL && \ - (s)->magic == ISCAPI_TASK_MAGIC) - isc_result_t isc_task_create(isc_taskmgr_t *manager, unsigned int quantum, isc_task_t **taskp); diff --git a/usr.bin/dig/lib/isc/include/isc/timer.h b/usr.bin/dig/lib/isc/include/isc/timer.h index 1dc618598e1..6eb76fa61a3 100644 --- a/usr.bin/dig/lib/isc/include/isc/timer.h +++ b/usr.bin/dig/lib/isc/include/isc/timer.h @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: timer.h,v 1.9 2020/02/16 21:08:59 florian Exp $ */ +/* $Id: timer.h,v 1.10 2020/02/18 18:11:27 florian Exp $ */ #ifndef ISC_TIMER_H #define ISC_TIMER_H 1 @@ -93,37 +93,6 @@ typedef struct isc_timerevent { #define ISC_TIMEREVENT_LIFE (ISC_EVENTCLASS_TIMER + 3) #define ISC_TIMEREVENT_LASTEVENT (ISC_EVENTCLASS_TIMER + 65535) -/*% - * This structure is actually just the common prefix of a timer manager - * object implementation's version of an isc_timermgr_t. - * \brief - * Direct use of this structure by clients is forbidden. timer implementations - * may change the structure. 'magic' must be ISCAPI_TIMERMGR_MAGIC for any - * of the isc_timer_ routines to work. timer implementations must maintain - * all timer invariants. - */ -struct isc_timermgr { - unsigned int impmagic; - unsigned int magic; -}; - -#define ISCAPI_TIMERMGR_MAGIC ISC_MAGIC('A','t','m','g') -#define ISCAPI_TIMERMGR_VALID(m) ((m) != NULL && \ - (m)->magic == ISCAPI_TIMERMGR_MAGIC) - -/*% - * This is the common prefix of a timer object. The same note as - * that for the timermgr structure applies. - */ -struct isc_timer { - unsigned int impmagic; - unsigned int magic; -}; - -#define ISCAPI_TIMER_MAGIC ISC_MAGIC('A','t','m','r') -#define ISCAPI_TIMER_VALID(s) ((s) != NULL && \ - (s)->magic == ISCAPI_TIMER_MAGIC) - /*** *** Timer and Timer Manager Functions *** |
