diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2008-07-19 11:38:55 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2008-07-19 11:38:55 +0000 |
commit | 51b0584575c3f2c14bf58c484d8ba95bfe471a33 (patch) | |
tree | fda4363a0c4abaff65dc50d8b602bc4df5920da3 /usr.sbin | |
parent | d68614ae1715c79fb4a5e718211c2d1ba16bb574 (diff) |
no need for using a TAILQ queue for the host children list, use a
singly-linked SLIST instead. the only noticeable change is the
reversed order to notify the children but it does not really matter
here. also only walk through the children host list if the host
itself is a potential parent.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/relayd/hce.c | 6 | ||||
-rw-r--r-- | usr.sbin/relayd/parse.y | 8 | ||||
-rw-r--r-- | usr.sbin/relayd/pfe.c | 22 | ||||
-rw-r--r-- | usr.sbin/relayd/relayd.h | 6 |
4 files changed, 21 insertions, 21 deletions
diff --git a/usr.sbin/relayd/hce.c b/usr.sbin/relayd/hce.c index 262f7f646c9..b6aa6599ac5 100644 --- a/usr.sbin/relayd/hce.c +++ b/usr.sbin/relayd/hce.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hce.c,v 1.42 2008/07/19 10:52:32 reyk Exp $ */ +/* $OpenBSD: hce.c,v 1.43 2008/07/19 11:38:54 reyk Exp $ */ /* * Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -332,11 +332,11 @@ hce_notify_done(struct host *host, const char *msg) host->last_up = host->up; - if (TAILQ_EMPTY(&host->children)) + if (SLIST_EMPTY(&host->children)) return; /* Notify for all other hosts that inherit the state from this one */ - TAILQ_FOREACH(h, &host->children, child) { + SLIST_FOREACH(h, &host->children, child) { h->up = hostup; hce_notify_done(h, msg); } diff --git a/usr.sbin/relayd/parse.y b/usr.sbin/relayd/parse.y index 9a881ed0f2a..b8812cac4c8 100644 --- a/usr.sbin/relayd/parse.y +++ b/usr.sbin/relayd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.120 2008/07/19 10:52:32 reyk Exp $ */ +/* $OpenBSD: parse.y,v 1.121 2008/07/19 11:38:54 reyk Exp $ */ /* * Copyright (c) 2007, 2008 Reyk Floeter <reyk@openbsd.org> @@ -1267,7 +1267,7 @@ host : STRING retry parent { $$->conf.id = 0; /* will be set later */ $$->conf.retry = $2; $$->conf.parentid = $3; - TAILQ_INIT(&$$->children); + SLIST_INIT(&$$->children); } ; @@ -1860,7 +1860,7 @@ parse_config(const char *filename, int opts) h->conf.parentid); errors++; } else - TAILQ_INSERT_TAIL(&ph->children, + SLIST_INSERT_HEAD(&ph->children, h, child); } } @@ -2167,7 +2167,7 @@ table_inherit(struct table *tb) } h->conf.tableid = tb->conf.id; h->tablename = tb->conf.name; - TAILQ_INIT(&h->children); + SLIST_INIT(&h->children); TAILQ_INSERT_TAIL(&tb->hosts, h, entry); } diff --git a/usr.sbin/relayd/pfe.c b/usr.sbin/relayd/pfe.c index f06432a6b6b..9b07926d405 100644 --- a/usr.sbin/relayd/pfe.c +++ b/usr.sbin/relayd/pfe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfe.c,v 1.49 2008/07/19 10:52:32 reyk Exp $ */ +/* $OpenBSD: pfe.c,v 1.50 2008/07/19 11:38:54 reyk Exp $ */ /* * Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -791,12 +791,12 @@ disable_host(struct ctl_conn *c, struct ctl_id *id, struct host *host) &host->conf.id, sizeof(host->conf.id)); log_debug("disable_host: disabled host %d", host->conf.id); - /* Disable all children */ - TAILQ_FOREACH(h, &host->children, child) - disable_host(c, id, h); - - if (!host->conf.parentid) + if (!host->conf.parentid) { + /* Disable all children */ + SLIST_FOREACH(h, &host->children, child) + disable_host(c, id, h); pfe_sync(); + } return (0); } @@ -833,12 +833,12 @@ enable_host(struct ctl_conn *c, struct ctl_id *id, struct host *host) &host->conf.id, sizeof(host->conf.id)); log_debug("enable_host: enabled host %d", host->conf.id); - /* Enable all children */ - TAILQ_FOREACH(h, &host->children, child) - enable_host(c, id, h); - - if (!host->conf.parentid) + if (!host->conf.parentid) { + /* Enable all children */ + SLIST_FOREACH(h, &host->children, child) + enable_host(c, id, h); pfe_sync(); + } return (0); } diff --git a/usr.sbin/relayd/relayd.h b/usr.sbin/relayd/relayd.h index 763a4f58709..c6ebf8eb955 100644 --- a/usr.sbin/relayd/relayd.h +++ b/usr.sbin/relayd/relayd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: relayd.h,v 1.107 2008/07/19 10:52:32 reyk Exp $ */ +/* $OpenBSD: relayd.h,v 1.108 2008/07/19 11:38:54 reyk Exp $ */ /* * Copyright (c) 2006, 2007 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -354,8 +354,8 @@ struct host_config { struct host { TAILQ_ENTRY(host) entry; - TAILQ_ENTRY(host) child; - TAILQ_HEAD(,host) children; + SLIST_ENTRY(host) child; + SLIST_HEAD(,host) children; struct host_config conf; u_int32_t flags; char *tablename; |