Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/7fed64c02472
branches:  trunk
changeset: 934103:7fed64c02472
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Jun 07 05:54:00 2020 +0000

description:
Update for proplib(3) API changes.

diffstat:

 lib/libdm/libdm_ioctl.c    |  14 +++++++-------
 sbin/ifconfig/af_atalk.c   |  18 +++++++++++++-----
 sbin/ifconfig/af_inetany.c |  12 ++++++------
 sbin/ifconfig/carp.c       |   8 ++++----
 sbin/ifconfig/env.c        |  10 +++++-----
 sbin/ifconfig/ether.c      |  12 ++++++------
 sbin/ifconfig/ifconfig.c   |  22 +++++++++++-----------
 sbin/ifconfig/media.c      |  10 +++++-----
 sbin/ifconfig/parse.c      |  23 +++++++++++------------
 sbin/ifconfig/pfsync.c     |   6 +++---
 sbin/ifconfig/tunnel.c     |   8 ++++----
 usr.sbin/powerd/powerd.c   |  23 ++++++-----------------
 12 files changed, 81 insertions(+), 85 deletions(-)

diffs (truncated from 629 to 300 lines):

diff -r 52753f53ccd4 -r 7fed64c02472 lib/libdm/libdm_ioctl.c
--- a/lib/libdm/libdm_ioctl.c   Sun Jun 07 05:42:25 2020 +0000
+++ b/lib/libdm/libdm_ioctl.c   Sun Jun 07 05:54:00 2020 +0000
@@ -207,7 +207,7 @@
                return NULL;
        }
 
-       if ((prop_dictionary_set_cstring(task->ldm_task, DM_IOCTL_COMMAND,
+       if ((prop_dictionary_set_string(task->ldm_task, DM_IOCTL_COMMAND,
                    command)) == false) {
                prop_object_release(task->ldm_task);
                free(task);
@@ -253,7 +253,7 @@
 libdm_task_set_name(const char *name, libdm_task_t libdm_task)
 {
 
-       if ((prop_dictionary_set_cstring(libdm_task->ldm_task,
+       if ((prop_dictionary_set_string(libdm_task->ldm_task,
                    DM_IOCTL_NAME, name)) == false)
                return ENOENT;
  
@@ -278,7 +278,7 @@
 libdm_task_set_uuid(const char *uuid, libdm_task_t libdm_task)
 {
 
-       if ((prop_dictionary_set_cstring(libdm_task->ldm_task,
+       if ((prop_dictionary_set_string(libdm_task->ldm_task,
            DM_IOCTL_UUID, uuid)) == false)
                return ENOENT;
 
@@ -657,7 +657,7 @@
        uint64_t deps;
 
        obj = prop_object_iterator_next(libdm_iter->ldm_obji);
-       deps = prop_number_unsigned_integer_value(obj);
+       deps = prop_number_unsigned_value(obj);
 
        if (obj != NULL)
                prop_object_release(obj);
@@ -747,7 +747,7 @@
        if (libdm_table == NULL)
                return ENOENT;
 
-       return prop_dictionary_set_cstring(libdm_table->ldm_tbl, DM_TABLE_TYPE, name);
+       return prop_dictionary_set_string(libdm_table->ldm_tbl, DM_TABLE_TYPE, name);
 }
 
 char *
@@ -769,7 +769,7 @@
        if (libdm_table == NULL)
                return ENOENT;
 
-       return prop_dictionary_set_cstring(libdm_table->ldm_tbl,
+       return prop_dictionary_set_string(libdm_table->ldm_tbl,
            DM_TABLE_PARAMS, params);
 }
 
@@ -885,5 +885,5 @@
        if (newname == NULL)
                return ENOENT;
 
-       return prop_array_set_cstring(libdm_cmd->ldm_cmd, 0, newname);
+       return prop_array_set_string(libdm_cmd->ldm_cmd, 0, newname);
 }
diff -r 52753f53ccd4 -r 7fed64c02472 sbin/ifconfig/af_atalk.c
--- a/sbin/ifconfig/af_atalk.c  Sun Jun 07 05:42:25 2020 +0000
+++ b/sbin/ifconfig/af_atalk.c  Sun Jun 07 05:54:00 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: af_atalk.c,v 1.20 2019/08/16 10:33:17 msaitoh Exp $    */
+/*     $NetBSD: af_atalk.c,v 1.21 2020/06/07 06:02:58 thorpej Exp $    */
 
 /*
  * Copyright (c) 1983, 1993
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: af_atalk.c,v 1.20 2019/08/16 10:33:17 msaitoh Exp $");
+__RCSID("$NetBSD: af_atalk.c,v 1.21 2020/06/07 06:02:58 thorpej Exp $");
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -138,7 +138,13 @@
        if ((d0 = (prop_data_t)prop_dictionary_get(env, "address")) == NULL)
                return;
 
-       addr = prop_data_data(d0);
+       addr = malloc(prop_data_size(d0));
+       if (addr == NULL)
+               return;
+       if (!prop_data_copy_value(d0, addr, prop_data_size(d0))) {
+               free(addr);
+               return;
+       }
 
        sat = (struct sockaddr_at *)&addr->pfx_addr;
 
@@ -154,11 +160,13 @@
 
        /* Copy the new address to a temporary input environment */
 
-       d = prop_data_create_data_nocopy(addr, paddr_prefix_size(addr));
+       d = prop_data_create_copy(addr, paddr_prefix_size(addr));
+       free(addr);
+
        ienv = prop_dictionary_copy_mutable(env);
 
        if (d == NULL)
-               err(EXIT_FAILURE, "%s: prop_data_create_data", __func__);
+               err(EXIT_FAILURE, "%s: prop_data_create_copy", __func__);
        if (ienv == NULL)
                err(EXIT_FAILURE, "%s: prop_dictionary_copy_mutable", __func__);
 
diff -r 52753f53ccd4 -r 7fed64c02472 sbin/ifconfig/af_inetany.c
--- a/sbin/ifconfig/af_inetany.c        Sun Jun 07 05:42:25 2020 +0000
+++ b/sbin/ifconfig/af_inetany.c        Sun Jun 07 05:54:00 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: af_inetany.c,v 1.18 2019/08/16 10:33:17 msaitoh Exp $  */
+/*     $NetBSD: af_inetany.c,v 1.19 2020/06/07 06:02:58 thorpej Exp $  */
 
 /*-
  * Copyright (c) 2008 David Young.  All rights reserved.
@@ -27,7 +27,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: af_inetany.c,v 1.18 2019/08/16 10:33:17 msaitoh Exp $");
+__RCSID("$NetBSD: af_inetany.c,v 1.19 2020/06/07 06:02:58 thorpej Exp $");
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -87,7 +87,7 @@
        strlcpy(param->name[1].buf, ifname, param->name[1].buflen);
 
        if ((d = (prop_data_t)prop_dictionary_get(env, "address")) != NULL)
-               addr = prop_data_data_nocopy(d);
+               addr = prop_data_value(d);
        else if (!prop_dictionary_get_bool(env, "alias", &alias) || alias ||
            param->gifaddr.cmd == 0)
                return;
@@ -99,17 +99,17 @@
                return;
 
        if ((d = (prop_data_t)prop_dictionary_get(env, "dst")) != NULL)
-               dst = prop_data_data_nocopy(d);
+               dst = prop_data_value(d);
        else
                dst = NULL;
 
        if ((d = (prop_data_t)prop_dictionary_get(env, "netmask")) != NULL)
-               mask = prop_data_data_nocopy(d);
+               mask = prop_data_value(d);
        else
                mask = NULL;
 
        if ((d = (prop_data_t)prop_dictionary_get(env, "broadcast")) != NULL)
-               brd = prop_data_data_nocopy(d);
+               brd = prop_data_value(d);
        else
                brd = NULL;
 
diff -r 52753f53ccd4 -r 7fed64c02472 sbin/ifconfig/carp.c
--- a/sbin/ifconfig/carp.c      Sun Jun 07 05:42:25 2020 +0000
+++ b/sbin/ifconfig/carp.c      Sun Jun 07 05:54:00 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: carp.c,v 1.13 2009/09/11 23:22:28 dyoung Exp $ */
+/* $NetBSD: carp.c,v 1.14 2020/06/07 06:02:58 thorpej Exp $ */
 
 /*
  * Copyright (c) 2002 Michael Shalayeff. All rights reserved.
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: carp.c,v 1.13 2009/09/11 23:22:28 dyoung Exp $");
+__RCSID("$NetBSD: carp.c,v 1.14 2020/06/07 06:02:58 thorpej Exp $");
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -167,7 +167,7 @@
 
        memset(carpr.carpr_key, 0, sizeof(carpr.carpr_key));
        /* XXX Should hash the password into the key here, perhaps? */
-       strlcpy((char *)carpr.carpr_key, prop_data_data_nocopy(data),
+       strlcpy((char *)carpr.carpr_key, prop_data_value(data),
            MIN(CARP_KEY_LEN, prop_data_size(data)));
 
        carp_set(env, &carpr);
@@ -267,7 +267,7 @@
 
        carp_get(env, &carpr);
 
-       strlcpy(carpr.carpr_carpdev, prop_string_cstring_nocopy(s),
+       strlcpy(carpr.carpr_carpdev, prop_string_value(s),
            sizeof(carpr.carpr_carpdev));
 
        carp_set(env, &carpr);
diff -r 52753f53ccd4 -r 7fed64c02472 sbin/ifconfig/env.c
--- a/sbin/ifconfig/env.c       Sun Jun 07 05:42:25 2020 +0000
+++ b/sbin/ifconfig/env.c       Sun Jun 07 05:54:00 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: env.c,v 1.12 2019/08/16 10:33:17 msaitoh Exp $ */
+/*     $NetBSD: env.c,v 1.13 2020/06/07 06:02:58 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2008 David Young.  All rights reserved.
@@ -27,7 +27,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: env.c,v 1.12 2019/08/16 10:33:17 msaitoh Exp $");
+__RCSID("$NetBSD: env.c,v 1.13 2020/06/07 06:02:58 thorpej Exp $");
 #endif /* not lint */
 
 #include <errno.h>
@@ -60,7 +60,7 @@
 
        while (i != NULL && (ko = prop_object_iterator_next(i)) != NULL) {
                k = (prop_dictionary_keysym_t)ko;
-               key = prop_dictionary_keysym_cstring_nocopy(k);
+               key = prop_dictionary_keysym_value(k);
                o = prop_dictionary_get_keysym(top, k);
                if (o == NULL || !prop_dictionary_set(d, key, o)) {
                        prop_object_release((prop_object_t)d);
@@ -141,7 +141,7 @@
                errno = ENAMETOOLONG;
                return -1;
        }
-       memcpy(buf, prop_data_data_nocopy(data), datalen);
+       memcpy(buf, prop_data_value(data), datalen);
        memset(buf + datalen, 0, buflen - datalen);
        return datalen;
 }
@@ -162,7 +162,7 @@
                errno = ENAMETOOLONG;
                return -1;
        }
-       memcpy(buf, prop_data_data_nocopy(data), datalen);
+       memcpy(buf, prop_data_value(data), datalen);
        memset(buf + datalen, 0, buflen - datalen);
        return datalen;
 }
diff -r 52753f53ccd4 -r 7fed64c02472 sbin/ifconfig/ether.c
--- a/sbin/ifconfig/ether.c     Sun Jun 07 05:42:25 2020 +0000
+++ b/sbin/ifconfig/ether.c     Sun Jun 07 05:54:00 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ether.c,v 1.8 2020/01/02 23:02:19 ryo Exp $    */
+/*     $NetBSD: ether.c,v 1.9 2020/06/07 06:02:58 thorpej Exp $        */
 
 /*
  * Copyright (c) 1983, 1993
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: ether.c,v 1.8 2020/01/02 23:02:19 ryo Exp $");
+__RCSID("$NetBSD: ether.c,v 1.9 2020/06/07 06:02:58 thorpej Exp $");
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -85,7 +85,7 @@
 
        assert(sizeof(eccr) == prop_data_size(d));
 
-       memcpy(&eccr, prop_data_data_nocopy(d), sizeof(eccr));
+       memcpy(&eccr, prop_data_value(d), sizeof(eccr));
        if (direct_ioctl(env, SIOCSETHERCAP, &eccr) == -1)
                err(EXIT_FAILURE, "SIOCSETHERCAP");
 }
@@ -102,7 +102,7 @@
        capdata = (prop_data_t)prop_dictionary_get(env, "ethercaps");
 
        if (capdata != NULL) {
-               tmpeccr = prop_data_data_nocopy(capdata);
+               tmpeccr = prop_data_value(capdata);
                *oeccr = *tmpeccr;
                return 0;
        }
@@ -110,7 +110,7 @@
        (void)direct_ioctl(env, SIOCGETHERCAP, &eccr);
        *oeccr = eccr;
 
-       capdata = prop_data_create_data(&eccr, sizeof(eccr));
+       capdata = prop_data_create_copy(&eccr, sizeof(eccr));
 
        rc = prop_dictionary_set(oenv, "ethercaps", capdata);
 
@@ -139,7 +139,7 @@
        } else
                eccr.eccr_capenable |= ethercap;
 
-       if ((capdata = prop_data_create_data(&eccr, sizeof(eccr))) == NULL)
+       if ((capdata = prop_data_create_copy(&eccr, sizeof(eccr))) == NULL)
                return -1;
 
        rc = prop_dictionary_set(oenv, "ethercaps", capdata);
diff -r 52753f53ccd4 -r 7fed64c02472 sbin/ifconfig/ifconfig.c
--- a/sbin/ifconfig/ifconfig.c  Sun Jun 07 05:42:25 2020 +0000
+++ b/sbin/ifconfig/ifconfig.c  Sun Jun 07 05:54:00 2020 +0000
@@ -1,4 +1,4 @@



Home | Main Index | Thread Index | Old Index