+++ /dev/null
-/* $NetBSD: callout.h,v 1.22 2005/12/11 12:25:20 christos Exp $ */\r
-\r
-/*-\r
- * Copyright (c) 2000, 2003 The NetBSD Foundation, Inc.\r
- * All rights reserved.\r
- *\r
- * This code is derived from software contributed to The NetBSD Foundation\r
- * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,\r
- * NASA Ames Research Center.\r
- *\r
- * Redistribution and use in source and binary forms, with or without\r
- * modification, are permitted provided that the following conditions\r
- * are met:\r
- * 1. Redistributions of source code must retain the above copyright\r
- * notice, this list of conditions and the following disclaimer.\r
- * 2. Redistributions in binary form must reproduce the above copyright\r
- * notice, this list of conditions and the following disclaimer in the\r
- * documentation and/or other materials provided with the distribution.\r
- * 3. All advertising materials mentioning features or use of this software\r
- * must display the following acknowledgement:\r
- * This product includes software developed by the NetBSD\r
- * Foundation, Inc. and its contributors.\r
- * 4. Neither the name of The NetBSD Foundation nor the names of its\r
- * contributors may be used to endorse or promote products derived\r
- * from this software without specific prior written permission.\r
- *\r
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS\r
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED\r
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS\r
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r
- * POSSIBILITY OF SUCH DAMAGE.\r
- */\r
-\r
-/*\r
- * Copyright (c) 2000-2001 Artur Grabowski <art@openbsd.org>\r
- * All rights reserved.\r
- *\r
- * Redistribution and use in source and binary forms, with or without\r
- * modification, are permitted provided that the following conditions\r
- * are met:\r
- *\r
- * 1. Redistributions of source code must retain the above copyright\r
- * notice, this list of conditions and the following disclaimer.\r
- * 2. Redistributions in binary form must reproduce the above copyright\r
- * notice, this list of conditions and the following disclaimer in the\r
- * documentation and/or other materials provided with the distribution.\r
- * 3. The name of the author may not be used to endorse or promote products\r
- * derived from this software without specific prior written permission.\r
- *\r
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,\r
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY\r
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL\r
- * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\r
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\r
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;\r
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\r
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR\r
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\r
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
- */\r
-\r
-#ifndef _SYS_CALLOUT_H_\r
-#define _SYS_CALLOUT_H_\r
-\r
-/*\r
- * The following funkyness is to appease gcc3's strict aliasing.\r
- */\r
-struct callout;\r
-struct callout_circq {\r
- /* next element */\r
- union {\r
- struct callout *elem;\r
- struct callout_circq *list;\r
- } cq_next;\r
- /* previous element */\r
- union {\r
- struct callout *elem;\r
- struct callout_circq *list;\r
- } cq_prev;\r
-};\r
-#define cq_next_e cq_next.elem\r
-#define cq_prev_e cq_prev.elem\r
-#define cq_next_l cq_next.list\r
-#define cq_prev_l cq_prev.list\r
-\r
-struct callout {\r
- struct callout_circq c_list; /* linkage on queue */\r
- void (*c_func)(void *); /* function to call */\r
- void *c_arg; /* function argument */\r
- int c_time; /* when callout fires */\r
- int c_flags; /* state of this entry */\r
-};\r
-\r
-#define CALLOUT_PENDING 0x0002 /* callout is on the queue */\r
-#define CALLOUT_FIRED 0x0004 /* callout has fired */\r
-#define CALLOUT_INVOKING 0x0008 /* callout function is being invoked */\r
-\r
-#define CALLOUT_INITIALIZER_SETFUNC(func, arg) \\r
- { {{NULL}, {NULL}}, func, arg, 0, 0 }\r
-\r
-#define CALLOUT_INITIALIZER CALLOUT_INITIALIZER_SETFUNC(NULL, NULL)\r
-\r
-#ifdef _KERNEL\r
-void callout_startup(void);\r
-void callout_init(struct callout *);\r
-void callout_setfunc(struct callout *, void (*)(void *), void *);\r
-void callout_reset(struct callout *, int, void (*)(void *), void *);\r
-void callout_schedule(struct callout *, int);\r
-void callout_stop(struct callout *);\r
-int callout_hardclock(void);\r
-\r
-#define callout_setfunc(c, f, a) \\r
-do { \\r
- (c)->c_func = (f); \\r
- (c)->c_arg = (a); \\r
-} while (/*CONSTCOND*/0)\r
-\r
-#define callout_pending(c) ((c)->c_flags & CALLOUT_PENDING)\r
-#define callout_expired(c) ((c)->c_flags & CALLOUT_FIRED)\r
-#define callout_active(c) ((c)->c_flags & (CALLOUT_PENDING|CALLOUT_FIRED))\r
-#define callout_invoking(c) ((c)->c_flags & CALLOUT_INVOKING)\r
-#define callout_ack(c) ((c)->c_flags &= ~CALLOUT_INVOKING)\r
-#endif /* _KERNEL */\r
-\r
-#endif /* !_SYS_CALLOUT_H_ */\r