1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-10-19 02:29:40 +00:00

- Use ng_callout() instead of home-grown implementation.

Submitted by:	emax
This commit is contained in:
Gleb Smirnoff 2005-01-11 11:55:56 +00:00
parent 0ef8db8ff2
commit c00e2d15b7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=140065
2 changed files with 4 additions and 22 deletions

View File

@ -116,7 +116,6 @@ static ng_disconnect_t ng_h4_disconnect;
/* Other stuff */
static void ng_h4_timeout (node_p);
static void ng_h4_untimeout (node_p);
static void ng_h4_queue_timeout (void *);
static void ng_h4_process_timeout (node_p, hook_p, void *, int);
static int ng_h4_mod_event (module_t, int, void *);
@ -179,7 +178,7 @@ ng_h4_open(struct cdev *dev, struct tty *tp)
sc->got = 0;
NG_BT_MBUFQ_INIT(&sc->outq, NG_H4_DEFAULTQLEN);
callout_handle_init(&sc->timo);
ng_callout_init(&sc->timo);
/* Setup netgraph node */
error = ng_make_node_common(&typestruct, &sc->node);
@ -959,8 +958,7 @@ ng_h4_timeout(node_p node)
{
ng_h4_info_p sc = (ng_h4_info_p) NG_NODE_PRIVATE(node);
NG_NODE_REF(node);
sc->timo = timeout(ng_h4_queue_timeout, node, 1);
ng_callout(&sc->timo, node, NULL, 1, ng_h4_process_timeout, NULL, 0);
sc->flags |= NG_H4_TIMEOUT;
} /* ng_h4_timeout */
@ -974,25 +972,9 @@ ng_h4_untimeout(node_p node)
ng_h4_info_p sc = (ng_h4_info_p) NG_NODE_PRIVATE(node);
sc->flags &= ~NG_H4_TIMEOUT;
untimeout(ng_h4_queue_timeout, node, sc->timo);
NG_NODE_UNREF(node);
ng_uncallout(&sc->timo, node);
} /* ng_h4_untimeout */
/*
* OK, timeout has happend, so queue function to process it
*/
static void
ng_h4_queue_timeout(void *context)
{
node_p node = (node_p) context;
if (NG_NODE_IS_VALID(node))
ng_send_fn(node, NULL, &ng_h4_process_timeout, NULL, 0);
NG_NODE_UNREF(node);
} /* ng_h4_queue_timeout */
/*
* Timeout processing function.
* We still have data to output to the device, so try sending more.

View File

@ -94,7 +94,7 @@ typedef struct ng_h4_info {
u_int32_t want; /* Number of bytes we want to receive */
hook_p hook; /* Upstream hook */
struct callout_handle timo; /* See man timeout(9) */
struct callout timo; /* See man timeout(9) */
} ng_h4_info_t;
typedef ng_h4_info_t * ng_h4_info_p;