CVS commit: src/usr.sbin/fstyp

2019-11-18 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Mon Nov 18 14:53:34 UTC 2019

Modified Files:
src/usr.sbin/fstyp: Makefile fstyp.8 fstyp.c fstyp.h
Added Files:
src/usr.sbin/fstyp: exfat.c

Log Message:
fstyp: Add exFAT support

Taken-from: FreeBSD and DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/fstyp/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.sbin/fstyp/exfat.c
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/fstyp/fstyp.8 \
src/usr.sbin/fstyp/fstyp.c
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/fstyp/fstyp.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/fstyp/Makefile
diff -u src/usr.sbin/fstyp/Makefile:1.5 src/usr.sbin/fstyp/Makefile:1.6
--- src/usr.sbin/fstyp/Makefile:1.5	Mon Jun 24 08:27:21 2019
+++ src/usr.sbin/fstyp/Makefile	Mon Nov 18 14:53:34 2019
@@ -1,9 +1,9 @@
-#	$NetBSD: Makefile,v 1.5 2019/06/24 08:27:21 hannken Exp $
+#	$NetBSD: Makefile,v 1.6 2019/11/18 14:53:34 tkusumi Exp $
 
 .include 
 
 PROG=	fstyp
-SRCS=	cd9660.c ext2fs.c fstyp.c msdosfs.c ntfs.c ufs.c
+SRCS=	cd9660.c exfat.c ext2fs.c fstyp.c msdosfs.c ntfs.c ufs.c
 
 .if (${MKZFS} != "no")
 SRCS+=	zfs.c

Index: src/usr.sbin/fstyp/fstyp.8
diff -u src/usr.sbin/fstyp/fstyp.8:1.2 src/usr.sbin/fstyp/fstyp.8:1.3
--- src/usr.sbin/fstyp/fstyp.8:1.2	Tue Jan  9 09:41:29 2018
+++ src/usr.sbin/fstyp/fstyp.8	Mon Nov 18 14:53:34 2019
@@ -1,4 +1,4 @@
-.\" $NetBSD: fstyp.8,v 1.2 2018/01/09 09:41:29 wiz Exp $
+.\" $NetBSD: fstyp.8,v 1.3 2019/11/18 14:53:34 tkusumi Exp $
 .\"
 .\" Copyright (c) 2017 The NetBSD Foundation, Inc.
 .\" Copyright (c) 2016 The DragonFly Project
@@ -34,7 +34,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 25, 2017
+.Dd November 19, 2019
 .Dt FSTYP 8
 .Os
 .Sh NAME
@@ -48,7 +48,7 @@
 The
 .Nm
 utility is used to determine the file system type on a given device.
-It can recognize ISO-9660, Ext2, FAT, NTFS, and UFS file systems.
+It can recognize ISO-9660, exFAT, Ext2, FAT, NTFS, and UFS file systems.
 When the
 .Fl u
 flag is specified,
@@ -64,6 +64,8 @@ as, respectively:
 .It
 cd9660
 .It
+exfat
+.It
 ext2fs
 .It
 msdosfs
Index: src/usr.sbin/fstyp/fstyp.c
diff -u src/usr.sbin/fstyp/fstyp.c:1.2 src/usr.sbin/fstyp/fstyp.c:1.3
--- src/usr.sbin/fstyp/fstyp.c:1.2	Tue Jan  9 10:47:57 2018
+++ src/usr.sbin/fstyp/fstyp.c	Mon Nov 18 14:53:34 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: fstyp.c,v 1.2 2018/01/09 10:47:57 martin Exp $	*/
+/*	$NetBSD: fstyp.c,v 1.3 2019/11/18 14:53:34 tkusumi Exp $	*/
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  *
  */
 #include 
-__RCSID("$NetBSD: fstyp.c,v 1.2 2018/01/09 10:47:57 martin Exp $");
+__RCSID("$NetBSD: fstyp.c,v 1.3 2019/11/18 14:53:34 tkusumi Exp $");
 
 #include 
 #include 
@@ -64,6 +64,7 @@ static struct {
 	bool		unmountable;
 } fstypes[] = {
 	{ "cd9660", _cd9660, false },
+	{ "exfat", _exfat, false },
 	{ "ext2fs", _ext2fs, false },
 	{ "msdosfs", _msdosfs, false },
 	{ "ntfs", _ntfs, false },

Index: src/usr.sbin/fstyp/fstyp.h
diff -u src/usr.sbin/fstyp/fstyp.h:1.1 src/usr.sbin/fstyp/fstyp.h:1.2
--- src/usr.sbin/fstyp/fstyp.h:1.1	Tue Jan  9 03:31:15 2018
+++ src/usr.sbin/fstyp/fstyp.h	Mon Nov 18 14:53:34 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: fstyp.h,v 1.1 2018/01/09 03:31:15 christos Exp $	*/
+/*	$NetBSD: fstyp.h,v 1.2 2019/11/18 14:53:34 tkusumi Exp $	*/
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -44,6 +44,7 @@ char	*checked_strdup(const char *);
 void	rtrim(char *, size_t);
 
 int	fstyp_cd9660(FILE *, char *, size_t);
+int	fstyp_exfat(FILE *fp, char *label, size_t size);
 int	fstyp_ext2fs(FILE *, char *, size_t);
 int	fstyp_msdosfs(FILE *, char *, size_t);
 int	fstyp_ntfs(FILE *, char *, size_t);

Added files:

Index: src/usr.sbin/fstyp/exfat.c
diff -u /dev/null src/usr.sbin/fstyp/exfat.c:1.1
--- /dev/null	Mon Nov 18 14:53:34 2019
+++ src/usr.sbin/fstyp/exfat.c	Mon Nov 18 14:53:34 2019
@@ -0,0 +1,78 @@
+/*	$NetBSD: exfat.c,v 1.1 2019/11/18 14:53:34 tkusumi Exp $	*/
+
+/*
+ * Copyright (c) 2017 Conrad Meyer 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 

CVS commit: src/usr.sbin/fstyp

2019-11-18 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Mon Nov 18 14:53:34 UTC 2019

Modified Files:
src/usr.sbin/fstyp: Makefile fstyp.8 fstyp.c fstyp.h
Added Files:
src/usr.sbin/fstyp: exfat.c

Log Message:
fstyp: Add exFAT support

Taken-from: FreeBSD and DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/fstyp/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.sbin/fstyp/exfat.c
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/fstyp/fstyp.8 \
src/usr.sbin/fstyp/fstyp.c
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/fstyp/fstyp.h

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



CVS commit: src/sys/fs/autofs

2019-11-16 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Nov 16 09:22:00 UTC 2019

Modified Files:
src/sys/fs/autofs: autofs_vfsops.c

Log Message:
autofs: Fix change by r1.3 "prevent assert on unmount."

Must delete all nodes on unmount, otherwise automounts with >1 level of 
directories can't be deleted.
taken-from: FreeBSD and DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/fs/autofs/autofs_vfsops.c

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



CVS commit: src/sys/fs/autofs

2019-11-16 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Nov 16 09:22:00 UTC 2019

Modified Files:
src/sys/fs/autofs: autofs_vfsops.c

Log Message:
autofs: Fix change by r1.3 "prevent assert on unmount."

Must delete all nodes on unmount, otherwise automounts with >1 level of 
directories can't be deleted.
taken-from: FreeBSD and DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/fs/autofs/autofs_vfsops.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/fs/autofs/autofs_vfsops.c
diff -u src/sys/fs/autofs/autofs_vfsops.c:1.5 src/sys/fs/autofs/autofs_vfsops.c:1.6
--- src/sys/fs/autofs/autofs_vfsops.c:1.5	Thu Nov 14 08:45:24 2019
+++ src/sys/fs/autofs/autofs_vfsops.c	Sat Nov 16 09:22:00 2019
@@ -33,7 +33,7 @@
  *
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autofs_vfsops.c,v 1.5 2019/11/14 08:45:24 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autofs_vfsops.c,v 1.6 2019/11/16 09:22:00 tkusumi Exp $");
 
 
 #include "autofs.h"
@@ -232,13 +232,14 @@ autofs_unmount(struct mount *mp, int mnt
 	mutex_enter(>am_lock);
 	while (!RB_EMPTY(>am_root->an_children)) {
 		struct autofs_node *anp;
+		/*
+		 * Force delete all nodes when more than one level of
+		 * directories are created via indirect map. Autofs doesn't
+		 * support rmdir(2), thus this is the only way to get out.
+		 */
 		anp = RB_MIN(autofs_node_tree, >am_root->an_children);
-		if (!RB_EMPTY(>an_children)) {
-			AUTOFS_DEBUG("%s: %s has children", __func__,
-			anp->an_name);
-			mutex_exit(>am_lock);
-			return EBUSY;
-		}
+		while (!RB_EMPTY(>an_children))
+			anp = RB_MIN(autofs_node_tree, >an_children);
 		autofs_node_delete(anp);
 	}
 	autofs_node_delete(amp->am_root);



CVS commit: src/usr.sbin/autofs

2019-11-16 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Nov 16 12:21:06 UTC 2019

Modified Files:
src/usr.sbin/autofs: common.c

Log Message:
autofs: Fix segfault that could occur on "automount -LL"


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/autofs/common.c

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



CVS commit: src/usr.sbin/autofs

2019-11-16 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Nov 16 12:21:06 UTC 2019

Modified Files:
src/usr.sbin/autofs: common.c

Log Message:
autofs: Fix segfault that could occur on "automount -LL"


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/autofs/common.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/autofs/common.c
diff -u src/usr.sbin/autofs/common.c:1.2 src/usr.sbin/autofs/common.c:1.3
--- src/usr.sbin/autofs/common.c:1.2	Sat Nov 16 11:56:29 2019
+++ src/usr.sbin/autofs/common.c	Sat Nov 16 12:21:06 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: common.c,v 1.2 2019/11/16 11:56:29 tkusumi Exp $	*/
+/*	$NetBSD: common.c,v 1.3 2019/11/16 12:21:06 tkusumi Exp $	*/
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  * $FreeBSD: head/usr.sbin/autofs/common.c 303527 2016-07-30 01:10:05Z bapt $
  */
 #include 
-__RCSID("$NetBSD: common.c,v 1.2 2019/11/16 11:56:29 tkusumi Exp $");
+__RCSID("$NetBSD: common.c,v 1.3 2019/11/16 12:21:06 tkusumi Exp $");
 
 #include 
 #include 
@@ -357,7 +357,7 @@ expand_ampersand(char *string, const cha
 		 * of characters before the '&'.
 		 */
 		before_len = i;
-		//assert(i + 1 < strlen(string));
+		//assert(i < strlen(string));
 
 		ret = asprintf(, "%.*s%s%s",
 		(int)before_len, string, key, string + before_len + 1);
@@ -372,6 +372,8 @@ expand_ampersand(char *string, const cha
 		 */
 		string = expanded;
 		i = before_len + strlen(key);
+		if (i == strlen(string))
+			break;
 		backslashed = false;
 		//assert(i < strlen(string));
 	}



CVS commit: src/usr.sbin/autofs

2019-11-16 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Nov 16 11:56:29 UTC 2019

Modified Files:
src/usr.sbin/autofs: common.c

Log Message:
autofs: Remove unneeded header include

common.c doesn't depend on autofs or its ioctls.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/autofs/common.c

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



CVS commit: src/usr.sbin/autofs

2019-11-16 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Nov 16 11:56:29 UTC 2019

Modified Files:
src/usr.sbin/autofs: common.c

Log Message:
autofs: Remove unneeded header include

common.c doesn't depend on autofs or its ioctls.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/autofs/common.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/autofs/common.c
diff -u src/usr.sbin/autofs/common.c:1.1 src/usr.sbin/autofs/common.c:1.2
--- src/usr.sbin/autofs/common.c:1.1	Tue Jan  9 03:31:15 2018
+++ src/usr.sbin/autofs/common.c	Sat Nov 16 11:56:29 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: common.c,v 1.1 2018/01/09 03:31:15 christos Exp $	*/
+/*	$NetBSD: common.c,v 1.2 2019/11/16 11:56:29 tkusumi Exp $	*/
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  * $FreeBSD: head/usr.sbin/autofs/common.c 303527 2016-07-30 01:10:05Z bapt $
  */
 #include 
-__RCSID("$NetBSD: common.c,v 1.1 2018/01/09 03:31:15 christos Exp $");
+__RCSID("$NetBSD: common.c,v 1.2 2019/11/16 11:56:29 tkusumi Exp $");
 
 #include 
 #include 
@@ -50,7 +50,6 @@ __RCSID("$NetBSD: common.c,v 1.1 2018/01
 #include 
 #include 
 #include 
-#include 
 
 #include "common.h"
 



CVS commit: src/usr.sbin/autofs

2019-11-16 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Nov 16 12:26:54 UTC 2019

Modified Files:
src/usr.sbin/autofs: auto_master.5 defined.c

Log Message:
autofs: Support DOLLAR for $ literal

taken-from FreeBSD and DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/autofs/auto_master.5
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/autofs/defined.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/autofs/auto_master.5
diff -u src/usr.sbin/autofs/auto_master.5:1.6 src/usr.sbin/autofs/auto_master.5:1.7
--- src/usr.sbin/autofs/auto_master.5:1.6	Thu Jan 25 19:15:10 2018
+++ src/usr.sbin/autofs/auto_master.5	Sat Nov 16 12:26:54 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: auto_master.5,v 1.6 2018/01/25 19:15:10 uwe Exp $
+.\"	$NetBSD: auto_master.5,v 1.7 2019/11/16 12:26:54 tkusumi Exp $
 .\" Copyright (c) 2017 The NetBSD Foundation, Inc.
 .\" Copyright (c) 2016 The DragonFly Project
 .\" Copyright (c) 2014 The FreeBSD Foundation
@@ -33,7 +33,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 25, 2017
+.Dd November 16, 2019
 .Dt AUTO_MASTER 5
 .Os
 .Sh NAME
@@ -195,6 +195,8 @@ Expands to the output of
 .It Dv CPU
 Same as
 .Dv ARCH .
+.It Dv DOLLAR
+A literal $ sign.
 .It Dv HOST
 Expands to the output of
 .Li "uname -n" .

Index: src/usr.sbin/autofs/defined.c
diff -u src/usr.sbin/autofs/defined.c:1.1 src/usr.sbin/autofs/defined.c:1.2
--- src/usr.sbin/autofs/defined.c:1.1	Tue Jan  9 03:31:15 2018
+++ src/usr.sbin/autofs/defined.c	Sat Nov 16 12:26:54 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: defined.c,v 1.1 2018/01/09 03:31:15 christos Exp $	*/
+/*	$NetBSD: defined.c,v 1.2 2019/11/16 12:26:54 tkusumi Exp $	*/
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  *
  */
 #include 
-__RCSID("$NetBSD: defined.c,v 1.1 2018/01/09 03:31:15 christos Exp $");
+__RCSID("$NetBSD: defined.c,v 1.2 2019/11/16 12:26:54 tkusumi Exp $");
 
 /*
  * All the "defined" stuff is for handling variables,
@@ -256,6 +256,7 @@ defined_init(void)
 
 	defined_add("ARCH", name.machine);
 	defined_add("CPU", name.machine);
+	defined_add("DOLLAR", "$");
 	defined_add("HOST", name.nodename);
 	defined_add("OSNAME", name.sysname);
 	defined_add("OSREL", name.release);



CVS commit: src/usr.sbin/autofs

2019-11-16 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Nov 16 12:26:54 UTC 2019

Modified Files:
src/usr.sbin/autofs: auto_master.5 defined.c

Log Message:
autofs: Support DOLLAR for $ literal

taken-from FreeBSD and DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/autofs/auto_master.5
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/autofs/defined.c

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



CVS commit: src

2019-11-21 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Thu Nov 21 15:24:18 UTC 2019

Modified Files:
src/share/man/man5: autofs.5
src/usr.sbin/autofs: auto_master.5 automount.8 automountd.8
autounmountd.8
src/usr.sbin/fstyp: fstyp.8

Log Message:
autofs: Change my email address in man pages to netbsd.org


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/share/man/man5/autofs.5
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/autofs/auto_master.5
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/autofs/automount.8
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/autofs/automountd.8 \
src/usr.sbin/autofs/autounmountd.8
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/fstyp/fstyp.8

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

Modified files:

Index: src/share/man/man5/autofs.5
diff -u src/share/man/man5/autofs.5:1.4 src/share/man/man5/autofs.5:1.5
--- src/share/man/man5/autofs.5:1.4	Mon Jan 22 09:45:32 2018
+++ src/share/man/man5/autofs.5	Thu Nov 21 15:24:17 2019
@@ -1,4 +1,4 @@
-.\" $NetBSD: autofs.5,v 1.4 2018/01/22 09:45:32 kamil Exp $
+.\" $NetBSD: autofs.5,v 1.5 2019/11/21 15:24:17 tkusumi Exp $
 .\"
 .\" Copyright (c) 2017 The NetBSD Foundation, Inc.
 .\" Copyright (c) 2016 The DragonFly Project
@@ -122,4 +122,4 @@ was ported to
 and
 .Nx
 by
-.An Tomohiro Kusumi Aq Mt kusumi.tomoh...@gmail.com .
+.An Tomohiro Kusumi Aq Mt tkus...@netbsd.org .

Index: src/usr.sbin/autofs/auto_master.5
diff -u src/usr.sbin/autofs/auto_master.5:1.7 src/usr.sbin/autofs/auto_master.5:1.8
--- src/usr.sbin/autofs/auto_master.5:1.7	Sat Nov 16 12:26:54 2019
+++ src/usr.sbin/autofs/auto_master.5	Thu Nov 21 15:24:17 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: auto_master.5,v 1.7 2019/11/16 12:26:54 tkusumi Exp $
+.\"	$NetBSD: auto_master.5,v 1.8 2019/11/21 15:24:17 tkusumi Exp $
 .\" Copyright (c) 2017 The NetBSD Foundation, Inc.
 .\" Copyright (c) 2016 The DragonFly Project
 .\" Copyright (c) 2014 The FreeBSD Foundation
@@ -393,7 +393,7 @@ configuration file functionality was por
 and
 .Nx
 by
-.An Tomohiro Kusumi Aq Mt kusumi.tomoh...@gmail.com .
+.An Tomohiro Kusumi Aq Mt tkus...@netbsd.org .
 .Sh BUGS
 The
 .Li -media

Index: src/usr.sbin/autofs/automount.8
diff -u src/usr.sbin/autofs/automount.8:1.5 src/usr.sbin/autofs/automount.8:1.6
--- src/usr.sbin/autofs/automount.8:1.5	Sun Jan 14 03:14:46 2018
+++ src/usr.sbin/autofs/automount.8	Thu Nov 21 15:24:17 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: automount.8,v 1.5 2018/01/14 03:14:46 uwe Exp $
+.\"	$NetBSD: automount.8,v 1.6 2019/11/21 15:24:17 tkusumi Exp $
 .\" Copyright (c) 2017 The NetBSD Foundation, Inc.
 .\" Copyright (c) 2016 The DragonFly Project
 .\" Copyright (c) 2014 The FreeBSD Foundation
@@ -131,4 +131,4 @@ was ported to
 and
 .Nx
 by
-.An Tomohiro Kusumi Aq Mt kusumi.tomoh...@gmail.com .
+.An Tomohiro Kusumi Aq Mt tkus...@netbsd.org .

Index: src/usr.sbin/autofs/automountd.8
diff -u src/usr.sbin/autofs/automountd.8:1.3 src/usr.sbin/autofs/automountd.8:1.4
--- src/usr.sbin/autofs/automountd.8:1.3	Sun Jan 14 03:17:28 2018
+++ src/usr.sbin/autofs/automountd.8	Thu Nov 21 15:24:17 2019
@@ -1,4 +1,4 @@
-.\" $NetBSD: automountd.8,v 1.3 2018/01/14 03:17:28 uwe Exp $
+.\" $NetBSD: automountd.8,v 1.4 2019/11/21 15:24:17 tkusumi Exp $
 .\"
 .\" Copyright (c) 2017 The NetBSD Foundation, Inc.
 .\" Copyright (c) 2016 The DragonFly Project
@@ -124,4 +124,4 @@ was ported to
 and
 .Nx
 by
-.An Tomohiro Kusumi Aq Mt kusumi.tomoh...@gmail.com .
+.An Tomohiro Kusumi Aq Mt tkus...@netbsd.org .
Index: src/usr.sbin/autofs/autounmountd.8
diff -u src/usr.sbin/autofs/autounmountd.8:1.3 src/usr.sbin/autofs/autounmountd.8:1.4
--- src/usr.sbin/autofs/autounmountd.8:1.3	Sun Jan 14 03:17:28 2018
+++ src/usr.sbin/autofs/autounmountd.8	Thu Nov 21 15:24:17 2019
@@ -1,4 +1,4 @@
-.\" $NetBSD: autounmountd.8,v 1.3 2018/01/14 03:17:28 uwe Exp $
+.\" $NetBSD: autounmountd.8,v 1.4 2019/11/21 15:24:17 tkusumi Exp $
 .\"
 .\" Copyright (c) 2017 The NetBSD Foundation, Inc.
 .\" Copyright (c) 2016 The DragonFly Project
@@ -110,4 +110,4 @@ was ported to
 and
 .Nx
 by
-.An Tomohiro Kusumi Aq Mt kusumi.tomoh...@gmail.com .
+.An Tomohiro Kusumi Aq Mt tkus...@netbsd.org .

Index: src/usr.sbin/fstyp/fstyp.8
diff -u src/usr.sbin/fstyp/fstyp.8:1.3 src/usr.sbin/fstyp/fstyp.8:1.4
--- src/usr.sbin/fstyp/fstyp.8:1.3	Mon Nov 18 14:53:34 2019
+++ src/usr.sbin/fstyp/fstyp.8	Thu Nov 21 15:24:17 2019
@@ -1,4 +1,4 @@
-.\" $NetBSD: fstyp.8,v 1.3 2019/11/18 14:53:34 tkusumi Exp $
+.\" $NetBSD: fstyp.8,v 1.4 2019/11/21 15:24:17 tkusumi Exp $
 .\"
 .\" Copyright (c) 2017 The NetBSD Foundation, Inc.
 .\" Copyright (c) 2016 The DragonFly Project
@@ -142,7 +142,7 @@ utility was ported to
 and
 .Nx
 by
-.An Tomohiro Kusumi Aq Mt kusumi.tomoh...@gmail.com .
+.An Tomohiro Kusumi Aq Mt tkus...@netbsd.org .
 .Sh BUGS
 geli and hammer are currently unsupported on
 .Nx .



CVS commit: src

2019-11-21 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Thu Nov 21 15:24:18 UTC 2019

Modified Files:
src/share/man/man5: autofs.5
src/usr.sbin/autofs: auto_master.5 automount.8 automountd.8
autounmountd.8
src/usr.sbin/fstyp: fstyp.8

Log Message:
autofs: Change my email address in man pages to netbsd.org


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/share/man/man5/autofs.5
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/autofs/auto_master.5
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/autofs/automount.8
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/autofs/automountd.8 \
src/usr.sbin/autofs/autounmountd.8
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/fstyp/fstyp.8

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



CVS commit: src/sys/fs/autofs

2019-11-23 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Nov 23 08:00:59 UTC 2019

Modified Files:
src/sys/fs/autofs: autofs.h

Log Message:
autofs: u_int -> unsigned int


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/fs/autofs/autofs.h

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



CVS commit: src/sys/fs/autofs

2019-11-23 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Nov 23 08:00:59 UTC 2019

Modified Files:
src/sys/fs/autofs: autofs.h

Log Message:
autofs: u_int -> unsigned int


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/fs/autofs/autofs.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/fs/autofs/autofs.h
diff -u src/sys/fs/autofs/autofs.h:1.2 src/sys/fs/autofs/autofs.h:1.3
--- src/sys/fs/autofs/autofs.h:1.2	Sat Nov 23 07:38:03 2019
+++ src/sys/fs/autofs/autofs.h	Sat Nov 23 08:00:59 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: autofs.h,v 1.2 2019/11/23 07:38:03 tkusumi Exp $	*/
+/*	$NetBSD: autofs.h,v 1.3 2019/11/23 08:00:59 tkusumi Exp $	*/
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -145,7 +145,7 @@ struct autofs_request {
 	charar_key[AUTOFS_MAXPATHLEN];
 	charar_options[AUTOFS_MAXPATHLEN];
 	struct callout			ar_callout;
-	volatile u_int			ar_refcount;
+	volatile unsigned int		ar_refcount;
 };
 
 struct autofs_softc {



CVS commit: src/sys/fs/autofs

2019-11-23 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Nov 23 08:30:39 UTC 2019

Modified Files:
src/sys/fs/autofs: autofs_mount.h

Log Message:
autofs: Fix a comment on autofs_args

mount_autofs(8) also uses this.
mount_autofs(8) was added by NetBSD as an optional command (not needed to use 
autofs).


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/fs/autofs/autofs_mount.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/fs/autofs/autofs_mount.h
diff -u src/sys/fs/autofs/autofs_mount.h:1.2 src/sys/fs/autofs/autofs_mount.h:1.3
--- src/sys/fs/autofs/autofs_mount.h:1.2	Sun Jan 14 22:43:18 2018
+++ src/sys/fs/autofs/autofs_mount.h	Sat Nov 23 08:30:39 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: autofs_mount.h,v 1.2 2018/01/14 22:43:18 christos Exp $	*/
+/*	$NetBSD: autofs_mount.h,v 1.3 2019/11/23 08:30:39 tkusumi Exp $	*/
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -36,7 +36,6 @@
 
 /*
  * Arguments to mount autofs filesystem.
- * This structure should only be used by automount(8).
  */
 struct autofs_args {
 	char	*from;



CVS commit: src/sys/fs/autofs

2019-11-23 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Nov 23 08:30:39 UTC 2019

Modified Files:
src/sys/fs/autofs: autofs_mount.h

Log Message:
autofs: Fix a comment on autofs_args

mount_autofs(8) also uses this.
mount_autofs(8) was added by NetBSD as an optional command (not needed to use 
autofs).


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/fs/autofs/autofs_mount.h

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



CVS commit: src/sys/fs/autofs

2019-11-22 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Nov 23 07:38:03 UTC 2019

Modified Files:
src/sys/fs/autofs: autofs.h

Log Message:
autofs: Drop unused autofs_mount field which originates from FreeBSD

Taken-from: DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/fs/autofs/autofs.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/fs/autofs/autofs.h
diff -u src/sys/fs/autofs/autofs.h:1.1 src/sys/fs/autofs/autofs.h:1.2
--- src/sys/fs/autofs/autofs.h:1.1	Tue Jan  9 03:31:14 2018
+++ src/sys/fs/autofs/autofs.h	Sat Nov 23 07:38:03 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: autofs.h,v 1.1 2018/01/09 03:31:14 christos Exp $	*/
+/*	$NetBSD: autofs.h,v 1.2 2019/11/23 07:38:03 tkusumi Exp $	*/
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -120,7 +120,6 @@ struct autofs_node {
 };
 
 struct autofs_mount {
-	TAILQ_ENTRY(autofs_mount)	am_next;
 	struct autofs_node		*am_root;
 	struct mount			*am_mp;
 	kmutex_t			am_lock;



CVS commit: src/sys/fs/autofs

2019-11-22 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Nov 23 07:38:03 UTC 2019

Modified Files:
src/sys/fs/autofs: autofs.h

Log Message:
autofs: Drop unused autofs_mount field which originates from FreeBSD

Taken-from: DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/fs/autofs/autofs.h

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



CVS commit: src/usr.sbin/autofs

2019-11-21 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Thu Nov 21 16:45:05 UTC 2019

Modified Files:
src/usr.sbin/autofs: autounmountd.c

Log Message:
autofs: Change autounmountd(8) to use time_t for duration instead of double

The commit log from FreeBSD.
--
autounmountd(8) uses doubles to handle mount time durations.  However,
it must convert to integer types, time_t in particular, to do anything
meaningful.  Additionally, even though it's a floating-point value in
seconds, the sub-seconds component is never used, so it's unnecessary.

Switching type to time_t fixes an assertion on powerpc64, which checks
that a sleep value that's not -1.0 is greater than 0.  On powerpc64, it
happens that the value of -1.0 gets loaded as a float (perhaps a bug in
gcc), but gets compared to a double.  This compares as false, so follows
through the 'sleep != -1.0' path, and fails the assert.  Since the
sub-second component isn't used in the double, just drop it and deal
with whole-integer seconds.
--

Taken-from: FreeBSD and DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/autofs/autounmountd.c

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



CVS commit: src/usr.sbin/autofs

2019-11-21 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Thu Nov 21 16:45:05 UTC 2019

Modified Files:
src/usr.sbin/autofs: autounmountd.c

Log Message:
autofs: Change autounmountd(8) to use time_t for duration instead of double

The commit log from FreeBSD.
--
autounmountd(8) uses doubles to handle mount time durations.  However,
it must convert to integer types, time_t in particular, to do anything
meaningful.  Additionally, even though it's a floating-point value in
seconds, the sub-seconds component is never used, so it's unnecessary.

Switching type to time_t fixes an assertion on powerpc64, which checks
that a sleep value that's not -1.0 is greater than 0.  On powerpc64, it
happens that the value of -1.0 gets loaded as a float (perhaps a bug in
gcc), but gets compared to a double.  This compares as false, so follows
through the 'sleep != -1.0' path, and fails the assert.  Since the
sub-second component isn't used in the double, just drop it and deal
with whole-integer seconds.
--

Taken-from: FreeBSD and DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/autofs/autounmountd.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/autofs/autounmountd.c
diff -u src/usr.sbin/autofs/autounmountd.c:1.1 src/usr.sbin/autofs/autounmountd.c:1.2
--- src/usr.sbin/autofs/autounmountd.c:1.1	Tue Jan  9 03:31:15 2018
+++ src/usr.sbin/autofs/autounmountd.c	Thu Nov 21 16:45:05 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: autounmountd.c,v 1.1 2018/01/09 03:31:15 christos Exp $	*/
+/*	$NetBSD: autounmountd.c,v 1.2 2019/11/21 16:45:05 tkusumi Exp $	*/
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  *
  */
 #include 
-__RCSID("$NetBSD: autounmountd.c,v 1.1 2018/01/09 03:31:15 christos Exp $");
+__RCSID("$NetBSD: autounmountd.c,v 1.2 2019/11/21 16:45:05 tkusumi Exp $");
 
 #include 
 #include 
@@ -175,12 +175,12 @@ do_unmount(const fsid_t fsid __unused, c
 	return error;
 }
 
-static double
-expire_automounted(double expiration_time)
+static time_t
+expire_automounted(time_t expiration_time)
 {
 	struct automounted_fs *af, *tmpaf;
 	time_t now;
-	double mounted_for, mounted_max = -1.0;
+	time_t mounted_for, mounted_max = -1;
 	int error;
 
 	now = time(NULL);
@@ -188,14 +188,14 @@ expire_automounted(double expiration_tim
 	log_debugx("expiring automounted filesystems");
 
 	TAILQ_FOREACH_SAFE(af, , af_next, tmpaf) {
-		mounted_for = difftime(now, af->af_mount_time);
+		mounted_for = (time_t)difftime(now, af->af_mount_time);
 
 		if (mounted_for < expiration_time) {
 			log_debugx("skipping %s (FSID:%d:%d), mounted "
-			"for %.0f seconds", af->af_mountpoint,
+			"for %jd seconds", af->af_mountpoint,
 			af->af_fsid.__fsid_val[0],
 			af->af_fsid.__fsid_val[1],
-			mounted_for);
+			(intmax_t)mounted_for);
 
 			if (mounted_for > mounted_max)
 mounted_max = mounted_for;
@@ -204,9 +204,9 @@ expire_automounted(double expiration_tim
 		}
 
 		log_debugx("filesystem mounted on %s (FSID:%d:%d), "
-		"was mounted for %.0f seconds; unmounting",
+		"was mounted for %jd seconds; unmounting",
 		af->af_mountpoint, af->af_fsid.__fsid_val[0],
-		af->af_fsid.__fsid_val[1], mounted_for);
+		af->af_fsid.__fsid_val[1], (intmax_t)mounted_for);
 		error = do_unmount(af->af_fsid, af->af_mountpoint);
 		if (error != 0) {
 			if (mounted_for > mounted_max)
@@ -227,19 +227,19 @@ usage_autounmountd(void)
 }
 
 static void
-do_wait(int kq, double sleep_time)
+do_wait(int kq, time_t sleep_time)
 {
 	struct timespec timeout;
 	struct kevent unused;
 	int nevents;
 
-	if (sleep_time != -1.0) {
-		assert(sleep_time > 0.0);
+	if (sleep_time != -1) {
+		assert(sleep_time > 0);
 		timeout.tv_sec = (int)sleep_time;
 		timeout.tv_nsec = 0;
 
-		log_debugx("waiting for filesystem event for %.0f seconds",
-		sleep_time);
+		log_debugx("waiting for filesystem event for %jd seconds",
+		(intmax_t)sleep_time);
 		nevents = kevent(kq, NULL, 0, , 1, );
 	} else {
 		log_debugx("waiting for filesystem event");
@@ -253,7 +253,7 @@ do_wait(int kq, double sleep_time)
 
 	if (nevents == 0) {
 		log_debugx("timeout reached");
-		assert(sleep_time > 0.0);
+		assert(sleep_time > 0);
 	} else {
 		log_debugx("got filesystem event");
 	}
@@ -264,7 +264,7 @@ main_autounmountd(int argc, char **argv)
 {
 	struct kevent event;
 	int ch, debug = 0, error, kq;
-	double expiration_time = 600, retry_time = 600, mounted_max, sleep_time;
+	time_t expiration_time = 600, retry_time = 600, mounted_max, sleep_time;
 	bool dont_daemonize = false;
 
 	while ((ch = getopt(argc, argv, "dr:t:v")) != -1) {
@@ -333,19 +333,18 @@ main_autounmountd(int argc, char **argv)
 	for (;;) {
 		refresh_automounted();
 		mounted_max = expire_automounted(expiration_time);
-		if (mounted_max == -1.0) {
+		if (mounted_max == -1) {
 			sleep_time = mounted_max;
 			log_debugx("no filesystems 

CVS commit: src/sys/fs/autofs

2019-11-23 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Nov 23 15:17:46 UTC 2019

Modified Files:
src/sys/fs/autofs: autofs_vfsops.c autofs_vnops.c

Log Message:
autofs: Don't calculate dirent reclen twice

Taken-from: DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/fs/autofs/autofs_vfsops.c
cvs rdiff -u -r1.1 -r1.2 src/sys/fs/autofs/autofs_vnops.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/fs/autofs/autofs_vfsops.c
diff -u src/sys/fs/autofs/autofs_vfsops.c:1.6 src/sys/fs/autofs/autofs_vfsops.c:1.7
--- src/sys/fs/autofs/autofs_vfsops.c:1.6	Sat Nov 16 09:22:00 2019
+++ src/sys/fs/autofs/autofs_vfsops.c	Sat Nov 23 15:17:46 2019
@@ -33,7 +33,7 @@
  *
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autofs_vfsops.c,v 1.6 2019/11/16 09:22:00 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autofs_vfsops.c,v 1.7 2019/11/23 15:17:46 tkusumi Exp $");
 
 
 #include "autofs.h"
@@ -74,6 +74,7 @@ autofs_init(void)
 static void
 autofs_done(void)
 {
+
 	KASSERT(autofs_softc);
 	KASSERT(!autofs_softc->sc_dev_opened);
 

Index: src/sys/fs/autofs/autofs_vnops.c
diff -u src/sys/fs/autofs/autofs_vnops.c:1.1 src/sys/fs/autofs/autofs_vnops.c:1.2
--- src/sys/fs/autofs/autofs_vnops.c:1.1	Tue Jan  9 03:31:14 2018
+++ src/sys/fs/autofs/autofs_vnops.c	Sat Nov 23 15:17:46 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: autofs_vnops.c,v 1.1 2018/01/09 03:31:14 christos Exp $	*/
+/*	$NetBSD: autofs_vnops.c,v 1.2 2019/11/23 15:17:46 tkusumi Exp $	*/
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
  * Copyright (c) 2016 The DragonFly Project
@@ -34,7 +34,7 @@
  *
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autofs_vnops.c,v 1.1 2018/01/09 03:31:14 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autofs_vnops.c,v 1.2 2019/11/23 15:17:46 tkusumi Exp $");
 
 #include "autofs.h"
 
@@ -413,8 +413,7 @@ autofs_print(void *v)
 }
 
 static int
-autofs_readdir_one(struct uio *uio, const char *name, ino_t ino,
-size_t *reclenp)
+autofs_readdir_one(struct uio *uio, const char *name, ino_t ino)
 {
 	struct dirent dirent;
 
@@ -424,9 +423,6 @@ autofs_readdir_one(struct uio *uio, cons
 	dirent.d_namlen = strlen(dirent.d_name);
 	dirent.d_reclen = _DIRENT_SIZE();
 
-	if (reclenp)
-		*reclenp = dirent.d_reclen;
-
 	if (!uio)
 		return 0;
 
@@ -439,11 +435,12 @@ autofs_readdir_one(struct uio *uio, cons
 static size_t
 autofs_dirent_reclen(const char *name)
 {
-	size_t reclen;
+	struct dirent dirent;
 
-	(void)autofs_readdir_one(NULL, name, -1, );
+	strlcpy(dirent.d_name, name, sizeof(dirent.d_name));
+	dirent.d_namlen = strlen(dirent.d_name);
 
-	return reclen;
+	return _DIRENT_SIZE();
 }
 
 static int
@@ -463,7 +460,7 @@ autofs_readdir(void *v)
 	struct autofs_mount *amp = VFSTOAUTOFS(vp->v_mount);
 	struct autofs_node *anp = VTOI(vp);
 	struct autofs_node *child;
-	size_t reclen, reclens;
+	size_t reclens;
 	int error;
 
 	if (vp->v_type != VDIR)
@@ -496,7 +493,7 @@ autofs_readdir(void *v)
 	 * Write out the directory entry for ".".
 	 */
 	if (uio->uio_offset == 0) {
-		error = autofs_readdir_one(uio, ".", anp->an_ino, );
+		error = autofs_readdir_one(uio, ".", anp->an_ino);
 		if (error)
 			goto out;
 	}
@@ -509,8 +506,7 @@ autofs_readdir(void *v)
 		if (uio->uio_offset != reclens)
 			return EINVAL;
 		error = autofs_readdir_one(uio, "..",
-		(anp->an_parent ? anp->an_parent->an_ino : anp->an_ino),
-		);
+		anp->an_parent ? anp->an_parent->an_ino : anp->an_ino);
 		if (error)
 			goto out;
 	}
@@ -538,9 +534,8 @@ autofs_readdir(void *v)
 			return EINVAL;
 		}
 
-		error = autofs_readdir_one(uio, child->an_name,
-		child->an_ino, );
-		reclens += reclen;
+		error = autofs_readdir_one(uio, child->an_name, child->an_ino);
+		reclens += autofs_dirent_reclen(child->an_name);
 		if (error) {
 			mutex_exit(>am_lock);
 			goto out;
@@ -562,7 +557,7 @@ out:
 	/*
 	 * Don't return an error if we managed to copy out some entries.
 	 */
-	if (uio->uio_resid < reclen)
+	if (uio->uio_resid < initial_resid)
 		return 0;
 
 	return error;



CVS commit: src/sys/fs/autofs

2019-11-23 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Nov 23 15:17:46 UTC 2019

Modified Files:
src/sys/fs/autofs: autofs_vfsops.c autofs_vnops.c

Log Message:
autofs: Don't calculate dirent reclen twice

Taken-from: DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/fs/autofs/autofs_vfsops.c
cvs rdiff -u -r1.1 -r1.2 src/sys/fs/autofs/autofs_vnops.c

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



CVS commit: src/sys/dev/dm

2019-12-04 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Wed Dec  4 15:31:12 UTC 2019

Modified Files:
src/sys/dev/dm: device-mapper.c dm_dev.c dm_ioctl.c dm_pdev.c
dm_table.c dm_target.c

Log Message:
dm: style + whitespace + indentation fixes

No functional changes.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/dm/device-mapper.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/dm/dm_dev.c
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/dm/dm_ioctl.c
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/dm/dm_pdev.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/dm/dm_table.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/dm/dm_target.c

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



CVS commit: src/sys/dev/dm

2019-12-04 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Wed Dec  4 15:31:12 UTC 2019

Modified Files:
src/sys/dev/dm: device-mapper.c dm_dev.c dm_ioctl.c dm_pdev.c
dm_table.c dm_target.c

Log Message:
dm: style + whitespace + indentation fixes

No functional changes.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/dm/device-mapper.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/dm/dm_dev.c
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/dm/dm_ioctl.c
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/dm/dm_pdev.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/dm/dm_table.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/dm/dm_target.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/dev/dm/device-mapper.c
diff -u src/sys/dev/dm/device-mapper.c:1.42 src/sys/dev/dm/device-mapper.c:1.43
--- src/sys/dev/dm/device-mapper.c:1.42	Tue Dec  3 15:36:00 2019
+++ src/sys/dev/dm/device-mapper.c	Wed Dec  4 15:31:12 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: device-mapper.c,v 1.42 2019/12/03 15:36:00 tkusumi Exp $ */
+/*$NetBSD: device-mapper.c,v 1.43 2019/12/04 15:31:12 tkusumi Exp $ */
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -149,7 +149,7 @@ static const struct cmd_function {
 	{ .cmd = "reload",  .fn = dm_table_load_ioctl,.allowed = 0 },
 	{ .cmd = "status",  .fn = dm_table_status_ioctl,  .allowed = 1 },
 	{ .cmd = "table",   .fn = dm_table_status_ioctl,  .allowed = 1 },
-	{ .cmd = NULL, 	.fn = NULL,			  .allowed = 0 }
+	{ .cmd = NULL,  .fn = NULL,			  .allowed = 0 }
 };
 
 #ifdef _MODULE
@@ -194,11 +194,8 @@ dm_modcmd(modcmd_t cmd, void *arg)
 			config_cfdriver_detach(_cd);
 			break;
 		}
-
 		dm_doinit();
-
 		break;
-
 	case MODULE_CMD_FINI:
 		/*
 		 * Disable unloading of dm module if there are any devices
@@ -220,7 +217,6 @@ dm_modcmd(modcmd_t cmd, void *arg)
 		break;
 	case MODULE_CMD_STAT:
 		return ENOTTY;
-
 	default:
 		return ENOTTY;
 	}
@@ -364,7 +360,7 @@ dmioctl(dev_t dev, const u_long cmd, voi
 	aprint_debug("dmioctl called\n");
 	KASSERT(data != NULL);
 
-	if (( r = disk_ioctl_switch(dev, cmd, data)) == ENOTTY) {
+	if ((r = disk_ioctl_switch(dev, cmd, data)) == ENOTTY) {
 		struct plistref *pref = (struct plistref *) data;
 
 		/* Check if we were called with NETBSD_DM_IOCTL ioctl
@@ -429,7 +425,6 @@ dm_ioctl_switch(u_long cmd)
 {
 
 	switch(cmd) {
-
 	case NETBSD_DM_IOCTL:
 		aprint_debug("dm NetBSD_DM_IOCTL called\n");
 		break;
@@ -511,8 +506,7 @@ disk_ioctl_switch(dev_t dev, u_long cmd,
 		 * Call sync target routine for all table entries. Target sync
 		 * routine basically call DIOCCACHESYNC on underlying devices.
 		 */
-		SLIST_FOREACH(table_en, tbl, next)
-		{
+		SLIST_FOREACH(table_en, tbl, next) {
 			(void)table_en->target->sync(table_en);
 		}
 		dm_table_release(>table_head, DM_TABLE_ACTIVE);
@@ -556,7 +550,6 @@ disk_ioctl_switch(dev_t dev, u_long cmd,
 		break;
 	}
 
-
 	default:
 		aprint_debug("unknown disk_ioctl called\n");
 		return ENOTTY;
@@ -622,8 +615,7 @@ dmstrategy(struct buf *bp)
 	/*
 	 * Find out what tables I want to select.
 	 */
-	SLIST_FOREACH(table_en, tbl, next)
-	{
+	SLIST_FOREACH(table_en, tbl, next) {
 		/* I need need number of bytes not blocks. */
 		table_start = table_en->start * DEV_BSIZE;
 		/*
@@ -672,8 +664,6 @@ dmstrategy(struct buf *bp)
 
 	dm_table_release(>table_head, DM_TABLE_ACTIVE);
 	dm_dev_unbusy(dmv);
-
-	return;
 }
 
 
@@ -697,15 +687,13 @@ dmsize(dev_t dev)
 	dm_dev_t *dmv;
 	uint64_t size;
 
-	size = 0;
-
 	if ((dmv = dm_dev_lookup(NULL, NULL, minor(dev))) == NULL)
-			return -ENOENT;
+		return -ENOENT;
 
 	size = dm_table_size(>table_head);
 	dm_dev_unbusy(dmv);
 
-  	return size;
+	return size;
 }
 
 static void

Index: src/sys/dev/dm/dm_dev.c
diff -u src/sys/dev/dm/dm_dev.c:1.12 src/sys/dev/dm/dm_dev.c:1.13
--- src/sys/dev/dm/dm_dev.c:1.12	Tue Dec  3 16:22:01 2019
+++ src/sys/dev/dm/dm_dev.c	Wed Dec  4 15:31:12 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_dev.c,v 1.12 2019/12/03 16:22:01 tkusumi Exp $  */
+/*$NetBSD: dm_dev.c,v 1.13 2019/12/04 15:31:12 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_dev.c,v 1.12 2019/12/03 16:22:01 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_dev.c,v 1.13 2019/12/04 15:31:12 tkusumi Exp $");
 
 #include 
 #include 
@@ -133,7 +133,6 @@ dm_dev_lookup_name(const char *dm_dev_na
 		return NULL;
 
 	TAILQ_FOREACH(dmv, _dev_list, next_devlist) {
-
 		dlen = strlen(dmv->name);
 
 		if (slen != dlen)
@@ -162,7 +161,6 @@ dm_dev_lookup_uuid(const char *dm_dev_uu
 		return NULL;
 
 	TAILQ_FOREACH(dmv, _dev_list, next_devlist) {
-
 		if (strlen(dmv->uuid) != len)
 			continue;
 
@@ -190,9 +188,7 @@ dm_dev_insert(dm_dev_t * dev)
 	if (((dmv = dm_dev_lookup_uuid(dev->uuid)) == NULL) &&
 	((dmv = dm_dev_lookup_name(dev->name)) == NULL) 

CVS commit: src/sys/dev/dm

2019-12-04 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Wed Dec  4 16:55:30 UTC 2019

Modified Files:
src/sys/dev/dm: device-mapper.c dm_pdev.c

Log Message:
dm: Minor fixes/cleanups


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/dm/device-mapper.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/dm/dm_pdev.c

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



CVS commit: src/sys/dev/dm

2019-12-04 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Wed Dec  4 16:54:03 UTC 2019

Modified Files:
src/sys/dev/dm: dm.h

Log Message:
dm: Comment out unused dm_dev fields documented in sys/dev/dm/doc


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/dm/dm.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/dm/dm.h
diff -u src/sys/dev/dm/dm.h:1.31 src/sys/dev/dm/dm.h:1.32
--- src/sys/dev/dm/dm.h:1.31	Tue Dec  3 16:09:13 2019
+++ src/sys/dev/dm/dm.h	Wed Dec  4 16:54:03 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm.h,v 1.31 2019/12/03 16:09:13 tkusumi Exp $  */
+/*$NetBSD: dm.h,v 1.32 2019/12/04 16:54:03 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -137,12 +137,12 @@ typedef struct dm_dev {
 
 	dm_table_head_t table_head;
 
-	struct dm_dev_head upcalls;
+	//struct dm_dev_head upcalls;
 
 	struct disk *diskp;
 	kmutex_t diskp_mtx;
 
-	TAILQ_ENTRY(dm_dev) next_upcall; /* LIST of mirrored, snapshoted devices. */
+	//TAILQ_ENTRY(dm_dev) next_upcall; /* LIST of mirrored, snapshoted devices. */
 
 	TAILQ_ENTRY(dm_dev) next_devlist; /* Major device list. */
 } dm_dev_t;



CVS commit: src/sys/dev/dm

2019-12-04 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Wed Dec  4 16:54:03 UTC 2019

Modified Files:
src/sys/dev/dm: dm.h

Log Message:
dm: Comment out unused dm_dev fields documented in sys/dev/dm/doc


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/dm/dm.h

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



CVS commit: src/sys/dev/dm

2019-12-04 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Wed Dec  4 16:55:30 UTC 2019

Modified Files:
src/sys/dev/dm: device-mapper.c dm_pdev.c

Log Message:
dm: Minor fixes/cleanups


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/dm/device-mapper.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/dm/dm_pdev.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/dev/dm/device-mapper.c
diff -u src/sys/dev/dm/device-mapper.c:1.43 src/sys/dev/dm/device-mapper.c:1.44
--- src/sys/dev/dm/device-mapper.c:1.43	Wed Dec  4 15:31:12 2019
+++ src/sys/dev/dm/device-mapper.c	Wed Dec  4 16:55:30 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: device-mapper.c,v 1.43 2019/12/04 15:31:12 tkusumi Exp $ */
+/*$NetBSD: device-mapper.c,v 1.44 2019/12/04 16:55:30 tkusumi Exp $ */
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -616,13 +616,13 @@ dmstrategy(struct buf *bp)
 	 * Find out what tables I want to select.
 	 */
 	SLIST_FOREACH(table_en, tbl, next) {
-		/* I need need number of bytes not blocks. */
+		/* I need number of bytes not blocks. */
 		table_start = table_en->start * DEV_BSIZE;
 		/*
 		 * I have to sub 1 from table_en->length to prevent
 		 * off by one error
 		 */
-		table_end = table_start + (table_en->length)* DEV_BSIZE;
+		table_end = table_start + table_en->length * DEV_BSIZE;
 
 		start = MAX(table_start, buf_start);
 

Index: src/sys/dev/dm/dm_pdev.c
diff -u src/sys/dev/dm/dm_pdev.c:1.14 src/sys/dev/dm/dm_pdev.c:1.15
--- src/sys/dev/dm/dm_pdev.c:1.14	Wed Dec  4 15:31:12 2019
+++ src/sys/dev/dm/dm_pdev.c	Wed Dec  4 16:55:30 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_pdev.c,v 1.14 2019/12/04 15:31:12 tkusumi Exp $  */
+/*$NetBSD: dm_pdev.c,v 1.15 2019/12/04 16:55:30 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_pdev.c,v 1.14 2019/12/04 15:31:12 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_pdev.c,v 1.15 2019/12/04 16:55:30 tkusumi Exp $");
 
 #include 
 #include 
@@ -43,7 +43,7 @@ __KERNEL_RCSID(0, "$NetBSD: dm_pdev.c,v 
 
 #include "dm.h"
 
-SLIST_HEAD(dm_pdevs, dm_pdev) dm_pdev_list;
+static SLIST_HEAD(dm_pdevs, dm_pdev) dm_pdev_list;
 
 static kmutex_t dm_pdev_mutex;
 



CVS commit: src/sys/dev/dm

2019-12-03 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Tue Dec  3 15:03:15 UTC 2019

Modified Files:
src/sys/dev/dm: netbsd-dm.h

Log Message:
dm: Remove unused macro DM_CMD_LEN

that was added but never used in both NetBSD and DragonFlyBSD.
taken-from: DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/dm/netbsd-dm.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/dm/netbsd-dm.h
diff -u src/sys/dev/dm/netbsd-dm.h:1.8 src/sys/dev/dm/netbsd-dm.h:1.9
--- src/sys/dev/dm/netbsd-dm.h:1.8	Sun Jun  4 08:50:27 2017
+++ src/sys/dev/dm/netbsd-dm.h	Tue Dec  3 15:03:14 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: netbsd-dm.h,v 1.8 2017/06/04 08:50:27 mbalmer Exp $  */
+/*$NetBSD: netbsd-dm.h,v 1.9 2019/12/03 15:03:14 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -35,8 +35,6 @@
 #include 
 #include 
 
-#define DM_CMD_LEN 16
-
 #define DM_IOCTL 0xfd
 
 #define DM_IOCTL_CMD 0



CVS commit: src/sys/dev/dm

2019-12-03 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Tue Dec  3 15:03:15 UTC 2019

Modified Files:
src/sys/dev/dm: netbsd-dm.h

Log Message:
dm: Remove unused macro DM_CMD_LEN

that was added but never used in both NetBSD and DragonFlyBSD.
taken-from: DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/dm/netbsd-dm.h

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



CVS commit: src/sys/dev/dm

2019-12-03 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Tue Dec  3 15:36:00 UTC 2019

Modified Files:
src/sys/dev/dm: device-mapper.c dm.h

Log Message:
dm: Doesn't need to expose struct cmd_function in a header


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/dm/device-mapper.c
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/dm/dm.h

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



CVS commit: src/sys/dev/dm

2019-12-03 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Tue Dec  3 15:47:38 UTC 2019

Modified Files:
src/sys/dev/dm: dm.h dm_ioctl.c dm_pdev.c dm_target_linear.c
dm_target_snapshot.c dm_target_stripe.c

Log Message:
dm: Include  in dm.h

dm.h already depends on vnode, so have dm.h include 
instead of other .c files.

taken-from: DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/dm/dm.h
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/dm/dm_ioctl.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/dm/dm_pdev.c
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/dm/dm_target_linear.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/dm/dm_target_snapshot.c
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/dm/dm_target_stripe.c

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



CVS commit: src/sys/dev/dm

2019-12-03 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Tue Dec  3 15:36:00 UTC 2019

Modified Files:
src/sys/dev/dm: device-mapper.c dm.h

Log Message:
dm: Doesn't need to expose struct cmd_function in a header


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/dm/device-mapper.c
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/dm/dm.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/dm/device-mapper.c
diff -u src/sys/dev/dm/device-mapper.c:1.41 src/sys/dev/dm/device-mapper.c:1.42
--- src/sys/dev/dm/device-mapper.c:1.41	Mon Dec  2 15:17:43 2019
+++ src/sys/dev/dm/device-mapper.c	Tue Dec  3 15:36:00 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: device-mapper.c,v 1.41 2019/12/02 15:17:43 tkusumi Exp $ */
+/*$NetBSD: device-mapper.c,v 1.42 2019/12/03 15:36:00 tkusumi Exp $ */
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -114,6 +114,13 @@ CFATTACH_DECL3_NEW(dm, 0,
 extern uint32_t dm_dev_counter;
 
 /*
+ * This structure is used to translate command sent to kernel driver in
+ * command
+ * 
+ * to function which I can call, and if the command is allowed for
+ * non-superusers.
+ */
+/*
  * This array is used to translate cmd to function pointer.
  *
  * Interface between libdevmapper and lvm2tools uses different
@@ -122,7 +129,11 @@ extern uint32_t dm_dev_counter;
  * ioctl to kernel but will do another things in userspace.
  *
  */
-static const struct cmd_function cmd_fn[] = {
+static const struct cmd_function {
+	const char *cmd;
+	int  (*fn)(prop_dictionary_t);
+	int  allowed;
+} cmd_fn[] = {
 	{ .cmd = "version", .fn = dm_get_version_ioctl,	  .allowed = 1 },
 	{ .cmd = "targets", .fn = dm_list_versions_ioctl, .allowed = 1 },
 	{ .cmd = "create",  .fn = dm_dev_create_ioctl,.allowed = 0 },

Index: src/sys/dev/dm/dm.h
diff -u src/sys/dev/dm/dm.h:1.28 src/sys/dev/dm/dm.h:1.29
--- src/sys/dev/dm/dm.h:1.28	Sun Dec  1 06:53:31 2019
+++ src/sys/dev/dm/dm.h	Tue Dec  3 15:36:00 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm.h,v 1.28 2019/12/01 06:53:31 tkusumi Exp $  */
+/*$NetBSD: dm.h,v 1.29 2019/12/03 15:36:00 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -242,19 +242,6 @@ typedef struct dm_target {
 
 /* Interface structures */
 
-/*
- * This structure is used to translate command sent to kernel driver in
- * command
- * 
- * to function which I can call, and if the command is allowed for
- * non-superusers.
- */
-struct cmd_function {
-	const char *cmd;
-	int  (*fn)(prop_dictionary_t);
-	int  allowed;
-};
-
 /* device-mapper */
 void dmgetproperties(struct disk *, dm_table_head_t *);
 



CVS commit: src/sys/dev/dm

2019-12-03 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Tue Dec  3 16:22:01 UTC 2019

Modified Files:
src/sys/dev/dm: dm_dev.c dm_pdev.c dm_target.c

Log Message:
dm: Make global dm locks static

These are all per-file locks which protect dev/pdev/target structure.
taken-from: DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/dm/dm_dev.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/dm/dm_pdev.c
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/dm/dm_target.c

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



CVS commit: src/sys/dev/dm

2019-12-03 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Tue Dec  3 16:09:13 UTC 2019

Modified Files:
src/sys/dev/dm: dm.h

Log Message:
dm: Remove unused macro MAX_TARGET_STRING_LEN

that was added but never used in both NetBSD and DragonFlyBSD.
taken-from: DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/dm/dm.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/dm/dm.h
diff -u src/sys/dev/dm/dm.h:1.30 src/sys/dev/dm/dm.h:1.31
--- src/sys/dev/dm/dm.h:1.30	Tue Dec  3 15:47:38 2019
+++ src/sys/dev/dm/dm.h	Tue Dec  3 16:09:13 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm.h,v 1.30 2019/12/03 15:47:38 tkusumi Exp $  */
+/*$NetBSD: dm.h,v 1.31 2019/12/03 16:09:13 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -66,11 +66,6 @@
 /*** Internal device-mapper structures ***/
 
 /*
- * A table entry describes a physical range of the logical volume.
- */
-#define MAX_TARGET_STRING_LEN 32
-
-/*
  * A device mapper table is a list of physical ranges plus the mapping target
  * applied to them.
  */



CVS commit: src/sys/dev/dm

2019-12-03 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Tue Dec  3 16:09:13 UTC 2019

Modified Files:
src/sys/dev/dm: dm.h

Log Message:
dm: Remove unused macro MAX_TARGET_STRING_LEN

that was added but never used in both NetBSD and DragonFlyBSD.
taken-from: DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/dm/dm.h

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



CVS commit: src/sys/dev/dm

2019-12-03 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Tue Dec  3 16:22:01 UTC 2019

Modified Files:
src/sys/dev/dm: dm_dev.c dm_pdev.c dm_target.c

Log Message:
dm: Make global dm locks static

These are all per-file locks which protect dev/pdev/target structure.
taken-from: DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/dm/dm_dev.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/dm/dm_pdev.c
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/dm/dm_target.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/dev/dm/dm_dev.c
diff -u src/sys/dev/dm/dm_dev.c:1.11 src/sys/dev/dm/dm_dev.c:1.12
--- src/sys/dev/dm/dm_dev.c:1.11	Fri Jan  5 14:22:26 2018
+++ src/sys/dev/dm/dm_dev.c	Tue Dec  3 16:22:01 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_dev.c,v 1.11 2018/01/05 14:22:26 christos Exp $  */
+/*$NetBSD: dm_dev.c,v 1.12 2019/12/03 16:22:01 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_dev.c,v 1.11 2018/01/05 14:22:26 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_dev.c,v 1.12 2019/12/03 16:22:01 tkusumi Exp $");
 
 #include 
 #include 
@@ -50,7 +50,7 @@ static dm_dev_t *dm_dev_lookup_minor(int
 static struct dm_dev_head dm_dev_list =
 TAILQ_HEAD_INITIALIZER(dm_dev_list);
 
-kmutex_t dm_dev_mutex;
+static kmutex_t dm_dev_mutex;
 
 /* dm_dev_mutex must be holdby caller before using disable_dev. */
 __inline static void

Index: src/sys/dev/dm/dm_pdev.c
diff -u src/sys/dev/dm/dm_pdev.c:1.12 src/sys/dev/dm/dm_pdev.c:1.13
--- src/sys/dev/dm/dm_pdev.c:1.12	Tue Dec  3 15:47:38 2019
+++ src/sys/dev/dm/dm_pdev.c	Tue Dec  3 16:22:01 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_pdev.c,v 1.12 2019/12/03 15:47:38 tkusumi Exp $  */
+/*$NetBSD: dm_pdev.c,v 1.13 2019/12/03 16:22:01 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_pdev.c,v 1.12 2019/12/03 15:47:38 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_pdev.c,v 1.13 2019/12/03 16:22:01 tkusumi Exp $");
 
 #include 
 #include 
@@ -45,7 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: dm_pdev.c,v 
 
 SLIST_HEAD(dm_pdevs, dm_pdev) dm_pdev_list;
 
-kmutex_t dm_pdev_mutex;
+static kmutex_t dm_pdev_mutex;
 
 static dm_pdev_t *dm_pdev_alloc(const char *);
 static int dm_pdev_rem(dm_pdev_t *);

Index: src/sys/dev/dm/dm_target.c
diff -u src/sys/dev/dm/dm_target.c:1.20 src/sys/dev/dm/dm_target.c:1.21
--- src/sys/dev/dm/dm_target.c:1.20	Fri Jan  5 14:22:26 2018
+++ src/sys/dev/dm/dm_target.c	Tue Dec  3 16:22:01 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target.c,v 1.20 2018/01/05 14:22:26 christos Exp $  */
+/*$NetBSD: dm_target.c,v 1.21 2019/12/03 16:22:01 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_target.c,v 1.20 2018/01/05 14:22:26 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target.c,v 1.21 2019/12/03 16:22:01 tkusumi Exp $");
 
 #include 
 #include 
@@ -48,7 +48,7 @@ TAILQ_HEAD(dm_target_head, dm_target);
 static struct dm_target_head dm_target_list =
 TAILQ_HEAD_INITIALIZER(dm_target_list);
 
-kmutex_t dm_target_mutex;
+static kmutex_t dm_target_mutex;
 
 /*
  * Called indirectly from dm_table_load_ioctl to mark target as used.



CVS commit: src/sys/dev/dm

2019-12-03 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Tue Dec  3 15:47:38 UTC 2019

Modified Files:
src/sys/dev/dm: dm.h dm_ioctl.c dm_pdev.c dm_target_linear.c
dm_target_snapshot.c dm_target_stripe.c

Log Message:
dm: Include  in dm.h

dm.h already depends on vnode, so have dm.h include 
instead of other .c files.

taken-from: DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/dm/dm.h
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/dm/dm_ioctl.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/dm/dm_pdev.c
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/dm/dm_target_linear.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/dm/dm_target_snapshot.c
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/dm/dm_target_stripe.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/dev/dm/dm.h
diff -u src/sys/dev/dm/dm.h:1.29 src/sys/dev/dm/dm.h:1.30
--- src/sys/dev/dm/dm.h:1.29	Tue Dec  3 15:36:00 2019
+++ src/sys/dev/dm/dm.h	Tue Dec  3 15:47:38 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm.h,v 1.29 2019/12/03 15:36:00 tkusumi Exp $  */
+/*$NetBSD: dm.h,v 1.30 2019/12/03 15:47:38 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -44,6 +44,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 

Index: src/sys/dev/dm/dm_ioctl.c
diff -u src/sys/dev/dm/dm_ioctl.c:1.35 src/sys/dev/dm/dm_ioctl.c:1.36
--- src/sys/dev/dm/dm_ioctl.c:1.35	Sun Dec  1 06:53:31 2019
+++ src/sys/dev/dm/dm_ioctl.c	Tue Dec  3 15:47:38 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: dm_ioctl.c,v 1.35 2019/12/01 06:53:31 tkusumi Exp $  */
+/* $NetBSD: dm_ioctl.c,v 1.36 2019/12/03 15:47:38 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_ioctl.c,v 1.35 2019/12/01 06:53:31 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_ioctl.c,v 1.36 2019/12/03 15:47:38 tkusumi Exp $");
 
 /*
  * Locking is used to synchronise between ioctl calls and between dm_table's
@@ -88,7 +88,6 @@ __KERNEL_RCSID(0, "$NetBSD: dm_ioctl.c,v
 #include 
 #include 
 #include 
-#include 
 
 #include 
 

Index: src/sys/dev/dm/dm_pdev.c
diff -u src/sys/dev/dm/dm_pdev.c:1.11 src/sys/dev/dm/dm_pdev.c:1.12
--- src/sys/dev/dm/dm_pdev.c:1.11	Sun Dec  1 16:33:33 2019
+++ src/sys/dev/dm/dm_pdev.c	Tue Dec  3 15:47:38 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_pdev.c,v 1.11 2019/12/01 16:33:33 tkusumi Exp $  */
+/*$NetBSD: dm_pdev.c,v 1.12 2019/12/03 15:47:38 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_pdev.c,v 1.11 2019/12/01 16:33:33 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_pdev.c,v 1.12 2019/12/03 15:47:38 tkusumi Exp $");
 
 #include 
 #include 
@@ -38,7 +38,6 @@ __KERNEL_RCSID(0, "$NetBSD: dm_pdev.c,v 
 #include 
 #include 
 #include 
-#include 
 
 #include 
 

Index: src/sys/dev/dm/dm_target_linear.c
diff -u src/sys/dev/dm/dm_target_linear.c:1.20 src/sys/dev/dm/dm_target_linear.c:1.21
--- src/sys/dev/dm/dm_target_linear.c:1.20	Mon Dec  2 16:10:34 2019
+++ src/sys/dev/dm/dm_target_linear.c	Tue Dec  3 15:47:38 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target_linear.c,v 1.20 2019/12/02 16:10:34 tkusumi Exp $  */
+/*$NetBSD: dm_target_linear.c,v 1.21 2019/12/03 15:47:38 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_target_linear.c,v 1.20 2019/12/02 16:10:34 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_linear.c,v 1.21 2019/12/03 15:47:38 tkusumi Exp $");
 
 /*
  * This file implements initial version of device-mapper dklinear target.
@@ -40,7 +40,6 @@ __KERNEL_RCSID(0, "$NetBSD: dm_target_li
 
 #include 
 #include 
-#include 
 #include 
 
 #include 

Index: src/sys/dev/dm/dm_target_snapshot.c
diff -u src/sys/dev/dm/dm_target_snapshot.c:1.21 src/sys/dev/dm/dm_target_snapshot.c:1.22
--- src/sys/dev/dm/dm_target_snapshot.c:1.21	Sun Dec  1 06:53:31 2019
+++ src/sys/dev/dm/dm_target_snapshot.c	Tue Dec  3 15:47:38 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target_snapshot.c,v 1.21 2019/12/01 06:53:31 tkusumi Exp $  */
+/*$NetBSD: dm_target_snapshot.c,v 1.22 2019/12/03 15:47:38 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_target_snapshot.c,v 1.21 2019/12/01 06:53:31 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_snapshot.c,v 1.22 2019/12/03 15:47:38 tkusumi Exp $");
 
 /*
  * 1. Suspend my_data to temporarily stop any I/O while the snapshot is being
@@ -83,7 +83,6 @@ __KERNEL_RCSID(0, "$NetBSD: dm_target_sn
 
 #include 
 #include 
-#include 
 
 #include "dm.h"
 


CVS commit: src/sys/dev/dm

2019-12-06 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Dec  7 06:26:31 UTC 2019

Modified Files:
src/sys/dev/dm: dm_pdev.c dm_table.c dm_target.c

Log Message:
dm: Simplify list eviction code

taken-from: DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/dm/dm_pdev.c
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/dm/dm_table.c
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/dm/dm_target.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/dev/dm/dm_pdev.c
diff -u src/sys/dev/dm/dm_pdev.c:1.16 src/sys/dev/dm/dm_pdev.c:1.17
--- src/sys/dev/dm/dm_pdev.c:1.16	Fri Dec  6 16:46:14 2019
+++ src/sys/dev/dm/dm_pdev.c	Sat Dec  7 06:26:31 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_pdev.c,v 1.16 2019/12/06 16:46:14 tkusumi Exp $  */
+/*$NetBSD: dm_pdev.c,v 1.17 2019/12/07 06:26:31 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_pdev.c,v 1.16 2019/12/06 16:46:14 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_pdev.c,v 1.17 2019/12/07 06:26:31 tkusumi Exp $");
 
 #include 
 #include 
@@ -188,16 +188,16 @@ dm_pdev_rem(dm_pdev_t * dmp)
 int
 dm_pdev_destroy(void)
 {
-	dm_pdev_t *dm_pdev;
+	dm_pdev_t *dmp;
 
 	mutex_enter(_pdev_mutex);
-	while (!SLIST_EMPTY(_pdev_list)) {	/* List Deletion. */
-		dm_pdev = SLIST_FIRST(_pdev_list);
-
-		SLIST_REMOVE_HEAD(_pdev_list, next_pdev);
 
-		dm_pdev_rem(dm_pdev);
+	while ((dmp = SLIST_FIRST(_pdev_list)) != NULL) {
+		SLIST_REMOVE(_pdev_list, dmp, dm_pdev, next_pdev);
+		dm_pdev_rem(dmp);
 	}
+	KASSERT(SLIST_EMPTY(_pdev_list));
+
 	mutex_exit(_pdev_mutex);
 
 	mutex_destroy(_pdev_mutex);

Index: src/sys/dev/dm/dm_table.c
diff -u src/sys/dev/dm/dm_table.c:1.10 src/sys/dev/dm/dm_table.c:1.11
--- src/sys/dev/dm/dm_table.c:1.10	Thu Dec  5 16:59:43 2019
+++ src/sys/dev/dm/dm_table.c	Sat Dec  7 06:26:31 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_table.c,v 1.10 2019/12/05 16:59:43 tkusumi Exp $  */
+/*$NetBSD: dm_table.c,v 1.11 2019/12/07 06:26:31 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_table.c,v 1.10 2019/12/05 16:59:43 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_table.c,v 1.11 2019/12/07 06:26:31 tkusumi Exp $");
 
 #include 
 #include 
@@ -160,15 +160,14 @@ dm_table_destroy(dm_table_head_t * head,
 
 	tbl = >tables[id];
 
-	while (!SLIST_EMPTY(tbl)) {	/* List Deletion. */
-		table_en = SLIST_FIRST(tbl);
+	while ((table_en = SLIST_FIRST(tbl)) != NULL) {
+		SLIST_REMOVE(tbl, table_en, dm_table_entry, next);
 		if (table_en->target->destroy(table_en) == 0)
 			table_en->target_config = NULL;
 
-		SLIST_REMOVE_HEAD(tbl, next);
-
 		kmem_free(table_en, sizeof(*table_en));
 	}
+	KASSERT(SLIST_EMPTY(tbl));
 
 	mutex_exit(>table_mtx);
 

Index: src/sys/dev/dm/dm_target.c
diff -u src/sys/dev/dm/dm_target.c:1.23 src/sys/dev/dm/dm_target.c:1.24
--- src/sys/dev/dm/dm_target.c:1.23	Fri Dec  6 16:11:59 2019
+++ src/sys/dev/dm/dm_target.c	Sat Dec  7 06:26:31 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target.c,v 1.23 2019/12/06 16:11:59 tkusumi Exp $  */
+/*$NetBSD: dm_target.c,v 1.24 2019/12/07 06:26:31 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_target.c,v 1.23 2019/12/06 16:11:59 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target.c,v 1.24 2019/12/07 06:26:31 tkusumi Exp $");
 
 #include 
 #include 
@@ -220,14 +220,13 @@ dm_target_destroy(void)
 	dm_target_t *dm_target;
 
 	mutex_enter(_target_mutex);
-	while (TAILQ_FIRST(_target_list) != NULL) {
-		dm_target = TAILQ_FIRST(_target_list);
-
-		TAILQ_REMOVE(_target_list, TAILQ_FIRST(_target_list),
-		dm_target_next);
 
+	while ((dm_target = TAILQ_FIRST(_target_list)) != NULL) {
+		TAILQ_REMOVE(_target_list, dm_target, dm_target_next);
 		(void)kmem_free(dm_target, sizeof(dm_target_t));
 	}
+	KASSERT(TAILQ_EMPTY(_target_list));
+
 	mutex_exit(_target_mutex);
 
 	mutex_destroy(_target_mutex);



CVS commit: src/sys/dev/dm

2019-12-06 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Dec  7 06:26:31 UTC 2019

Modified Files:
src/sys/dev/dm: dm_pdev.c dm_table.c dm_target.c

Log Message:
dm: Simplify list eviction code

taken-from: DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/dm/dm_pdev.c
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/dm/dm_table.c
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/dm/dm_target.c

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



CVS commit: src/sys/dev/dm

2019-12-09 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Mon Dec  9 16:06:19 UTC 2019

Modified Files:
src/sys/dev/dm: dm_target_linear.c

Log Message:
dm: Silence aprint_normal() in dm_target_linear_status()

dm_target_linear_status() shouldn't print this debug message by default
on dmsetup "table" ioctl/command.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/dm/dm_target_linear.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/dev/dm/dm_target_linear.c
diff -u src/sys/dev/dm/dm_target_linear.c:1.25 src/sys/dev/dm/dm_target_linear.c:1.26
--- src/sys/dev/dm/dm_target_linear.c:1.25	Sun Dec  8 04:41:02 2019
+++ src/sys/dev/dm/dm_target_linear.c	Mon Dec  9 16:06:19 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target_linear.c,v 1.25 2019/12/08 04:41:02 tkusumi Exp $  */
+/*$NetBSD: dm_target_linear.c,v 1.26 2019/12/09 16:06:19 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_target_linear.c,v 1.25 2019/12/08 04:41:02 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_linear.c,v 1.26 2019/12/09 16:06:19 tkusumi Exp $");
 
 /*
  * This file implements initial version of device-mapper dklinear target.
@@ -106,7 +106,6 @@ dm_target_linear_status(void *target_con
 	aprint_debug("Linear target status function called\n");
 
 	params = kmem_alloc(DM_MAX_PARAMS_SIZE, KM_SLEEP);
-	aprint_normal("%s %" PRIu64, tlc->pdev->name, tlc->offset);
 	snprintf(params, DM_MAX_PARAMS_SIZE, "%s %" PRIu64,
 	tlc->pdev->name, tlc->offset);
 



CVS commit: src/sys/dev/dm

2019-12-09 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Mon Dec  9 15:30:42 UTC 2019

Modified Files:
src/sys/dev/dm: dm_target_stripe.c

Log Message:
dm: Correct target name "stripe" -> "striped"

Sync with Linux kernel.
The file name is "stripe", but the target name is "striped".
DragonFlyBSD also follows this.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/dm/dm_target_stripe.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/dev/dm/dm_target_stripe.c
diff -u src/sys/dev/dm/dm_target_stripe.c:1.32 src/sys/dev/dm/dm_target_stripe.c:1.33
--- src/sys/dev/dm/dm_target_stripe.c:1.32	Sun Dec  8 10:50:21 2019
+++ src/sys/dev/dm/dm_target_stripe.c	Mon Dec  9 15:30:42 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target_stripe.c,v 1.32 2019/12/08 10:50:21 tkusumi Exp $*/
+/*$NetBSD: dm_target_stripe.c,v 1.33 2019/12/09 15:30:42 tkusumi Exp $*/
 
 /*
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_target_stripe.c,v 1.32 2019/12/08 10:50:21 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_stripe.c,v 1.33 2019/12/09 15:30:42 tkusumi Exp $");
 
 /*
  * This file implements initial version of device-mapper stripe target.
@@ -73,11 +73,11 @@ dm_target_stripe_modcmd(modcmd_t cmd, vo
 
 	switch (cmd) {
 	case MODULE_CMD_INIT:
-		if ((dmt = dm_target_lookup("stripe")) != NULL) {
+		if ((dmt = dm_target_lookup("striped")) != NULL) {
 			dm_target_unbusy(dmt);
 			return EEXIST;
 		}
-		dmt = dm_target_alloc("stripe");
+		dmt = dm_target_alloc("striped");
 
 		dmt->version[0] = 1;
 		dmt->version[1] = 0;
@@ -96,7 +96,7 @@ dm_target_stripe_modcmd(modcmd_t cmd, vo
 		break;
 
 	case MODULE_CMD_FINI:
-		r = dm_target_rem("stripe");
+		r = dm_target_rem("striped");
 		break;
 
 	case MODULE_CMD_STAT:



CVS commit: src/sys/dev/dm

2019-12-09 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Mon Dec  9 15:30:42 UTC 2019

Modified Files:
src/sys/dev/dm: dm_target_stripe.c

Log Message:
dm: Correct target name "stripe" -> "striped"

Sync with Linux kernel.
The file name is "stripe", but the target name is "striped".
DragonFlyBSD also follows this.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/dm/dm_target_stripe.c

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



CVS commit: src/sys/dev/dm

2019-12-09 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Mon Dec  9 15:54:59 UTC 2019

Modified Files:
src/sys/dev/dm: device-mapper.c

Log Message:
dm: Fix error handling in dmioctl()

Looks like cleanup_exit label is in a wrong place.
Should skip prop_dictionary_copyout_ioctl() on error.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/dm/device-mapper.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/dev/dm/device-mapper.c
diff -u src/sys/dev/dm/device-mapper.c:1.47 src/sys/dev/dm/device-mapper.c:1.48
--- src/sys/dev/dm/device-mapper.c:1.47	Sat Dec  7 16:13:39 2019
+++ src/sys/dev/dm/device-mapper.c	Mon Dec  9 15:54:59 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: device-mapper.c,v 1.47 2019/12/07 16:13:39 tkusumi Exp $ */
+/*$NetBSD: device-mapper.c,v 1.48 2019/12/09 15:54:59 tkusumi Exp $ */
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -355,20 +355,18 @@ dmioctl(dev_t dev, const u_long cmd, voi
 	int r;
 	prop_dictionary_t dm_dict_in;
 
-	r = 0;
-
 	aprint_debug("dmioctl called\n");
 	KASSERT(data != NULL);
 
 	if ((r = disk_ioctl_switch(dev, cmd, data)) == ENOTTY) {
-		struct plistref *pref = (struct plistref *) data;
+		struct plistref *pref = (struct plistref *)data;
 
 		/* Check if we were called with NETBSD_DM_IOCTL ioctl
 		   otherwise quit. */
 		if ((r = dm_ioctl_switch(cmd)) != 0)
 			return r;
 
-		if((r = prop_dictionary_copyin_ioctl(pref, cmd, _dict_in))
+		if ((r = prop_dictionary_copyin_ioctl(pref, cmd, _dict_in))
 		!= 0)
 			return r;
 
@@ -379,8 +377,8 @@ dmioctl(dev_t dev, const u_long cmd, voi
 		if ((r = dm_cmd_to_fun(dm_dict_in)) != 0)
 			goto cleanup_exit;
 
-cleanup_exit:
 		r = prop_dictionary_copyout_ioctl(pref, cmd, dm_dict_in);
+cleanup_exit:
 		prop_object_release(dm_dict_in);
 	}
 



CVS commit: src/sys/dev/dm

2019-12-09 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Mon Dec  9 15:54:59 UTC 2019

Modified Files:
src/sys/dev/dm: device-mapper.c

Log Message:
dm: Fix error handling in dmioctl()

Looks like cleanup_exit label is in a wrong place.
Should skip prop_dictionary_copyout_ioctl() on error.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/dm/device-mapper.c

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



CVS commit: src/sys/dev/dm

2019-12-09 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Mon Dec  9 16:06:19 UTC 2019

Modified Files:
src/sys/dev/dm: dm_target_linear.c

Log Message:
dm: Silence aprint_normal() in dm_target_linear_status()

dm_target_linear_status() shouldn't print this debug message by default
on dmsetup "table" ioctl/command.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/dm/dm_target_linear.c

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



CVS commit: src/sys/dev/dm

2019-12-13 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Fri Dec 13 15:49:22 UTC 2019

Modified Files:
src/sys/dev/dm: dm_pdev.c

Log Message:
dm: Fix memory leak in dm_pdev_rem()

Need to free dmp regardless of dm_pdev_rem() return value.
taken-from: DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/dm/dm_pdev.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/dev/dm/dm_pdev.c
diff -u src/sys/dev/dm/dm_pdev.c:1.19 src/sys/dev/dm/dm_pdev.c:1.20
--- src/sys/dev/dm/dm_pdev.c:1.19	Sun Dec  8 12:14:40 2019
+++ src/sys/dev/dm/dm_pdev.c	Fri Dec 13 15:49:22 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_pdev.c,v 1.19 2019/12/08 12:14:40 mlelstv Exp $  */
+/*$NetBSD: dm_pdev.c,v 1.20 2019/12/13 15:49:22 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_pdev.c,v 1.19 2019/12/08 12:14:40 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_pdev.c,v 1.20 2019/12/13 15:49:22 tkusumi Exp $");
 
 #include 
 #include 
@@ -174,8 +174,10 @@ dm_pdev_rem(dm_pdev_t *dmp)
 
 	if (dmp->pdev_vnode != NULL) {
 		int error = vn_close(dmp->pdev_vnode, FREAD | FWRITE, FSCRED);
-		if (error != 0)
+		if (error != 0) {
+			kmem_free(dmp, sizeof(*dmp));
 			return error;
+		}
 	}
 	kmem_free(dmp, sizeof(*dmp));
 



CVS commit: src/sys/dev/dm

2019-12-13 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Fri Dec 13 15:49:22 UTC 2019

Modified Files:
src/sys/dev/dm: dm_pdev.c

Log Message:
dm: Fix memory leak in dm_pdev_rem()

Need to free dmp regardless of dm_pdev_rem() return value.
taken-from: DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/dm/dm_pdev.c

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



CVS commit: src/sys/dev/dm

2019-12-13 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Fri Dec 13 16:15:54 UTC 2019

Modified Files:
src/sys/dev/dm: dm_target.c

Log Message:
dm: Don't KASSERT() target handlers

Having assertions here causes panic if target is missing anything
as shown in "dm: Add dummy target ->sync()/->secsize() to prevent panic on 
modload(8)".
Instead just return EINVAL if a handler(s) isn't implemented.

taken-from: DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/dm/dm_target.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/dev/dm/dm_target.c
diff -u src/sys/dev/dm/dm_target.c:1.26 src/sys/dev/dm/dm_target.c:1.27
--- src/sys/dev/dm/dm_target.c:1.26	Sun Dec  8 10:35:53 2019
+++ src/sys/dev/dm/dm_target.c	Fri Dec 13 16:15:54 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target.c,v 1.26 2019/12/08 10:35:53 tkusumi Exp $  */
+/*$NetBSD: dm_target.c,v 1.27 2019/12/13 16:15:54 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_target.c,v 1.26 2019/12/08 10:35:53 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target.c,v 1.27 2019/12/13 16:15:54 tkusumi Exp $");
 
 #include 
 #include 
@@ -156,14 +156,38 @@ dm_target_insert(dm_target_t *dm_target)
 	dm_target_t *dmt;
 
 	/* Sanity check for any missing function */
-	KASSERT(dm_target->init != NULL);
-	KASSERT(dm_target->status != NULL);
-	KASSERT(dm_target->strategy != NULL);
-	KASSERT(dm_target->deps != NULL);
-	KASSERT(dm_target->destroy != NULL);
-	KASSERT(dm_target->upcall != NULL);
-	KASSERT(dm_target->sync != NULL);
-	KASSERT(dm_target->secsize != NULL);
+	if (dm_target->init == NULL) {
+		printf("%s missing init\n", dm_target->name);
+		return EINVAL;
+	}
+	if (dm_target->status == NULL) {
+		printf("%s missing status\n", dm_target->name);
+		return EINVAL;
+	}
+	if (dm_target->strategy == NULL) {
+		printf("%s missing strategy\n", dm_target->name);
+		return EINVAL;
+	}
+	if (dm_target->deps == NULL) {
+		printf("%s missing deps\n", dm_target->name);
+		return EINVAL;
+	}
+	if (dm_target->destroy == NULL) {
+		printf("%s missing destroy\n", dm_target->name);
+		return EINVAL;
+	}
+	if (dm_target->upcall == NULL) {
+		printf("%s missing upcall\n", dm_target->name);
+		return EINVAL;
+	}
+	if (dm_target->sync == NULL) {
+		printf("%s missing sync\n", dm_target->name);
+		return EINVAL;
+	}
+	if (dm_target->secsize == NULL) {
+		printf("%s missing secsize\n", dm_target->name);
+		return EINVAL;
+	}
 
 	mutex_enter(_target_mutex);
 



CVS commit: src/sys/dev/dm

2019-12-13 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Fri Dec 13 16:15:54 UTC 2019

Modified Files:
src/sys/dev/dm: dm_target.c

Log Message:
dm: Don't KASSERT() target handlers

Having assertions here causes panic if target is missing anything
as shown in "dm: Add dummy target ->sync()/->secsize() to prevent panic on 
modload(8)".
Instead just return EINVAL if a handler(s) isn't implemented.

taken-from: DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/dm/dm_target.c

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



CVS commit: src/sys/dev/dm

2019-12-14 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Dec 14 10:02:35 UTC 2019

Modified Files:
src/sys/dev/dm: dm_target_error.c dm_target_linear.c dm_target_mirror.c
dm_target_snapshot.c dm_target_stripe.c dm_target_zero.c

Log Message:
dm: Remove unconditional debug prints in targets' ->strategy()

Having debug prints in ->strategy() by default just to tell ->strategy()
is called is overkill.
taken-from: DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/dm/dm_target_error.c
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/dm/dm_target_linear.c
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/dm/dm_target_mirror.c
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/dm/dm_target_snapshot.c
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/dm/dm_target_stripe.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/dm/dm_target_zero.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/dev/dm/dm_target_error.c
diff -u src/sys/dev/dm/dm_target_error.c:1.19 src/sys/dev/dm/dm_target_error.c:1.20
--- src/sys/dev/dm/dm_target_error.c:1.19	Thu Dec 12 16:28:24 2019
+++ src/sys/dev/dm/dm_target_error.c	Sat Dec 14 10:02:35 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target_error.c,v 1.19 2019/12/12 16:28:24 tkusumi Exp $  */
+/*$NetBSD: dm_target_error.c,v 1.20 2019/12/14 10:02:35 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_target_error.c,v 1.19 2019/12/12 16:28:24 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_error.c,v 1.20 2019/12/14 10:02:35 tkusumi Exp $");
 
 /*
  * This file implements initial version of device-mapper error target.
@@ -133,8 +133,6 @@ int
 dm_target_error_strategy(dm_table_entry_t *table_en, struct buf *bp)
 {
 
-	printf("Error target read function called!!\n");
-
 	bp->b_error = EIO;
 	bp->b_resid = 0;
 

Index: src/sys/dev/dm/dm_target_linear.c
diff -u src/sys/dev/dm/dm_target_linear.c:1.27 src/sys/dev/dm/dm_target_linear.c:1.28
--- src/sys/dev/dm/dm_target_linear.c:1.27	Thu Dec 12 16:28:24 2019
+++ src/sys/dev/dm/dm_target_linear.c	Sat Dec 14 10:02:35 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target_linear.c,v 1.27 2019/12/12 16:28:24 tkusumi Exp $  */
+/*$NetBSD: dm_target_linear.c,v 1.28 2019/12/14 10:02:35 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_target_linear.c,v 1.27 2019/12/12 16:28:24 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_linear.c,v 1.28 2019/12/14 10:02:35 tkusumi Exp $");
 
 /*
  * This file implements initial version of device-mapper dklinear target.
@@ -114,15 +114,11 @@ dm_target_linear_strategy(dm_table_entry
 
 	tlc = table_en->target_config;
 
-/*	printf("Linear target read function called %" PRIu64 "!!\n",
-	tlc->offset);*/
-
 	bp->b_blkno += tlc->offset;
 
 	VOP_STRATEGY(tlc->pdev->pdev_vnode, bp);
 
 	return 0;
-
 }
 
 /*

Index: src/sys/dev/dm/dm_target_mirror.c
diff -u src/sys/dev/dm/dm_target_mirror.c:1.18 src/sys/dev/dm/dm_target_mirror.c:1.19
--- src/sys/dev/dm/dm_target_mirror.c:1.18	Thu Dec 12 16:28:24 2019
+++ src/sys/dev/dm/dm_target_mirror.c	Sat Dec 14 10:02:35 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target_mirror.c,v 1.18 2019/12/12 16:28:24 tkusumi Exp $*/
+/*$NetBSD: dm_target_mirror.c,v 1.19 2019/12/14 10:02:35 tkusumi Exp $*/
 
 /*
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_target_mirror.c,v 1.18 2019/12/12 16:28:24 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_mirror.c,v 1.19 2019/12/14 10:02:35 tkusumi Exp $");
 
 /*
  * This file implements initial version of device-mapper mirror target.
@@ -149,8 +149,6 @@ int
 dm_target_mirror_strategy(dm_table_entry_t *table_en, struct buf *bp)
 {
 
-	printf("Mirror target read function called!!\n");
-
 	bp->b_error = EIO;
 	bp->b_resid = 0;
 

Index: src/sys/dev/dm/dm_target_snapshot.c
diff -u src/sys/dev/dm/dm_target_snapshot.c:1.30 src/sys/dev/dm/dm_target_snapshot.c:1.31
--- src/sys/dev/dm/dm_target_snapshot.c:1.30	Thu Dec 12 16:28:24 2019
+++ src/sys/dev/dm/dm_target_snapshot.c	Sat Dec 14 10:02:35 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target_snapshot.c,v 1.30 2019/12/12 16:28:24 tkusumi Exp $  */
+/*$NetBSD: dm_target_snapshot.c,v 1.31 2019/12/14 10:02:35 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_target_snapshot.c,v 1.30 2019/12/12 16:28:24 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_snapshot.c,v 1.31 2019/12/14 10:02:35 tkusumi Exp $");
 
 /*
  * 1. Suspend my_data to temporarily stop any I/O while the snapshot is being
@@ 

CVS commit: src/sys/dev/dm

2019-12-14 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Dec 14 10:02:35 UTC 2019

Modified Files:
src/sys/dev/dm: dm_target_error.c dm_target_linear.c dm_target_mirror.c
dm_target_snapshot.c dm_target_stripe.c dm_target_zero.c

Log Message:
dm: Remove unconditional debug prints in targets' ->strategy()

Having debug prints in ->strategy() by default just to tell ->strategy()
is called is overkill.
taken-from: DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/dm/dm_target_error.c
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/dm/dm_target_linear.c
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/dm/dm_target_mirror.c
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/dm/dm_target_snapshot.c
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/dm/dm_target_stripe.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/dm/dm_target_zero.c

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



CVS commit: src/sys/dev/dm

2019-12-14 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Dec 14 10:49:30 UTC 2019

Modified Files:
src/sys/dev/dm: device-mapper.c dm_dev.c dm_table.c dm_target.c

Log Message:
dm: Remove void casts of function calls

Use of void casts in dm is not consistent, just get rid of them.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/dev/dm/device-mapper.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/dm/dm_dev.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/dm/dm_table.c
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/dm/dm_target.c

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



CVS commit: src/sys/dev/dm

2019-12-14 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Dec 14 10:49:30 UTC 2019

Modified Files:
src/sys/dev/dm: device-mapper.c dm_dev.c dm_table.c dm_target.c

Log Message:
dm: Remove void casts of function calls

Use of void casts in dm is not consistent, just get rid of them.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/dev/dm/device-mapper.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/dm/dm_dev.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/dm/dm_table.c
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/dm/dm_target.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/dev/dm/device-mapper.c
diff -u src/sys/dev/dm/device-mapper.c:1.49 src/sys/dev/dm/device-mapper.c:1.50
--- src/sys/dev/dm/device-mapper.c:1.49	Wed Dec 11 14:03:37 2019
+++ src/sys/dev/dm/device-mapper.c	Sat Dec 14 10:49:30 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: device-mapper.c,v 1.49 2019/12/11 14:03:37 tkusumi Exp $ */
+/*$NetBSD: device-mapper.c,v 1.50 2019/12/14 10:49:30 tkusumi Exp $ */
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -282,7 +282,7 @@ dm_detach(device_t self, int flags)
 	disk_destroy(dmv->diskp);
 
 	/* Destroy device */
-	(void)dm_dev_free(dmv);
+	dm_dev_free(dmv);
 
 	/* Decrement device counter After removing device */
 	atomic_dec_32(_dev_counter);
@@ -505,9 +505,8 @@ disk_ioctl_switch(dev_t dev, u_long cmd,
 		 * Call sync target routine for all table entries. Target sync
 		 * routine basically call DIOCCACHESYNC on underlying devices.
 		 */
-		SLIST_FOREACH(table_en, tbl, next) {
-			(void)table_en->target->sync(table_en);
-		}
+		SLIST_FOREACH(table_en, tbl, next)
+			table_en->target->sync(table_en);
 		dm_table_release(>table_head, DM_TABLE_ACTIVE);
 		dm_dev_unbusy(dmv);
 		break;

Index: src/sys/dev/dm/dm_dev.c
diff -u src/sys/dev/dm/dm_dev.c:1.14 src/sys/dev/dm/dm_dev.c:1.15
--- src/sys/dev/dm/dm_dev.c:1.14	Sat Dec  7 15:28:39 2019
+++ src/sys/dev/dm/dm_dev.c	Sat Dec 14 10:49:30 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_dev.c,v 1.14 2019/12/07 15:28:39 tkusumi Exp $  */
+/*$NetBSD: dm_dev.c,v 1.15 2019/12/14 10:49:30 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_dev.c,v 1.14 2019/12/07 15:28:39 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_dev.c,v 1.15 2019/12/14 10:49:30 tkusumi Exp $");
 
 #include 
 #include 
@@ -306,7 +306,7 @@ dm_dev_destroy(void)
 		mutex_destroy(>dev_mtx);
 		cv_destroy(>dev_cv);
 
-		(void)kmem_free(dmv, sizeof(dm_dev_t));
+		kmem_free(dmv, sizeof(dm_dev_t));
 	}
 	mutex_exit(_dev_mutex);
 
@@ -340,9 +340,9 @@ dm_dev_free(dm_dev_t *dmv)
 	cv_destroy(>dev_cv);
 
 	if (dmv->diskp != NULL)
-		(void)kmem_free(dmv->diskp, sizeof(struct disk));
+		kmem_free(dmv->diskp, sizeof(struct disk));
 
-	(void)kmem_free(dmv, sizeof(dm_dev_t));
+	kmem_free(dmv, sizeof(dm_dev_t));
 
 	return 0;
 }

Index: src/sys/dev/dm/dm_table.c
diff -u src/sys/dev/dm/dm_table.c:1.12 src/sys/dev/dm/dm_table.c:1.13
--- src/sys/dev/dm/dm_table.c:1.12	Sat Dec  7 15:28:39 2019
+++ src/sys/dev/dm/dm_table.c	Sat Dec 14 10:49:30 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_table.c,v 1.12 2019/12/07 15:28:39 tkusumi Exp $  */
+/*$NetBSD: dm_table.c,v 1.13 2019/12/14 10:49:30 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_table.c,v 1.12 2019/12/07 15:28:39 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_table.c,v 1.13 2019/12/14 10:49:30 tkusumi Exp $");
 
 #include 
 #include 
@@ -248,7 +248,7 @@ dm_table_disksize(dm_table_head_t *head,
 	secsize = 0;
 	SLIST_FOREACH(table_en, tbl, next) {
 		length += table_en->length;
-		(void)table_en->target->secsize(table_en, );
+		table_en->target->secsize(table_en, );
 		if (secsize < tsecsize)
 			secsize = tsecsize;
 	}

Index: src/sys/dev/dm/dm_target.c
diff -u src/sys/dev/dm/dm_target.c:1.27 src/sys/dev/dm/dm_target.c:1.28
--- src/sys/dev/dm/dm_target.c:1.27	Fri Dec 13 16:15:54 2019
+++ src/sys/dev/dm/dm_target.c	Sat Dec 14 10:49:30 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target.c,v 1.27 2019/12/13 16:15:54 tkusumi Exp $  */
+/*$NetBSD: dm_target.c,v 1.28 2019/12/14 10:49:30 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_target.c,v 1.27 2019/12/13 16:15:54 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target.c,v 1.28 2019/12/14 10:49:30 tkusumi Exp $");
 
 #include 
 #include 
@@ -87,7 +87,7 @@ dm_target_autoload(const char *dm_target
 		gen = module_gen;
 
 		/* Try to autoload target module */
-		(void)module_autoload(name, MODULE_CLASS_MISC);
+		module_autoload(name, MODULE_CLASS_MISC);
 	} while (gen != 

CVS commit: src/sys/dev/dm

2019-12-14 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Dec 14 11:20:51 UTC 2019

Modified Files:
src/sys/dev/dm: device-mapper.c dm.h dm_ioctl.c

Log Message:
dm: Move extern declaration of global variables to dm.h


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/dev/dm/device-mapper.c
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/dm/dm.h
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/dm/dm_ioctl.c

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



CVS commit: src/sys/dev/dm

2019-12-14 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Dec 14 11:20:51 UTC 2019

Modified Files:
src/sys/dev/dm: device-mapper.c dm.h dm_ioctl.c

Log Message:
dm: Move extern declaration of global variables to dm.h


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/dev/dm/device-mapper.c
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/dm/dm.h
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/dm/dm_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/sys/dev/dm/device-mapper.c
diff -u src/sys/dev/dm/device-mapper.c:1.50 src/sys/dev/dm/device-mapper.c:1.51
--- src/sys/dev/dm/device-mapper.c:1.50	Sat Dec 14 10:49:30 2019
+++ src/sys/dev/dm/device-mapper.c	Sat Dec 14 11:20:51 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: device-mapper.c,v 1.50 2019/12/14 10:49:30 tkusumi Exp $ */
+/*$NetBSD: device-mapper.c,v 1.51 2019/12/14 11:20:51 tkusumi Exp $ */
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -111,8 +111,6 @@ CFATTACH_DECL3_NEW(dm, 0,
  dm_match, dm_attach, dm_detach, NULL, NULL, NULL,
  DVF_DETACH_SHUTDOWN);
 
-extern uint32_t dm_dev_counter;
-
 /*
  * This structure is used to translate command sent to kernel driver in
  * command

Index: src/sys/dev/dm/dm.h
diff -u src/sys/dev/dm/dm.h:1.39 src/sys/dev/dm/dm.h:1.40
--- src/sys/dev/dm/dm.h:1.39	Thu Dec 12 16:28:24 2019
+++ src/sys/dev/dm/dm.h	Sat Dec 14 11:20:51 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm.h,v 1.39 2019/12/12 16:28:24 tkusumi Exp $  */
+/*$NetBSD: dm.h,v 1.40 2019/12/14 11:20:51 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -65,6 +65,9 @@
 
 /*** Internal device-mapper structures ***/
 
+extern const struct dkdriver dmdkdriver;
+extern uint32_t dm_dev_counter;
+
 /*
  * A device mapper table is a list of physical ranges plus the mapping target
  * applied to them.

Index: src/sys/dev/dm/dm_ioctl.c
diff -u src/sys/dev/dm/dm_ioctl.c:1.41 src/sys/dev/dm/dm_ioctl.c:1.42
--- src/sys/dev/dm/dm_ioctl.c:1.41	Thu Dec 12 16:28:24 2019
+++ src/sys/dev/dm/dm_ioctl.c	Sat Dec 14 11:20:51 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: dm_ioctl.c,v 1.41 2019/12/12 16:28:24 tkusumi Exp $  */
+/* $NetBSD: dm_ioctl.c,v 1.42 2019/12/14 11:20:51 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_ioctl.c,v 1.41 2019/12/12 16:28:24 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_ioctl.c,v 1.42 2019/12/14 11:20:51 tkusumi Exp $");
 
 /*
  * Locking is used to synchronise between ioctl calls and between dm_table's
@@ -95,7 +95,6 @@ __KERNEL_RCSID(0, "$NetBSD: dm_ioctl.c,v
 #include "dm.h"
 
 static uint32_t sc_minor_num;
-extern const struct dkdriver dmdkdriver;
 uint32_t dm_dev_counter;
 
 /* Generic cf_data for device-mapper driver */



CVS commit: src/sys/dev/dm

2019-12-14 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Dec 14 14:43:38 UTC 2019

Modified Files:
src/sys/dev/dm: dm_ioctl.c

Log Message:
dm: Make dm_dbg_print_flags() take uint32_t flag

which comes from prop_dictionary_get_uint32() result.
taken-from: DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/dm/dm_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/sys/dev/dm/dm_ioctl.c
diff -u src/sys/dev/dm/dm_ioctl.c:1.42 src/sys/dev/dm/dm_ioctl.c:1.43
--- src/sys/dev/dm/dm_ioctl.c:1.42	Sat Dec 14 11:20:51 2019
+++ src/sys/dev/dm/dm_ioctl.c	Sat Dec 14 14:43:38 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: dm_ioctl.c,v 1.42 2019/12/14 11:20:51 tkusumi Exp $  */
+/* $NetBSD: dm_ioctl.c,v 1.43 2019/12/14 14:43:38 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_ioctl.c,v 1.42 2019/12/14 11:20:51 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_ioctl.c,v 1.43 2019/12/14 14:43:38 tkusumi Exp $");
 
 /*
  * Locking is used to synchronise between ioctl calls and between dm_table's
@@ -116,14 +116,14 @@ static struct cfdata dm_cfdata = {
 		prop_dictionary_set_uint32(dm_dict,DM_IOCTL_FLAGS,flag); \
 } while (/*CONSTCOND*/0)
 
-static int dm_dbg_print_flags(int);
+static int dm_dbg_print_flags(uint32_t);
 static int dm_table_init(dm_target_t *, dm_table_entry_t *, char *);
 
 /*
  * Print flags sent to the kernel from libevmapper.
  */
 static int
-dm_dbg_print_flags(int flags)
+dm_dbg_print_flags(uint32_t flags)
 {
 	aprint_debug("dbg_print --- %d\n", flags);
 



CVS commit: src/sys/dev/dm

2019-12-14 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Dec 14 14:43:38 UTC 2019

Modified Files:
src/sys/dev/dm: dm_ioctl.c

Log Message:
dm: Make dm_dbg_print_flags() take uint32_t flag

which comes from prop_dictionary_get_uint32() result.
taken-from: DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/dm/dm_ioctl.c

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



CVS commit: src/sys/fs/autofs

2019-12-14 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Dec 14 12:01:13 UTC 2019

Modified Files:
src/sys/fs/autofs: autofs.c

Log Message:
autofs: Make /dev/autofs cdevsw functions static

Also less confusing since autofs vnops also has autofs_{open,close} in NetBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/fs/autofs/autofs.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/fs/autofs/autofs.c
diff -u src/sys/fs/autofs/autofs.c:1.3 src/sys/fs/autofs/autofs.c:1.4
--- src/sys/fs/autofs/autofs.c:1.3	Tue Jan  9 16:19:39 2018
+++ src/sys/fs/autofs/autofs.c	Sat Dec 14 12:01:13 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: autofs.c,v 1.3 2018/01/09 16:19:39 christos Exp $	*/
+/*	$NetBSD: autofs.c,v 1.4 2019/12/14 12:01:13 tkusumi Exp $	*/
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autofs.c,v 1.3 2018/01/09 16:19:39 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autofs.c,v 1.4 2019/12/14 12:01:13 tkusumi Exp $");
 
 #include "autofs.h"
 
@@ -78,9 +78,9 @@ __KERNEL_RCSID(0, "$NetBSD: autofs.c,v 1
 #include 
 #include 
 
-dev_type_open(autofs_open);
-dev_type_close(autofs_close);
-dev_type_ioctl(autofs_ioctl);
+static dev_type_open(autofs_open);
+static dev_type_close(autofs_close);
+static dev_type_ioctl(autofs_ioctl);
 
 const struct cdevsw autofs_cdevsw = {
 	.d_open = autofs_open,
@@ -519,7 +519,7 @@ autofs_ioctl_done(struct autofs_daemon_d
 	return 0;
 }
 
-int
+static int
 autofs_open(dev_t dev, int flags, int mode, struct lwp *l)
 {
 
@@ -543,7 +543,7 @@ autofs_open(dev_t dev, int flags, int mo
 	return 0;
 }
 
-int
+static int
 autofs_close(dev_t dev, int flags, int mode, struct lwp *l)
 {
 
@@ -555,7 +555,7 @@ autofs_close(dev_t dev, int flags, int m
 	return 0;
 }
 
-int
+static int
 autofs_ioctl(dev_t dev, const u_long cmd, void *data, int flag, struct lwp *l)
 {
 



CVS commit: src/sys/fs/autofs

2019-12-14 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Dec 14 12:01:13 UTC 2019

Modified Files:
src/sys/fs/autofs: autofs.c

Log Message:
autofs: Make /dev/autofs cdevsw functions static

Also less confusing since autofs vnops also has autofs_{open,close} in NetBSD.


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

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



CVS commit: src/sys/dev/dm

2019-12-15 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sun Dec 15 09:22:29 UTC 2019

Modified Files:
src/sys/dev/dm: device-mapper.c dm.h dm_table.c dm_target_linear.c
dm_target_stripe.c

Log Message:
dm: "unsigned" -> "unsigned int" for consistency

Use either one, but not both.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/dev/dm/device-mapper.c
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/dm/dm.h
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/dm/dm_table.c
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/dm/dm_target_linear.c
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/dm/dm_target_stripe.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/dev/dm/device-mapper.c
diff -u src/sys/dev/dm/device-mapper.c:1.51 src/sys/dev/dm/device-mapper.c:1.52
--- src/sys/dev/dm/device-mapper.c:1.51	Sat Dec 14 11:20:51 2019
+++ src/sys/dev/dm/device-mapper.c	Sun Dec 15 09:22:28 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: device-mapper.c,v 1.51 2019/12/14 11:20:51 tkusumi Exp $ */
+/*$NetBSD: device-mapper.c,v 1.52 2019/12/15 09:22:28 tkusumi Exp $ */
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -451,7 +451,7 @@ disk_ioctl_switch(dev_t dev, u_long cmd,
 	case DIOCGWEDGEINFO:
 	{
 		struct dkwedge_info *dkw = (void *) data;
-		unsigned secsize;
+		unsigned int secsize;
 
 		if ((dmv = dm_dev_lookup(NULL, NULL, minor(dev))) == NULL)
 			return ENODEV;
@@ -703,7 +703,7 @@ void
 dmgetproperties(struct disk *disk, dm_table_head_t *head)
 {
 	uint64_t numsec;
-	unsigned secsize;
+	unsigned int secsize;
 
 	dm_table_disksize(head, , );
 

Index: src/sys/dev/dm/dm.h
diff -u src/sys/dev/dm/dm.h:1.42 src/sys/dev/dm/dm.h:1.43
--- src/sys/dev/dm/dm.h:1.42	Sun Dec 15 05:56:02 2019
+++ src/sys/dev/dm/dm.h	Sun Dec 15 09:22:28 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm.h,v 1.42 2019/12/15 05:56:02 tkusumi Exp $  */
+/*$NetBSD: dm.h,v 1.43 2019/12/15 09:22:28 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -111,7 +111,7 @@ typedef struct dm_pdev {
 
 	struct vnode *pdev_vnode;
 	uint64_t pdev_numsec;
-	unsigned pdev_secsize;
+	unsigned int pdev_secsize;
 	int ref_cnt; /* reference counter for users ofthis pdev */
 
 	SLIST_ENTRY(dm_pdev) next_pdev;
@@ -193,7 +193,7 @@ typedef struct dm_target {
 	int (*strategy)(dm_table_entry_t *, struct buf *);
 	int (*sync)(dm_table_entry_t *);
 	int (*upcall)(dm_table_entry_t *, struct buf *);
-	int (*secsize)(dm_table_entry_t *, unsigned *);
+	int (*secsize)(dm_table_entry_t *, unsigned int *);
 
 	uint32_t version[3];
 	uint32_t ref_cnt;
@@ -248,7 +248,7 @@ int dm_target_linear_sync(dm_table_entry
 int dm_target_linear_deps(dm_table_entry_t *, prop_array_t);
 int dm_target_linear_destroy(dm_table_entry_t *);
 int dm_target_linear_upcall(dm_table_entry_t *, struct buf *);
-int dm_target_linear_secsize(dm_table_entry_t *, unsigned *);
+int dm_target_linear_secsize(dm_table_entry_t *, unsigned int *);
 
 /* Generic function used to convert char to string */
 uint64_t atoi(const char *);
@@ -261,7 +261,7 @@ int dm_target_stripe_sync(dm_table_entry
 int dm_target_stripe_deps(dm_table_entry_t *, prop_array_t);
 int dm_target_stripe_destroy(dm_table_entry_t *);
 int dm_target_stripe_upcall(dm_table_entry_t *, struct buf *);
-int dm_target_stripe_secsize(dm_table_entry_t *, unsigned *);
+int dm_target_stripe_secsize(dm_table_entry_t *, unsigned int *);
 
 /* dm_table.c  */
 #define DM_TABLE_ACTIVE 0
@@ -270,7 +270,7 @@ int dm_target_stripe_secsize(dm_table_en
 int dm_table_destroy(dm_table_head_t *, uint8_t);
 uint64_t dm_table_size(dm_table_head_t *);
 uint64_t dm_inactive_table_size(dm_table_head_t *);
-void dm_table_disksize(dm_table_head_t *, uint64_t *, unsigned *);
+void dm_table_disksize(dm_table_head_t *, uint64_t *, unsigned int *);
 dm_table_t *dm_table_get_entry(dm_table_head_t *, uint8_t);
 int dm_table_get_target_count(dm_table_head_t *, uint8_t);
 void dm_table_release(dm_table_head_t *, uint8_t s);
@@ -300,7 +300,7 @@ dm_pdev_t* dm_pdev_insert(const char *);
 
 /* XXX dummy */
 static __inline int
-dm_target_dummy_secsize(dm_table_entry_t *table_en, unsigned *secsizep)
+dm_target_dummy_secsize(dm_table_entry_t *table_en, unsigned int *secsizep)
 {
 	return 0;
 }

Index: src/sys/dev/dm/dm_table.c
diff -u src/sys/dev/dm/dm_table.c:1.13 src/sys/dev/dm/dm_table.c:1.14
--- src/sys/dev/dm/dm_table.c:1.13	Sat Dec 14 10:49:30 2019
+++ src/sys/dev/dm/dm_table.c	Sun Dec 15 09:22:28 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_table.c,v 1.13 2019/12/14 10:49:30 tkusumi Exp $  */
+/*$NetBSD: dm_table.c,v 1.14 2019/12/15 09:22:28 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_table.c,v 1.13 2019/12/14 10:49:30 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_table.c,v 1.14 2019/12/15 

CVS commit: src/sys/dev/dm

2019-12-15 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sun Dec 15 09:22:29 UTC 2019

Modified Files:
src/sys/dev/dm: device-mapper.c dm.h dm_table.c dm_target_linear.c
dm_target_stripe.c

Log Message:
dm: "unsigned" -> "unsigned int" for consistency

Use either one, but not both.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/dev/dm/device-mapper.c
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/dm/dm.h
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/dm/dm_table.c
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/dm/dm_target_linear.c
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/dm/dm_target_stripe.c

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



CVS commit: src/sys/dev/dm

2019-12-15 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sun Dec 15 10:12:45 UTC 2019

Modified Files:
src/sys/dev/dm: device-mapper.c dm.h dm_target.c dm_target_error.c
dm_target_snapshot.c dm_target_zero.c

Log Message:
dm: Make targets' ->sync() optional

Apparently some targets have nothing to sync, so make it optional.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/dev/dm/device-mapper.c
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/dm/dm.h
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/dm/dm_target.c
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/dm/dm_target_error.c
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/dm/dm_target_snapshot.c
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/dm/dm_target_zero.c

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



CVS commit: src/sys/dev/dm

2019-12-14 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sun Dec 15 05:56:02 UTC 2019

Modified Files:
src/sys/dev/dm: dm.h dm_ioctl.c dm_target.c dm_target_error.c
dm_target_linear.c dm_target_mirror.c dm_target_snapshot.c
dm_target_stripe.c dm_target_zero.c

Log Message:
dm: Rename targets' ->status() to ->table() given ->info() exists

Since now that dm targets in NetBSD have ->info() for "status",
->status() should be renamed to ->table() for "table",
given how dm target status was originally designed in Linux kernel.

taken-from: DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/dm/dm.h
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/dm/dm_ioctl.c
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/dm/dm_target.c \
src/sys/dev/dm/dm_target_linear.c
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/dm/dm_target_error.c
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/dm/dm_target_mirror.c
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/dm/dm_target_snapshot.c
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/dm/dm_target_stripe.c
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/dm/dm_target_zero.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/dev/dm/dm.h
diff -u src/sys/dev/dm/dm.h:1.41 src/sys/dev/dm/dm.h:1.42
--- src/sys/dev/dm/dm.h:1.41	Sat Dec 14 17:15:54 2019
+++ src/sys/dev/dm/dm.h	Sun Dec 15 05:56:02 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm.h,v 1.41 2019/12/14 17:15:54 tkusumi Exp $  */
+/*$NetBSD: dm.h,v 1.42 2019/12/15 05:56:02 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -184,12 +184,12 @@ typedef struct dm_target {
 
 	int (*deps) (dm_table_entry_t *, prop_array_t);
 	/*
-	 * Info/status routine are called to get params string, which is target
+	 * Info/table routine are called to get params string, which is target
 	 * specific. When dm_table_status_ioctl is called with flag
 	 * DM_STATUS_TABLE_FLAG I have to sent params string back.
 	 */
 	char *(*info)(void *);
-	char * (*status)(void *);
+	char *(*table)(void *);
 	int (*strategy)(dm_table_entry_t *, struct buf *);
 	int (*sync)(dm_table_entry_t *);
 	int (*upcall)(dm_table_entry_t *, struct buf *);
@@ -242,7 +242,7 @@ int dm_target_init(void);
 
 /* dm_target_linear.c */
 int dm_target_linear_init(dm_table_entry_t *, int, char **);
-char *dm_target_linear_status(void *);
+char *dm_target_linear_table(void *);
 int dm_target_linear_strategy(dm_table_entry_t *, struct buf *);
 int dm_target_linear_sync(dm_table_entry_t *);
 int dm_target_linear_deps(dm_table_entry_t *, prop_array_t);
@@ -255,7 +255,7 @@ uint64_t atoi(const char *);
 
 /* dm_target_stripe.c */
 int dm_target_stripe_init(dm_table_entry_t *, int, char **);
-char *dm_target_stripe_status(void *);
+char *dm_target_stripe_table(void *);
 int dm_target_stripe_strategy(dm_table_entry_t *, struct buf *);
 int dm_target_stripe_sync(dm_table_entry_t *);
 int dm_target_stripe_deps(dm_table_entry_t *, prop_array_t);

Index: src/sys/dev/dm/dm_ioctl.c
diff -u src/sys/dev/dm/dm_ioctl.c:1.44 src/sys/dev/dm/dm_ioctl.c:1.45
--- src/sys/dev/dm/dm_ioctl.c:1.44	Sat Dec 14 17:15:54 2019
+++ src/sys/dev/dm/dm_ioctl.c	Sun Dec 15 05:56:02 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: dm_ioctl.c,v 1.44 2019/12/14 17:15:54 tkusumi Exp $  */
+/* $NetBSD: dm_ioctl.c,v 1.45 2019/12/15 05:56:02 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_ioctl.c,v 1.44 2019/12/14 17:15:54 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_ioctl.c,v 1.45 2019/12/15 05:56:02 tkusumi Exp $");
 
 /*
  * Locking is used to synchronise between ioctl calls and between dm_table's
@@ -943,7 +943,7 @@ dm_table_status_ioctl(prop_dictionary_t 
 		prop_dictionary_set_cstring(target_dict, DM_TABLE_PARAMS, "");
 
 		if (flags & DM_STATUS_TABLE_FLAG)
-			params = table_en->target->status(
+			params = table_en->target->table(
 			table_en->target_config);
 		else if (table_en->target->info)
 			params = table_en->target->info(

Index: src/sys/dev/dm/dm_target.c
diff -u src/sys/dev/dm/dm_target.c:1.28 src/sys/dev/dm/dm_target.c:1.29
--- src/sys/dev/dm/dm_target.c:1.28	Sat Dec 14 10:49:30 2019
+++ src/sys/dev/dm/dm_target.c	Sun Dec 15 05:56:02 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target.c,v 1.28 2019/12/14 10:49:30 tkusumi Exp $  */
+/*$NetBSD: dm_target.c,v 1.29 2019/12/15 05:56:02 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_target.c,v 1.28 2019/12/14 10:49:30 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target.c,v 1.29 2019/12/15 05:56:02 tkusumi Exp $");
 
 #include 
 #include 
@@ -160,8 +160,8 @@ dm_target_insert(dm_target_t *dm_target)
 		printf("%s missing init\n", dm_target->name);
 		return 

CVS commit: src/sys/dev/dm

2019-12-14 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sun Dec 15 05:56:02 UTC 2019

Modified Files:
src/sys/dev/dm: dm.h dm_ioctl.c dm_target.c dm_target_error.c
dm_target_linear.c dm_target_mirror.c dm_target_snapshot.c
dm_target_stripe.c dm_target_zero.c

Log Message:
dm: Rename targets' ->status() to ->table() given ->info() exists

Since now that dm targets in NetBSD have ->info() for "status",
->status() should be renamed to ->table() for "table",
given how dm target status was originally designed in Linux kernel.

taken-from: DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/dm/dm.h
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/dm/dm_ioctl.c
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/dm/dm_target.c \
src/sys/dev/dm/dm_target_linear.c
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/dm/dm_target_error.c
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/dm/dm_target_mirror.c
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/dm/dm_target_snapshot.c
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/dm/dm_target_stripe.c
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/dm/dm_target_zero.c

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



CVS commit: src/sys/dev/dm

2019-12-15 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sun Dec 15 09:42:29 UTC 2019

Modified Files:
src/sys/dev/dm: dm.h dm_table.c dm_target.c dm_target_error.c
dm_target_mirror.c dm_target_snapshot.c dm_target_zero.c

Log Message:
dm: Make targets' ->secsize() optional

and make a caller assume secsize 0 if ->secsize not present.
This allows a dummy function to be removed which was added in
"dm: Add dummy target ->sync()/->secsize() to prevent panic on modload(8)".


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/dm/dm.h
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/dm/dm_table.c
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/dm/dm_target.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/dm/dm_target_error.c
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/dm/dm_target_mirror.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/dm/dm_target_snapshot.c
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/dm/dm_target_zero.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/dev/dm/dm.h
diff -u src/sys/dev/dm/dm.h:1.43 src/sys/dev/dm/dm.h:1.44
--- src/sys/dev/dm/dm.h:1.43	Sun Dec 15 09:22:28 2019
+++ src/sys/dev/dm/dm.h	Sun Dec 15 09:42:29 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm.h,v 1.43 2019/12/15 09:22:28 tkusumi Exp $  */
+/*$NetBSD: dm.h,v 1.44 2019/12/15 09:42:29 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -193,6 +193,9 @@ typedef struct dm_target {
 	int (*strategy)(dm_table_entry_t *, struct buf *);
 	int (*sync)(dm_table_entry_t *);
 	int (*upcall)(dm_table_entry_t *, struct buf *);
+	/*
+	 * Optional routines.
+	 */
 	int (*secsize)(dm_table_entry_t *, unsigned int *);
 
 	uint32_t version[3];
@@ -298,13 +301,6 @@ int dm_pdev_destroy(void);
 int dm_pdev_init(void);
 dm_pdev_t* dm_pdev_insert(const char *);
 
-/* XXX dummy */
-static __inline int
-dm_target_dummy_secsize(dm_table_entry_t *table_en, unsigned int *secsizep)
-{
-	return 0;
-}
-
 #endif /*_KERNEL*/
 
 #endif /*_DM_DEV_H_*/

Index: src/sys/dev/dm/dm_table.c
diff -u src/sys/dev/dm/dm_table.c:1.14 src/sys/dev/dm/dm_table.c:1.15
--- src/sys/dev/dm/dm_table.c:1.14	Sun Dec 15 09:22:28 2019
+++ src/sys/dev/dm/dm_table.c	Sun Dec 15 09:42:29 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_table.c,v 1.14 2019/12/15 09:22:28 tkusumi Exp $  */
+/*$NetBSD: dm_table.c,v 1.15 2019/12/15 09:42:29 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_table.c,v 1.14 2019/12/15 09:22:28 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_table.c,v 1.15 2019/12/15 09:42:29 tkusumi Exp $");
 
 #include 
 #include 
@@ -248,7 +248,10 @@ dm_table_disksize(dm_table_head_t *head,
 	secsize = 0;
 	SLIST_FOREACH(table_en, tbl, next) {
 		length += table_en->length;
-		table_en->target->secsize(table_en, );
+		if (table_en->target->secsize)
+			table_en->target->secsize(table_en, );
+		else
+			tsecsize = 0;
 		if (secsize < tsecsize)
 			secsize = tsecsize;
 	}

Index: src/sys/dev/dm/dm_target.c
diff -u src/sys/dev/dm/dm_target.c:1.29 src/sys/dev/dm/dm_target.c:1.30
--- src/sys/dev/dm/dm_target.c:1.29	Sun Dec 15 05:56:02 2019
+++ src/sys/dev/dm/dm_target.c	Sun Dec 15 09:42:29 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target.c,v 1.29 2019/12/15 05:56:02 tkusumi Exp $  */
+/*$NetBSD: dm_target.c,v 1.30 2019/12/15 09:42:29 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_target.c,v 1.29 2019/12/15 05:56:02 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target.c,v 1.30 2019/12/15 09:42:29 tkusumi Exp $");
 
 #include 
 #include 
@@ -184,10 +184,6 @@ dm_target_insert(dm_target_t *dm_target)
 		printf("%s missing sync\n", dm_target->name);
 		return EINVAL;
 	}
-	if (dm_target->secsize == NULL) {
-		printf("%s missing secsize\n", dm_target->name);
-		return EINVAL;
-	}
 
 	mutex_enter(_target_mutex);
 

Index: src/sys/dev/dm/dm_target_error.c
diff -u src/sys/dev/dm/dm_target_error.c:1.21 src/sys/dev/dm/dm_target_error.c:1.22
--- src/sys/dev/dm/dm_target_error.c:1.21	Sun Dec 15 05:56:02 2019
+++ src/sys/dev/dm/dm_target_error.c	Sun Dec 15 09:42:29 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target_error.c,v 1.21 2019/12/15 05:56:02 tkusumi Exp $  */
+/*$NetBSD: dm_target_error.c,v 1.22 2019/12/15 09:42:29 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_target_error.c,v 1.21 2019/12/15 05:56:02 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_error.c,v 1.22 2019/12/15 09:42:29 tkusumi Exp $");
 
 /*
  * This file implements initial version of device-mapper error target.
@@ -88,7 +88,6 @@ dm_target_error_modcmd(modcmd_t 

CVS commit: src/sys/dev/dm

2019-12-15 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sun Dec 15 09:42:29 UTC 2019

Modified Files:
src/sys/dev/dm: dm.h dm_table.c dm_target.c dm_target_error.c
dm_target_mirror.c dm_target_snapshot.c dm_target_zero.c

Log Message:
dm: Make targets' ->secsize() optional

and make a caller assume secsize 0 if ->secsize not present.
This allows a dummy function to be removed which was added in
"dm: Add dummy target ->sync()/->secsize() to prevent panic on modload(8)".


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/dm/dm.h
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/dm/dm_table.c
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/dm/dm_target.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/dm/dm_target_error.c
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/dm/dm_target_mirror.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/dm/dm_target_snapshot.c
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/dm/dm_target_zero.c

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



CVS commit: src/sys/dev/dm

2019-12-15 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sun Dec 15 10:12:45 UTC 2019

Modified Files:
src/sys/dev/dm: device-mapper.c dm.h dm_target.c dm_target_error.c
dm_target_snapshot.c dm_target_zero.c

Log Message:
dm: Make targets' ->sync() optional

Apparently some targets have nothing to sync, so make it optional.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/dev/dm/device-mapper.c
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/dm/dm.h
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/dm/dm_target.c
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/dm/dm_target_error.c
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/dm/dm_target_snapshot.c
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/dm/dm_target_zero.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/dev/dm/device-mapper.c
diff -u src/sys/dev/dm/device-mapper.c:1.52 src/sys/dev/dm/device-mapper.c:1.53
--- src/sys/dev/dm/device-mapper.c:1.52	Sun Dec 15 09:22:28 2019
+++ src/sys/dev/dm/device-mapper.c	Sun Dec 15 10:12:45 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: device-mapper.c,v 1.52 2019/12/15 09:22:28 tkusumi Exp $ */
+/*$NetBSD: device-mapper.c,v 1.53 2019/12/15 10:12:45 tkusumi Exp $ */
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -504,7 +504,8 @@ disk_ioctl_switch(dev_t dev, u_long cmd,
 		 * routine basically call DIOCCACHESYNC on underlying devices.
 		 */
 		SLIST_FOREACH(table_en, tbl, next)
-			table_en->target->sync(table_en);
+			if (table_en->target->sync)
+table_en->target->sync(table_en);
 		dm_table_release(>table_head, DM_TABLE_ACTIVE);
 		dm_dev_unbusy(dmv);
 		break;

Index: src/sys/dev/dm/dm.h
diff -u src/sys/dev/dm/dm.h:1.44 src/sys/dev/dm/dm.h:1.45
--- src/sys/dev/dm/dm.h:1.44	Sun Dec 15 09:42:29 2019
+++ src/sys/dev/dm/dm.h	Sun Dec 15 10:12:45 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm.h,v 1.44 2019/12/15 09:42:29 tkusumi Exp $  */
+/*$NetBSD: dm.h,v 1.45 2019/12/15 10:12:45 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -191,11 +191,11 @@ typedef struct dm_target {
 	char *(*info)(void *);
 	char *(*table)(void *);
 	int (*strategy)(dm_table_entry_t *, struct buf *);
-	int (*sync)(dm_table_entry_t *);
 	int (*upcall)(dm_table_entry_t *, struct buf *);
 	/*
 	 * Optional routines.
 	 */
+	int (*sync)(dm_table_entry_t *);
 	int (*secsize)(dm_table_entry_t *, unsigned int *);
 
 	uint32_t version[3];

Index: src/sys/dev/dm/dm_target.c
diff -u src/sys/dev/dm/dm_target.c:1.30 src/sys/dev/dm/dm_target.c:1.31
--- src/sys/dev/dm/dm_target.c:1.30	Sun Dec 15 09:42:29 2019
+++ src/sys/dev/dm/dm_target.c	Sun Dec 15 10:12:45 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target.c,v 1.30 2019/12/15 09:42:29 tkusumi Exp $  */
+/*$NetBSD: dm_target.c,v 1.31 2019/12/15 10:12:45 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_target.c,v 1.30 2019/12/15 09:42:29 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target.c,v 1.31 2019/12/15 10:12:45 tkusumi Exp $");
 
 #include 
 #include 
@@ -180,10 +180,6 @@ dm_target_insert(dm_target_t *dm_target)
 		printf("%s missing upcall\n", dm_target->name);
 		return EINVAL;
 	}
-	if (dm_target->sync == NULL) {
-		printf("%s missing sync\n", dm_target->name);
-		return EINVAL;
-	}
 
 	mutex_enter(_target_mutex);
 

Index: src/sys/dev/dm/dm_target_error.c
diff -u src/sys/dev/dm/dm_target_error.c:1.22 src/sys/dev/dm/dm_target_error.c:1.23
--- src/sys/dev/dm/dm_target_error.c:1.22	Sun Dec 15 09:42:29 2019
+++ src/sys/dev/dm/dm_target_error.c	Sun Dec 15 10:12:45 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target_error.c,v 1.22 2019/12/15 09:42:29 tkusumi Exp $  */
+/*$NetBSD: dm_target_error.c,v 1.23 2019/12/15 10:12:45 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_target_error.c,v 1.22 2019/12/15 09:42:29 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_error.c,v 1.23 2019/12/15 10:12:45 tkusumi Exp $");
 
 /*
  * This file implements initial version of device-mapper error target.
@@ -45,7 +45,6 @@ __KERNEL_RCSID(0, "$NetBSD: dm_target_er
 int dm_target_error_init(dm_table_entry_t*, int, char **);
 char *dm_target_error_table(void *);
 int dm_target_error_strategy(dm_table_entry_t *, struct buf *);
-int dm_target_error_sync(dm_table_entry_t *);
 int dm_target_error_deps(dm_table_entry_t *, prop_array_t);
 int dm_target_error_destroy(dm_table_entry_t *);
 int dm_target_error_upcall(dm_table_entry_t *, struct buf *);
@@ -84,7 +83,6 @@ dm_target_error_modcmd(modcmd_t cmd, voi
 		dmt->init = _target_error_init;
 		dmt->table = _target_error_table;
 		dmt->strategy = _target_error_strategy;
-		dmt->sync = _target_error_sync;
 		dmt->deps = 

CVS commit: src/sys/dev/dm

2019-12-15 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sun Dec 15 16:14:27 UTC 2019

Modified Files:
src/sys/dev/dm: device-mapper.c dm.h dm_target_linear.c
dm_target_snapshot.c dm_target_stripe.c

Log Message:
dm: Rename dm specific atoi() to atoi64()

This is uint64_t version, not sys/lib/libsa/atoi.c.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/dev/dm/device-mapper.c
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/dm/dm.h
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/dm/dm_target_linear.c
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/dm/dm_target_snapshot.c
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/dm/dm_target_stripe.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/dev/dm/device-mapper.c
diff -u src/sys/dev/dm/device-mapper.c:1.54 src/sys/dev/dm/device-mapper.c:1.55
--- src/sys/dev/dm/device-mapper.c:1.54	Sun Dec 15 14:39:42 2019
+++ src/sys/dev/dm/device-mapper.c	Sun Dec 15 16:14:27 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: device-mapper.c,v 1.54 2019/12/15 14:39:42 tkusumi Exp $ */
+/*$NetBSD: device-mapper.c,v 1.55 2019/12/15 16:14:27 tkusumi Exp $ */
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -700,3 +700,23 @@ dmgetproperties(struct disk *disk, dm_ta
 
 	disk_set_info(NULL, disk, "ESDI");
 }
+
+/*
+ * Transform char s to uint64_t offset number.
+ */
+uint64_t
+atoi64(const char *s)
+{
+	uint64_t n;
+	n = 0;
+
+	while (*s != '\0') {
+		if (!isdigit(*s))
+			break;
+
+		n = (10 * n) + (*s - '0');
+		s++;
+	}
+
+	return n;
+}

Index: src/sys/dev/dm/dm.h
diff -u src/sys/dev/dm/dm.h:1.45 src/sys/dev/dm/dm.h:1.46
--- src/sys/dev/dm/dm.h:1.45	Sun Dec 15 10:12:45 2019
+++ src/sys/dev/dm/dm.h	Sun Dec 15 16:14:27 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm.h,v 1.45 2019/12/15 10:12:45 tkusumi Exp $  */
+/*$NetBSD: dm.h,v 1.46 2019/12/15 16:14:27 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -210,6 +210,9 @@ typedef struct dm_target {
 /* device-mapper */
 void dmgetproperties(struct disk *, dm_table_head_t *);
 
+/* Generic function used to convert char to string */
+uint64_t atoi64(const char *);
+
 /* dm_ioctl.c */
 int dm_dev_create_ioctl(prop_dictionary_t);
 int dm_dev_list_ioctl(prop_dictionary_t);
@@ -253,9 +256,6 @@ int dm_target_linear_destroy(dm_table_en
 int dm_target_linear_upcall(dm_table_entry_t *, struct buf *);
 int dm_target_linear_secsize(dm_table_entry_t *, unsigned int *);
 
-/* Generic function used to convert char to string */
-uint64_t atoi(const char *);
-
 /* dm_target_stripe.c */
 int dm_target_stripe_init(dm_table_entry_t *, int, char **);
 char *dm_target_stripe_table(void *);

Index: src/sys/dev/dm/dm_target_linear.c
diff -u src/sys/dev/dm/dm_target_linear.c:1.31 src/sys/dev/dm/dm_target_linear.c:1.32
--- src/sys/dev/dm/dm_target_linear.c:1.31	Sun Dec 15 14:39:42 2019
+++ src/sys/dev/dm/dm_target_linear.c	Sun Dec 15 16:14:27 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target_linear.c,v 1.31 2019/12/15 14:39:42 tkusumi Exp $  */
+/*$NetBSD: dm_target_linear.c,v 1.32 2019/12/15 16:14:27 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_target_linear.c,v 1.31 2019/12/15 14:39:42 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_linear.c,v 1.32 2019/12/15 16:14:27 tkusumi Exp $");
 
 /*
  * This file implements initial version of device-mapper dklinear target.
@@ -75,7 +75,7 @@ dm_target_linear_init(dm_table_entry_t *
 
 	tlc = kmem_alloc(sizeof(dm_target_linear_config_t), KM_SLEEP);
 	tlc->pdev = dmp;
-	tlc->offset = atoi(argv[1]);
+	tlc->offset = atoi64(argv[1]);
 
 	table_en->target_config = tlc;
 
@@ -213,23 +213,3 @@ dm_target_linear_secsize(dm_table_entry_
 
 	return 0;
 }
-
-/*
- * Transform char s to uint64_t offset number.
- */
-uint64_t
-atoi(const char *s)
-{
-	uint64_t n;
-	n = 0;
-
-	while (*s != '\0') {
-		if (!isdigit(*s))
-			break;
-
-		n = (10 * n) + (*s - '0');
-		s++;
-	}
-
-	return n;
-}

Index: src/sys/dev/dm/dm_target_snapshot.c
diff -u src/sys/dev/dm/dm_target_snapshot.c:1.35 src/sys/dev/dm/dm_target_snapshot.c:1.36
--- src/sys/dev/dm/dm_target_snapshot.c:1.35	Sun Dec 15 14:39:42 2019
+++ src/sys/dev/dm/dm_target_snapshot.c	Sun Dec 15 16:14:27 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target_snapshot.c,v 1.35 2019/12/15 14:39:42 tkusumi Exp $  */
+/*$NetBSD: dm_target_snapshot.c,v 1.36 2019/12/15 16:14:27 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_target_snapshot.c,v 1.35 2019/12/15 14:39:42 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_snapshot.c,v 1.36 2019/12/15 16:14:27 tkusumi Exp $");
 
 /*
  * 1. Suspend my_data to temporarily stop any I/O while the snapshot is 

CVS commit: src/sys/dev/dm

2019-12-15 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sun Dec 15 14:39:43 UTC 2019

Modified Files:
src/sys/dev/dm: device-mapper.c dm_dev.c dm_ioctl.c dm_pdev.c
dm_table.c dm_target.c dm_target_error.c dm_target_linear.c
dm_target_mirror.c dm_target_snapshot.c dm_target_stripe.c
dm_target_zero.c

Log Message:
dm: Style cleanups (no functional changes)


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/dev/dm/device-mapper.c
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/dm/dm_dev.c src/sys/dev/dm/dm_table.c
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/dm/dm_ioctl.c
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/dm/dm_pdev.c
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/dm/dm_target.c
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/dm/dm_target_error.c
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/dm/dm_target_linear.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/dm/dm_target_mirror.c
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/dm/dm_target_snapshot.c
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/dm/dm_target_stripe.c
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/dm/dm_target_zero.c

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



CVS commit: src/sys/dev/dm

2019-12-15 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sun Dec 15 14:39:43 UTC 2019

Modified Files:
src/sys/dev/dm: device-mapper.c dm_dev.c dm_ioctl.c dm_pdev.c
dm_table.c dm_target.c dm_target_error.c dm_target_linear.c
dm_target_mirror.c dm_target_snapshot.c dm_target_stripe.c
dm_target_zero.c

Log Message:
dm: Style cleanups (no functional changes)


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/dev/dm/device-mapper.c
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/dm/dm_dev.c src/sys/dev/dm/dm_table.c
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/dm/dm_ioctl.c
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/dm/dm_pdev.c
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/dm/dm_target.c
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/dm/dm_target_error.c
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/dm/dm_target_linear.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/dm/dm_target_mirror.c
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/dm/dm_target_snapshot.c
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/dm/dm_target_stripe.c
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/dm/dm_target_zero.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/dev/dm/device-mapper.c
diff -u src/sys/dev/dm/device-mapper.c:1.53 src/sys/dev/dm/device-mapper.c:1.54
--- src/sys/dev/dm/device-mapper.c:1.53	Sun Dec 15 10:12:45 2019
+++ src/sys/dev/dm/device-mapper.c	Sun Dec 15 14:39:42 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: device-mapper.c,v 1.53 2019/12/15 10:12:45 tkusumi Exp $ */
+/*$NetBSD: device-mapper.c,v 1.54 2019/12/15 14:39:42 tkusumi Exp $ */
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -35,7 +35,6 @@
 
 #include 
 #include 
-
 #include 
 #include 
 #include 
@@ -236,7 +235,7 @@ dm_match(device_t parent, cfdata_t match
 {
 
 	/* Pseudo-device; always present. */
-	return (1);
+	return 1;
 }
 
 /*
@@ -247,10 +246,8 @@ dm_match(device_t parent, cfdata_t match
 static void
 dm_attach(device_t parent, device_t self, void *aux)
 {
-	return;
 }
 
-
 /*
  * dm_detach:
  *
@@ -291,6 +288,7 @@ dm_detach(device_t self, int flags)
 static void
 dm_doinit(void)
 {
+
 	dm_target_init();
 	dm_dev_init();
 	dm_pdev_init();
@@ -303,12 +301,11 @@ dmattach(int n)
 	int error;
 
 	error = config_cfattach_attach(dm_cd.cd_name, _ca);
-	if (error) {
+	if (error)
 		aprint_error("%s: unable to register cfattach\n",
 		dm_cd.cd_name);
-	} else {
+	else
 		dm_doinit();
-	}
 }
 
 #ifdef _MODULE
@@ -388,16 +385,14 @@ cleanup_exit:
  */
 static int
 dm_cmd_to_fun(prop_dictionary_t dm_dict)
- {
+{
 	int i, r;
 	prop_string_t command;
 
-	r = 0;
-
 	if ((command = prop_dictionary_get(dm_dict, DM_IOCTL_COMMAND)) == NULL)
 		return EINVAL;
 
-	for(i = 0; cmd_fn[i].cmd != NULL; i++)
+	for (i = 0; cmd_fn[i].cmd != NULL; i++)
 		if (prop_string_equals_cstring(command, cmd_fn[i].cmd))
 			break;
 
@@ -412,9 +407,8 @@ dm_cmd_to_fun(prop_dictionary_t dm_dict)
 	aprint_debug("ioctl %s called %p\n", cmd_fn[i].cmd, cmd_fn[i].fn);
 	if (cmd_fn[i].fn == NULL)
 		return 0;
-	r = cmd_fn[i].fn(dm_dict);
 
-	return r;
+	return cmd_fn[i].fn(dm_dict);
 }
 
 /* Call apropriate ioctl handler function. */
@@ -469,7 +463,6 @@ disk_ioctl_switch(dev_t dev, u_long cmd,
 		dm_dev_unbusy(dmv);
 		break;
 	}
-
 	case DIOCGDISKINFO:
 	{
 		struct plistref *pref = (struct plistref *) data;
@@ -487,7 +480,6 @@ disk_ioctl_switch(dev_t dev, u_long cmd,
 		dm_dev_unbusy(dmv);
 		break;
 	}
-
 	case DIOCCACHESYNC:
 	{
 		dm_table_entry_t *table_en;
@@ -510,7 +502,6 @@ disk_ioctl_switch(dev_t dev, u_long cmd,
 		dm_dev_unbusy(dmv);
 		break;
 	}
-
 	case DIOCGSECTORSIZE:
 	{
 		u_int *valp = data;
@@ -528,7 +519,6 @@ disk_ioctl_switch(dev_t dev, u_long cmd,
 		dm_dev_unbusy(dmv);
 		break;
 	}
-
 	case DIOCGMEDIASIZE:
 	{
 		off_t *valp = data;
@@ -546,7 +536,6 @@ disk_ioctl_switch(dev_t dev, u_long cmd,
 		dm_dev_unbusy(dmv);
 		break;
 	}
-
 	default:
 		aprint_debug("unknown disk_ioctl called\n");
 		return ENOTTY;
@@ -563,7 +552,7 @@ static void
 dmstrategy(struct buf *bp)
 {
 	dm_dev_t *dmv;
-	dm_table_t  *tbl;
+	dm_table_t *tbl;
 	dm_table_entry_t *table_en;
 	struct buf *nestbuf;
 
@@ -574,8 +563,6 @@ dmstrategy(struct buf *bp)
 	buf_start = bp->b_blkno * DEV_BSIZE;
 	buf_len = bp->b_bcount;
 
-	tbl = NULL;
-
 	table_end = 0;
 	issued_len = 0;
 
@@ -620,9 +607,7 @@ dmstrategy(struct buf *bp)
 		 * off by one error
 		 */
 		table_end = table_start + table_en->length * DEV_BSIZE;
-
 		start = MAX(table_start, buf_start);
-
 		end = MIN(table_end, buf_start + buf_len);
 
 		aprint_debug("\n");
@@ -639,15 +624,11 @@ dmstrategy(struct buf *bp)
 		if (start < end) {
 			/* create nested buffer  */
 			nestbuf = getiobuf(NULL, true);
-
 			nestiobuf_setup(bp, nestbuf, start - buf_start,
-			(end - start));
-
+			end - start);
 			issued_len += end - start;
-
 			/* I need number of blocks. */
 			nestbuf->b_blkno = (start - 

CVS commit: src/sys/dev/dm

2019-12-15 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sun Dec 15 16:14:27 UTC 2019

Modified Files:
src/sys/dev/dm: device-mapper.c dm.h dm_target_linear.c
dm_target_snapshot.c dm_target_stripe.c

Log Message:
dm: Rename dm specific atoi() to atoi64()

This is uint64_t version, not sys/lib/libsa/atoi.c.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/dev/dm/device-mapper.c
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/dm/dm.h
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/dm/dm_target_linear.c
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/dm/dm_target_snapshot.c
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/dm/dm_target_stripe.c

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



CVS commit: src/sys/dev/dm

2019-12-11 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Wed Dec 11 14:03:37 UTC 2019

Modified Files:
src/sys/dev/dm: device-mapper.c

Log Message:
dm: Revert "Fix error handling in dmioctl()" for now

This change seems to break "deps" in dm ioctl(2) for linear target.
Revert the change, will revisit later.
https://mail-index.netbsd.org/current-users/2019/12/11/msg037179.html


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/dm/device-mapper.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/dev/dm/device-mapper.c
diff -u src/sys/dev/dm/device-mapper.c:1.48 src/sys/dev/dm/device-mapper.c:1.49
--- src/sys/dev/dm/device-mapper.c:1.48	Mon Dec  9 15:54:59 2019
+++ src/sys/dev/dm/device-mapper.c	Wed Dec 11 14:03:37 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: device-mapper.c,v 1.48 2019/12/09 15:54:59 tkusumi Exp $ */
+/*$NetBSD: device-mapper.c,v 1.49 2019/12/11 14:03:37 tkusumi Exp $ */
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -377,8 +377,8 @@ dmioctl(dev_t dev, const u_long cmd, voi
 		if ((r = dm_cmd_to_fun(dm_dict_in)) != 0)
 			goto cleanup_exit;
 
-		r = prop_dictionary_copyout_ioctl(pref, cmd, dm_dict_in);
 cleanup_exit:
+		r = prop_dictionary_copyout_ioctl(pref, cmd, dm_dict_in);
 		prop_object_release(dm_dict_in);
 	}
 



CVS commit: src/sys/dev/dm

2019-12-11 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Wed Dec 11 14:03:37 UTC 2019

Modified Files:
src/sys/dev/dm: device-mapper.c

Log Message:
dm: Revert "Fix error handling in dmioctl()" for now

This change seems to break "deps" in dm ioctl(2) for linear target.
Revert the change, will revisit later.
https://mail-index.netbsd.org/current-users/2019/12/11/msg037179.html


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/dm/device-mapper.c

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



CVS commit: src/sys/dev/dm

2019-12-12 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Thu Dec 12 16:28:24 UTC 2019

Modified Files:
src/sys/dev/dm: dm.h dm_ioctl.c dm_target_error.c dm_target_linear.c
dm_target_mirror.c dm_target_snapshot.c dm_target_stripe.c
dm_target_zero.c

Log Message:
dm: Make target's ->init() take parsed argc and argv

This gets rid of the same parser code in each target using strsep(3).
taken-from: DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/dm/dm.h
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/dm/dm_ioctl.c
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/dm/dm_target_error.c
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/dm/dm_target_linear.c
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/dm/dm_target_mirror.c
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/dm/dm_target_snapshot.c
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/dm/dm_target_stripe.c
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/dm/dm_target_zero.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/dev/dm/dm.h
diff -u src/sys/dev/dm/dm.h:1.38 src/sys/dev/dm/dm.h:1.39
--- src/sys/dev/dm/dm.h:1.38	Sun Dec  8 14:59:42 2019
+++ src/sys/dev/dm/dm.h	Thu Dec 12 16:28:24 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm.h,v 1.38 2019/12/08 14:59:42 tkusumi Exp $  */
+/*$NetBSD: dm.h,v 1.39 2019/12/12 16:28:24 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -174,7 +174,7 @@ typedef struct target_linear_devs dm_tar
 typedef struct dm_target {
 	char name[DM_MAX_TYPE_NAME];
 	/* Initialize target_config area */
-	int (*init)(dm_table_entry_t *, char *);
+	int (*init)(dm_table_entry_t *, int, char **);
 
 	/* Destroy target_config area */
 	int (*destroy)(dm_table_entry_t *);
@@ -193,6 +193,7 @@ typedef struct dm_target {
 
 	uint32_t version[3];
 	uint32_t ref_cnt;
+	int max_argc;
 
 	TAILQ_ENTRY(dm_target) dm_target_next;
 } dm_target_t;
@@ -236,7 +237,7 @@ int dm_target_init(void);
 #define DM_MAX_PARAMS_SIZE 1024
 
 /* dm_target_linear.c */
-int dm_target_linear_init(dm_table_entry_t *, char *);
+int dm_target_linear_init(dm_table_entry_t *, int, char **);
 char *dm_target_linear_status(void *);
 int dm_target_linear_strategy(dm_table_entry_t *, struct buf *);
 int dm_target_linear_sync(dm_table_entry_t *);
@@ -249,7 +250,7 @@ int dm_target_linear_secsize(dm_table_en
 uint64_t atoi(const char *);
 
 /* dm_target_stripe.c */
-int dm_target_stripe_init(dm_table_entry_t *, char *);
+int dm_target_stripe_init(dm_table_entry_t *, int, char **);
 char *dm_target_stripe_status(void *);
 int dm_target_stripe_strategy(dm_table_entry_t *, struct buf *);
 int dm_target_stripe_sync(dm_table_entry_t *);

Index: src/sys/dev/dm/dm_ioctl.c
diff -u src/sys/dev/dm/dm_ioctl.c:1.40 src/sys/dev/dm/dm_ioctl.c:1.41
--- src/sys/dev/dm/dm_ioctl.c:1.40	Sun Dec  8 04:41:02 2019
+++ src/sys/dev/dm/dm_ioctl.c	Thu Dec 12 16:28:24 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: dm_ioctl.c,v 1.40 2019/12/08 04:41:02 tkusumi Exp $  */
+/* $NetBSD: dm_ioctl.c,v 1.41 2019/12/12 16:28:24 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_ioctl.c,v 1.40 2019/12/08 04:41:02 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_ioctl.c,v 1.41 2019/12/12 16:28:24 tkusumi Exp $");
 
 /*
  * Locking is used to synchronise between ioctl calls and between dm_table's
@@ -118,6 +118,7 @@ static struct cfdata dm_cfdata = {
 } while (/*CONSTCOND*/0)
 
 static int dm_dbg_print_flags(int);
+static int dm_table_init(dm_target_t *, dm_table_entry_t *, char *);
 
 /*
  * Print flags sent to the kernel from libevmapper.
@@ -774,13 +775,7 @@ dm_table_load_ioctl(prop_dictionary_t dm
 		else
 			SLIST_INSERT_AFTER(last_table, table_en, next);
 
-		/*
-		 * Params string is different for every target,
-		 * therfore I have to pass it to target init
-		 * routine and parse parameters there.
-		 */
-
-		if ((ret = target->init(table_en, str)) != 0) {
+		if ((ret = dm_table_init(target, table_en, str)) != 0) {
 			dm_table_release(>table_head, DM_TABLE_INACTIVE);
 			dm_table_destroy(>table_head, DM_TABLE_INACTIVE);
 			free(str, M_TEMP);
@@ -802,6 +797,41 @@ dm_table_load_ioctl(prop_dictionary_t dm
 	return 0;
 }
 
+static int
+dm_table_init(dm_target_t *target, dm_table_entry_t *table_en, char *params)
+{
+	int i, n, ret, argc;
+	char **ap, **argv;
+
+	if (params == NULL)
+		return EINVAL;
+
+	n = target->max_argc;
+	if (n)
+		aprint_debug("Max argc %d for %s target\n", n, target->name);
+	else
+		n = 32; /* large enough for most targets */
+
+	argv = kmem_alloc(sizeof(*argv) * n, KM_SLEEP);
+
+	for (ap = argv;
+	 ap < [n] && (*ap = strsep(, " \t")) != NULL;) {
+		if (**ap != '\0')
+			ap++;
+	}
+	argc = ap - argv;
+
+	for (i = 0; i < argc; i++)
+		aprint_debug("DM: argv[%d] = \"%s\"\n", i, argv[i]);
+
+	KASSERT(target->init);
+	ret = 

CVS commit: src/sys/dev/dm

2019-12-12 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Thu Dec 12 16:28:24 UTC 2019

Modified Files:
src/sys/dev/dm: dm.h dm_ioctl.c dm_target_error.c dm_target_linear.c
dm_target_mirror.c dm_target_snapshot.c dm_target_stripe.c
dm_target_zero.c

Log Message:
dm: Make target's ->init() take parsed argc and argv

This gets rid of the same parser code in each target using strsep(3).
taken-from: DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/dm/dm.h
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/dm/dm_ioctl.c
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/dm/dm_target_error.c
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/dm/dm_target_linear.c
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/dm/dm_target_mirror.c
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/dm/dm_target_snapshot.c
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/dm/dm_target_stripe.c
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/dm/dm_target_zero.c

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



CVS commit: src/sys/dev/dm

2019-12-05 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Thu Dec  5 15:52:39 UTC 2019

Modified Files:
src/sys/dev/dm: device-mapper.c dm.h dm_ioctl.c

Log Message:
dm: Remove unneeded dm_get_version_ioctl()

"version" is implemented and handled in userspace,
hence dm ioctl doesn't need to support it.

taken-from: DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/dm/device-mapper.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/dm/dm.h
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/dm/dm_ioctl.c

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



CVS commit: src/sys/dev/dm

2019-12-05 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Thu Dec  5 16:59:43 UTC 2019

Modified Files:
src/sys/dev/dm: dm_table.c dm_target_error.c dm_target_linear.c
dm_target_mirror.c dm_target_snapshot.c dm_target_stripe.c
dm_target_zero.c

Log Message:
dm: Make dm core set config to NULL after destroy

Just let dm core do this instead of having a comment expecting each
target to do the right thing.

taken-from: DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/dm/dm_table.c
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/dm/dm_target_error.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/dm/dm_target_linear.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/dm/dm_target_mirror.c
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/dm/dm_target_snapshot.c
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/dm/dm_target_stripe.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/dm/dm_target_zero.c

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



CVS commit: src/sys/dev/dm

2019-12-06 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Fri Dec  6 16:11:59 UTC 2019

Modified Files:
src/sys/dev/dm: dm_target.c dm_target_error.c dm_target_mirror.c
dm_target_snapshot.c dm_target_stripe.c dm_target_zero.c

Log Message:
dm: Don't ignore dm_target_alloc() argument

dm_target_alloc() is supposed to be copying the name argument to its ->name.
taken-from: DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/dm/dm_target.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/dm/dm_target_error.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/dm/dm_target_mirror.c
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/dm/dm_target_snapshot.c
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/dm/dm_target_stripe.c
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/dm/dm_target_zero.c

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



CVS commit: src/sys/dev/dm

2019-12-06 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Fri Dec  6 16:33:47 UTC 2019

Modified Files:
src/sys/dev/dm: device-mapper.c dm_ioctl.c dm_target_stripe.c

Log Message:
dm: Fix typos in comments/messages

taken-from: DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/dm/device-mapper.c
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/dm/dm_ioctl.c
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/dm/dm_target_stripe.c

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



CVS commit: src/sys/dev/dm

2019-12-06 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Fri Dec  6 16:46:14 UTC 2019

Modified Files:
src/sys/dev/dm: dm_pdev.c dm_target_linear.c dm_target_zero.c
netbsd-dm.h

Log Message:
dm: Remove trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/dm/dm_pdev.c
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/dm/dm_target_linear.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/dm/dm_target_zero.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/dm/netbsd-dm.h

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



CVS commit: src/sys/dev/dm

2019-12-05 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Thu Dec  5 15:52:39 UTC 2019

Modified Files:
src/sys/dev/dm: device-mapper.c dm.h dm_ioctl.c

Log Message:
dm: Remove unneeded dm_get_version_ioctl()

"version" is implemented and handled in userspace,
hence dm ioctl doesn't need to support it.

taken-from: DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/dm/device-mapper.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/dm/dm.h
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/dm/dm_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/sys/dev/dm/device-mapper.c
diff -u src/sys/dev/dm/device-mapper.c:1.44 src/sys/dev/dm/device-mapper.c:1.45
--- src/sys/dev/dm/device-mapper.c:1.44	Wed Dec  4 16:55:30 2019
+++ src/sys/dev/dm/device-mapper.c	Thu Dec  5 15:52:39 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: device-mapper.c,v 1.44 2019/12/04 16:55:30 tkusumi Exp $ */
+/*$NetBSD: device-mapper.c,v 1.45 2019/12/05 15:52:39 tkusumi Exp $ */
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -134,7 +134,7 @@ static const struct cmd_function {
 	int  (*fn)(prop_dictionary_t);
 	int  allowed;
 } cmd_fn[] = {
-	{ .cmd = "version", .fn = dm_get_version_ioctl,	  .allowed = 1 },
+	{ .cmd = "version", .fn = NULL,   .allowed = 1 },
 	{ .cmd = "targets", .fn = dm_list_versions_ioctl, .allowed = 1 },
 	{ .cmd = "create",  .fn = dm_dev_create_ioctl,.allowed = 0 },
 	{ .cmd = "info",.fn = dm_dev_status_ioctl,.allowed = 1 },
@@ -413,7 +413,9 @@ dm_cmd_to_fun(prop_dictionary_t dm_dict)
 	if (cmd_fn[i].cmd == NULL)
 		return EINVAL;
 
-	aprint_debug("ioctl %s called\n", cmd_fn[i].cmd);
+	aprint_debug("ioctl %s called %p\n", cmd_fn[i].cmd, cmd_fn[i].fn);
+	if (cmd_fn[i].fn == NULL)
+		return 0;
 	r = cmd_fn[i].fn(dm_dict);
 
 	return r;

Index: src/sys/dev/dm/dm.h
diff -u src/sys/dev/dm/dm.h:1.32 src/sys/dev/dm/dm.h:1.33
--- src/sys/dev/dm/dm.h:1.32	Wed Dec  4 16:54:03 2019
+++ src/sys/dev/dm/dm.h	Thu Dec  5 15:52:39 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm.h,v 1.32 2019/12/04 16:54:03 tkusumi Exp $  */
+/*$NetBSD: dm.h,v 1.33 2019/12/05 15:52:39 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -251,7 +251,6 @@ int dm_dev_status_ioctl(prop_dictionary_
 int dm_dev_suspend_ioctl(prop_dictionary_t);
 
 int dm_check_version(prop_dictionary_t);
-int dm_get_version_ioctl(prop_dictionary_t);
 int dm_list_versions_ioctl(prop_dictionary_t);
 
 int dm_table_clear_ioctl(prop_dictionary_t);

Index: src/sys/dev/dm/dm_ioctl.c
diff -u src/sys/dev/dm/dm_ioctl.c:1.37 src/sys/dev/dm/dm_ioctl.c:1.38
--- src/sys/dev/dm/dm_ioctl.c:1.37	Wed Dec  4 15:31:12 2019
+++ src/sys/dev/dm/dm_ioctl.c	Thu Dec  5 15:52:39 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: dm_ioctl.c,v 1.37 2019/12/04 15:31:12 tkusumi Exp $  */
+/* $NetBSD: dm_ioctl.c,v 1.38 2019/12/05 15:52:39 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_ioctl.c,v 1.37 2019/12/04 15:31:12 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_ioctl.c,v 1.38 2019/12/05 15:52:39 tkusumi Exp $");
 
 /*
  * Locking is used to synchronise between ioctl calls and between dm_table's
@@ -161,17 +161,6 @@ dm_dbg_print_flags(int flags)
 }
 
 /*
- * Get version ioctl call I do it as default therefore this
- * function is unused now.
- */
-int
-dm_get_version_ioctl(prop_dictionary_t dm_dict)
-{
-
-	return 0;
-}
-
-/*
  * Get list of all available targets from global
  * target list and sent them back to libdevmapper.
  */



CVS commit: src/sys/dev/dm

2019-12-05 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Thu Dec  5 16:59:43 UTC 2019

Modified Files:
src/sys/dev/dm: dm_table.c dm_target_error.c dm_target_linear.c
dm_target_mirror.c dm_target_snapshot.c dm_target_stripe.c
dm_target_zero.c

Log Message:
dm: Make dm core set config to NULL after destroy

Just let dm core do this instead of having a comment expecting each
target to do the right thing.

taken-from: DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/dm/dm_table.c
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/dm/dm_target_error.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/dm/dm_target_linear.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/dm/dm_target_mirror.c
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/dm/dm_target_snapshot.c
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/dm/dm_target_stripe.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/dm/dm_target_zero.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/dev/dm/dm_table.c
diff -u src/sys/dev/dm/dm_table.c:1.9 src/sys/dev/dm/dm_table.c:1.10
--- src/sys/dev/dm/dm_table.c:1.9	Wed Dec  4 15:31:12 2019
+++ src/sys/dev/dm/dm_table.c	Thu Dec  5 16:59:43 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_table.c,v 1.9 2019/12/04 15:31:12 tkusumi Exp $  */
+/*$NetBSD: dm_table.c,v 1.10 2019/12/05 16:59:43 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_table.c,v 1.9 2019/12/04 15:31:12 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_table.c,v 1.10 2019/12/05 16:59:43 tkusumi Exp $");
 
 #include 
 #include 
@@ -162,11 +162,8 @@ dm_table_destroy(dm_table_head_t * head,
 
 	while (!SLIST_EMPTY(tbl)) {	/* List Deletion. */
 		table_en = SLIST_FIRST(tbl);
-		/*
-		 * Remove target specific config data. After successfull
-		 * call table_en->target_config must be set to NULL.
-		 */
-		table_en->target->destroy(table_en);
+		if (table_en->target->destroy(table_en) == 0)
+			table_en->target_config = NULL;
 
 		SLIST_REMOVE_HEAD(tbl, next);
 

Index: src/sys/dev/dm/dm_target_error.c
diff -u src/sys/dev/dm/dm_target_error.c:1.13 src/sys/dev/dm/dm_target_error.c:1.14
--- src/sys/dev/dm/dm_target_error.c:1.13	Sun Dec  1 06:53:31 2019
+++ src/sys/dev/dm/dm_target_error.c	Thu Dec  5 16:59:43 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target_error.c,v 1.13 2019/12/01 06:53:31 tkusumi Exp $  */
+/*$NetBSD: dm_target_error.c,v 1.14 2019/12/05 16:59:43 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_target_error.c,v 1.13 2019/12/01 06:53:31 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_error.c,v 1.14 2019/12/05 16:59:43 tkusumi Exp $");
 
 /*
  * This file implements initial version of device-mapper error target.
@@ -155,8 +155,6 @@ dm_target_error_sync(dm_table_entry_t * 
 int
 dm_target_error_destroy(dm_table_entry_t * table_en)
 {
-	table_en->target_config = NULL;
-
 	/* Unbusy target so we can unload it */
 	dm_target_unbusy(table_en->target);
 

Index: src/sys/dev/dm/dm_target_linear.c
diff -u src/sys/dev/dm/dm_target_linear.c:1.21 src/sys/dev/dm/dm_target_linear.c:1.22
--- src/sys/dev/dm/dm_target_linear.c:1.21	Tue Dec  3 15:47:38 2019
+++ src/sys/dev/dm/dm_target_linear.c	Thu Dec  5 16:59:43 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target_linear.c,v 1.21 2019/12/03 15:47:38 tkusumi Exp $  */
+/*$NetBSD: dm_target_linear.c,v 1.22 2019/12/05 16:59:43 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_target_linear.c,v 1.21 2019/12/03 15:47:38 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_linear.c,v 1.22 2019/12/05 16:59:43 tkusumi Exp $");
 
 /*
  * This file implements initial version of device-mapper dklinear target.
@@ -166,7 +166,6 @@ dm_target_linear_destroy(dm_table_entry_
 		goto out;
 
 	dm_target_linear_config_t *tlc = table_en->target_config;
-	table_en->target_config = NULL;
 
 	/* Decrement pdev ref counter if 0 remove it */
 	dm_pdev_decr(tlc->pdev);

Index: src/sys/dev/dm/dm_target_mirror.c
diff -u src/sys/dev/dm/dm_target_mirror.c:1.11 src/sys/dev/dm/dm_target_mirror.c:1.12
--- src/sys/dev/dm/dm_target_mirror.c:1.11	Sun Dec  1 06:53:31 2019
+++ src/sys/dev/dm/dm_target_mirror.c	Thu Dec  5 16:59:43 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target_mirror.c,v 1.11 2019/12/01 06:53:31 tkusumi Exp $*/
+/*$NetBSD: dm_target_mirror.c,v 1.12 2019/12/05 16:59:43 tkusumi Exp $*/
 
 /*
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_target_mirror.c,v 1.11 2019/12/01 06:53:31 tkusumi Exp $");

CVS commit: src/sys/dev/dm

2019-12-06 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Fri Dec  6 16:11:59 UTC 2019

Modified Files:
src/sys/dev/dm: dm_target.c dm_target_error.c dm_target_mirror.c
dm_target_snapshot.c dm_target_stripe.c dm_target_zero.c

Log Message:
dm: Don't ignore dm_target_alloc() argument

dm_target_alloc() is supposed to be copying the name argument to its ->name.
taken-from: DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/dm/dm_target.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/dm/dm_target_error.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/dm/dm_target_mirror.c
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/dm/dm_target_snapshot.c
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/dm/dm_target_stripe.c
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/dm/dm_target_zero.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/dev/dm/dm_target.c
diff -u src/sys/dev/dm/dm_target.c:1.22 src/sys/dev/dm/dm_target.c:1.23
--- src/sys/dev/dm/dm_target.c:1.22	Wed Dec  4 15:31:12 2019
+++ src/sys/dev/dm/dm_target.c	Fri Dec  6 16:11:59 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target.c,v 1.22 2019/12/04 15:31:12 tkusumi Exp $  */
+/*$NetBSD: dm_target.c,v 1.23 2019/12/06 16:11:59 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_target.c,v 1.22 2019/12/04 15:31:12 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target.c,v 1.23 2019/12/06 16:11:59 tkusumi Exp $");
 
 #include 
 #include 
@@ -241,7 +241,16 @@ dm_target_destroy(void)
 dm_target_t *
 dm_target_alloc(const char *name)
 {
-	return kmem_zalloc(sizeof(dm_target_t), KM_SLEEP);
+	dm_target_t *dmt;
+
+	dmt = kmem_zalloc(sizeof(dm_target_t), KM_SLEEP);
+	if (dmt == NULL)
+		return NULL;
+
+	if (name)
+		strlcpy(dmt->name, name, sizeof(dmt->name));
+
+	return dmt;
 }
 
 /*
@@ -298,7 +307,6 @@ dm_target_init(void)
 	dmt->version[0] = 1;
 	dmt->version[1] = 0;
 	dmt->version[2] = 2;
-	strlcpy(dmt->name, "linear", DM_MAX_TYPE_NAME);
 	dmt->init = _target_linear_init;
 	dmt->status = _target_linear_status;
 	dmt->strategy = _target_linear_strategy;
@@ -313,7 +321,6 @@ dm_target_init(void)
 	dmt3->version[0] = 1;
 	dmt3->version[1] = 0;
 	dmt3->version[2] = 3;
-	strlcpy(dmt3->name, "striped", DM_MAX_TYPE_NAME);
 	dmt3->init = _target_stripe_init;
 	dmt3->status = _target_stripe_status;
 	dmt3->strategy = _target_stripe_strategy;

Index: src/sys/dev/dm/dm_target_error.c
diff -u src/sys/dev/dm/dm_target_error.c:1.14 src/sys/dev/dm/dm_target_error.c:1.15
--- src/sys/dev/dm/dm_target_error.c:1.14	Thu Dec  5 16:59:43 2019
+++ src/sys/dev/dm/dm_target_error.c	Fri Dec  6 16:11:59 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target_error.c,v 1.14 2019/12/05 16:59:43 tkusumi Exp $  */
+/*$NetBSD: dm_target_error.c,v 1.15 2019/12/06 16:11:59 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_target_error.c,v 1.14 2019/12/05 16:59:43 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_error.c,v 1.15 2019/12/06 16:11:59 tkusumi Exp $");
 
 /*
  * This file implements initial version of device-mapper error target.
@@ -81,7 +81,6 @@ dm_target_error_modcmd(modcmd_t cmd, voi
 		dmt->version[0] = 1;
 		dmt->version[1] = 0;
 		dmt->version[2] = 0;
-		strlcpy(dmt->name, "error", DM_MAX_TYPE_NAME);
 		dmt->init = _target_error_init;
 		dmt->status = _target_error_status;
 		dmt->strategy = _target_error_strategy;

Index: src/sys/dev/dm/dm_target_mirror.c
diff -u src/sys/dev/dm/dm_target_mirror.c:1.12 src/sys/dev/dm/dm_target_mirror.c:1.13
--- src/sys/dev/dm/dm_target_mirror.c:1.12	Thu Dec  5 16:59:43 2019
+++ src/sys/dev/dm/dm_target_mirror.c	Fri Dec  6 16:11:59 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target_mirror.c,v 1.12 2019/12/05 16:59:43 tkusumi Exp $*/
+/*$NetBSD: dm_target_mirror.c,v 1.13 2019/12/06 16:11:59 tkusumi Exp $*/
 
 /*
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_target_mirror.c,v 1.12 2019/12/05 16:59:43 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_mirror.c,v 1.13 2019/12/06 16:11:59 tkusumi Exp $");
 
 /*
  * This file implements initial version of device-mapper mirror target.
@@ -81,7 +81,6 @@ dm_target_mirror_modcmd(modcmd_t cmd, vo
 		dmt->version[0] = 1;
 		dmt->version[1] = 0;
 		dmt->version[2] = 0;
-		strlcpy(dmt->name, "mirror", DM_MAX_TYPE_NAME);
 		dmt->init = _target_mirror_init;
 		dmt->status = _target_mirror_status;
 		dmt->strategy = _target_mirror_strategy;

Index: src/sys/dev/dm/dm_target_snapshot.c
diff -u src/sys/dev/dm/dm_target_snapshot.c:1.23 src/sys/dev/dm/dm_target_snapshot.c:1.24
--- src/sys/dev/dm/dm_target_snapshot.c:1.23	Thu Dec  5 16:59:43 

CVS commit: src/sys/dev/dm

2019-12-06 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Fri Dec  6 16:33:47 UTC 2019

Modified Files:
src/sys/dev/dm: device-mapper.c dm_ioctl.c dm_target_stripe.c

Log Message:
dm: Fix typos in comments/messages

taken-from: DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/dm/device-mapper.c
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/dm/dm_ioctl.c
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/dm/dm_target_stripe.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/dev/dm/device-mapper.c
diff -u src/sys/dev/dm/device-mapper.c:1.45 src/sys/dev/dm/device-mapper.c:1.46
--- src/sys/dev/dm/device-mapper.c:1.45	Thu Dec  5 15:52:39 2019
+++ src/sys/dev/dm/device-mapper.c	Fri Dec  6 16:33:47 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: device-mapper.c,v 1.45 2019/12/05 15:52:39 tkusumi Exp $ */
+/*$NetBSD: device-mapper.c,v 1.46 2019/12/06 16:33:47 tkusumi Exp $ */
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -428,7 +428,7 @@ dm_ioctl_switch(u_long cmd)
 
 	switch(cmd) {
 	case NETBSD_DM_IOCTL:
-		aprint_debug("dm NetBSD_DM_IOCTL called\n");
+		aprint_debug("dm NETBSD_DM_IOCTL called\n");
 		break;
 	default:
 		 aprint_debug("dm unknown ioctl called\n");
@@ -637,9 +637,9 @@ dmstrategy(struct buf *bp)
 		PRIu64"\n", buf_start, buf_len);
 		aprint_debug("start-buf_start %010"PRIu64", end %010"
 		PRIu64"\n", start - buf_start, end);
-		aprint_debug("start %010" PRIu64" , end %010"
+		aprint_debug("start %010" PRIu64", end %010"
 PRIu64"\n", start, end);
-		aprint_debug("\n\n");
+		aprint_debug("\n");
 
 		if (start < end) {
 			/* create nested buffer  */

Index: src/sys/dev/dm/dm_ioctl.c
diff -u src/sys/dev/dm/dm_ioctl.c:1.38 src/sys/dev/dm/dm_ioctl.c:1.39
--- src/sys/dev/dm/dm_ioctl.c:1.38	Thu Dec  5 15:52:39 2019
+++ src/sys/dev/dm/dm_ioctl.c	Fri Dec  6 16:33:47 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: dm_ioctl.c,v 1.38 2019/12/05 15:52:39 tkusumi Exp $  */
+/* $NetBSD: dm_ioctl.c,v 1.39 2019/12/06 16:33:47 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_ioctl.c,v 1.38 2019/12/05 15:52:39 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_ioctl.c,v 1.39 2019/12/06 16:33:47 tkusumi Exp $");
 
 /*
  * Locking is used to synchronise between ioctl calls and between dm_table's
@@ -131,10 +131,10 @@ dm_dbg_print_flags(int flags)
 		aprint_debug("dbg_flags: DM_READONLY_FLAG set In/Out\n");
 
 	if (flags & DM_SUSPEND_FLAG)
-		aprint_debug("dbg_flags: DM_SUSPEND_FLAG set In/Out \n");
+		aprint_debug("dbg_flags: DM_SUSPEND_FLAG set In/Out\n");
 
 	if (flags & DM_PERSISTENT_DEV_FLAG)
-		aprint_debug("db_flags: DM_PERSISTENT_DEV_FLAG set In\n");
+		aprint_debug("dbg_flags: DM_PERSISTENT_DEV_FLAG set In\n");
 
 	if (flags & DM_STATUS_TABLE_FLAG)
 		aprint_debug("dbg_flags: DM_STATUS_TABLE_FLAG set In\n");

Index: src/sys/dev/dm/dm_target_stripe.c
diff -u src/sys/dev/dm/dm_target_stripe.c:1.28 src/sys/dev/dm/dm_target_stripe.c:1.29
--- src/sys/dev/dm/dm_target_stripe.c:1.28	Fri Dec  6 16:11:59 2019
+++ src/sys/dev/dm/dm_target_stripe.c	Fri Dec  6 16:33:47 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target_stripe.c,v 1.28 2019/12/06 16:11:59 tkusumi Exp $*/
+/*$NetBSD: dm_target_stripe.c,v 1.29 2019/12/06 16:33:47 tkusumi Exp $*/
 
 /*
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_target_stripe.c,v 1.28 2019/12/06 16:11:59 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_stripe.c,v 1.29 2019/12/06 16:33:47 tkusumi Exp $");
 
 /*
  * This file implements initial version of device-mapper stripe target.
@@ -241,11 +241,11 @@ dm_target_stripe_strategy(dm_table_entry
 	blkoff = 0;
 	num_blks = bp->b_resid / DEV_BSIZE;
 	for (;;) {
-		/* blockno to strip piece nr */
+		/* blockno to stripe piece nr */
 		stripe = blkno / tsc->stripe_chunksize;
 		stripe_off = blkno % tsc->stripe_chunksize;
 
-		/* where we are inside the strip */
+		/* where we are inside the stripe */
 		stripe_devnr = stripe % tsc->stripe_num;
 		stripe_blknr = stripe / tsc->stripe_num;
 



CVS commit: src/sys/dev/dm

2019-12-06 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Fri Dec  6 16:46:14 UTC 2019

Modified Files:
src/sys/dev/dm: dm_pdev.c dm_target_linear.c dm_target_zero.c
netbsd-dm.h

Log Message:
dm: Remove trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/dm/dm_pdev.c
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/dm/dm_target_linear.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/dm/dm_target_zero.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/dm/netbsd-dm.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/dm/dm_pdev.c
diff -u src/sys/dev/dm/dm_pdev.c:1.15 src/sys/dev/dm/dm_pdev.c:1.16
--- src/sys/dev/dm/dm_pdev.c:1.15	Wed Dec  4 16:55:30 2019
+++ src/sys/dev/dm/dm_pdev.c	Fri Dec  6 16:46:14 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_pdev.c,v 1.15 2019/12/04 16:55:30 tkusumi Exp $  */
+/*$NetBSD: dm_pdev.c,v 1.16 2019/12/06 16:46:14 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_pdev.c,v 1.15 2019/12/04 16:55:30 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_pdev.c,v 1.16 2019/12/06 16:46:14 tkusumi Exp $");
 
 #include 
 #include 
@@ -240,15 +240,14 @@ static int
 dm_pdev_dump_list(void)
 {
 	dm_pdev_t *dmp;
-	
+
 	aprint_verbose("Dumping dm_pdev_list\n");
-	
+
 	SLIST_FOREACH(dmp, _pdev_list, next_pdev) {
 		aprint_verbose("dm_pdev_name %s ref_cnt %d list_rf_cnt %d\n",
 		dmp->name, dmp->ref_cnt, dmp->list_ref_cnt);
 	}
-	
+
 	return 0;
-	
 }
 #endif

Index: src/sys/dev/dm/dm_target_linear.c
diff -u src/sys/dev/dm/dm_target_linear.c:1.22 src/sys/dev/dm/dm_target_linear.c:1.23
--- src/sys/dev/dm/dm_target_linear.c:1.22	Thu Dec  5 16:59:43 2019
+++ src/sys/dev/dm/dm_target_linear.c	Fri Dec  6 16:46:14 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target_linear.c,v 1.22 2019/12/05 16:59:43 tkusumi Exp $  */
+/*$NetBSD: dm_target_linear.c,v 1.23 2019/12/06 16:46:14 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_target_linear.c,v 1.22 2019/12/05 16:59:43 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_linear.c,v 1.23 2019/12/06 16:46:14 tkusumi Exp $");
 
 /*
  * This file implements initial version of device-mapper dklinear target.
@@ -146,9 +146,9 @@ dm_target_linear_sync(dm_table_entry_t *
 	tlc = table_en->target_config;
 
 	cmd = 1;
-	
+
 	return VOP_IOCTL(tlc->pdev->pdev_vnode,  DIOCCACHESYNC, ,
-	FREAD|FWRITE, kauth_cred_get());	
+	FREAD|FWRITE, kauth_cred_get());
 }
 
 /*

Index: src/sys/dev/dm/dm_target_zero.c
diff -u src/sys/dev/dm/dm_target_zero.c:1.16 src/sys/dev/dm/dm_target_zero.c:1.17
--- src/sys/dev/dm/dm_target_zero.c:1.16	Fri Dec  6 16:11:59 2019
+++ src/sys/dev/dm/dm_target_zero.c	Fri Dec  6 16:46:14 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target_zero.c,v 1.16 2019/12/06 16:11:59 tkusumi Exp $  */
+/*$NetBSD: dm_target_zero.c,v 1.17 2019/12/06 16:46:14 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_target_zero.c,v 1.16 2019/12/06 16:11:59 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_zero.c,v 1.17 2019/12/06 16:46:14 tkusumi Exp $");
 
 /*
  * This file implements initial version of device-mapper zero target.
@@ -84,7 +84,7 @@ dm_target_zero_modcmd(modcmd_t cmd, void
 		dmt->init = _target_zero_init;
 		dmt->status = _target_zero_status;
 		dmt->strategy = _target_zero_strategy;
-		dmt->sync = _target_zero_sync;		 
+		dmt->sync = _target_zero_sync;
 		dmt->deps = _target_zero_deps;
 		dmt->destroy = _target_zero_destroy;
 		dmt->upcall = _target_zero_upcall;

Index: src/sys/dev/dm/netbsd-dm.h
diff -u src/sys/dev/dm/netbsd-dm.h:1.9 src/sys/dev/dm/netbsd-dm.h:1.10
--- src/sys/dev/dm/netbsd-dm.h:1.9	Tue Dec  3 15:03:14 2019
+++ src/sys/dev/dm/netbsd-dm.h	Fri Dec  6 16:46:14 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: netbsd-dm.h,v 1.9 2019/12/03 15:03:14 tkusumi Exp $  */
+/*$NetBSD: netbsd-dm.h,v 1.10 2019/12/06 16:46:14 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  * ...
  *
  * dev
- *  
+ * 
  *
  * flags
  * 
@@ -110,7 +110,7 @@
  */
 
 /*
- * DM_DEV_LIST == "names" 
+ * DM_DEV_LIST == "names"
  * Request list of device-mapper created devices from kernel.
  *
  * 
@@ -128,7 +128,7 @@
  */
 
  /*
-  * DM_DEV_RENAME == "rename" 
+  * DM_DEV_RENAME == "rename"
   * Rename device to string.
   *
   * 
@@ -138,14 +138,14 @@
   */
 
  /*
-  * DM_DEV_STATUS == "info, mknodes" 
+  * DM_DEV_STATUS == "info, mknodes"
   * Will change fields DM_IOCTL_OPEN, DM_IOCTL_DEV in received dictionary,
   * with dm device values with 

CVS commit: src/sys/dev/dm

2019-12-07 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Dec  7 16:13:39 UTC 2019

Modified Files:
src/sys/dev/dm: device-mapper.c

Log Message:
dm: Fix indentation


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/dm/device-mapper.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/dev/dm/device-mapper.c
diff -u src/sys/dev/dm/device-mapper.c:1.46 src/sys/dev/dm/device-mapper.c:1.47
--- src/sys/dev/dm/device-mapper.c:1.46	Fri Dec  6 16:33:47 2019
+++ src/sys/dev/dm/device-mapper.c	Sat Dec  7 16:13:39 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: device-mapper.c,v 1.46 2019/12/06 16:33:47 tkusumi Exp $ */
+/*$NetBSD: device-mapper.c,v 1.47 2019/12/07 16:13:39 tkusumi Exp $ */
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -149,7 +149,7 @@ static const struct cmd_function {
 	{ .cmd = "reload",  .fn = dm_table_load_ioctl,.allowed = 0 },
 	{ .cmd = "status",  .fn = dm_table_status_ioctl,  .allowed = 1 },
 	{ .cmd = "table",   .fn = dm_table_status_ioctl,  .allowed = 1 },
-	{ .cmd = NULL,  .fn = NULL,			  .allowed = 0 }
+	{ .cmd = NULL,  .fn = NULL,   .allowed = 0 },
 };
 
 #ifdef _MODULE
@@ -431,18 +431,17 @@ dm_ioctl_switch(u_long cmd)
 		aprint_debug("dm NETBSD_DM_IOCTL called\n");
 		break;
 	default:
-		 aprint_debug("dm unknown ioctl called\n");
-		 return ENOTTY;
-		 break; /* NOT REACHED */
+		aprint_debug("dm unknown ioctl called\n");
+		return ENOTTY;
+		break; /* NOT REACHED */
 	}
 
-	 return 0;
+	return 0;
 }
 
- /*
-  * Check for disk specific ioctls.
-  */
-
+/*
+ * Check for disk specific ioctls.
+ */
 static int
 disk_ioctl_switch(dev_t dev, u_long cmd, void *data)
 {



CVS commit: src/sys/dev/dm

2019-12-07 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Dec  7 16:13:39 UTC 2019

Modified Files:
src/sys/dev/dm: device-mapper.c

Log Message:
dm: Fix indentation


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/dm/device-mapper.c

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



CVS commit: src/sys/dev/dm

2019-12-07 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Dec  7 15:28:39 UTC 2019

Modified Files:
src/sys/dev/dm: dm.h dm_dev.c dm_pdev.c dm_table.c dm_target.c
dm_target_error.c dm_target_linear.c dm_target_mirror.c
dm_target_snapshot.c dm_target_stripe.c dm_target_zero.c
src/sys/dev/dm/doc: locking.txt

Log Message:
dm: Fix strange pointer declarations

Should be "type *name" or "type* name", but not "type * name".
taken-from: DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/dm/dm.h
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/dm/dm_dev.c \
src/sys/dev/dm/dm_target_mirror.c
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/dm/dm_pdev.c \
src/sys/dev/dm/dm_target_zero.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/dm/dm_table.c
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/dm/dm_target.c \
src/sys/dev/dm/dm_target_snapshot.c
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/dm/dm_target_error.c
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/dm/dm_target_linear.c
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/dm/dm_target_stripe.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/dm/doc/locking.txt

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/dm/dm.h
diff -u src/sys/dev/dm/dm.h:1.33 src/sys/dev/dm/dm.h:1.34
--- src/sys/dev/dm/dm.h:1.33	Thu Dec  5 15:52:39 2019
+++ src/sys/dev/dm/dm.h	Sat Dec  7 15:28:39 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm.h,v 1.33 2019/12/05 15:52:39 tkusumi Exp $  */
+/*$NetBSD: dm.h,v 1.34 2019/12/07 15:28:39 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -276,7 +276,7 @@ int dm_target_init(void);
 
 /* dm_target_linear.c */
 int dm_target_linear_init(dm_dev_t *, void**, char *);
-char * dm_target_linear_status(void *);
+char *dm_target_linear_status(void *);
 int dm_target_linear_strategy(dm_table_entry_t *, struct buf *);
 int dm_target_linear_sync(dm_table_entry_t *);
 int dm_target_linear_deps(dm_table_entry_t *, prop_array_t);
@@ -289,7 +289,7 @@ uint64_t atoi(const char *);
 
 /* dm_target_stripe.c */
 int dm_target_stripe_init(dm_dev_t *, void**, char *);
-char * dm_target_stripe_status(void *);
+char *dm_target_stripe_status(void *);
 int dm_target_stripe_strategy(dm_table_entry_t *, struct buf *);
 int dm_target_stripe_sync(dm_table_entry_t *);
 int dm_target_stripe_deps(dm_table_entry_t *, prop_array_t);
@@ -305,7 +305,7 @@ int dm_table_destroy(dm_table_head_t *, 
 uint64_t dm_table_size(dm_table_head_t *);
 uint64_t dm_inactive_table_size(dm_table_head_t *);
 void dm_table_disksize(dm_table_head_t *, uint64_t *, unsigned *);
-dm_table_t * dm_table_get_entry(dm_table_head_t *, uint8_t);
+dm_table_t *dm_table_get_entry(dm_table_head_t *, uint8_t);
 int dm_table_get_target_count(dm_table_head_t *, uint8_t);
 void dm_table_release(dm_table_head_t *, uint8_t s);
 void dm_table_switch_tables(dm_table_head_t *);

Index: src/sys/dev/dm/dm_dev.c
diff -u src/sys/dev/dm/dm_dev.c:1.13 src/sys/dev/dm/dm_dev.c:1.14
--- src/sys/dev/dm/dm_dev.c:1.13	Wed Dec  4 15:31:12 2019
+++ src/sys/dev/dm/dm_dev.c	Sat Dec  7 15:28:39 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_dev.c,v 1.13 2019/12/04 15:31:12 tkusumi Exp $  */
+/*$NetBSD: dm_dev.c,v 1.14 2019/12/07 15:28:39 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_dev.c,v 1.13 2019/12/04 15:31:12 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_dev.c,v 1.14 2019/12/07 15:28:39 tkusumi Exp $");
 
 #include 
 #include 
@@ -54,7 +54,7 @@ static kmutex_t dm_dev_mutex;
 
 /* dm_dev_mutex must be holdby caller before using disable_dev. */
 __inline static void
-disable_dev(dm_dev_t * dmv)
+disable_dev(dm_dev_t *dmv)
 {
 	TAILQ_REMOVE(_dev_list, dmv, next_devlist);
 	mutex_enter(>dev_mtx);
@@ -175,7 +175,7 @@ dm_dev_lookup_uuid(const char *dm_dev_uu
  * Insert new device to the global list of devices.
  */
 int
-dm_dev_insert(dm_dev_t * dev)
+dm_dev_insert(dm_dev_t *dev)
 {
 	dm_dev_t *dmv;
 	int r;
@@ -331,7 +331,7 @@ dm_dev_alloc(void)
  * Freed device entry.
  */
 int
-dm_dev_free(dm_dev_t * dmv)
+dm_dev_free(dm_dev_t *dmv)
 {
 	KASSERT(dmv != NULL);
 
@@ -348,7 +348,7 @@ dm_dev_free(dm_dev_t * dmv)
 }
 
 void
-dm_dev_busy(dm_dev_t * dmv)
+dm_dev_busy(dm_dev_t *dmv)
 {
 	mutex_enter(>dev_mtx);
 	dmv->ref_cnt++;
@@ -356,7 +356,7 @@ dm_dev_busy(dm_dev_t * dmv)
 }
 
 void
-dm_dev_unbusy(dm_dev_t * dmv)
+dm_dev_unbusy(dm_dev_t *dmv)
 {
 	KASSERT(dmv->ref_cnt != 0);
 
Index: src/sys/dev/dm/dm_target_mirror.c
diff -u src/sys/dev/dm/dm_target_mirror.c:1.13 src/sys/dev/dm/dm_target_mirror.c:1.14
--- src/sys/dev/dm/dm_target_mirror.c:1.13	Fri Dec  6 16:11:59 2019
+++ src/sys/dev/dm/dm_target_mirror.c	Sat Dec  7 15:28:39 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target_mirror.c,v 1.13 2019/12/06 16:11:59 tkusumi Exp $*/
+/*$NetBSD: 

CVS commit: src/sys/dev/dm

2019-12-07 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Dec  7 15:28:39 UTC 2019

Modified Files:
src/sys/dev/dm: dm.h dm_dev.c dm_pdev.c dm_table.c dm_target.c
dm_target_error.c dm_target_linear.c dm_target_mirror.c
dm_target_snapshot.c dm_target_stripe.c dm_target_zero.c
src/sys/dev/dm/doc: locking.txt

Log Message:
dm: Fix strange pointer declarations

Should be "type *name" or "type* name", but not "type * name".
taken-from: DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/dm/dm.h
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/dm/dm_dev.c \
src/sys/dev/dm/dm_target_mirror.c
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/dm/dm_pdev.c \
src/sys/dev/dm/dm_target_zero.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/dm/dm_table.c
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/dm/dm_target.c \
src/sys/dev/dm/dm_target_snapshot.c
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/dm/dm_target_error.c
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/dm/dm_target_linear.c
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/dm/dm_target_stripe.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/dm/doc/locking.txt

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



CVS commit: src/sys/dev/dm

2019-12-07 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sun Dec  8 04:41:02 UTC 2019

Modified Files:
src/sys/dev/dm: dm.h dm_ioctl.c dm_target_error.c dm_target_linear.c
dm_target_mirror.c dm_target_snapshot.c dm_target_stripe.c
dm_target_zero.c

Log Message:
dm: Refactor target's ->init() i/f

Take dm_table_entry_t* instead of void**.
Remove dm_dev_t* unneeded by target code.
No functional change, but for future changes.

taken-from: DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/dm/dm.h
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/dm/dm_ioctl.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/dm/dm_target_error.c
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/dm/dm_target_linear.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/dm/dm_target_mirror.c
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/dm/dm_target_snapshot.c
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/dm/dm_target_stripe.c
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/dm/dm_target_zero.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/dev/dm/dm.h
diff -u src/sys/dev/dm/dm.h:1.34 src/sys/dev/dm/dm.h:1.35
--- src/sys/dev/dm/dm.h:1.34	Sat Dec  7 15:28:39 2019
+++ src/sys/dev/dm/dm.h	Sun Dec  8 04:41:02 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm.h,v 1.34 2019/12/07 15:28:39 tkusumi Exp $  */
+/*$NetBSD: dm.h,v 1.35 2019/12/08 04:41:02 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -213,7 +213,7 @@ typedef struct target_snapshot_origin_co
 typedef struct dm_target {
 	char name[DM_MAX_TYPE_NAME];
 	/* Initialize target_config area */
-	int (*init)(dm_dev_t *, void **, char *);
+	int (*init)(dm_table_entry_t *, char *);
 
 	/* Destroy target_config area */
 	int (*destroy)(dm_table_entry_t *);
@@ -275,7 +275,7 @@ int dm_target_init(void);
 #define DM_MAX_PARAMS_SIZE 1024
 
 /* dm_target_linear.c */
-int dm_target_linear_init(dm_dev_t *, void**, char *);
+int dm_target_linear_init(dm_table_entry_t *, char *);
 char *dm_target_linear_status(void *);
 int dm_target_linear_strategy(dm_table_entry_t *, struct buf *);
 int dm_target_linear_sync(dm_table_entry_t *);
@@ -288,7 +288,7 @@ int dm_target_linear_secsize(dm_table_en
 uint64_t atoi(const char *);
 
 /* dm_target_stripe.c */
-int dm_target_stripe_init(dm_dev_t *, void**, char *);
+int dm_target_stripe_init(dm_table_entry_t *, char *);
 char *dm_target_stripe_status(void *);
 int dm_target_stripe_strategy(dm_table_entry_t *, struct buf *);
 int dm_target_stripe_sync(dm_table_entry_t *);

Index: src/sys/dev/dm/dm_ioctl.c
diff -u src/sys/dev/dm/dm_ioctl.c:1.39 src/sys/dev/dm/dm_ioctl.c:1.40
--- src/sys/dev/dm/dm_ioctl.c:1.39	Fri Dec  6 16:33:47 2019
+++ src/sys/dev/dm/dm_ioctl.c	Sun Dec  8 04:41:02 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: dm_ioctl.c,v 1.39 2019/12/06 16:33:47 tkusumi Exp $  */
+/* $NetBSD: dm_ioctl.c,v 1.40 2019/12/08 04:41:02 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_ioctl.c,v 1.39 2019/12/06 16:33:47 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_ioctl.c,v 1.40 2019/12/08 04:41:02 tkusumi Exp $");
 
 /*
  * Locking is used to synchronise between ioctl calls and between dm_table's
@@ -780,8 +780,7 @@ dm_table_load_ioctl(prop_dictionary_t dm
 		 * routine and parse parameters there.
 		 */
 
-		if ((ret = target->init(dmv, _en->target_config,
-			str)) != 0) {
+		if ((ret = target->init(table_en, str)) != 0) {
 			dm_table_release(>table_head, DM_TABLE_INACTIVE);
 			dm_table_destroy(>table_head, DM_TABLE_INACTIVE);
 			free(str, M_TEMP);

Index: src/sys/dev/dm/dm_target_error.c
diff -u src/sys/dev/dm/dm_target_error.c:1.16 src/sys/dev/dm/dm_target_error.c:1.17
--- src/sys/dev/dm/dm_target_error.c:1.16	Sat Dec  7 15:28:39 2019
+++ src/sys/dev/dm/dm_target_error.c	Sun Dec  8 04:41:02 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target_error.c,v 1.16 2019/12/07 15:28:39 tkusumi Exp $  */
+/*$NetBSD: dm_target_error.c,v 1.17 2019/12/08 04:41:02 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_target_error.c,v 1.16 2019/12/07 15:28:39 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_error.c,v 1.17 2019/12/08 04:41:02 tkusumi Exp $");
 
 /*
  * This file implements initial version of device-mapper error target.
@@ -42,7 +42,7 @@ __KERNEL_RCSID(0, "$NetBSD: dm_target_er
 #include "dm.h"
 
 /* dm_target_error.c */
-int dm_target_error_init(dm_dev_t *, void**, char *);
+int dm_target_error_init(dm_table_entry_t*, char *);
 char *dm_target_error_status(void *);
 int dm_target_error_strategy(dm_table_entry_t *, struct buf *);
 int dm_target_error_sync(dm_table_entry_t *);
@@ -110,12 +110,12 @@ dm_target_error_modcmd(modcmd_t cmd, voi
 
 /* Init 

CVS commit: src/sys/dev/dm

2019-12-07 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sun Dec  8 04:41:02 UTC 2019

Modified Files:
src/sys/dev/dm: dm.h dm_ioctl.c dm_target_error.c dm_target_linear.c
dm_target_mirror.c dm_target_snapshot.c dm_target_stripe.c
dm_target_zero.c

Log Message:
dm: Refactor target's ->init() i/f

Take dm_table_entry_t* instead of void**.
Remove dm_dev_t* unneeded by target code.
No functional change, but for future changes.

taken-from: DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/dm/dm.h
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/dm/dm_ioctl.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/dm/dm_target_error.c
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/dm/dm_target_linear.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/dm/dm_target_mirror.c
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/dm/dm_target_snapshot.c
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/dm/dm_target_stripe.c
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/dm/dm_target_zero.c

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



CVS commit: src/sys/dev/dm

2019-12-08 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sun Dec  8 10:35:53 UTC 2019

Modified Files:
src/sys/dev/dm: dm.h dm_target.c dm_target_snapshot.c

Log Message:
dm: Unbreak compilation of kernel modules

The dm kernel modules (MK_DM_TARGETS enabled in sys/modules/dm/Makefile)
have been broken. Unbreak the build.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/dm/dm.h
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/dm/dm_target.c
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/dm/dm_target_snapshot.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/dev/dm/dm.h
diff -u src/sys/dev/dm/dm.h:1.35 src/sys/dev/dm/dm.h:1.36
--- src/sys/dev/dm/dm.h:1.35	Sun Dec  8 04:41:02 2019
+++ src/sys/dev/dm/dm.h	Sun Dec  8 10:35:53 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm.h,v 1.35 2019/12/08 04:41:02 tkusumi Exp $  */
+/*$NetBSD: dm.h,v 1.36 2019/12/08 10:35:53 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -265,7 +265,7 @@ int dm_target_destroy(void);
 int dm_target_insert(dm_target_t *);
 prop_array_t dm_target_prop_list(void);
 dm_target_t* dm_target_lookup(const char *);
-int dm_target_rem(char *);
+int dm_target_rem(const char *);
 void dm_target_unbusy(dm_target_t *);
 void dm_target_busy(dm_target_t *);
 

Index: src/sys/dev/dm/dm_target.c
diff -u src/sys/dev/dm/dm_target.c:1.25 src/sys/dev/dm/dm_target.c:1.26
--- src/sys/dev/dm/dm_target.c:1.25	Sat Dec  7 15:28:39 2019
+++ src/sys/dev/dm/dm_target.c	Sun Dec  8 10:35:53 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target.c,v 1.25 2019/12/07 15:28:39 tkusumi Exp $  */
+/*$NetBSD: dm_target.c,v 1.26 2019/12/08 10:35:53 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_target.c,v 1.25 2019/12/07 15:28:39 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target.c,v 1.26 2019/12/08 10:35:53 tkusumi Exp $");
 
 #include 
 #include 
@@ -183,7 +183,7 @@ dm_target_insert(dm_target_t *dm_target)
  * Remove target from TAIL, target is selected with its name.
  */
 int
-dm_target_rem(char *dm_target_name)
+dm_target_rem(const char *dm_target_name)
 {
 	dm_target_t *dmt;
 

Index: src/sys/dev/dm/dm_target_snapshot.c
diff -u src/sys/dev/dm/dm_target_snapshot.c:1.26 src/sys/dev/dm/dm_target_snapshot.c:1.27
--- src/sys/dev/dm/dm_target_snapshot.c:1.26	Sun Dec  8 04:41:02 2019
+++ src/sys/dev/dm/dm_target_snapshot.c	Sun Dec  8 10:35:53 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target_snapshot.c,v 1.26 2019/12/08 04:41:02 tkusumi Exp $  */
+/*$NetBSD: dm_target_snapshot.c,v 1.27 2019/12/08 10:35:53 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_target_snapshot.c,v 1.26 2019/12/08 04:41:02 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_snapshot.c,v 1.27 2019/12/08 10:35:53 tkusumi Exp $");
 
 /*
  * 1. Suspend my_data to temporarily stop any I/O while the snapshot is being
@@ -240,8 +240,6 @@ dm_target_snapshot_init(dm_table_entry_t
 
 	table_en->target_config = tsc;
 
-	dmv->sec_size = dmp_snap->dmp_secsize;
-
 	return 0;
 }
 
@@ -258,14 +256,13 @@ dm_target_snapshot_status(void *target_c
 	uint32_t i;
 	uint32_t count;
 	size_t prm_len, cow_len;
-	char *params, *cow_name;
+	char *params;
 
 	tsc = target_config;
 
 	prm_len = 0;
 	cow_len = 0;
 	count = 0;
-	cow_name = NULL;
 
 	printf("Snapshot target status function called\n");
 



CVS commit: src/sys/dev/dm

2019-12-08 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sun Dec  8 10:35:53 UTC 2019

Modified Files:
src/sys/dev/dm: dm.h dm_target.c dm_target_snapshot.c

Log Message:
dm: Unbreak compilation of kernel modules

The dm kernel modules (MK_DM_TARGETS enabled in sys/modules/dm/Makefile)
have been broken. Unbreak the build.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/dm/dm.h
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/dm/dm_target.c
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/dm/dm_target_snapshot.c

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



CVS commit: src/sys/dev/dm

2019-12-08 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sun Dec  8 10:50:21 UTC 2019

Modified Files:
src/sys/dev/dm: dm.h dm_target_mirror.c dm_target_snapshot.c
dm_target_stripe.c

Log Message:
dm: Move targets specific structs to .c files

These don't need to be defined and exposed in dm.h.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/dm/dm.h
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/dm/dm_target_mirror.c
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/dm/dm_target_snapshot.c
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/dm/dm_target_stripe.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/dev/dm/dm.h
diff -u src/sys/dev/dm/dm.h:1.36 src/sys/dev/dm/dm.h:1.37
--- src/sys/dev/dm/dm.h:1.36	Sun Dec  8 10:35:53 2019
+++ src/sys/dev/dm/dm.h	Sun Dec  8 10:50:21 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm.h,v 1.36 2019/12/08 10:35:53 tkusumi Exp $  */
+/*$NetBSD: dm.h,v 1.37 2019/12/08 10:50:21 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -170,45 +170,6 @@ TAILQ_HEAD(target_linear_devs, target_li
 
 typedef struct target_linear_devs dm_target_linear_devs_t;
 
-/* for stripe : */
-typedef struct target_stripe_config {
-#define DM_STRIPE_DEV_OFFSET 2
-	struct target_linear_devs stripe_devs;
-	uint8_t stripe_num;
-	uint64_t stripe_chunksize;
-	size_t params_len;
-} dm_target_stripe_config_t;
-
-/* for mirror : */
-typedef struct target_mirror_config {
-#define MAX_MIRROR_COPIES 4
-	dm_pdev_t *orig;
-	dm_pdev_t *copies[MAX_MIRROR_COPIES];
-
-	/* copied blocks bitmaps administration etc*/
-	dm_pdev_t *log_pdev;	/* for administration */
-	uint64_t log_regionsize;	/* blocksize of mirror */
-
-	/* list of parts that still need copied etc.; run length encoded? */
-} dm_target_mirror_config_t;
-
-
-/* for snapshot : */
-typedef struct target_snapshot_config {
-	dm_pdev_t *tsc_snap_dev;
-	/* cow dev is set only for persistent snapshot devices */
-	dm_pdev_t *tsc_cow_dev;
-
-	uint64_t tsc_chunk_size;
-	uint32_t tsc_persistent_dev;
-} dm_target_snapshot_config_t;
-
-/* for snapshot-origin devices */
-typedef struct target_snapshot_origin_config {
-	dm_pdev_t *tsoc_real_dev;
-	/* list of snapshots ? */
-} dm_target_snapshot_origin_config_t;
-
 /* constant dm_target structures for error, zero, linear, stripes etc. */
 typedef struct dm_target {
 	char name[DM_MAX_TYPE_NAME];

Index: src/sys/dev/dm/dm_target_mirror.c
diff -u src/sys/dev/dm/dm_target_mirror.c:1.15 src/sys/dev/dm/dm_target_mirror.c:1.16
--- src/sys/dev/dm/dm_target_mirror.c:1.15	Sun Dec  8 04:41:02 2019
+++ src/sys/dev/dm/dm_target_mirror.c	Sun Dec  8 10:50:21 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target_mirror.c,v 1.15 2019/12/08 04:41:02 tkusumi Exp $*/
+/*$NetBSD: dm_target_mirror.c,v 1.16 2019/12/08 10:50:21 tkusumi Exp $*/
 
 /*
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_target_mirror.c,v 1.15 2019/12/08 04:41:02 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_mirror.c,v 1.16 2019/12/08 10:50:21 tkusumi Exp $");
 
 /*
  * This file implements initial version of device-mapper mirror target.
@@ -50,6 +50,18 @@ int dm_target_mirror_deps(dm_table_entry
 int dm_target_mirror_destroy(dm_table_entry_t *);
 int dm_target_mirror_upcall(dm_table_entry_t *, struct buf *);
 
+typedef struct target_mirror_config {
+#define MAX_MIRROR_COPIES 4
+	dm_pdev_t *orig;
+	dm_pdev_t *copies[MAX_MIRROR_COPIES];
+
+	/* copied blocks bitmaps administration etc*/
+	dm_pdev_t *log_pdev;	/* for administration */
+	uint64_t log_regionsize;	/* blocksize of mirror */
+
+	/* list of parts that still need copied etc.; run length encoded? */
+} dm_target_mirror_config_t;
+
 #ifdef DM_TARGET_MODULE
 /*
  * Every target can be compiled directly to dm driver or as a

Index: src/sys/dev/dm/dm_target_snapshot.c
diff -u src/sys/dev/dm/dm_target_snapshot.c:1.27 src/sys/dev/dm/dm_target_snapshot.c:1.28
--- src/sys/dev/dm/dm_target_snapshot.c:1.27	Sun Dec  8 10:35:53 2019
+++ src/sys/dev/dm/dm_target_snapshot.c	Sun Dec  8 10:50:21 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target_snapshot.c,v 1.27 2019/12/08 10:35:53 tkusumi Exp $  */
+/*$NetBSD: dm_target_snapshot.c,v 1.28 2019/12/08 10:50:21 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_target_snapshot.c,v 1.27 2019/12/08 10:35:53 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_snapshot.c,v 1.28 2019/12/08 10:50:21 tkusumi Exp $");
 
 /*
  * 1. Suspend my_data to temporarily stop any I/O while the snapshot is being
@@ -103,6 +103,20 @@ int dm_target_snapshot_orig_deps(dm_tabl
 int dm_target_snapshot_orig_destroy(dm_table_entry_t *);
 int dm_target_snapshot_orig_upcall(dm_table_entry_t *, struct buf *);
 

CVS commit: src/sys/dev/dm

2019-12-08 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sun Dec  8 10:50:21 UTC 2019

Modified Files:
src/sys/dev/dm: dm.h dm_target_mirror.c dm_target_snapshot.c
dm_target_stripe.c

Log Message:
dm: Move targets specific structs to .c files

These don't need to be defined and exposed in dm.h.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/dm/dm.h
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/dm/dm_target_mirror.c
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/dm/dm_target_snapshot.c
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/dm/dm_target_stripe.c

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



CVS commit: src/sys

2019-12-16 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Mon Dec 16 14:26:23 UTC 2019

Modified Files:
src/sys/dev/dm: dm.h dm_target.c dm_target_error.c dm_target_zero.c
src/sys/modules/dm: Makefile

Log Message:
dm: Enable dm-error and dm-zero target

Add these two targets to dm.kmod.
These are generally available in Linux and DragonFlyBSD,
so enable them in NetBSD as well.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/dm/dm.h
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/dm/dm_target.c
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/dm/dm_target_error.c
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/dm/dm_target_zero.c
cvs rdiff -u -r1.7 -r1.8 src/sys/modules/dm/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/dev/dm/dm.h
diff -u src/sys/dev/dm/dm.h:1.46 src/sys/dev/dm/dm.h:1.47
--- src/sys/dev/dm/dm.h:1.46	Sun Dec 15 16:14:27 2019
+++ src/sys/dev/dm/dm.h	Mon Dec 16 14:26:23 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm.h,v 1.46 2019/12/15 16:14:27 tkusumi Exp $  */
+/*$NetBSD: dm.h,v 1.47 2019/12/16 14:26:23 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -266,6 +266,22 @@ int dm_target_stripe_destroy(dm_table_en
 int dm_target_stripe_upcall(dm_table_entry_t *, struct buf *);
 int dm_target_stripe_secsize(dm_table_entry_t *, unsigned int *);
 
+/* dm_target_error.c */
+int dm_target_error_init(dm_table_entry_t*, int, char **);
+char *dm_target_error_table(void *);
+int dm_target_error_strategy(dm_table_entry_t *, struct buf *);
+int dm_target_error_deps(dm_table_entry_t *, prop_array_t);
+int dm_target_error_destroy(dm_table_entry_t *);
+int dm_target_error_upcall(dm_table_entry_t *, struct buf *);
+
+/* dm_target_zero.c */
+int dm_target_zero_init(dm_table_entry_t *, int, char **);
+char *dm_target_zero_table(void *);
+int dm_target_zero_strategy(dm_table_entry_t *, struct buf *);
+int dm_target_zero_destroy(dm_table_entry_t *);
+int dm_target_zero_deps(dm_table_entry_t *, prop_array_t);
+int dm_target_zero_upcall(dm_table_entry_t *, struct buf *);
+
 /* dm_table.c  */
 #define DM_TABLE_ACTIVE 0
 #define DM_TABLE_INACTIVE 1

Index: src/sys/dev/dm/dm_target.c
diff -u src/sys/dev/dm/dm_target.c:1.32 src/sys/dev/dm/dm_target.c:1.33
--- src/sys/dev/dm/dm_target.c:1.32	Sun Dec 15 14:39:42 2019
+++ src/sys/dev/dm/dm_target.c	Mon Dec 16 14:26:23 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target.c,v 1.32 2019/12/15 14:39:42 tkusumi Exp $  */
+/*$NetBSD: dm_target.c,v 1.33 2019/12/16 14:26:23 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_target.c,v 1.32 2019/12/15 14:39:42 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target.c,v 1.33 2019/12/16 14:26:23 tkusumi Exp $");
 
 #include 
 #include 
@@ -312,14 +312,11 @@ dm_target_prop_list(void)
 int
 dm_target_init(void)
 {
-	dm_target_t *dmt, *dmt3;
-	int r;
+	dm_target_t *dmt;
 
 	mutex_init(_target_mutex, MUTEX_DEFAULT, IPL_NONE);
 
 	dmt = dm_target_alloc("linear");
-	dmt3 = dm_target_alloc("striped");
-
 	dmt->version[0] = 1;
 	dmt->version[1] = 0;
 	dmt->version[2] = 2;
@@ -331,22 +328,49 @@ dm_target_init(void)
 	dmt->destroy = _target_linear_destroy;
 	dmt->upcall = _target_linear_upcall;
 	dmt->secsize = _target_linear_secsize;
+	if (dm_target_insert(dmt))
+		printf("Failed to insert linear\n");
 
-	r = dm_target_insert(dmt);
+	dmt = dm_target_alloc("striped");
+	dmt->version[0] = 1;
+	dmt->version[1] = 0;
+	dmt->version[2] = 3;
+	dmt->init = _target_stripe_init;
+	dmt->table = _target_stripe_table;
+	dmt->strategy = _target_stripe_strategy;
+	dmt->sync = _target_stripe_sync;
+	dmt->deps = _target_stripe_deps;
+	dmt->destroy = _target_stripe_destroy;
+	dmt->upcall = _target_stripe_upcall;
+	dmt->secsize = _target_stripe_secsize;
+	if (dm_target_insert(dmt))
+		printf("Failed to insert striped\n");
 
-	dmt3->version[0] = 1;
-	dmt3->version[1] = 0;
-	dmt3->version[2] = 3;
-	dmt3->init = _target_stripe_init;
-	dmt3->table = _target_stripe_table;
-	dmt3->strategy = _target_stripe_strategy;
-	dmt3->sync = _target_stripe_sync;
-	dmt3->deps = _target_stripe_deps;
-	dmt3->destroy = _target_stripe_destroy;
-	dmt3->upcall = _target_stripe_upcall;
-	dmt3->secsize = _target_stripe_secsize;
+	dmt = dm_target_alloc("error");
+	dmt->version[0] = 1;
+	dmt->version[1] = 0;
+	dmt->version[2] = 0;
+	dmt->init = _target_error_init;
+	dmt->table = _target_error_table;
+	dmt->strategy = _target_error_strategy;
+	dmt->deps = _target_error_deps;
+	dmt->destroy = _target_error_destroy;
+	dmt->upcall = _target_error_upcall;
+	if (dm_target_insert(dmt))
+		printf("Failed to insert error\n");
 
-	r = dm_target_insert(dmt3);
+	dmt = dm_target_alloc("zero");
+	dmt->version[0] = 1;
+	dmt->version[1] = 0;
+	dmt->version[2] = 0;
+	dmt->init = _target_zero_init;
+	

CVS commit: src/sys

2019-12-16 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Mon Dec 16 14:26:23 UTC 2019

Modified Files:
src/sys/dev/dm: dm.h dm_target.c dm_target_error.c dm_target_zero.c
src/sys/modules/dm: Makefile

Log Message:
dm: Enable dm-error and dm-zero target

Add these two targets to dm.kmod.
These are generally available in Linux and DragonFlyBSD,
so enable them in NetBSD as well.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/dm/dm.h
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/dm/dm_target.c
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/dm/dm_target_error.c
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/dm/dm_target_zero.c
cvs rdiff -u -r1.7 -r1.8 src/sys/modules/dm/Makefile

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



CVS commit: src/sys/dev/dm

2019-12-16 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Mon Dec 16 15:59:05 UTC 2019

Modified Files:
src/sys/dev/dm: dm.h

Log Message:
dm: Cleanup dm.h (remove unneeded comments, etc)


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/dm/dm.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/dm/dm.h
diff -u src/sys/dev/dm/dm.h:1.47 src/sys/dev/dm/dm.h:1.48
--- src/sys/dev/dm/dm.h:1.47	Mon Dec 16 14:26:23 2019
+++ src/sys/dev/dm/dm.h	Mon Dec 16 15:59:04 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm.h,v 1.47 2019/12/16 14:26:23 tkusumi Exp $  */
+/*$NetBSD: dm.h,v 1.48 2019/12/16 15:59:04 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,14 +29,12 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef _DM_DEV_H_
-#define _DM_DEV_H_
-
+#ifndef _DM_H_
+#define _DM_H_
 
 #ifdef _KERNEL
 
 #include 
-
 #include 
 #include 
 #include 
@@ -45,7 +43,6 @@
 #include 
 #include 
 #include 
-
 #include 
 #include 
 #include 
@@ -72,7 +69,6 @@ extern uint32_t dm_dev_counter;
  * A device mapper table is a list of physical ranges plus the mapping target
  * applied to them.
  */
-
 typedef struct dm_table_entry {
 	struct dm_dev *dm_dev;		/* backlink */
 	uint64_t start;
@@ -90,10 +86,10 @@ typedef struct dm_table dm_table_t;
 typedef struct dm_table_head {
 	/* Current active table is selected with this. */
 	int cur_active_table;
-	struct dm_table tables[2];
+	dm_table_t tables[2];
 
 	kmutex_t   table_mtx;
-	kcondvar_t table_cv; /*IO waiting cv */
+	kcondvar_t table_cv; /* I/O waiting cv */
 
 	uint32_t io_cnt;
 } dm_table_head_t;
@@ -105,7 +101,6 @@ typedef struct dm_table_head {
  * I need this because devices can be opened only once, but I can
  * have more than one device on one partition.
  */
-
 typedef struct dm_pdev {
 	char name[MAX_DEV_NAME];
 
@@ -150,13 +145,7 @@ typedef struct dm_dev {
 	TAILQ_ENTRY(dm_dev) next_devlist; /* Major device list. */
 } dm_dev_t;
 
-/* for zero, error : dm_target->target_config == NULL */
-
-/*
- * Target config is initiated with target_init function.
- */
-
-/* for linear : */
+/* For linear target. */
 typedef struct target_linear_config {
 	dm_pdev_t *pdev;
 	uint64_t offset;
@@ -182,7 +171,7 @@ typedef struct dm_target {
 	/* Destroy target_config area */
 	int (*destroy)(dm_table_entry_t *);
 
-	int (*deps) (dm_table_entry_t *, prop_array_t);
+	int (*deps)(dm_table_entry_t *, prop_array_t);
 	/*
 	 * Info/table routine are called to get params string, which is target
 	 * specific. When dm_table_status_ioctl is called with flag
@@ -205,8 +194,6 @@ typedef struct dm_target {
 	TAILQ_ENTRY(dm_target) dm_target_next;
 } dm_target_t;
 
-/* Interface structures */
-
 /* device-mapper */
 void dmgetproperties(struct disk *, dm_table_head_t *);
 
@@ -240,8 +227,6 @@ dm_target_t* dm_target_lookup(const char
 int dm_target_rem(const char *);
 void dm_target_unbusy(dm_target_t *);
 void dm_target_busy(dm_target_t *);
-
-/* XXX temporally add */
 int dm_target_init(void);
 
 #define DM_MAX_PARAMS_SIZE 1024
@@ -319,4 +304,4 @@ dm_pdev_t* dm_pdev_insert(const char *);
 
 #endif /*_KERNEL*/
 
-#endif /*_DM_DEV_H_*/
+#endif /*_DM_H_*/



CVS commit: src/sys/dev/dm

2019-12-16 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Mon Dec 16 15:59:05 UTC 2019

Modified Files:
src/sys/dev/dm: dm.h

Log Message:
dm: Cleanup dm.h (remove unneeded comments, etc)


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/dm/dm.h

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



  1   2   3   >