CVS commit: src/lib/libdm

2020-06-06 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Jun  7 05:57:17 UTC 2020

Modified Files:
src/lib/libdm: libdm_ioctl.c

Log Message:
Update for proplib(3) API changes.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/libdm/libdm_ioctl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libdm/libdm_ioctl.c
diff -u src/lib/libdm/libdm_ioctl.c:1.4 src/lib/libdm/libdm_ioctl.c:1.5
--- src/lib/libdm/libdm_ioctl.c:1.4	Sat Feb 15 22:55:22 2020
+++ src/lib/libdm/libdm_ioctl.c	Sun Jun  7 05:57:17 2020
@@ -207,7 +207,7 @@ libdm_task_create(const char *command)
 		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 @@ int
 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 @@ int
 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 @@ libdm_cmd_get_deps(libdm_iter_t libdm_it
 	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 @@ libdm_table_set_target(const char *name,
 	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 @@ libdm_table_set_params(const char *param
 	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 @@ libdm_dev_set_newname(const char *newnam
 	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);
 }



CVS commit: src/usr.sbin/powerd

2020-06-06 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Jun  7 05:54:00 UTC 2020

Modified Files:
src/usr.sbin/powerd: powerd.c

Log Message:
Update for proplib(3) API changes.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.sbin/powerd/powerd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/powerd/powerd.c
diff -u src/usr.sbin/powerd/powerd.c:1.18 src/usr.sbin/powerd/powerd.c:1.19
--- src/usr.sbin/powerd/powerd.c:1.18	Sat Feb  9 01:16:39 2013
+++ src/usr.sbin/powerd/powerd.c	Sun Jun  7 05:54:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: powerd.c,v 1.18 2013/02/09 01:16:39 christos Exp $	*/
+/*	$NetBSD: powerd.c,v 1.19 2020/06/07 05:54:00 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -314,7 +314,6 @@ static void
 dispatch_power_event_state_change(int fd, power_event_t *pev)
 {
 	prop_dictionary_t dict;
-	prop_object_t obj;
 	const char *argv[6];
 	char *buf = NULL;
 	int error;
@@ -333,21 +332,11 @@ dispatch_power_event_state_change(int fd
 		free(buf);
 	}
 
-	obj = prop_dictionary_get(dict, "powerd-script-name");
-	argv[0] = prop_string_cstring_nocopy(obj);
-
-	obj = prop_dictionary_get(dict, "driver-name");
-	argv[1] = prop_string_cstring_nocopy(obj);
-
-	obj = prop_dictionary_get(dict, "powerd-event-name");
-	argv[2] = prop_string_cstring_nocopy(obj);
-
-	obj = prop_dictionary_get(dict, "sensor-name");
-	argv[3] = prop_string_cstring_nocopy(obj);
-
-	obj = prop_dictionary_get(dict, "state-description");
-	argv[4] = prop_string_cstring_nocopy(obj);
-
+	prop_dictionary_get_string(dict, "powerd-script-name", [0]);
+	prop_dictionary_get_string(dict, "driver-name", [1]);
+	prop_dictionary_get_string(dict, "powerd-event-name", [2]);
+	prop_dictionary_get_string(dict, "sensor-name", [3]);
+	prop_dictionary_get_string(dict, "state-description", [4]);
 	argv[5] = NULL;
 
 	run_script(argv);



CVS commit: src/sbin/modload

2020-06-06 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Jun  7 05:49:05 UTC 2020

Modified Files:
src/sbin/modload: main.c

Log Message:
Update for proplib(3) API changes.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sbin/modload/main.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/modload/main.c
diff -u src/sbin/modload/main.c:1.17 src/sbin/modload/main.c:1.18
--- src/sbin/modload/main.c:1.17	Mon Sep  5 01:09:57 2016
+++ src/sbin/modload/main.c	Sun Jun  7 05:49:05 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.17 2016/09/05 01:09:57 sevan Exp $	*/
+/*	$NetBSD: main.c,v 1.18 2020/06/07 05:49:05 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: main.c,v 1.17 2016/09/05 01:09:57 sevan Exp $");
+__RCSID("$NetBSD: main.c,v 1.18 2020/06/07 05:49:05 thorpej Exp $");
 #endif /* !lint */
 
 #include 
@@ -184,7 +184,6 @@ parse_bool_param(prop_dictionary_t props
 		 const char *value)
 {
 	bool boolvalue;
-	prop_object_t po;
 
 	assert(name != NULL);
 	assert(value != NULL);
@@ -200,10 +199,8 @@ parse_bool_param(prop_dictionary_t props
 	else
 		errx(EXIT_FAILURE, "Invalid boolean value `%s'", value);
 
-	po = prop_bool_create(boolvalue);
-	if (po == NULL)
-		err(EXIT_FAILURE, "prop_bool_create");
-	prop_dictionary_set(props, name, po);
+	if (!prop_dictionary_set_bool(props, name, boolvalue))
+		err(EXIT_FAILURE, "prop_dictionary_set_bool");
 }
 
 static void
@@ -211,7 +208,6 @@ parse_int_param(prop_dictionary_t props,
 		const char *value)
 {
 	int64_t intvalue;
-	prop_object_t po;
 
 	assert(name != NULL);
 	assert(value != NULL);
@@ -219,10 +215,8 @@ parse_int_param(prop_dictionary_t props,
 	if (dehumanize_number(value, ) != 0)
 		err(EXIT_FAILURE, "Invalid integer value `%s'", value);
 
-	po = prop_number_create_integer(intvalue);
-	if (po == NULL)
-		err(EXIT_FAILURE, "prop_number_create_integer");
-	prop_dictionary_set(props, name, po);
+	if (!prop_dictionary_set_int64(props, name, intvalue))
+		err(EXIT_FAILURE, "prop_dictionary_set_int64");
 }
 
 static void
@@ -249,15 +243,12 @@ static void
 parse_string_param(prop_dictionary_t props, const char *name,
 		   const char *value)
 {
-	prop_object_t po;
 
 	assert(name != NULL);
 	assert(value != NULL);
 
-	po = prop_string_create_cstring(value);
-	if (po == NULL)
-		err(EXIT_FAILURE, "prop_string_create_cstring");
-	prop_dictionary_set(props, name, po);
+	if (!prop_dictionary_set_string(props, name, value))
+		err(EXIT_FAILURE, "prop_dictionary_set_string");
 }
 
 static void
@@ -288,7 +279,7 @@ merge_dicts(prop_dictionary_t existing_d
 
 	while ((props_obj = prop_object_iterator_next(props_iter)) != NULL) {
 		props_keysym = (prop_dictionary_keysym_t)props_obj;
-		props_key = prop_dictionary_keysym_cstring_nocopy(props_keysym);
+		props_key = prop_dictionary_keysym_value(props_keysym);
 		props_obj = prop_dictionary_get_keysym(new_dict, props_keysym);
 		if ((props_obj == NULL) || !prop_dictionary_set(existing_dict,
 		props_key, props_obj)) {



CVS commit: src/sbin/gpt

2020-06-06 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Jun  7 05:42:25 UTC 2020

Modified Files:
src/sbin/gpt: backup.c restore.c

Log Message:
Update for proplib(3) API changes.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sbin/gpt/backup.c
cvs rdiff -u -r1.19 -r1.20 src/sbin/gpt/restore.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/gpt/backup.c
diff -u src/sbin/gpt/backup.c:1.18 src/sbin/gpt/backup.c:1.19
--- src/sbin/gpt/backup.c:1.18	Thu Sep  7 10:23:33 2017
+++ src/sbin/gpt/backup.c	Sun Jun  7 05:42:25 2020
@@ -33,7 +33,7 @@
 __FBSDID("$FreeBSD: src/sbin/gpt/show.c,v 1.14 2006/06/22 22:22:32 marcel Exp $");
 #endif
 #ifdef __RCSID
-__RCSID("$NetBSD: backup.c,v 1.18 2017/09/07 10:23:33 christos Exp $");
+__RCSID("$NetBSD: backup.c,v 1.19 2020/06/07 05:42:25 thorpej Exp $");
 #endif
 
 #include 
@@ -68,79 +68,46 @@ struct gpt_cmd c_backup = {
 
 #define PROP_ERR(x)	if (!(x)) goto cleanup
 
-#define prop_uint(a) prop_number_create_unsigned_integer(a)
-
 static int
 store_mbr(gpt_t gpt, unsigned int i, const struct mbr *mbr,
 prop_array_t *mbr_array)
 {
 	prop_dictionary_t mbr_dict;
-	prop_number_t propnum;
 	const struct mbr_part *par = >mbr_part[i];
-	bool rc;
 
 	if (mbr->mbr_part[i].part_typ == MBR_PTYPE_UNUSED)
 		return 0;
 
 	mbr_dict = prop_dictionary_create();
 	PROP_ERR(mbr_dict);
-	propnum = prop_number_create_integer(i);
-	PROP_ERR(propnum);
-	rc = prop_dictionary_set(mbr_dict, "index", propnum);
-	PROP_ERR(rc);
-	propnum = prop_uint(par->part_flag);
-	PROP_ERR(propnum);
-	rc = prop_dictionary_set(mbr_dict, "flag", propnum);
-	PROP_ERR(rc);
-	propnum = prop_uint(par->part_shd);
-	PROP_ERR(propnum);
-	rc = prop_dictionary_set(mbr_dict, "start_head", propnum);
-	PROP_ERR(rc);
-	propnum = prop_uint(par->part_ssect);
-	PROP_ERR(propnum);
-	rc = prop_dictionary_set(mbr_dict, "start_sector", propnum);
-	PROP_ERR(rc);
-	propnum = prop_uint(par->part_scyl);
-	PROP_ERR(propnum);
-	rc = prop_dictionary_set(mbr_dict, "start_cylinder", propnum);
-	PROP_ERR(rc);
-	propnum = prop_uint(par->part_typ);
-	PROP_ERR(propnum);
-	rc = prop_dictionary_set(mbr_dict, "type", propnum);
-	PROP_ERR(rc);
-	propnum = prop_uint(par->part_ehd);
-	PROP_ERR(propnum);
-	rc = prop_dictionary_set(mbr_dict, "end_head", propnum);
-	PROP_ERR(rc);
-	propnum = prop_uint(par->part_esect);
-	PROP_ERR(propnum);
-	rc = prop_dictionary_set(mbr_dict, "end_sector", propnum);
-	PROP_ERR(rc);
-	propnum = prop_uint(par->part_ecyl);
-	PROP_ERR(propnum);
-	rc = prop_dictionary_set(mbr_dict, "end_cylinder", propnum);
-	PROP_ERR(rc);
-	propnum = prop_uint(le16toh(par->part_start_lo));
-	PROP_ERR(propnum);
-	rc = prop_dictionary_set(mbr_dict, "lba_start_low", propnum);
-	PROP_ERR(rc);
-	propnum = prop_uint(le16toh(par->part_start_hi));
-	PROP_ERR(propnum);
-	rc = prop_dictionary_set(mbr_dict, "lba_start_high", propnum);
-	PROP_ERR(rc);
-	propnum = prop_uint(le16toh(par->part_size_lo));
-	PROP_ERR(propnum);
-	rc = prop_dictionary_set(mbr_dict, "lba_size_low", propnum);
-	PROP_ERR(rc);
-	propnum = prop_uint(le16toh(par->part_size_hi));
-	PROP_ERR(propnum);
-	rc = prop_dictionary_set(mbr_dict, "lba_size_high", propnum);
+	PROP_ERR(prop_dictionary_set_uint(mbr_dict, "index", i));
+	PROP_ERR(prop_dictionary_set_uint(mbr_dict, "flag", par->part_flag));
+	PROP_ERR(prop_dictionary_set_uint(mbr_dict, "start_head",
+	  par->part_shd));
+	PROP_ERR(prop_dictionary_set_uint(mbr_dict, "start_sector",
+	  par->part_ssect));
+	PROP_ERR(prop_dictionary_set_uint(mbr_dict, "start_cylinder",
+	  par->part_scyl));
+	PROP_ERR(prop_dictionary_set_uint(mbr_dict, "type", par->part_typ));
+	PROP_ERR(prop_dictionary_set_uint(mbr_dict, "end_head", par->part_ehd));
+	PROP_ERR(prop_dictionary_set_uint(mbr_dict, "end_sector",
+	  par->part_esect));
+	PROP_ERR(prop_dictionary_set_uint(mbr_dict, "end_cylinder",
+	  par->part_ecyl));
+	PROP_ERR(prop_dictionary_set_uint(mbr_dict, "lba_start_low",
+	  le16toh(par->part_start_lo)));
+	PROP_ERR(prop_dictionary_set_uint(mbr_dict, "lba_start_high",
+	  le16toh(par->part_start_hi)));
+	PROP_ERR(prop_dictionary_set_uint(mbr_dict, "lba_size_low",
+	  le16toh(par->part_size_lo)));
+	PROP_ERR(prop_dictionary_set_uint(mbr_dict, "lba_size_high",
+	  le16toh(par->part_size_hi)));
+
 	if (*mbr_array == NULL) {
 		*mbr_array = prop_array_create();
 		PROP_ERR(*mbr_array);
 	}
-	rc = prop_array_add(*mbr_array, mbr_dict);
-	PROP_ERR(rc);
+	PROP_ERR(prop_array_add_and_rel(*mbr_array, mbr_dict));
 	return 0;
 cleanup:
 	if (mbr_dict)
@@ -152,26 +119,16 @@ cleanup:
 static int
 store_gpt(gpt_t gpt, const struct gpt_hdr *hdr, prop_dictionary_t *type_dict)
 {
-	prop_number_t propnum;
-	prop_string_t propstr;
 	char buf[128];
-	bool rc;
 
 	*type_dict = prop_dictionary_create();
 	PROP_ERR(type_dict);
-	propnum = prop_uint(le32toh(hdr->hdr_revision));
-	PROP_ERR(propnum);
-	

CVS commit: src/sys/arch/ews4800mips/stand/boot

2020-06-06 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Jun  7 03:02:42 UTC 2020

Modified Files:
src/sys/arch/ews4800mips/stand/boot: Makefile

Log Message:
Use -fno-unwind-tables to shrink boot binaries a bit.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/ews4800mips/stand/boot/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/ews4800mips/stand/boot/Makefile
diff -u src/sys/arch/ews4800mips/stand/boot/Makefile:1.24 src/sys/arch/ews4800mips/stand/boot/Makefile:1.25
--- src/sys/arch/ews4800mips/stand/boot/Makefile:1.24	Mon Dec 23 19:28:04 2019
+++ src/sys/arch/ews4800mips/stand/boot/Makefile	Sun Jun  7 03:02:42 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.24 2019/12/23 19:28:04 christos Exp $
+#	$NetBSD: Makefile,v 1.25 2020/06/07 03:02:42 tsutsui Exp $
 
 WARNS		?= 1
 NOMAN		=
@@ -62,7 +62,7 @@ MIPSFLAGS	= -mips1 -G 0 -mno-abicalls
 DEBUGFLAGS	= -Wall -Werror
 DEBUGFLAGS	+= -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith
 DEBUGFLAGS	+= -Wno-format-zero-length -Wno-sign-compare
-OPTFLAGS	= -Os -mmemcpy
+OPTFLAGS	= -Os -mmemcpy -fno-unwind-tables
 FLAGS		= ${MIPSFLAGS} ${DEBUGFLAGS} ${OPTFLAGS}
 AFLAGS		= -xassembler-with-cpp -D_LOCORE ${FLAGS}
 CFLAGS		= ${FLAGS} -ffreestanding



CVS commit: src/sys/arch/ews4800mips/stand/common

2020-06-06 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Jun  7 03:00:54 UTC 2020

Modified Files:
src/sys/arch/ews4800mips/stand/common: bootxx.c

Log Message:
Fix "illegal exceptoin" error on loading a secondary boot.

Recent gcc/binutils create more than two problem header sections
so the primary bootxx should handle them accordingly.
See my port-mips@ port for more details:
 https://mail-index.netbsd.org/port-mips/2020/06/06/msg000948.html

Should be pulled up to netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/ews4800mips/stand/common/bootxx.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/ews4800mips/stand/common/bootxx.c
diff -u src/sys/arch/ews4800mips/stand/common/bootxx.c:1.5 src/sys/arch/ews4800mips/stand/common/bootxx.c:1.6
--- src/sys/arch/ews4800mips/stand/common/bootxx.c:1.5	Wed Feb  4 15:22:13 2009
+++ src/sys/arch/ews4800mips/stand/common/bootxx.c	Sun Jun  7 03:00:53 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bootxx.c,v 1.5 2009/02/04 15:22:13 tsutsui Exp $	*/
+/*	$NetBSD: bootxx.c,v 1.6 2020/06/07 03:00:53 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2005 The NetBSD Foundation, Inc.
@@ -46,6 +46,10 @@
 
 #include "common.h"
 
+#define	IS_TEXT(p)	(p.p_flags & PF_X)
+#define	IS_DATA(p)	((p.p_flags & PF_X) == 0)
+#define	IS_BSS(p)	(p.p_filesz < p.p_memsz)
+
 #define	FILHSZ	(sizeof(struct ecoff_filehdr))
 #define	SCNHSZ	(sizeof(struct ecoff_scnhdr))
 #define	N_TXTOFF(f, a)			\
@@ -186,6 +190,7 @@ load_elf(uint8_t *buf, uint32_t *entry)
 {
 	Elf32_Ehdr *e = (void *)buf;
 	Elf32_Phdr *p;
+	int i;
 
 	if (e->e_ident[EI_MAG2] != 'L' || e->e_ident[EI_MAG3] != 'F' ||
 	e->e_ident[EI_CLASS] != ELFCLASS32 ||
@@ -197,16 +202,35 @@ load_elf(uint8_t *buf, uint32_t *entry)
 	BASSERT(e->e_phentsize == sizeof(Elf32_Phdr));
 	p = (void *)(buf + e->e_phoff);
 #ifdef _STANDALONE
-	memcpy((void *)p->p_vaddr, buf + p->p_offset, p->p_filesz);
-	p++;
-	memcpy((void *)p->p_vaddr, buf + p->p_offset, p->p_filesz);
+	for (i = 0; i < e->e_phnum; i++) {
+		if (p[i].p_type != PT_LOAD ||
+		(p[i].p_flags & (PF_W|PF_R|PF_X)) == 0)
+			continue;
+		if (IS_TEXT(p[i]) || IS_DATA(p[i])) {
+			memcpy((void *)p[i].p_vaddr,
+			buf + p[i].p_offset, p[i].p_filesz);
+		}
+		if (IS_BSS(p[i])) {
+			memset((void *)(p[i].p_vaddr + p[i].p_filesz), 0,
+			p[i].p_memsz - p[i].p_filesz);
+		}
+	}
 #else
 	DPRINTF("ELF entry point 0x%08x\n", e->e_entry);
-	DPRINTF("[text] 0x%08x 0x%x %dbyte.\n", p->p_vaddr, p->p_offset,
-	p->p_filesz);
-	p++;
-	DPRINTF("[data] 0x%08x 0x%x %dbyte.\n", p->p_vaddr, p->p_offset,
-	p->p_filesz);
+	for (i = 0; i < e->e_phnum; i++) {
+		if (p[i].p_type != PT_LOAD ||
+		(p[i].p_flags & (PF_W|PF_R|PF_X)) == 0)
+			continue;
+		if (IS_TEXT(p[i]) || IS_DATA(p[i])) {
+			DPRINTF("[text/data] 0x%08x 0x%x %dbyte.\n",
+			p[i].p_vaddr, p[i].p_offset, p[i].p_filesz);
+		}
+		if (IS_BSS(p[i])) {
+			DPRINTF("[bss] 0x%08x %dbyte.\n",
+			p[i].p_vaddr + p[i].p_filesz,
+			p[i].p_memsz - p[i].p_filesz);
+		}
+	}
 #endif
 	*entry = e->e_entry;
 



CVS commit: src/usr.sbin/installboot

2020-06-06 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Jun  7 00:58:59 UTC 2020

Modified Files:
src/usr.sbin/installboot: evboards.c

Log Message:
Update for proplib(3) API changes.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/installboot/evboards.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/installboot/evboards.c
diff -u src/usr.sbin/installboot/evboards.c:1.4 src/usr.sbin/installboot/evboards.c:1.5
--- src/usr.sbin/installboot/evboards.c:1.4	Thu May 14 08:34:18 2020
+++ src/usr.sbin/installboot/evboards.c	Sun Jun  7 00:58:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: evboards.c,v 1.4 2020/05/14 08:34:18 msaitoh Exp $	*/
+/*	$NetBSD: evboards.c,v 1.5 2020/06/07 00:58:58 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 
 #if !defined(__lint)
-__RCSID("$NetBSD: evboards.c,v 1.4 2020/05/14 08:34:18 msaitoh Exp $");
+__RCSID("$NetBSD: evboards.c,v 1.5 2020/06/07 00:58:58 thorpej Exp $");
 #endif  /* !__lint */
 
 #include 
@@ -654,7 +654,7 @@ validate_ubinstall_object(evb_board boar
 
 	if (prop_object_type(obj) == PROP_TYPE_STRING) {
 		evb_ubinstall tobj = prop_dictionary_get(board,
-		prop_string_cstring_nocopy((prop_string_t)obj));
+		prop_string_value((prop_string_t)obj));
 
 		/*
 		 * The target evb_ubinstall object must exist
@@ -738,7 +738,7 @@ validate_board_object(evb_board obj, boo
 	prop_object_iterator_t iter = prop_dictionary_iterator(obj);
 	prop_dictionary_keysym_t key;
 	while ((key = prop_object_iterator_next(iter)) != NULL) {
-		const char *cp = prop_dictionary_keysym_cstring_nocopy(key);
+		const char *cp = prop_dictionary_keysym_value(key);
 		if (strcmp(cp, board_u_boot_install_key) == 0) {
 			has_default_install = true;
 		} else if (strncmp(cp, board_u_boot_install_key,
@@ -807,13 +807,13 @@ evb_db_load_overlay(ib_params *params, c
 		assert(board != NULL);
 		if (!validate_board_object(board, true)) {
 			warnx("invalid board object in '%s': '%s'", path,
-			prop_dictionary_keysym_cstring_nocopy(key));
+			prop_dictionary_keysym_value(key));
 			continue;
 		}
 
 		/* Add "runtime-u-boot-path". */
 		prop_string_t string =
-		prop_string_create_cstring(runtime_uboot_path);
+		prop_string_create_copy(runtime_uboot_path);
 		assert(string != NULL);
 		prop_dictionary_set(board, board_u_boot_path_key, string);
 		prop_object_release(string);
@@ -942,7 +942,7 @@ evb_db_load_base(ib_params *params)
 		assert(board != NULL);
 		if (!validate_board_object(board, false)) {
 			warnx("invalid board object in '%s': '%s'", path,
-			prop_dictionary_keysym_cstring_nocopy(key));
+			prop_dictionary_keysym_value(key));
 			prop_dictionary_remove_keysym(board_db, key);
 		}
 	}
@@ -1339,7 +1339,7 @@ evb_db_list_boards(ib_params *params, FI
 			continue;
 
 		fprintf(out, "%-30s %s\n",
-		prop_dictionary_keysym_cstring_nocopy(key),
+		prop_dictionary_keysym_value(key),
 		evb_board_get_description(params, board));
 
 		if ((params->flags & IB_VERBOSE) && uboot_path) {
@@ -1364,7 +1364,7 @@ evb_board_get_description(ib_params *par
 	prop_string_t string;
 
 	string = prop_dictionary_get(board, board_description_key);
-	return prop_string_cstring_nocopy(string);
+	return prop_string_value(string);
 }
 
 /*
@@ -1379,7 +1379,7 @@ evb_board_get_uboot_pkg(ib_params *param
 	string = prop_dictionary_get(board, board_u_boot_pkg_key);
 	if (string == NULL)
 		return NULL;
-	return prop_string_cstring_nocopy(string);
+	return prop_string_value(string);
 }
 
 /*
@@ -1394,7 +1394,7 @@ evb_board_get_uboot_path(ib_params *para
 	string = prop_dictionary_get(board, board_u_boot_path_key);
 	if (string == NULL)
 		return NULL;
-	return prop_string_cstring_nocopy(string);
+	return prop_string_value(string);
 }
 
 /*
@@ -1440,7 +1440,7 @@ evb_board_get_uboot_install(ib_params *p
 			 * exists.
 			 */
 			install = prop_dictionary_get(board,
-			prop_string_cstring_nocopy((prop_string_t)install));
+			prop_string_value((prop_string_t)install));
 		}
 		return install;
 	}
@@ -1453,7 +1453,7 @@ evb_board_get_uboot_install(ib_params *p
 	prop_object_iterator_t iter = prop_array_iterator(array);
 	prop_string_t string;
 	while ((string = prop_object_iterator_next(iter)) != NULL)
-		fprintf(stderr, " %s", prop_string_cstring_nocopy(string));
+		fprintf(stderr, " %s", prop_string_value(string));
 	fprintf(stderr, "\n");
 	prop_object_iterator_release(iter);
 	prop_object_release(array);
@@ -1482,12 +1482,12 @@ evb_board_copy_uboot_media(ib_params *pa
 	assert(iter != NULL);
 
 	while ((key = prop_object_iterator_next(iter)) != NULL) {
-		cp = prop_dictionary_keysym_cstring_nocopy(key);
+		cp = prop_dictionary_keysym_value(key);
 		if (strcmp(cp, board_u_boot_install_key) == 0 ||
 		strncmp(cp, board_u_boot_install_key,
 			sizeof(board_u_boot_install_key) - 1) != 

CVS commit: src/usr.sbin/hdaudioctl

2020-06-06 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Jun  7 00:56:05 UTC 2020

Modified Files:
src/usr.sbin/hdaudioctl: graph.c

Log Message:
Update for proplib(3) API changes.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/hdaudioctl/graph.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/hdaudioctl/graph.c
diff -u src/usr.sbin/hdaudioctl/graph.c:1.3 src/usr.sbin/hdaudioctl/graph.c:1.4
--- src/usr.sbin/hdaudioctl/graph.c:1.3	Sat Mar 28 14:09:59 2015
+++ src/usr.sbin/hdaudioctl/graph.c	Sun Jun  7 00:56:05 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: graph.c,v 1.3 2015/03/28 14:09:59 jmcneill Exp $ */
+/* $NetBSD: graph.c,v 1.4 2020/06/07 00:56:05 thorpej Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd 
@@ -165,7 +165,7 @@ hdaudioctl_graph(int fd, int argc, char 
 		iter = prop_array_iterator(connlist);
 		prop_object_iterator_reset(iter);
 		while ((nnid = prop_object_iterator_next(iter)) != NULL) {
-			nid = prop_number_unsigned_integer_value(nnid);
+			nid = prop_number_unsigned_value(nnid);
 			printf(" widget%02Xh -> %s [sametail=widget%02Xh];\n",
 			nid, buf, nid);
 		}



CVS commit: src/usr.sbin/bthcid

2020-06-06 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Jun  7 00:54:22 UTC 2020

Modified Files:
src/usr.sbin/bthcid: config.c

Log Message:
Update for proplib(3) API changes.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/bthcid/config.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/bthcid/config.c
diff -u src/usr.sbin/bthcid/config.c:1.5 src/usr.sbin/bthcid/config.c:1.6
--- src/usr.sbin/bthcid/config.c:1.5	Wed Apr 15 00:37:05 2009
+++ src/usr.sbin/bthcid/config.c	Sun Jun  7 00:54:22 2020
@@ -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 
-__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 
 #include 
@@ -114,7 +114,7 @@ lookup_key(bdaddr_t *laddr, bdaddr_t *ra
 		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 @@ save_key(bdaddr_t *laddr, bdaddr_t *radd
 		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);



CVS commit: src/usr.sbin/envstat

2020-06-06 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Jun  7 00:51:48 UTC 2020

Modified Files:
src/usr.sbin/envstat: config.c envstat.c envstat.h

Log Message:
Update for proplib(3) API changes.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/envstat/config.c
cvs rdiff -u -r1.96 -r1.97 src/usr.sbin/envstat/envstat.c
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/envstat/envstat.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/envstat/config.c
diff -u src/usr.sbin/envstat/config.c:1.12 src/usr.sbin/envstat/config.c:1.13
--- src/usr.sbin/envstat/config.c:1.12	Wed Aug 31 13:32:36 2011
+++ src/usr.sbin/envstat/config.c	Sun Jun  7 00:51:48 2020
@@ -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 
 #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 
@@ -107,8 +107,8 @@ config_dict_add_prop(const char *key, ch
 			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 @@ config_dict_destroy(prop_dictionary_t d)
 
 	 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 @@ config_devblock_add(const char *key, pro
 	SLIST_FOREACH(sb, _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 @@ config_devblock_getdict(const char *dvna
 
 	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 @@ config_devblock_check_sensorprops(prop_d
   const char *sensor)
 {
 	prop_object_t obj, obj2, obj3;
-	char *strval, *endptr;
+	const char *strval;
+	char *endptr;
 	double val;
 
 	/*
@@ -435,7 +436,7 @@ config_devblock_check_sensorprops(prop_d
 	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, );
 			if (*endptr != '\0')
 config_errmsg(VALUE_ERR, "rfact", sensor);
@@ -454,7 +455,7 @@ config_devblock_check_sensorprops(prop_d
 		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, );
 			if ((*endptr != '\0') || (val < 0 || val > 100))
 config_errmsg(VALUE_ERR,
@@ -464,7 +465,7 @@ config_devblock_check_sensorprops(prop_d
 			 * 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 @@ config_devblock_check_sensorprops(prop_d
 		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, );
 			if ((*endptr != '\0') || (val < 0 || val > 100))
 config_errmsg(VALUE_ERR,
@@ -492,7 +493,7 @@ config_devblock_check_sensorprops(prop_d
 			 * 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 @@ config_devblock_check_sensorprops(prop_d
 		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, );
 			if ((*endptr != '\0') || (val < 0 || val > 100))
 

CVS commit: src/usr.bin/btkey

2020-06-06 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Jun  7 00:15:37 UTC 2020

Modified Files:
src/usr.bin/btkey: file.c

Log Message:
Update for proplib(3) API changes.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/btkey/file.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/btkey/file.c
diff -u src/usr.bin/btkey/file.c:1.2 src/usr.bin/btkey/file.c:1.3
--- src/usr.bin/btkey/file.c:1.2	Sun Feb 23 07:50:01 2014
+++ src/usr.bin/btkey/file.c	Sun Jun  7 00:15:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: file.c,v 1.2 2014/02/23 07:50:01 mlelstv Exp $	*/
+/*	$NetBSD: file.c,v 1.3 2020/06/07 00:15:37 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2007 Iain Hibbert
@@ -28,7 +28,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: file.c,v 1.2 2014/02/23 07:50:01 mlelstv Exp $");
+__RCSID("$NetBSD: file.c,v 1.3 2020/06/07 00:15:37 thorpej Exp $");
 
 #include 
 #include 
@@ -67,7 +67,7 @@ list_file(void)
 		goto done;
 
 	while ((sym = prop_object_iterator_next(iter)) != NULL) {
-		if (bt_aton(prop_dictionary_keysym_cstring_nocopy(sym), ) == 0)
+		if (bt_aton(prop_dictionary_keysym_value(sym), ) == 0)
 			continue;
 		if (bdaddr_any())
 			continue;
@@ -78,7 +78,7 @@ list_file(void)
 
 		printf("\n");
 		print_addr("bdaddr", );
-		print_key("file key", prop_data_data_nocopy(dat));
+		print_key("file key", prop_data_value(dat));
 	}
 
 	prop_object_iterator_release(iter);
@@ -111,7 +111,7 @@ read_file(void)
 	if (prop_data_size(dat) != HCI_KEY_SIZE)
 		goto done;
 
-	memcpy(key, prop_data_data_nocopy(dat), HCI_KEY_SIZE);
+	memcpy(key, prop_data_value(dat), HCI_KEY_SIZE);
 	rv = true;
 
 done:
@@ -149,7 +149,7 @@ write_file(void)
 			goto done;
 	}
 
-	dat = prop_data_create_data_nocopy(key, HCI_KEY_SIZE);
+	dat = prop_data_create_nocopy(key, HCI_KEY_SIZE);
 	if (dat == NULL)
 		goto done;
 



CVS commit: src/usr.sbin/btdevctl

2020-06-06 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Jun  7 00:12:00 UTC 2020

Modified Files:
src/usr.sbin/btdevctl: btdevctl.c db.c print.c sdp.c

Log Message:
Update for proplib(3) API changes.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/btdevctl/btdevctl.c \
src/usr.sbin/btdevctl/sdp.c
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/btdevctl/db.c
cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/btdevctl/print.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/btdevctl/btdevctl.c
diff -u src/usr.sbin/btdevctl/btdevctl.c:1.10 src/usr.sbin/btdevctl/btdevctl.c:1.11
--- src/usr.sbin/btdevctl/btdevctl.c:1.10	Sat Aug 27 22:24:14 2011
+++ src/usr.sbin/btdevctl/btdevctl.c	Sun Jun  7 00:12:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: btdevctl.c,v 1.10 2011/08/27 22:24:14 joerg Exp $	*/
+/*	$NetBSD: btdevctl.c,v 1.11 2020/06/07 00:12:00 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -35,7 +35,7 @@
 __COPYRIGHT("@(#) Copyright (c) 2006 The NetBSD Foundation, Inc.\
   @(#) Copyright (c) 2006 Itronix, Inc.\
   All rights reserved.");
-__RCSID("$NetBSD: btdevctl.c,v 1.10 2011/08/27 22:24:14 joerg Exp $");
+__RCSID("$NetBSD: btdevctl.c,v 1.11 2020/06/07 00:12:00 thorpej Exp $");
 
 #include 
 #include 
@@ -62,7 +62,6 @@ int
 main(int argc, char *argv[])
 {
 	prop_dictionary_t dev;
-	prop_object_t obj;
 	bdaddr_t laddr, raddr;
 	const char *service, *mode;
 	int ch, query, verbose, attach, detach, set, none;
@@ -161,11 +160,8 @@ main(int argc, char *argv[])
 	}
 
 	if (mode != NULL) {
-		obj = prop_string_create_cstring_nocopy(mode);
-		if (obj == NULL || !prop_dictionary_set(dev, BTDEVmode, obj))
+		if (!prop_dictionary_set_string_nocopy(dev, BTDEVmode, mode))
 			errx(EXIT_FAILURE, "proplib failure (%s)", BTDEVmode);
-
-		prop_object_release(obj);
 		set = true;
 	}
 
@@ -178,26 +174,17 @@ main(int argc, char *argv[])
 		errx(EXIT_FAILURE, "service store failed");
 
 	/* add binary local-bdaddr */
-	obj = prop_data_create_data(, sizeof(laddr));
-	if (obj == NULL || !prop_dictionary_set(dev, BTDEVladdr, obj))
+	if (!prop_dictionary_set_data(dev, BTDEVladdr, , sizeof(laddr)))
 		errx(EXIT_FAILURE, "proplib failure (%s)", BTDEVladdr);
 
-	prop_object_release(obj);
-
 	/* add binary remote-bdaddr */
-	obj = prop_data_create_data(, sizeof(raddr));
-	if (obj == NULL || !prop_dictionary_set(dev, BTDEVraddr, obj))
+	if (!prop_dictionary_set_data(dev, BTDEVraddr, , sizeof(raddr)))
 		errx(EXIT_FAILURE, "proplib failure (%s)", BTDEVraddr);
 
-	prop_object_release(obj);
-
 	/* add service name */
-	obj = prop_string_create_cstring(service);
-	if (obj == NULL || !prop_dictionary_set(dev, BTDEVservice, obj))
+	if (!prop_dictionary_set_string(dev, BTDEVservice, service))
 		errx(EXIT_FAILURE, "proplib failure (%s)", BTDEVservice);
 
-	prop_object_release(obj);
-
 	if (verbose == true)
 		cfg_print(dev);
 
Index: src/usr.sbin/btdevctl/sdp.c
diff -u src/usr.sbin/btdevctl/sdp.c:1.10 src/usr.sbin/btdevctl/sdp.c:1.11
--- src/usr.sbin/btdevctl/sdp.c:1.10	Sun Dec 10 20:38:14 2017
+++ src/usr.sbin/btdevctl/sdp.c	Sun Jun  7 00:12:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdp.c,v 1.10 2017/12/10 20:38:14 bouyer Exp $	*/
+/*	$NetBSD: sdp.c,v 1.11 2020/06/07 00:12:00 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -56,7 +56,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: sdp.c,v 1.10 2017/12/10 20:38:14 bouyer Exp $");
+__RCSID("$NetBSD: sdp.c,v 1.11 2020/06/07 00:12:00 thorpej Exp $");
 
 #include 
 
@@ -318,43 +318,27 @@ config_hid(prop_dictionary_t dict, sdp_d
 	|| hid_length == -1)
 		return ENOATTR;
 
-	obj = prop_string_create_cstring_nocopy("bthidev");
-	if (obj == NULL || !prop_dictionary_set(dict, BTDEVtype, obj))
+	if (!prop_dictionary_set_string_nocopy(dict, BTDEVtype, "bthidev"))
 		return errno;
 
-	prop_object_release(obj);
-
-	obj = prop_number_create_integer(control_psm);
-	if (obj == NULL || !prop_dictionary_set(dict, BTHIDEVcontrolpsm, obj))
-		return errno;
-
-	prop_object_release(obj);
-
-	obj = prop_number_create_integer(interrupt_psm);
-	if (obj == NULL || !prop_dictionary_set(dict, BTHIDEVinterruptpsm, obj))
+	if (!prop_dictionary_set_int32(dict, BTHIDEVcontrolpsm, control_psm) ||
+	!prop_dictionary_set_int32(dict, BTHIDEVinterruptpsm,
+				   interrupt_psm))
 		return errno;
 
-	prop_object_release(obj);
-
-	obj = prop_data_create_data(hid_descriptor, hid_length);
+	obj = prop_data_create_copy(hid_descriptor, hid_length);
 	if (obj == NULL || !prop_dictionary_set(dict, BTHIDEVdescriptor, obj))
 		return errno;
 
 	mode = hid_mode(obj);
 	prop_object_release(obj);
 
-	obj = prop_string_create_cstring_nocopy(mode);
-	if (obj == NULL || !prop_dictionary_set(dict, BTDEVmode, obj))
+	if (!prop_dictionary_set_string_nocopy(dict, BTDEVmode, mode))
 		return errno;
 
-	prop_object_release(obj);
-
 	if (!reconnect_initiate) {
-		obj = prop_bool_create(true);
-		if 

CVS commit: src/sys/kern

2020-06-06 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Jun  6 23:02:25 UTC 2020

Modified Files:
src/sys/kern: subr_physmap.c

Log Message:
uvmexp.ncolors being used where uvmexp.colormask wanted


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/kern/subr_physmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/subr_physmap.c
diff -u src/sys/kern/subr_physmap.c:1.2 src/sys/kern/subr_physmap.c:1.3
--- src/sys/kern/subr_physmap.c:1.2	Sat Jan 19 01:04:51 2013
+++ src/sys/kern/subr_physmap.c	Sat Jun  6 23:02:25 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_physmap.c,v 1.2 2013/01/19 01:04:51 rmind Exp $	*/
+/*	$NetBSD: subr_physmap.c,v 1.3 2020/06/06 23:02:25 ad Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: subr_physmap.c,v 1.2 2013/01/19 01:04:51 rmind Exp $");
+__KERNEL_RCSID(1, "$NetBSD: subr_physmap.c,v 1.3 2020/06/06 23:02:25 ad Exp $");
 
 #include 
 #include 
@@ -316,7 +316,7 @@ physmap_map(void *cookie, vaddr_t *kvap)
 		 * so we map it via the kernel_map.
 		 */
 		pc->pc_kva = uvm_km_alloc(kernel_map, pc->pc_klen,
-		atop(pa) & uvmexp.ncolors,
+		atop(pa) & uvmexp.colormask,
 		UVM_KMF_VAONLY | UVM_KMF_WAITVA | UVM_KMF_COLORMATCH);
 		KASSERT(pc->pc_kva != 0);
 



CVS commit: src/sbin/veriexecctl

2020-06-06 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jun  6 22:36:39 UTC 2020

Modified Files:
src/sbin/veriexecctl: veriexecctl.h

Log Message:
Update for proplib(3) API changes.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sbin/veriexecctl/veriexecctl.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/veriexecctl/veriexecctl.h
diff -u src/sbin/veriexecctl/veriexecctl.h:1.11 src/sbin/veriexecctl/veriexecctl.h:1.12
--- src/sbin/veriexecctl/veriexecctl.h:1.11	Sun Aug 31 23:37:45 2008
+++ src/sbin/veriexecctl/veriexecctl.h	Sat Jun  6 22:36:39 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: veriexecctl.h,v 1.11 2008/08/31 23:37:45 dholland Exp $	*/
+/*	$NetBSD: veriexecctl.h,v 1.12 2020/06/06 22:36:39 thorpej Exp $	*/
 
 /*-
  * Copyright 2005 Elad Efrat 
@@ -34,15 +34,15 @@
 #define _VERIEXECCTL_H_
 
 #define dict_sets(d, k, v) \
-	prop_dictionary_set(d, k, prop_string_create_cstring(v))
+	prop_dictionary_set_string(d, k, v)
 
 #define dict_gets(d, k) \
-	prop_string_cstring_nocopy(prop_dictionary_get(d, k))
+	prop_string_value(prop_dictionary_get(d, k))
 
 #define	dict_setd(d, k, v, n) \
-	prop_dictionary_set(d, k, prop_data_create_data(v, n))
+	prop_dictionary_set_data(d, k, v, n)
 
 #define	dict_getd(d, k) \
-	prop_data_data_nocopy(prop_dictionary_get(d, k))
+	prop_data_value(prop_dictionary_get(d, k))
 
 #endif /* _VERIEXECCTL_H_ */



CVS commit: src/usr.sbin/ofctl

2020-06-06 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jun  6 22:33:23 UTC 2020

Modified Files:
src/usr.sbin/ofctl: ofctl.c

Log Message:
Update for proplib(3) API changes.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/usr.sbin/ofctl/ofctl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/ofctl/ofctl.c
diff -u src/usr.sbin/ofctl/ofctl.c:1.14 src/usr.sbin/ofctl/ofctl.c:1.15
--- src/usr.sbin/ofctl/ofctl.c:1.14	Mon May 28 12:42:45 2018
+++ src/usr.sbin/ofctl/ofctl.c	Sat Jun  6 22:33:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofctl.c,v 1.14 2018/05/28 12:42:45 wiz Exp $	*/
+/*	$NetBSD: ofctl.c,v 1.15 2020/06/06 22:33:23 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #ifndef lint
 __COPYRIGHT("@(#) Copyright (c) 2006, 2007\
  The NetBSD Foundation, Inc.  All rights reserved.");
-__RCSID("$NetBSD: ofctl.c,v 1.14 2018/05/28 12:42:45 wiz Exp $");
+__RCSID("$NetBSD: ofctl.c,v 1.15 2020/06/06 22:33:23 thorpej Exp $");
 #endif /* not lint */
 
 #include 
@@ -108,7 +108,7 @@ of_tree_mkprop(struct of_node *node, pro
 	prop_data_t obj;
 	const char *name;
 
-	name = prop_dictionary_keysym_cstring_nocopy(key);
+	name = prop_dictionary_keysym_value(key);
 	obj = prop_dictionary_get_keysym(propdict, key);
 
 	prop = malloc(sizeof(*prop) + strlen(name) + 1);
@@ -131,8 +131,10 @@ of_tree_mkprop(struct of_node *node, pro
 	of_prop_count++;
 
 	prop->prop_length = prop_data_size(obj);
-	if (prop->prop_length)
-		prop->prop_data = prop_data_data(obj);
+	if (prop->prop_length) {
+		prop->prop_data = malloc(prop->prop_length);
+		prop_data_copy_value(obj, prop->prop_data, prop->prop_length);
+	}
 }
 
 static struct of_node *
@@ -163,7 +165,7 @@ of_tree_fill(prop_dictionary_t dict, str
 	prop_array_t children;
 	unsigned int i, count;
 
-	node->of_nodeid = prop_number_unsigned_integer_value(
+	node->of_nodeid = prop_number_unsigned_value(
 	prop_dictionary_get(dict, "node"));
 
 	propdict = prop_dictionary_get(dict, "properties");
@@ -224,7 +226,7 @@ of_proplib_mkprop(int fd, int nodeid, ch
 		free(ofio.of_buf);
 		return NULL;
 	}
-	obj = prop_data_create_data(ofio.of_buf, ofio.of_buflen);
+	obj = prop_data_create_copy(ofio.of_buf, ofio.of_buflen);
 	free(ofio.of_buf);
 	return obj;
 }
@@ -249,7 +251,7 @@ of_proplib_tree_fill(int fd, int nodeid)
 
 	dict = prop_dictionary_create();
 	prop_dictionary_set(dict, "node",
-	prop_number_create_unsigned_integer(nodeid));
+	prop_number_create_unsigned(nodeid));
 
 	propdict = prop_dictionary_create();
 	for (;;) {



CVS commit: src/sys/rump/librump/rumpkern

2020-06-06 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Jun  6 22:31:41 UTC 2020

Modified Files:
src/sys/rump/librump/rumpkern: vm.c

Log Message:
Correction to previous - set VI_PAGES correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.188 -r1.189 src/sys/rump/librump/rumpkern/vm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/rump/librump/rumpkern/vm.c
diff -u src/sys/rump/librump/rumpkern/vm.c:1.188 src/sys/rump/librump/rumpkern/vm.c:1.189
--- src/sys/rump/librump/rumpkern/vm.c:1.188	Wed Jun  3 22:25:49 2020
+++ src/sys/rump/librump/rumpkern/vm.c	Sat Jun  6 22:31:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm.c,v 1.188 2020/06/03 22:25:49 ad Exp $	*/
+/*	$NetBSD: vm.c,v 1.189 2020/06/06 22:31:40 ad Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.188 2020/06/03 22:25:49 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.189 2020/06/06 22:31:40 ad Exp $");
 
 #include 
 #include 
@@ -176,7 +176,6 @@ uvm_pagealloc_strat(struct uvm_object *u
 		pool_cache_put(, pg);
 		return NULL;
 	}
-	uobj->uo_npages++;
 
 	if (UVM_OBJ_IS_VNODE(uobj)) {
 		if (uobj->uo_npages == 0) {
@@ -187,6 +186,7 @@ uvm_pagealloc_strat(struct uvm_object *u
 		}
 		pg->flags |= PG_FILE;
 	}
+	uobj->uo_npages++;
 
 	pg->flags = PG_CLEAN|PG_BUSY|PG_FAKE;
 	if (flags & UVM_PGA_ZERO) {



CVS commit: src/common/lib/libppath

2020-06-06 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jun  6 22:28:07 UTC 2020

Modified Files:
src/common/lib/libppath: ppath.c

Log Message:
Update for proplib(3) API changes.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/common/lib/libppath/ppath.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/common/lib/libppath/ppath.c
diff -u src/common/lib/libppath/ppath.c:1.4 src/common/lib/libppath/ppath.c:1.5
--- src/common/lib/libppath/ppath.c:1.4	Sat Dec 29 20:08:23 2012
+++ src/common/lib/libppath/ppath.c	Sat Jun  6 22:28:07 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ppath.c,v 1.4 2012/12/29 20:08:23 christos Exp $ */
+/* $NetBSD: ppath.c,v 1.5 2020/06/06 22:28:07 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: ppath.c,v 1.4 2012/12/29 20:08:23 christos Exp $");
+__RCSID("$NetBSD: ppath.c,v 1.5 2020/06/06 22:28:07 thorpej Exp $");
 
 #ifdef _KERNEL
 #include 
@@ -412,7 +412,7 @@ int
 ppath_create_string(prop_object_t o, const ppath_t *p, const char *s)
 {
 	return ppath_create_object_and_release(o, p,
-	prop_string_create_cstring(s));
+	prop_string_create_copy(s));
 }
 
 int
@@ -420,21 +420,21 @@ ppath_create_data(prop_object_t o, const
 const void *data, size_t size)
 {
 	return ppath_create_object_and_release(o, p,
-	prop_data_create_data(data, size));
+	prop_data_create_copy(data, size));
 }
 
 int
 ppath_create_uint64(prop_object_t o, const ppath_t *p, uint64_t u)
 {
 	return ppath_create_object_and_release(o, p,
-	prop_number_create_unsigned_integer(u));
+	prop_number_create_unsigned(u));
 }
 
 int
 ppath_create_int64(prop_object_t o, const ppath_t *p, int64_t i)
 {
 	return ppath_create_object_and_release(o, p,
-	prop_number_create_integer(i));
+	prop_number_create_signed(i));
 }
 
 int
@@ -746,14 +746,14 @@ ppath_copyset_data(prop_object_t o, prop
 const void *data, size_t size)
 {
 	return ppath_copyset_object_and_release(o, op, p,
-	prop_data_create_data(data, size));
+	prop_data_create_copy(data, size));
 }
 
 int
 ppath_set_data(prop_object_t o, const ppath_t *p, const void *data, size_t size)
 {
 	return ppath_set_object_and_release(o, p,
-	prop_data_create_data(data, size));
+	prop_data_create_copy(data, size));
 }
 
 int
@@ -767,7 +767,7 @@ ppath_get_data(prop_object_t o, const pp
 		return rc;
 
 	if (datap != NULL)
-		*datap = prop_data_data_nocopy(v);
+		*datap = prop_data_value(v);
 	if (sizep != NULL)
 		*sizep = prop_data_size(v);
 
@@ -783,10 +783,16 @@ ppath_dup_data(prop_object_t o, const pp
 	if ((rc = ppath_get_object_of_type(o, p, , PROP_TYPE_DATA)) != 0)
 		return rc;
 
-	if (datap != NULL)
-		*datap = prop_data_data(v);
+	const size_t data_size = prop_data_size(v);
+
+	if (datap != NULL) {
+		void *buf = ppath_alloc(data_size);
+		if (buf != NULL)
+			(void) prop_data_copy_value(v, buf, data_size);
+		*datap = buf;
+	}
 	if (sizep != NULL)
-		*sizep = prop_data_size(v);
+		*sizep = data_size;
 
 	return 0;
 }
@@ -802,14 +808,14 @@ ppath_copyset_int64(prop_object_t o, pro
 int64_t i)
 {
 	return ppath_copyset_object_and_release(o, op, p,
-	prop_number_create_integer(i));
+	prop_number_create_signed(i));
 }
 
 int
 ppath_set_int64(prop_object_t o, const ppath_t *p, int64_t i)
 {
 	return ppath_set_object_and_release(o, p,
-	prop_number_create_integer(i));
+	prop_number_create_signed(i));
 }
 
 int
@@ -825,7 +831,7 @@ ppath_get_int64(prop_object_t o, const p
 		return EFTYPE;
 
 	if (ip != NULL)
-		*ip = prop_number_integer_value(v);
+		*ip = prop_number_signed_value(v);
 
 	return 0;
 }
@@ -841,14 +847,14 @@ ppath_copyset_string(prop_object_t o, pr
 const char *s)
 {
 	return ppath_copyset_object_and_release(o, op, p,
-	prop_string_create_cstring(s));
+	prop_string_create_copy(s));
 }
 
 int
 ppath_set_string(prop_object_t o, const ppath_t *p, const char *s)
 {
 	return ppath_set_object_and_release(o, p,
-	prop_string_create_cstring(s));
+	prop_string_create_copy(s));
 }
 
 int
@@ -861,7 +867,7 @@ ppath_get_string(prop_object_t o, const 
 		return rc;
 
 	if (sp != NULL)
-		*sp = prop_string_cstring_nocopy(v);
+		*sp = prop_string_value(v);
 
 	return 0;
 }
@@ -875,8 +881,14 @@ ppath_dup_string(prop_object_t o, const 
 	if ((rc = ppath_get_object_of_type(o, p, , PROP_TYPE_STRING)) != 0)
 		return rc;
 
-	if (sp != NULL)
-		*sp = prop_string_cstring(v);
+	const size_t string_size = prop_string_size(v);
+
+	if (sp != NULL) {
+		char *cp = ppath_alloc(string_size + 1);
+		if (cp != NULL)
+			(void)prop_string_copy_value(v, cp, string_size + 1);
+		*sp = cp;
+	}
 
 	return 0;
 }
@@ -892,14 +904,14 @@ ppath_copyset_uint64(prop_object_t o, pr
 uint64_t u)
 {
 	return ppath_copyset_object_and_release(o, op, p,
-	prop_number_create_unsigned_integer(u));
+	

CVS commit: src/sys/kern

2020-06-06 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Jun  6 22:26:47 UTC 2020

Modified Files:
src/sys/kern: kern_lwp.c

Log Message:
lwp_exit(): add a warning about (l != curlwp)


To generate a diff of this commit:
cvs rdiff -u -r1.240 -r1.241 src/sys/kern/kern_lwp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_lwp.c
diff -u src/sys/kern/kern_lwp.c:1.240 src/sys/kern/kern_lwp.c:1.241
--- src/sys/kern/kern_lwp.c:1.240	Mon Jun  1 13:58:14 2020
+++ src/sys/kern/kern_lwp.c	Sat Jun  6 22:26:47 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_lwp.c,v 1.240 2020/06/01 13:58:14 thorpej Exp $	*/
+/*	$NetBSD: kern_lwp.c,v 1.241 2020/06/06 22:26:47 ad Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2006, 2007, 2008, 2009, 2019, 2020
@@ -217,7 +217,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.240 2020/06/01 13:58:14 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.241 2020/06/06 22:26:47 ad Exp $");
 
 #include "opt_ddb.h"
 #include "opt_lockdebug.h"
@@ -1054,6 +1054,8 @@ lwp_startup(struct lwp *prev, struct lwp
 
 /*
  * Exit an LWP.
+ *
+ * *** WARNING *** This can be called with (l != curlwp) in error paths.
  */
 void
 lwp_exit(struct lwp *l)



CVS commit: src/common/lib/libprop

2020-06-06 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jun  6 22:23:31 UTC 2020

Modified Files:
src/common/lib/libprop: prop_number.c

Log Message:
Correct a deprecation warning.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/common/lib/libprop/prop_number.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/common/lib/libprop/prop_number.c
diff -u src/common/lib/libprop/prop_number.c:1.32 src/common/lib/libprop/prop_number.c:1.33
--- src/common/lib/libprop/prop_number.c:1.32	Sat Jun  6 21:25:59 2020
+++ src/common/lib/libprop/prop_number.c	Sat Jun  6 22:23:31 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: prop_number.c,v 1.32 2020/06/06 21:25:59 thorpej Exp $	*/
+/*	$NetBSD: prop_number.c,v 1.33 2020/06/06 22:23:31 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2020 The NetBSD Foundation, Inc.
@@ -366,7 +366,7 @@ prop_number_create_unsigned(uintmax_t va
 }
 
 _PROP_DEPRECATED(prop_number_create_unsigned_integer,
-"this program uses prop_number_create_uinteger(), "
+"this program uses prop_number_create_unsigned_integer(), "
 "which is deprecated; use prop_number_create_unsigned() instead.")
 prop_number_t
 prop_number_create_unsigned_integer(uint64_t val)



CVS commit: src/lib/libpthread

2020-06-06 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Jun  6 22:24:00 UTC 2020

Modified Files:
src/lib/libpthread: pthread_cond.c

Log Message:
Adjust previous.  In the condvar case the wakeup might already have been
eaten.


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/lib/libpthread/pthread_cond.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libpthread/pthread_cond.c
diff -u src/lib/libpthread/pthread_cond.c:1.72 src/lib/libpthread/pthread_cond.c:1.73
--- src/lib/libpthread/pthread_cond.c:1.72	Thu Jun  4 04:40:01 2020
+++ src/lib/libpthread/pthread_cond.c	Sat Jun  6 22:23:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_cond.c,v 1.72 2020/06/04 04:40:01 riastradh Exp $	*/
+/*	$NetBSD: pthread_cond.c,v 1.73 2020/06/06 22:23:59 ad Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2006, 2007, 2008, 2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pthread_cond.c,v 1.72 2020/06/04 04:40:01 riastradh Exp $");
+__RCSID("$NetBSD: pthread_cond.c,v 1.73 2020/06/06 22:23:59 ad Exp $");
 
 #include 
 #include 
@@ -185,14 +185,14 @@ pthread_cond_timedwait(pthread_cond_t *c
 		pthread_cond_broadcast(cond);
 
 		/*
-		 * Might have raced with another thread to do the wakeup.
-		 * In any case there will be a wakeup for sure.  Eat it and
-		 * wait for pt_condwait to clear.
+		 * Might have raced with another thread to do the wakeup. 
+		 * Wait until released - this thread can't wait on a condvar
+		 * again until the data structures are no longer in us.
 		 */
-		do {
+		while (self->pt_condwait) {
 			(void)_lwp_park(CLOCK_REALTIME, TIMER_ABSTIME, NULL,
 			0, NULL, NULL);
-		} while (self->pt_condwait);
+		}
 	}
 
 	/*



CVS commit: src/share/mk

2020-06-06 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sat Jun  6 22:06:42 UTC 2020

Modified Files:
src/share/mk: bsd.own.mk

Log Message:
sun2 and vax have no native TLS support, so avoid using modern jemalloc
as it has a couple of nasty race conditions when using TSD.


To generate a diff of this commit:
cvs rdiff -u -r1.1198 -r1.1199 src/share/mk/bsd.own.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.1198 src/share/mk/bsd.own.mk:1.1199
--- src/share/mk/bsd.own.mk:1.1198	Tue Jun  2 14:26:01 2020
+++ src/share/mk/bsd.own.mk	Sat Jun  6 22:06:42 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.1198 2020/06/02 14:26:01 jmcneill Exp $
+#	$NetBSD: bsd.own.mk,v 1.1199 2020/06/06 22:06:42 joerg Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -181,7 +181,11 @@ EXTERNAL_BINUTILS_SUBDIR=	/does/not/exis
 # What version of jemalloc we use (100 is the one
 # built-in to libc from 2005 (pre version 3).
 #
+.if ${MACHINE_ARCH} == "vax" || ${MACHINE} == "sun2"
+HAVE_JEMALLOC?=		100
+.else
 HAVE_JEMALLOC?=		510
+.endif
 
 .if empty(.MAKEFLAGS:tW:M*-V .OBJDIR*)
 .if defined(MAKEOBJDIRPREFIX) || defined(MAKEOBJDIR)



CVS commit: src/tests/lib/libprop

2020-06-06 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jun  6 21:45:07 UTC 2020

Modified Files:
src/tests/lib/libprop: t_proplib.c

Log Message:
Don't use deprecated proplib APIs (in the old "basic" test case).


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libprop/t_proplib.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libprop/t_proplib.c
diff -u src/tests/lib/libprop/t_proplib.c:1.1 src/tests/lib/libprop/t_proplib.c:1.2
--- src/tests/lib/libprop/t_proplib.c:1.1	Sat Jun  6 21:26:00 2020
+++ src/tests/lib/libprop/t_proplib.c	Sat Jun  6 21:45:07 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: t_proplib.c,v 1.1 2020/06/06 21:26:00 thorpej Exp $ */
+/* $NetBSD: t_proplib.c,v 1.2 2020/06/06 21:45:07 thorpej Exp $ */
 
 /*
  * Copyright (c) 2008, 2020 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #include 
 __COPYRIGHT("@(#) Copyright (c) 2008, 2020\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_proplib.c,v 1.1 2020/06/06 21:26:00 thorpej Exp $");
+__RCSID("$NetBSD: t_proplib.c,v 1.2 2020/06/06 21:45:07 thorpej Exp $");
 
 #include 
 #include 
@@ -110,7 +110,7 @@ ATF_TC_BODY(prop_basic, tc)
 	ATF_REQUIRE(dict != NULL);
 
 	{
-		prop_number_t num = prop_number_create_integer(1);
+		prop_number_t num = prop_number_create_signed(1);
 		ATF_REQUIRE(num != NULL);
 
 		ATF_REQUIRE_EQ(prop_dictionary_set(dict, "one", num), true);
@@ -118,7 +118,7 @@ ATF_TC_BODY(prop_basic, tc)
 	}
 
 	{
-		prop_string_t str = prop_string_create_cstring("number-two");
+		prop_string_t str = prop_string_create_copy("number-two");
 		ATF_REQUIRE(str != NULL);
 
 		ATF_REQUIRE_EQ(prop_dictionary_set(dict, "two", str), true);



CVS commit: src/usr.sbin/npf

2020-06-06 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Jun  6 20:38:00 UTC 2020

Modified Files:
src/usr.sbin/npf: npf-params.7

Log Message:
Use more markup.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/npf/npf-params.7

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/npf/npf-params.7
diff -u src/usr.sbin/npf/npf-params.7:1.6 src/usr.sbin/npf/npf-params.7:1.7
--- src/usr.sbin/npf/npf-params.7:1.6	Sun May 31 16:32:07 2020
+++ src/usr.sbin/npf/npf-params.7	Sat Jun  6 20:38:00 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: npf-params.7,v 1.6 2020/05/31 16:32:07 tnn Exp $
+.\" $NetBSD: npf-params.7,v 1.7 2020/06/06 20:38:00 wiz Exp $
 .\"
 .\" Copyright (c) 2019 Mindaugas Rasiukevicius 
 .\" All rights reserved.
@@ -34,7 +34,9 @@
 NPF supports a set of dynamically tunable parameters.
 .Pp
 All parameter values are integers and should generally be between
-zero and INT_MAX, unless specified otherwise.
+zero and
+.Dv INT_MAX ,
+unless specified otherwise.
 Some parameters values can be negative; such values would typically
 have a special meaning.
 Enable/disable switches should be represented as boolean values 0 ("off")



CVS commit: src/usr.sbin/installboot

2020-06-06 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Jun  6 20:30:23 UTC 2020

Modified Files:
src/usr.sbin/installboot: installboot.8

Log Message:
Reduce macro arguments.


To generate a diff of this commit:
cvs rdiff -u -r1.98 -r1.99 src/usr.sbin/installboot/installboot.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/installboot/installboot.8
diff -u src/usr.sbin/installboot/installboot.8:1.98 src/usr.sbin/installboot/installboot.8:1.99
--- src/usr.sbin/installboot/installboot.8:1.98	Sat Jun  6 10:22:45 2020
+++ src/usr.sbin/installboot/installboot.8	Sat Jun  6 20:30:23 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: installboot.8,v 1.98 2020/06/06 10:22:45 tsutsui Exp $
+.\"	$NetBSD: installboot.8,v 1.99 2020/06/06 20:30:23 wiz Exp $
 .\"
 .\" Copyright (c) 2002-2019 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -774,9 +774,10 @@ already present in the SysVBFS partition
 .Bd -ragged -offset indent-two -compact
 .Em Note :
 On
-.Nx Ns /ews4800mips the p partition is the
+.Nx Ns /ews4800mips
+the p partition is the
 .Dq whole disk
-(i.e. raw) partition.
+(i.e., raw) partition.
 .Ed
 .Ss Nx Ns /i386 and Nx Ns /amd64
 Install new boot blocks on an existing



CVS commit: src/usr.bin/make

2020-06-06 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Jun  6 20:28:42 UTC 2020

Modified Files:
src/usr.bin/make: make.1

Log Message:
Remove trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.281 -r1.282 src/usr.bin/make/make.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/make.1
diff -u src/usr.bin/make/make.1:1.281 src/usr.bin/make/make.1:1.282
--- src/usr.bin/make/make.1:1.281	Fri Jun  5 19:20:46 2020
+++ src/usr.bin/make/make.1	Sat Jun  6 20:28:42 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: make.1,v 1.281 2020/06/05 19:20:46 sjg Exp $
+.\"	$NetBSD: make.1,v 1.282 2020/06/06 20:28:42 wiz Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -1430,7 +1430,7 @@ If only
 .Ar old_string
 contains the pattern matching character
 .Ar % ,
-and 
+and
 .Ar old_string
 matches, then the result is the
 .Ar new_string .



CVS commit: src/sys/kern

2020-06-06 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jun  6 18:13:02 UTC 2020

Modified Files:
src/sys/kern: subr_pcu.c

Log Message:
Relax the KASSERT() in pcu_discard_all() to allow non-curlwp if it is
in LSIDL state, which can happen if the new LWP is exiting before it's
ever run, e.g. if an error occurs in _lwp_create(2).


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/kern/subr_pcu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/subr_pcu.c
diff -u src/sys/kern/subr_pcu.c:1.21 src/sys/kern/subr_pcu.c:1.22
--- src/sys/kern/subr_pcu.c:1.21	Mon Oct 16 15:03:57 2017
+++ src/sys/kern/subr_pcu.c	Sat Jun  6 18:13:01 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_pcu.c,v 1.21 2017/10/16 15:03:57 bouyer Exp $	*/
+/*	$NetBSD: subr_pcu.c,v 1.22 2020/06/06 18:13:01 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2011, 2014 The NetBSD Foundation, Inc.
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_pcu.c,v 1.21 2017/10/16 15:03:57 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pcu.c,v 1.22 2020/06/06 18:13:01 thorpej Exp $");
 
 #include 
 #include 
@@ -130,7 +130,12 @@ pcu_discard_all(lwp_t *l)
 {
 	const uint32_t pcu_valid = l->l_pcu_valid;
 
-	KASSERT(l == curlwp || ((l->l_flag & LW_SYSTEM) && pcu_valid == 0));
+	/*
+	 * The check for LSIDL here is to catch the case where the LWP exits
+	 * due to an error in the LWP creation path before it ever runs.
+	 */
+	KASSERT(l == curlwp || l->l_stat == LSIDL ||
+		((l->l_flag & LW_SYSTEM) && pcu_valid == 0));
 
 	if (__predict_true(pcu_valid == 0)) {
 		/* PCUs are not in use. */



CVS commit: src/tests/lib/libc/sys

2020-06-06 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jun  6 18:11:21 UTC 2020

Modified Files:
src/tests/lib/libc/sys: t_lwp_create.c

Log Message:
Add a test case to ensure that _lwp_create() fails with the
expected error code when a bad new-lwp-id pointer is passed.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/sys/t_lwp_create.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libc/sys/t_lwp_create.c
diff -u src/tests/lib/libc/sys/t_lwp_create.c:1.2 src/tests/lib/libc/sys/t_lwp_create.c:1.3
--- src/tests/lib/libc/sys/t_lwp_create.c:1.2	Tue May 22 09:23:39 2012
+++ src/tests/lib/libc/sys/t_lwp_create.c	Sat Jun  6 18:11:21 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: t_lwp_create.c,v 1.2 2012/05/22 09:23:39 martin Exp $ */
+/* $NetBSD: t_lwp_create.c,v 1.3 2020/06/06 18:11:21 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -119,6 +119,30 @@ ATF_TC_BODY(lwp_create_works, tc)
 	ATF_REQUIRE(lid == the_lwp_id);
 }
 
+ATF_TC(lwp_create_bad_lid_ptr);
+ATF_TC_HEAD(lwp_create_bad_lid_ptr, tc)
+{
+	atf_tc_set_md_var(tc, "descr",
+	"Verify _lwp_create() fails as expected with bad lid pointer");
+}
+
+ATF_TC_BODY(lwp_create_bad_lid_ptr, tc)
+{
+	ucontext_t uc;
+	int error;
+	int serrno;
+	void *stack;
+	static const size_t ssize = 16*1024;
+
+	stack = malloc(ssize);
+	_lwp_makecontext(, lwp_main_func, NULL, NULL, stack, ssize);
+
+	error = _lwp_create(, 0, NULL);
+	serrno = errno;
+	ATF_REQUIRE(error == -1);
+	ATF_REQUIRE(serrno == EFAULT);
+}
+
 INVALID_UCONTEXT(generic, no_uc_cpu, "not setting cpu registers")
 	uc->uc_flags &= ~_UC_CPU;
 }
@@ -206,6 +230,7 @@ INVALID_UCONTEXT(vax, psl_cm, "setting C
 ATF_TP_ADD_TCS(tp)
 {
 	ATF_TP_ADD_TC(tp, lwp_create_works);
+	ATF_TP_ADD_TC(tp, lwp_create_bad_lid_ptr);
 	ATF_TP_ADD_TC(tp, lwp_create_generic_fail_no_uc_cpu);
 #ifdef __alpha__
 	ATF_TP_ADD_TC(tp, lwp_create_alpha_fail_pslset);



CVS commit: src/share/misc

2020-06-06 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Sat Jun  6 17:39:35 UTC 2020

Modified Files:
src/share/misc: acronyms-o.real

Log Message:
FTP


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/share/misc/acronyms-o.real

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/misc/acronyms-o.real
diff -u src/share/misc/acronyms-o.real:1.7 src/share/misc/acronyms-o.real:1.8
--- src/share/misc/acronyms-o.real:1.7	Thu Jun  4 14:09:54 2020
+++ src/share/misc/acronyms-o.real	Sat Jun  6 17:39:35 2020
@@ -1,4 +1,4 @@
-# $NetBSD: acronyms-o.real,v 1.7 2020/06/04 14:09:54 nia Exp $
+# $NetBSD: acronyms-o.real,v 1.8 2020/06/06 17:39:35 nia Exp $
 ACAB	all cops are bastards
 AFU	all fucked up
 AYFKM	are you fucking kidding me
@@ -22,6 +22,7 @@ FSCK	fuck
 FTFA	from the fucking article
 FTFM	fuck the fuckin' manual!
 FTMFW	for the motherfucking win
+FTP	fuck the police
 FTS	fuck that shit
 FUBAR	fucked up beyond all recognition
 FYIAD	fuck you, I'm a dragon!



CVS commit: src/sys/lib/libsa

2020-06-06 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jun  6 15:45:47 UTC 2020

Modified Files:
src/sys/lib/libsa: subr_prf.c

Log Message:
Make libsa's vsnprintf() work as expected when passed a NULL
destinatino buffer.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/lib/libsa/subr_prf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/lib/libsa/subr_prf.c
diff -u src/sys/lib/libsa/subr_prf.c:1.28 src/sys/lib/libsa/subr_prf.c:1.29
--- src/sys/lib/libsa/subr_prf.c:1.28	Sun Feb  3 11:59:43 2019
+++ src/sys/lib/libsa/subr_prf.c	Sat Jun  6 15:45:47 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_prf.c,v 1.28 2019/02/03 11:59:43 mrg Exp $	*/
+/*	$NetBSD: subr_prf.c,v 1.29 2020/06/06 15:45:47 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1993
@@ -127,6 +127,12 @@ do {\
 #endif	/* LIBSA_PRINTF_LONGLONG_SUPPORT */
 
 static void
+null_sputchar(int c)
+{
+	sbuf++;
+}
+
+static void
 sputchar(int c)
 {
 
@@ -147,8 +153,9 @@ vsnprintf(char *buf, size_t size, const 
 
 	sbuf = buf;
 	ebuf = buf + size - 1;
-	kdoprnt(sputchar, fmt, ap);
-	*sbuf = '\0';
+	kdoprnt(buf == NULL ? null_sputchar : sputchar, fmt, ap);
+	if (buf != NULL)
+		*sbuf = '\0';
 	return sbuf - buf;
 }
 



CVS commit: src/sys/arch/mips/mips

2020-06-06 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sat Jun  6 14:30:44 UTC 2020

Modified Files:
src/sys/arch/mips/mips: cache_octeon.c

Log Message:
Increase readability by reducing #ifdef using a macro.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/mips/mips/cache_octeon.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/mips/mips/cache_octeon.c
diff -u src/sys/arch/mips/mips/cache_octeon.c:1.3 src/sys/arch/mips/mips/cache_octeon.c:1.4
--- src/sys/arch/mips/mips/cache_octeon.c:1.3	Sat Apr 13 21:39:46 2019
+++ src/sys/arch/mips/mips/cache_octeon.c	Sat Jun  6 14:30:44 2020
@@ -1,7 +1,7 @@
-/*	$NetBSD: cache_octeon.c,v 1.3 2019/04/13 21:39:46 maya Exp $	*/
+/*	$NetBSD: cache_octeon.c,v 1.4 2020/06/06 14:30:44 simonb Exp $	*/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cache_octeon.c,v 1.3 2019/04/13 21:39:46 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cache_octeon.c,v 1.4 2020/06/06 14:30:44 simonb Exp $");
 
 #include 
 #include 
@@ -13,59 +13,55 @@ __KERNEL_RCSID(0, "$NetBSD: cache_octeon
 #define	SYNC	__asm volatile("sync")
 
 #ifdef OCTEON_ICACHE_DEBUG
-int octeon_cache_debug;
+int octeon_cache_debug = 0;
+#define	ICACHE_DEBUG_PRINTF(x)		\
+	if (__predict_false(octeon_cache_debug != 0))			\
+		printf x;
+#else
+#define	ICACHE_DEBUG_PRINTF(x)		/* nothing */
 #endif
 
+
 static inline void
 mips_synci(vaddr_t va)
 {
+
 	__asm __volatile("synci 0(%0)" :: "r"(va));
 }
 
 void
 octeon_icache_sync_all(void)
 {
-#ifdef OCTEON_ICACHE_DEBUG
-	if (__predict_false(octeon_cache_debug != 0))
-		printf("%s\n", __func__);
-#endif
+
+	ICACHE_DEBUG_PRINTF(("%s\n", __func__));
 	mips_synci(MIPS_KSEG0_START);
-//	cache_octeon_invalidate(CACHEOP_OCTEON_INV_ALL | CACHE_OCTEON_I);
 	SYNC;
 }
 void
 octeon_icache_sync_range(register_t va, vsize_t size)
 {
-#ifdef OCTEON_ICACHE_DEBUG
-	if (__predict_false(octeon_cache_debug != 0))
-		printf("%s: va=%#"PRIxREGISTER", size=%#"PRIxVSIZE"\n",
-		__func__, va, size);
-#endif
+
+	ICACHE_DEBUG_PRINTF(("%s: va=%#"PRIxREGISTER", size=%#"PRIxVSIZE"\n",
+	__func__, va, size));
 	mips_synci(MIPS_KSEG0_START);
-//	cache_octeon_invalidate(CACHEOP_OCTEON_INV_ALL | CACHE_OCTEON_I);
 	SYNC;
 }
 
 void
 octeon_icache_sync_range_index(vaddr_t va, vsize_t size)
 {
-#ifdef OCTEON_ICACHE_DEBUG
-	if (__predict_false(octeon_cache_debug != 0))
-		printf("%s: va=%#"PRIxVADDR", size=%#"PRIxVSIZE"\n",
-		__func__, va, size);
-#endif
+
+	ICACHE_DEBUG_PRINTF(("%s: va=%#"PRIxVADDR", size=%#"PRIxVSIZE"\n",
+	__func__, va, size));
 	mips_synci(MIPS_KSEG0_START);
-//	cache_octeon_invalidate(CACHEOP_OCTEON_INV_ALL | CACHE_OCTEON_I);
 	SYNC;
 }
 
 void
 octeon_pdcache_inv_all(void)
 {
-#ifdef OCTEON_ICACHE_DEBUG
-	if (__predict_false(octeon_cache_debug != 0))
-		printf("%s\n", __func__);
-#endif
+
+	ICACHE_DEBUG_PRINTF(("%s\n", __func__));
 	cache_octeon_invalidate(CACHEOP_OCTEON_INV_ALL | CACHE_OCTEON_D);
 	SYNC;
 }
@@ -73,11 +69,9 @@ octeon_pdcache_inv_all(void)
 void
 octeon_pdcache_inv_range(register_t va, vsize_t size)
 {
-#ifdef OCTEON_ICACHE_DEBUG
-	if (__predict_false(octeon_cache_debug != 0))
-		printf("%s: va=%#"PRIxREGISTER", size=%#"PRIxVSIZE"\n",
-		__func__, va, size);
-#endif
+
+	ICACHE_DEBUG_PRINTF(("%s: va=%#"PRIxREGISTER", size=%#"PRIxVSIZE"\n",
+	__func__, va, size));
 	cache_octeon_invalidate(CACHEOP_OCTEON_INV_ALL | CACHE_OCTEON_D);
 	SYNC;
 }
@@ -85,11 +79,9 @@ octeon_pdcache_inv_range(register_t va, 
 void
 octeon_pdcache_inv_range_index(vaddr_t va, vsize_t size)
 {
-#ifdef OCTEON_ICACHE_DEBUG
-	if (__predict_false(octeon_cache_debug != 0))
-		printf("%s: va=%#"PRIxVADDR", size=%#"PRIxVSIZE"\n",
-		__func__, va, size);
-#endif
+
+	ICACHE_DEBUG_PRINTF(("%s: va=%#"PRIxVADDR", size=%#"PRIxVSIZE"\n",
+	__func__, va, size));
 	cache_octeon_invalidate(CACHEOP_OCTEON_INV_ALL | CACHE_OCTEON_D);
 	SYNC;
 }
@@ -98,6 +90,8 @@ octeon_pdcache_inv_range_index(vaddr_t v
 
 #ifdef OCTEON_ICACHE_DEBUG
 
+/* XXX does the following even make sense for Octeon II/III? */
+
 /* icache: 16KB, 2ways */
 
 #define	OCTEON_ICACHE_VA_WAY(_va)		(((_va) & __BITS(14, 13)) >> 13)



CVS commit: src/sys/dev/usb

2020-06-06 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Sat Jun  6 13:53:43 UTC 2020

Modified Files:
src/sys/dev/usb: if_run.c if_runvar.h

Log Message:
Conditionally enable the formerly #if'ed-out code to use the
WRITE_REGION_1 command for writing blocks of data to the device.
This is to address a performance issue where "ifconfig run0 up" would
take as long as 20-30 seconds when using a UHCI or OHCI host
controller due to the large number of control transfers performed by
the driver in combination with the inability of those host controllers
to perform multiple control transfers per USB frame.  Limit the
transfers to 64 bytes as in the corresponding #if'ed-out code in
FreeBSD.  Currently only enabled for mac_ver 0x5390 as it is the only
version tested so far.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/usb/if_run.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/usb/if_runvar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/if_run.c
diff -u src/sys/dev/usb/if_run.c:1.39 src/sys/dev/usb/if_run.c:1.40
--- src/sys/dev/usb/if_run.c:1.39	Sun Mar 15 23:04:51 2020
+++ src/sys/dev/usb/if_run.c	Sat Jun  6 13:53:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_run.c,v 1.39 2020/03/15 23:04:51 thorpej Exp $	*/
+/*	$NetBSD: if_run.c,v 1.40 2020/06/06 13:53:43 gson Exp $	*/
 /*	$OpenBSD: if_run.c,v 1.90 2012/03/24 15:11:04 jsg Exp $	*/
 
 /*-
@@ -23,7 +23,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_run.c,v 1.39 2020/03/15 23:04:51 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_run.c,v 1.40 2020/06/06 13:53:43 gson Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -649,6 +649,19 @@ run_attach(device_t parent, device_t sel
 	sc->mac_ver = ver >> 16;
 	sc->mac_rev = ver & 0x;
 
+   /*
+	* Per the comment in run_write_region_1(), "the WRITE_REGION_1
+	* command is not stable on RT2860", but WRITE_REGION_1 calls
+	* of up to 64 bytes have been tested and found to work with
+	* mac_ver 0x5390, and they reduce the run time of "ifconfig
+	* run0 up" from 30 seconds to a couple of seconds on OHCI.
+	* Enable WRITE_REGION_1 for the tested version only.  As other
+	* versions are tested and found to work, they can be added
+	* here.
+	*/
+	if (sc->mac_ver == 0x5390)
+		sc->sc_flags |= RUN_USE_BLOCK_WRITE;
+
 	/* retrieve RF rev. no and various other things from EEPROM */
 	run_read_eeprom(sc);
 
@@ -1046,37 +1059,49 @@ run_write_2(struct run_softc *sc, uint16
 static int
 run_write(struct run_softc *sc, uint16_t reg, uint32_t val)
 {
-	int error;
-
-	if ((error = run_write_2(sc, reg, val & 0x)) == 0)
-		error = run_write_2(sc, reg + 2, val >> 16);
-	return error;
+	uint32_t tmp = htole32(val);
+	return run_write_region_1(sc, reg, (uint8_t *), sizeof(tmp));
 }
 
 static int
 run_write_region_1(struct run_softc *sc, uint16_t reg, const uint8_t *buf,
 int len)
 {
-#if 1
-	int i, error = 0;
-	/*
-	 * NB: the WRITE_REGION_1 command is not stable on RT2860.
-	 * We thus issue multiple WRITE_2 commands instead.
-	 */
-	KASSERT((len & 1) == 0);
-	for (i = 0; i < len && error == 0; i += 2)
-		error = run_write_2(sc, reg + i, buf[i] | buf[i + 1] << 8);
+	int error = 0;
+	if (sc->sc_flags & RUN_USE_BLOCK_WRITE) {
+		usb_device_request_t req;
+		/*
+		 * NOTE: It appears the WRITE_REGION_1 command cannot be
+		 * passed a huge amount of data, which will crash the
+		 * firmware. Limit amount of data passed to 64 bytes at a
+		 * time.
+		 */
+		while (len > 0) {
+			int delta = MIN(len, 64);
+			req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
+			req.bRequest = RT2870_WRITE_REGION_1;
+			USETW(req.wValue, 0);
+			USETW(req.wIndex, reg);
+			USETW(req.wLength, delta);
+			error = usbd_do_request(sc->sc_udev, ,
+			__UNCONST(buf));
+			if (error != 0)
+break;
+			reg += delta;
+			buf += delta;
+			len -= delta;
+		}
+	} else {
+		/*
+		 * NB: the WRITE_REGION_1 command is not stable on RT2860.
+		 * We thus issue multiple WRITE_2 commands instead.
+		 */
+		int i;
+		KASSERT((len & 1) == 0);
+		for (i = 0; i < len && error == 0; i += 2)
+			error = run_write_2(sc, reg + i, buf[i] | buf[i + 1] << 8);
+	}
 	return error;
-#else
-	usb_device_request_t req;
-
-	req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
-	req.bRequest = RT2870_WRITE_REGION_1;
-	USETW(req.wValue, 0);
-	USETW(req.wIndex, reg);
-	USETW(req.wLength, len);
-	return usbd_do_request(sc->sc_udev, , __UNCONST(buf));
-#endif
 }
 
 static int
@@ -1084,8 +1109,25 @@ run_set_region_4(struct run_softc *sc, u
 {
 	int error = 0;
 
-	for (; count > 0 && error == 0; count--, reg += 4)
-		error = run_write(sc, reg, val);
+	if (sc->sc_flags & RUN_USE_BLOCK_WRITE) {
+		while (count > 0) {
+			int i, delta;
+			uint32_t tmp[16];
+
+			delta = MIN(count, __arraycount(tmp));
+			for (i = 0; i < delta; i++)
+tmp[i] = htole32(val);
+			error = run_write_region_1(sc, reg, (uint8_t *)tmp,
+			delta * sizeof(uint32_t));
+			if 

CVS commit: src/usr.sbin/installboot

2020-06-06 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jun  6 10:22:45 UTC 2020

Modified Files:
src/usr.sbin/installboot: installboot.8

Log Message:
Fix ews4800mips example.  Its raw partition is rsd0p, not rsd0c.


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/usr.sbin/installboot/installboot.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/installboot/installboot.8
diff -u src/usr.sbin/installboot/installboot.8:1.97 src/usr.sbin/installboot/installboot.8:1.98
--- src/usr.sbin/installboot/installboot.8:1.97	Tue May  7 08:14:59 2019
+++ src/usr.sbin/installboot/installboot.8	Sat Jun  6 10:22:45 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: installboot.8,v 1.97 2019/05/07 08:14:59 wiz Exp $
+.\"	$NetBSD: installboot.8,v 1.98 2020/06/06 10:22:45 tsutsui Exp $
 .\"
 .\" Copyright (c) 2002-2019 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -770,8 +770,14 @@ Install the System V Boot File System pr
 with the secondary bootstrap
 .Sq Pa /boot
 already present in the SysVBFS partition on the disk:
-.Dl Ic installboot /dev/rsd0c /usr/mdec/bootxx_bfs
-.
+.Dl Ic installboot /dev/rsd0p /usr/mdec/bootxx_bfs
+.Bd -ragged -offset indent-two -compact
+.Em Note :
+On
+.Nx Ns /ews4800mips the p partition is the
+.Dq whole disk
+(i.e. raw) partition.
+.Ed
 .Ss Nx Ns /i386 and Nx Ns /amd64
 Install new boot blocks on an existing
 .Sy FFSv2



CVS commit: src/sys/arch/arm/arm32

2020-06-06 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jun  6 09:03:59 UTC 2020

Modified Files:
src/sys/arch/arm/arm32: arm32_boot.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/arm/arm32/arm32_boot.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/arm32/arm32_boot.c
diff -u src/sys/arch/arm/arm32/arm32_boot.c:1.37 src/sys/arch/arm/arm32/arm32_boot.c:1.38
--- src/sys/arch/arm/arm32/arm32_boot.c:1.37	Sat Feb 15 08:16:11 2020
+++ src/sys/arch/arm/arm32/arm32_boot.c	Sat Jun  6 09:03:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: arm32_boot.c,v 1.37 2020/02/15 08:16:11 skrll Exp $	*/
+/*	$NetBSD: arm32_boot.c,v 1.38 2020/06/06 09:03:59 skrll Exp $	*/
 
 /*
  * Copyright (c) 2002, 2003, 2005  Genetec Corporation.  All rights reserved.
@@ -122,7 +122,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: arm32_boot.c,v 1.37 2020/02/15 08:16:11 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: arm32_boot.c,v 1.38 2020/06/06 09:03:59 skrll Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_cputypes.h"
@@ -131,11 +131,12 @@ __KERNEL_RCSID(1, "$NetBSD: arm32_boot.c
 #include "opt_multiprocessor.h"
 
 #include 
-#include 
-#include 
-#include 
+
 #include 
+#include 
 #include 
+#include 
+#include 
 
 #include 
 



CVS commit: src/sys/dev/usb

2020-06-06 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jun  6 08:56:31 UTC 2020

Modified Files:
src/sys/dev/usb: xhci.c xhcireg.h

Log Message:
More __BITS.  NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.131 -r1.132 src/sys/dev/usb/xhci.c
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/usb/xhcireg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/xhci.c
diff -u src/sys/dev/usb/xhci.c:1.131 src/sys/dev/usb/xhci.c:1.132
--- src/sys/dev/usb/xhci.c:1.131	Thu Jun  4 20:54:37 2020
+++ src/sys/dev/usb/xhci.c	Sat Jun  6 08:56:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci.c,v 1.131 2020/06/04 20:54:37 skrll Exp $	*/
+/*	$NetBSD: xhci.c,v 1.132 2020/06/06 08:56:30 skrll Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.131 2020/06/04 20:54:37 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.132 2020/06/06 08:56:30 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -645,7 +645,7 @@ xhci_detach(struct xhci_softc *sc, int f
 
 	xhci_rt_write_4(sc, XHCI_ERSTSZ(0), 0);
 	xhci_rt_write_8(sc, XHCI_ERSTBA(0), 0);
-	xhci_rt_write_8(sc, XHCI_ERDP(0), 0|XHCI_ERDP_LO_BUSY);
+	xhci_rt_write_8(sc, XHCI_ERDP(0), 0 | XHCI_ERDP_BUSY);
 	xhci_ring_free(sc, >sc_er);
 
 	usb_freemem(>sc_bus, >sc_eventst_dma);
@@ -1211,7 +1211,7 @@ xhci_init(struct xhci_softc *sc)
 	xhci_rt_write_4(sc, XHCI_ERSTSZ(0), XHCI_EVENT_RING_SEGMENTS);
 	xhci_rt_write_8(sc, XHCI_ERSTBA(0), DMAADDR(>sc_eventst_dma, 0));
 	xhci_rt_write_8(sc, XHCI_ERDP(0), xhci_ring_trbp(sc->sc_er, 0) |
-	XHCI_ERDP_LO_BUSY);
+	XHCI_ERDP_BUSY);
 
 	xhci_op_write_8(sc, XHCI_DCBAAP, DMAADDR(>sc_dcbaa_dma, 0));
 	xhci_op_write_8(sc, XHCI_CRCR, xhci_ring_trbp(sc->sc_cr, 0) |
@@ -2225,7 +2225,7 @@ xhci_softintr(void *v)
 	er->xr_cs = j;
 
 	xhci_rt_write_8(sc, XHCI_ERDP(0), xhci_ring_trbp(er, er->xr_ep) |
-	XHCI_ERDP_LO_BUSY);
+	XHCI_ERDP_BUSY);
 
 	DPRINTFN(16, "ends", 0, 0, 0, 0);
 

Index: src/sys/dev/usb/xhcireg.h
diff -u src/sys/dev/usb/xhcireg.h:1.17 src/sys/dev/usb/xhcireg.h:1.18
--- src/sys/dev/usb/xhcireg.h:1.17	Thu Jun  4 20:54:37 2020
+++ src/sys/dev/usb/xhcireg.h	Sat Jun  6 08:56:30 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: xhcireg.h,v 1.17 2020/06/04 20:54:37 skrll Exp $ */
+/* $NetBSD: xhcireg.h,v 1.18 2020/06/06 08:56:30 skrll Exp $ */
 
 /*-
  * Copyright (c) 2010 Hans Petter Selasky. All rights reserved.
@@ -51,6 +51,7 @@
 #define	 XHCI_HCIVERSION_0_96	0x0096	/* xHCI version 0.96 */
 #define	 XHCI_HCIVERSION_1_0	0x0100	/* xHCI version 1.0 */
 #define	 XHCI_HCIVERSION_1_1	0x0110	/* xHCI version 1.1 */
+#define	 XHCI_HCIVERSION_1_2	0x0120	/* xHCI version 1.2 */
 
 #define	XHCI_HCSPARAMS1		0x04	/* RO structual parameters 1 */
 #define	 XHCI_HCS1_MAXSLOTS_MASK	__BITS(7, 0)
@@ -129,7 +130,6 @@
 #define	 XHCI_CMD_TSC_EN	__BIT(15)	/* RW Extended TBC TRB Status Enable */
 #define	 XHCI_CMD_VTIOE		__BIT(16)	/* RW VTIO Enable */
 
-
 #define	XHCI_WAIT_CNR		100		/* in 1ms */
 #define	XHCI_WAIT_HCRST		100		/* in 1ms */
 
@@ -282,44 +282,63 @@
 #define	XHCI_PLMC3_LSEC_MASK	__BITS(15, 0)	/* RW - Link Soft Error Count */
 #define	XHCI_PLMC3_LSEC_GET(x)	__SHIFTOUT((x), XHCI_PLMC3_LSEC_MASK)
 
+/* 5.5.1 */
 /* XHCI runtime registers.  Offset given by XHCI_CAPLENGTH + XHCI_RTSOFF registers */
-#define	XHCI_MFINDEX		0x		/* RO - microframe index */
-#define	 XHCI_MFINDEX_GET(x)	((x) & 0x3FFF)
-
-#define	XHCI_IMAN(n)		(0x0020 + (0x20 * (n)))	/* XHCI interrupt management */
+#define	XHCI_MFINDEX		0x
+#define	 XHCI_MFINDEX_MASK	__BITS(13, 0)	/* RO - microframe index */
+#define	 XHCI_MFINDEX_GET(x)	__SHIFTOUT((x), XHCI_MFINDEX_MASK)
+
+/* 5.5.2 Interrupter Register set */
+/* 5.5.2.1 interrupt management */
+#define	XHCI_IMAN(n)		(0x0020 + (0x20 * (n)))
 #define	 XHCI_IMAN_INTR_PEND	__BIT(0)	/* RW - interrupt pending */
 #define	 XHCI_IMAN_INTR_ENA	__BIT(1)	/* RW - interrupt enable */
 
+/* 5.5.2.2 Interrupter Moderation */
 #define	XHCI_IMOD(n)		(0x0024 + (0x20 * (n)))	/* XHCI interrupt moderation */
-#define	 XHCI_IMOD_IVAL_GET(x)	(((x) >> 0) & 0x)	/* 250ns unit */
-#define	 XHCI_IMOD_IVAL_SET(x)	(((x) & 0x) << 0)	/* 250ns unit */
-#define	 XHCI_IMOD_ICNT_GET(x)	(((x) >> 16) & 0x)	/* 250ns unit */
-#define	 XHCI_IMOD_ICNT_SET(x)	(((x) & 0x) << 16)	/* 250ns unit */
+#define	 XHCI_IMOD_IVAL_MASK	__BITS(15,0)	/* 250ns unit */
+#define	 XHCI_IMOD_IVAL_GET(x)	__SHIFTOUT((x), XHCI_IMOD_IVAL_MASK)
+#define	 XHCI_IMOD_IVAL_SET(x)	__SHIFTIN((x), XHCI_IMOD_IVAL_MASK)
+#define	 XHCI_IMOD_ICNT_MASK	__BITS(31, 16)	/* 250ns unit */
+#define	 XHCI_IMOD_ICNT_GET(x)	__SHIFTOUT((x), XHCI_IMOD_ICNT_MASK)
+#define	 XHCI_IMOD_ICNT_SET(x)	__SHIFTIN((x), XHCI_IMOD_ICNT_MASK)
 #define	 XHCI_IMOD_DEFAULT	0x01F4U	/* 8000 IRQ/second */
 #define	 XHCI_IMOD_DEFAULT_LP	0x03E8U	/* 4000 IRQ/sec for LynxPoint */
 
-#define	XHCI_ERSTSZ(n)		(0x0028 + (0x20 * (n)))	

CVS commit: src/sys/arch/amd64/amd64

2020-06-06 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Jun  6 07:03:21 UTC 2020

Modified Files:
src/sys/arch/amd64/amd64: db_machdep.c

Log Message:
If the frame is not aligned, leave right away. This place probably needs
to be revisited, because %rbp could easily contain garbage.

Reported-by: syzbot+ecb40cf7f8acc102c...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/amd64/amd64/db_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/amd64/amd64/db_machdep.c
diff -u src/sys/arch/amd64/amd64/db_machdep.c:1.7 src/sys/arch/amd64/amd64/db_machdep.c:1.8
--- src/sys/arch/amd64/amd64/db_machdep.c:1.7	Thu May 14 16:57:53 2020
+++ src/sys/arch/amd64/amd64/db_machdep.c	Sat Jun  6 07:03:21 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_machdep.c,v 1.7 2020/05/14 16:57:53 maxv Exp $	*/
+/*	$NetBSD: db_machdep.c,v 1.8 2020/06/06 07:03:21 maxv Exp $	*/
 
 /*
  * Mach Operating System
@@ -26,7 +26,7 @@
  * rights to redistribute these changes.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.7 2020/05/14 16:57:53 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.8 2020/06/06 07:03:21 maxv Exp $");
 
 #include 
 #include 
@@ -151,6 +151,8 @@ db_nextframe(long **nextframe, long **re
 			db_get_value((long)>tf_rbp, 8, false);
 		if (fp == NULL)
 			return 0;
+		if (((uintptr_t)fp & 7) != 0)
+			return 0;
 		*nextframe = (long *)>f_frame;
 		*retaddr = (long *)>f_retaddr;
 		*arg0 = (long *)>f_arg0;



CVS commit: src/sys/kern

2020-06-06 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Jun  6 06:42:54 UTC 2020

Modified Files:
src/sys/kern: subr_pool.c

Log Message:
kMSan: re-set the orig after pool_cache_get_slow(), using the address of
the caller of pool_cache_get_paddr().

Otherwise the orig is just pool_cache_get_paddr(), and that's not really
useful for debugging.


To generate a diff of this commit:
cvs rdiff -u -r1.268 -r1.269 src/sys/kern/subr_pool.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/subr_pool.c
diff -u src/sys/kern/subr_pool.c:1.268 src/sys/kern/subr_pool.c:1.269
--- src/sys/kern/subr_pool.c:1.268	Wed Apr 15 17:16:22 2020
+++ src/sys/kern/subr_pool.c	Sat Jun  6 06:42:54 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_pool.c,v 1.268 2020/04/15 17:16:22 maxv Exp $	*/
+/*	$NetBSD: subr_pool.c,v 1.269 2020/06/06 06:42:54 maxv Exp $	*/
 
 /*
  * Copyright (c) 1997, 1999, 2000, 2002, 2007, 2008, 2010, 2014, 2015, 2018
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.268 2020/04/15 17:16:22 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.269 2020/06/06 06:42:54 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -2574,8 +2574,13 @@ pool_cache_get_paddr(pool_cache_t pc, in
 		 * no more objects are available, it will return false.
 		 * Otherwise, we need to retry.
 		 */
-		if (!pool_cache_get_slow(cc, s, , pap, flags))
+		if (!pool_cache_get_slow(cc, s, , pap, flags)) {
+			if (object != NULL) {
+kmsan_orig(object, pc->pc_pool.pr_size,
+KMSAN_TYPE_POOL, __RET_ADDR);
+			}
 			break;
+		}
 	}
 
 	/*