Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin Update for proplib(3) API changes.



details:   https://anonhg.NetBSD.org/src/rev/6f371617e8cb
branches:  trunk
changeset: 934099:6f371617e8cb
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Jun 07 00:51:48 2020 +0000

description:
Update for proplib(3) API changes.

diffstat:

 usr.sbin/bthcid/config.c        |   8 ++--
 usr.sbin/envstat/config.c       |  63 ++++++++++++++++++++--------------------
 usr.sbin/envstat/envstat.c      |  44 ++++++++++++++--------------
 usr.sbin/envstat/envstat.h      |   4 +-
 usr.sbin/hdaudioctl/graph.c     |   4 +-
 usr.sbin/installboot/evboards.c |  46 ++++++++++++++--------------
 6 files changed, 85 insertions(+), 84 deletions(-)

diffs (truncated from 679 to 300 lines):

diff -r ec90069b7938 -r 6f371617e8cb usr.sbin/bthcid/config.c
--- a/usr.sbin/bthcid/config.c  Sun Jun 07 00:12:00 2020 +0000
+++ b/usr.sbin/bthcid/config.c  Sun Jun 07 00:51:48 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: config.c,v 1.5 2009/04/15 00:37:05 lukem Exp $ */
+/*     $NetBSD: config.c,v 1.6 2020/06/07 00:54:22 thorpej Exp $       */
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: config.c,v 1.5 2009/04/15 00:37:05 lukem Exp $");
+__RCSID("$NetBSD: config.c,v 1.6 2020/06/07 00:54:22 thorpej Exp $");
 
 #include <sys/time.h>
 #include <prop/proplib.h>
@@ -114,7 +114,7 @@
                return NULL;
        }
 
-       memcpy(key, prop_data_data_nocopy(obj), sizeof(key));
+       memcpy(key, prop_data_value(obj), sizeof(key));
        prop_object_release(cfg);
        return key;
 }
@@ -156,7 +156,7 @@
                prop_object_release(dev);
        }
 
-       dat = prop_data_create_data_nocopy(key, HCI_KEY_SIZE);
+       dat = prop_data_create_nocopy(key, HCI_KEY_SIZE);
        if (dat == NULL) {
                syslog(LOG_ERR, "Cannot create data object: %m");
                prop_object_release(cfg);
diff -r ec90069b7938 -r 6f371617e8cb usr.sbin/envstat/config.c
--- a/usr.sbin/envstat/config.c Sun Jun 07 00:12:00 2020 +0000
+++ b/usr.sbin/envstat/config.c Sun Jun 07 00:51:48 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: config.c,v 1.12 2011/08/31 13:32:36 joerg Exp $        */
+/*     $NetBSD: config.c,v 1.13 2020/06/07 00:51:48 thorpej Exp $      */
 
 /*-
  * Copyright (c) 2007 Juan Romero Pardines.
@@ -27,7 +27,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: config.c,v 1.12 2011/08/31 13:32:36 joerg Exp $");
+__RCSID("$NetBSD: config.c,v 1.13 2020/06/07 00:51:48 thorpej Exp $");
 #endif /* not lint */
 
 #include <stdio.h>
@@ -107,8 +107,8 @@
                        err(EXIT_FAILURE, "sensordict");
        }
 
-       if (!prop_dictionary_set_cstring(sensordict, key, value))
-               err(EXIT_FAILURE, "prop_dict_set_cstring");
+       if (!prop_dictionary_set_string(sensordict, key, value))
+               err(EXIT_FAILURE, "prop_dict_set_string");
 }
 
 /*
@@ -258,7 +258,7 @@
 
         while ((obj = prop_object_iterator_next(iter)) != NULL) {
                 prop_dictionary_remove(d,
-                    prop_dictionary_keysym_cstring_nocopy(obj));
+                    prop_dictionary_keysym_value(obj));
                 prop_object_iterator_reset(iter);
         }
 
@@ -292,7 +292,7 @@
        SLIST_FOREACH(sb, &sensor_block_list, sb_head) {
                /* get the index object value from configuration */
                lindex = prop_dictionary_get(sb->dict, "index");
-               sensor = prop_string_cstring_nocopy(lindex);
+               sensor = prop_string_value(lindex);
 
                iter = prop_array_iterator(array);
                if (!iter)
@@ -407,7 +407,7 @@
 
        while ((obj = prop_object_iterator_next(iter)) != NULL) {
                obj2 = prop_dictionary_get(obj, "index");
-               if (prop_string_equals_cstring(obj2, sensor_key))
+               if (prop_string_equals_string(obj2, sensor_key))
                        break;
        }
 
@@ -425,7 +425,8 @@
                                  const char *sensor)
 {
        prop_object_t obj, obj2, obj3;
-       char *strval, *endptr;
+       const char *strval;
+       char *endptr;
        double val;
 
        /*
@@ -435,7 +436,7 @@
        if (obj) {
                obj2 = prop_dictionary_get(ksdict, "allow-rfact");
                if (prop_bool_true(obj2)) {
-                       strval = prop_string_cstring(obj);
+                       strval = prop_string_value(obj);
                        val = strtod(strval, &endptr);
                        if (*endptr != '\0')
                                config_errmsg(VALUE_ERR, "rfact", sensor);
@@ -454,7 +455,7 @@
                obj2 = prop_dictionary_get(ksdict, "want-percentage");
                obj3 = prop_dictionary_get(ksdict, "monitoring-supported");
                if (prop_bool_true(obj2) && prop_bool_true(obj3)) {
-                       strval = prop_string_cstring(obj);
+                       strval = prop_string_value(obj);
                        val = strtod(strval, &endptr);
                        if ((*endptr != '\0') || (val < 0 || val > 100))
                                config_errmsg(VALUE_ERR,
@@ -464,7 +465,7 @@
                         * Convert the value to a valid percentage.
                         */
                        obj = prop_dictionary_get(ksdict, "max-value");
-                       val = (val / 100) * prop_number_integer_value(obj);
+                       val = (val / 100) * prop_number_signed_value(obj);
 
                        if (!prop_dictionary_set_uint32(csdict,
                                                       "critical-capacity",
@@ -482,7 +483,7 @@
                obj2 = prop_dictionary_get(ksdict, "want-percentage");
                obj3 = prop_dictionary_get(ksdict, "monitoring-supported");
                if (prop_bool_true(obj2) && prop_bool_true(obj3)) {
-                       strval = prop_string_cstring(obj);
+                       strval = prop_string_value(obj);
                        val = strtod(strval, &endptr);
                        if ((*endptr != '\0') || (val < 0 || val > 100))
                                config_errmsg(VALUE_ERR,
@@ -492,7 +493,7 @@
                         * Convert the value to a valid percentage.
                         */
                        obj = prop_dictionary_get(ksdict, "max-value");
-                       val = (val / 100) * prop_number_integer_value(obj);
+                       val = (val / 100) * prop_number_signed_value(obj);
 
                        if (!prop_dictionary_set_uint32(csdict,
                                                       "warning-capacity",
@@ -510,7 +511,7 @@
                obj2 = prop_dictionary_get(ksdict, "want-percentage");
                obj3 = prop_dictionary_get(ksdict, "monitoring-supported");
                if (prop_bool_true(obj2) && prop_bool_true(obj3)) {
-                       strval = prop_string_cstring(obj);
+                       strval = prop_string_value(obj);
                        val = strtod(strval, &endptr);
                        if ((*endptr != '\0') || (val < 0 || val > 100))
                                config_errmsg(VALUE_ERR,
@@ -520,7 +521,7 @@
                         * Convert the value to a valid percentage.
                         */
                        obj = prop_dictionary_get(ksdict, "max-value");
-                       val = (val / 100) * prop_number_integer_value(obj);
+                       val = (val / 100) * prop_number_signed_value(obj);
 
                        if (!prop_dictionary_set_uint32(csdict,
                                                       "high-capacity",
@@ -538,7 +539,7 @@
                obj2 = prop_dictionary_get(ksdict, "want-percentage");
                obj3 = prop_dictionary_get(ksdict, "monitoring-supported");
                if (prop_bool_true(obj2) && prop_bool_true(obj3)) {
-                       strval = prop_string_cstring(obj);
+                       strval = prop_string_value(obj);
                        val = strtod(strval, &endptr);
                        if ((*endptr != '\0') || (val < 0 || val > 100))
                                config_errmsg(VALUE_ERR,
@@ -548,7 +549,7 @@
                         * Convert the value to a valid percentage.
                         */
                        obj = prop_dictionary_get(ksdict, "max-value");
-                       val = (val / 100) * prop_number_integer_value(obj);
+                       val = (val / 100) * prop_number_signed_value(obj);
 
                        if (!prop_dictionary_set_uint32(csdict,
                                                       "maximum-capacity",
@@ -567,7 +568,7 @@
                if (!prop_bool_true(obj2))
                        config_errmsg(PROP_ERR, "critical-max", sensor);
 
-               strval = prop_string_cstring(obj);
+               strval = prop_string_value(obj);
                obj = convert_val_to_pnumber(ksdict, "critical-max",
                                             sensor, strval);
                if (!prop_dictionary_set(csdict, "critical-max", obj))
@@ -583,7 +584,7 @@
                if (!prop_bool_true(obj2))
                        config_errmsg(PROP_ERR, "critical-min", sensor);
 
-               strval = prop_string_cstring(obj);
+               strval = prop_string_value(obj);
                obj = convert_val_to_pnumber(ksdict, "critical-min",
                                             sensor, strval);
                if (!prop_dictionary_set(csdict, "critical-min", obj))
@@ -599,7 +600,7 @@
                if (!prop_bool_true(obj2))
                        config_errmsg(PROP_ERR, "warning-max", sensor);
 
-               strval = prop_string_cstring(obj);
+               strval = prop_string_value(obj);
                obj = convert_val_to_pnumber(ksdict, "warning-max",
                                             sensor, strval);
                if (!prop_dictionary_set(csdict, "warning-max", obj))
@@ -614,7 +615,7 @@
                if (!prop_bool_true(obj2))
                        config_errmsg(PROP_ERR, "warning-min", sensor);
 
-               strval = prop_string_cstring(obj);
+               strval = prop_string_value(obj);
                obj = convert_val_to_pnumber(ksdict, "warning-min",
                                             sensor, strval);
                if (!prop_dictionary_set(csdict, "warning-min", obj))
@@ -627,7 +628,7 @@
  */
 prop_number_t
 convert_val_to_pnumber(prop_dictionary_t kdict, const char *prop,
-                      const char *sensor, char *value)
+                      const char *sensor, const char *value)
 {
        prop_object_t obj;
        prop_number_t num;
@@ -642,13 +643,13 @@
         * Not allowed in battery sensors.
         */
        obj = prop_dictionary_get(kdict, "type");
-       if (prop_string_equals_cstring(obj, "Battery capacity"))
+       if (prop_string_equals_string(obj, "Battery capacity"))
                config_errmsg(PROP_ERR, prop, sensor);
 
        /*
         * Make the conversion for sensor's type.
         */
-       if (prop_string_equals_cstring(obj, "Temperature")) {
+       if (prop_string_equals_string(obj, "Temperature")) {
                tmp = strchr(value, 'C');
                if (tmp)
                        celsius = true;
@@ -678,26 +679,26 @@
 
                /* convert to microKelvin */
                val = val * 1000000 + 273150000;
-               num = prop_number_create_unsigned_integer(val);
+               num = prop_number_create_unsigned(val);
                free(strval);
 
-       } else if (prop_string_equals_cstring(obj, "Fan") ||
-                  prop_string_equals_cstring(obj, "Integer")) {
+       } else if (prop_string_equals_string(obj, "Fan") ||
+                  prop_string_equals_string(obj, "Integer")) {
                /* no conversion */
                val = strtod(value, &endptr);
                if (*endptr != '\0')
                        config_errmsg(VALUE_ERR, prop, sensor);
 
-               num = prop_number_create_unsigned_integer(val);
+               num = prop_number_create_unsigned(val);
 
        } else {
                obj = prop_dictionary_get(kdict, "max-value");
                if (obj)
-                       max = prop_number_integer_value(obj);
+                       max = prop_number_signed_value(obj);
 
                obj = prop_dictionary_get(kdict, "min-value");
                if (obj)
-                       min = prop_number_integer_value(obj);
+                       min = prop_number_signed_value(obj);
 
                val = strtod(value, &endptr);
                if (*endptr != '\0')
@@ -720,7 +721,7 @@
                if (min && val < min)
                        config_errmsg(VALUE_ERR, prop, sensor);
 
-               num = prop_number_create_integer(val);
+               num = prop_number_create_signed(val);
        }
 
        return num;
diff -r ec90069b7938 -r 6f371617e8cb usr.sbin/envstat/envstat.c
--- a/usr.sbin/envstat/envstat.c        Sun Jun 07 00:12:00 2020 +0000
+++ b/usr.sbin/envstat/envstat.c        Sun Jun 07 00:51:48 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: envstat.c,v 1.96 2018/05/27 01:39:00 thorpej Exp $ */
+/* $NetBSD: envstat.c,v 1.97 2020/06/07 00:51:48 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2007, 2008 Juan Romero Pardines.
@@ -27,7 +27,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: envstat.c,v 1.96 2018/05/27 01:39:00 thorpej Exp $");



Home | Main Index | Thread Index | Old Index