diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2006-05-27 22:23:50 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2006-05-27 22:23:50 +0000 |
commit | 98ee3c3ba21d44bb73b12a5c7abdb7d7f352fdb9 (patch) | |
tree | 7f8ea26f736ce205506af310a47bf545d1404ff0 | |
parent | ab1b2afa516f90c0314b01f2b3a6898eb9bcfd72 (diff) |
add sensor_byid(), return sensor by its id
-rw-r--r-- | usr.sbin/ntpd/sensors.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/usr.sbin/ntpd/sensors.c b/usr.sbin/ntpd/sensors.c index ea8de0f8c8c..98c52c39b81 100644 --- a/usr.sbin/ntpd/sensors.c +++ b/usr.sbin/ntpd/sensors.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sensors.c,v 1.5 2006/05/27 22:22:47 henning Exp $ */ +/* $OpenBSD: sensors.c,v 1.6 2006/05/27 22:23:49 henning Exp $ */ /* * Copyright (c) 2006 Henning Brauer <henning@openbsd.org> @@ -34,8 +34,9 @@ #define SENSORS_MAX 255 #define _PATH_DEV_HOTPLUG "/dev/hotplug" -void sensor_probe(int); -void sensor_add(struct sensor *); +void sensor_probe(int); +void sensor_add(struct sensor *); +struct ntp_sensor *sensor_byid(int); struct ntpd_conf *conf; @@ -117,6 +118,18 @@ sensor_remove(struct ntp_sensor *s) free(s); } +struct ntp_sensor * +sensor_byid(int id) +{ + struct ntp_sensor *s; + + TAILQ_FOREACH(s, &conf->ntp_sensors, entry) + if (s->sensorid == id) + return(s); + + return (NULL); +} + int sensor_query(struct ntp_sensor *s) { |