diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2006-05-27 22:22:48 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2006-05-27 22:22:48 +0000 |
commit | ab1b2afa516f90c0314b01f2b3a6898eb9bcfd72 (patch) | |
tree | 9e2a1ee781fbd8dd85c676738cdbdb7bbc782142 /usr.sbin | |
parent | 106ee2c6eb16e1e33a4d103a2ec8e3d2c86e174d (diff) |
stop passing the config around all time, just store one copy
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/ntpd/ntp.c | 6 | ||||
-rw-r--r-- | usr.sbin/ntpd/ntpd.h | 6 | ||||
-rw-r--r-- | usr.sbin/ntpd/sensors.c | 23 |
3 files changed, 19 insertions, 16 deletions
diff --git a/usr.sbin/ntpd/ntp.c b/usr.sbin/ntpd/ntp.c index a4ef5edcbba..0fceeb90326 100644 --- a/usr.sbin/ntpd/ntp.c +++ b/usr.sbin/ntpd/ntp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ntp.c,v 1.73 2006/05/27 21:27:34 henning Exp $ */ +/* $OpenBSD: ntp.c,v 1.74 2006/05/27 22:22:47 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -237,7 +237,7 @@ ntp_main(int pipe_prnt[2], struct ntpd_conf *nconf) } if (last_sensor_scan + SENSOR_SCAN_INTERVAL < time(NULL)) { - sensor_scan(conf); + sensor_scan(); last_sensor_scan = time(NULL); } sensors_cnt = 0; @@ -301,7 +301,7 @@ ntp_main(int pipe_prnt[2], struct ntpd_conf *nconf) s = next_s) { next_s = TAILQ_NEXT(s, entry); if (sensor_query(s) == -1) - sensor_remove(conf, s); + sensor_remove(s); } } diff --git a/usr.sbin/ntpd/ntpd.h b/usr.sbin/ntpd/ntpd.h index 8b041053b40..cf550cecb69 100644 --- a/usr.sbin/ntpd/ntpd.h +++ b/usr.sbin/ntpd/ntpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ntpd.h,v 1.66 2006/05/27 21:27:34 henning Exp $ */ +/* $OpenBSD: ntpd.h,v 1.67 2006/05/27 22:22:47 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -282,8 +282,8 @@ struct s_fixedpt d_to_sfp(double); /* sensors.c */ void sensor_init(struct ntpd_conf *); -void sensor_scan(struct ntpd_conf *); -void sensor_remove(struct ntpd_conf *, struct ntp_sensor *); +void sensor_scan(void); +void sensor_remove(struct ntp_sensor *); int sensor_query(struct ntp_sensor *); int sensor_hotplugfd(void); void sensor_hotplugevent(int); diff --git a/usr.sbin/ntpd/sensors.c b/usr.sbin/ntpd/sensors.c index d493b4476eb..ea8de0f8c8c 100644 --- a/usr.sbin/ntpd/sensors.c +++ b/usr.sbin/ntpd/sensors.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sensors.c,v 1.4 2006/05/27 21:33:47 henning Exp $ */ +/* $OpenBSD: sensors.c,v 1.5 2006/05/27 22:22:47 henning Exp $ */ /* * Copyright (c) 2006 Henning Brauer <henning@openbsd.org> @@ -34,26 +34,29 @@ #define SENSORS_MAX 255 #define _PATH_DEV_HOTPLUG "/dev/hotplug" -void sensor_probe(struct ntpd_conf *, int); -void sensor_add(struct ntpd_conf *, struct sensor *); +void sensor_probe(int); +void sensor_add(struct sensor *); + +struct ntpd_conf *conf; void -sensor_init(struct ntpd_conf *conf) +sensor_init(struct ntpd_conf *c) { + conf = c; TAILQ_INIT(&conf->ntp_sensors); } void -sensor_scan(struct ntpd_conf *conf) +sensor_scan(void) { int i; for (i = 0; i < SENSORS_MAX; i++) - sensor_probe(conf, i); + sensor_probe(i); } void -sensor_probe(struct ntpd_conf *conf, int id) +sensor_probe(int id) { int mib[3]; size_t len; @@ -71,11 +74,11 @@ sensor_probe(struct ntpd_conf *conf, int id) } if (sensor.type == SENSOR_TIMEDELTA) - sensor_add(conf, &sensor); + sensor_add(&sensor); } void -sensor_add(struct ntpd_conf *conf, struct sensor *sensor) +sensor_add(struct sensor *sensor) { struct ntp_sensor *s; struct ntp_conf_sensor *cs; @@ -107,7 +110,7 @@ sensor_add(struct ntpd_conf *conf, struct sensor *sensor) } void -sensor_remove(struct ntpd_conf *conf, struct ntp_sensor *s) +sensor_remove(struct ntp_sensor *s) { TAILQ_REMOVE(&conf->ntp_sensors, s, entry); free(s->device); |