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 <sys/types.h>
 #include <sys/param.h>
-
 #include <sys/buf.h>
 #include <sys/conf.h>
 #include <sys/device.h>
@@ -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, &dm_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 - table_start) / DEV_BSIZE;
-
 			table_en->target->strategy(table_en, nestbuf);
 		}
 	}
@@ -656,7 +637,7 @@ dmstrategy(struct buf *bp)
 		nestiobuf_done(bp, buf_len - issued_len, EINVAL);
 
 	mutex_enter(&dmv->diskp_mtx);
-	disk_unbusy(dmv->diskp, buf_len, bp != NULL ? bp->b_flags & B_READ : 0);
+	disk_unbusy(dmv->diskp, buf_len, bp ? (bp->b_flags & B_READ) : 0);
 	mutex_exit(&dmv->diskp_mtx);
 
 	dm_table_release(&dmv->table_head, DM_TABLE_ACTIVE);
@@ -668,14 +649,14 @@ static int
 dmread(dev_t dev, struct uio *uio, int flag)
 {
 
-	return (physio(dmstrategy, NULL, dev, B_READ, dmminphys, uio));
+	return physio(dmstrategy, NULL, dev, B_READ, dmminphys, uio);
 }
 
 static int
 dmwrite(dev_t dev, struct uio *uio, int flag)
 {
 
-	return (physio(dmstrategy, NULL, dev, B_WRITE, dmminphys, uio));
+	return physio(dmstrategy, NULL, dev, B_WRITE, dmminphys, uio);
 }
 
 static int
@@ -705,10 +686,11 @@ dmgetproperties(struct disk *disk, dm_ta
 {
 	uint64_t numsec;
 	unsigned int secsize;
+	struct disk_geom *dg;
 
 	dm_table_disksize(head, &numsec, &secsize);
 
-	struct disk_geom *dg = &disk->dk_geom;
+	dg = &disk->dk_geom;
 
 	memset(dg, 0, sizeof(*dg));
 	dg->dg_secperunit = numsec;

Index: src/sys/dev/dm/dm_dev.c
diff -u src/sys/dev/dm/dm_dev.c:1.15 src/sys/dev/dm/dm_dev.c:1.16
--- src/sys/dev/dm/dm_dev.c:1.15	Sat Dec 14 10:49:30 2019
+++ src/sys/dev/dm/dm_dev.c	Sun Dec 15 14:39:42 2019
@@ -1,4 +1,4 @@
-/*        $NetBSD: dm_dev.c,v 1.15 2019/12/14 10:49:30 tkusumi Exp $      */
+/*        $NetBSD: dm_dev.c,v 1.16 2019/12/15 14:39:42 tkusumi Exp $      */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,11 +29,10 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dm_dev.c,v 1.15 2019/12/14 10:49:30 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_dev.c,v 1.16 2019/12/15 14:39:42 tkusumi Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
-
 #include <sys/disk.h>
 #include <sys/disklabel.h>
 #include <sys/ioctl.h>
@@ -47,8 +46,7 @@ static dm_dev_t *dm_dev_lookup_name(cons
 static dm_dev_t *dm_dev_lookup_uuid(const char *);
 static dm_dev_t *dm_dev_lookup_minor(int);
 
-static struct dm_dev_head dm_dev_list =
-TAILQ_HEAD_INITIALIZER(dm_dev_list);
+static struct dm_dev_head dm_dev_list = TAILQ_HEAD_INITIALIZER(dm_dev_list);
 
 static kmutex_t dm_dev_mutex;
 
@@ -56,6 +54,7 @@ static kmutex_t dm_dev_mutex;
 __inline static void
 disable_dev(dm_dev_t *dmv)
 {
+
 	TAILQ_REMOVE(&dm_dev_list, dmv, next_devlist);
 	mutex_enter(&dmv->dev_mtx);
 	mutex_exit(&dm_dev_mutex);
@@ -74,9 +73,7 @@ dm_dev_lookup(const char *dm_dev_name, c
 {
 	dm_dev_t *dmv;
 
-	dmv = NULL;
 	mutex_enter(&dm_dev_mutex);
-
 	/* KASSERT(dm_dev_name != NULL && dm_dev_uuid != NULL && dm_dev_minor
 	 * > 0); */
 	if (dm_dev_minor > 0)
@@ -98,6 +95,7 @@ dm_dev_lookup(const char *dm_dev_name, c
 			return dmv;
 		}
 	mutex_exit(&dm_dev_mutex);
+
 	return NULL;
 }
 
@@ -109,10 +107,9 @@ dm_dev_lookup_minor(int dm_dev_minor)
 {
 	dm_dev_t *dmv;
 
-	TAILQ_FOREACH(dmv, &dm_dev_list, next_devlist) {
+	TAILQ_FOREACH(dmv, &dm_dev_list, next_devlist)
 		if (dm_dev_minor == dmv->minor)
 			return dmv;
-	}
 
 	return NULL;
 }
@@ -191,8 +188,8 @@ dm_dev_insert(dm_dev_t *dev)
 		TAILQ_INSERT_TAIL(&dm_dev_list, dev, next_devlist);
 	} else
 		r = EEXIST;
-
 	mutex_exit(&dm_dev_mutex);
+
 	return r;
 }
 
@@ -249,10 +246,8 @@ dm_dev_rem(const char *dm_dev_name, cons
     int dm_dev_minor)
 {
 	dm_dev_t *dmv;
-	dmv = NULL;
 
 	mutex_enter(&dm_dev_mutex);
-
 	if (dm_dev_minor > 0)
 		if ((dmv = dm_dev_lookup_minor(dm_dev_minor)) != NULL) {
 			disable_dev(dmv);
@@ -281,8 +276,8 @@ int
 dm_dev_destroy(void)
 {
 	dm_dev_t *dmv;
-	mutex_enter(&dm_dev_mutex);
 
+	mutex_enter(&dm_dev_mutex);
 	while (TAILQ_FIRST(&dm_dev_list) != NULL) {
 		dmv = TAILQ_FIRST(&dm_dev_list);
 
@@ -333,6 +328,7 @@ dm_dev_alloc(void)
 int
 dm_dev_free(dm_dev_t *dmv)
 {
+
 	KASSERT(dmv != NULL);
 
 	mutex_destroy(&dmv->dev_mtx);
@@ -350,6 +346,7 @@ dm_dev_free(dm_dev_t *dmv)
 void
 dm_dev_busy(dm_dev_t *dmv)
 {
+
 	mutex_enter(&dmv->dev_mtx);
 	dmv->ref_cnt++;
 	mutex_exit(&dmv->dev_mtx);
@@ -358,6 +355,7 @@ dm_dev_busy(dm_dev_t *dmv)
 void
 dm_dev_unbusy(dm_dev_t *dmv)
 {
+
 	KASSERT(dmv->ref_cnt != 0);
 
 	mutex_enter(&dmv->dev_mtx);
@@ -400,6 +398,7 @@ dm_dev_prop_list(void)
 int
 dm_dev_init(void)
 {
+
 	TAILQ_INIT(&dm_dev_list);	/* initialize global dev list */
 	mutex_init(&dm_dev_mutex, MUTEX_DEFAULT, IPL_NONE);
 	return 0;
Index: src/sys/dev/dm/dm_table.c
diff -u src/sys/dev/dm/dm_table.c:1.15 src/sys/dev/dm/dm_table.c:1.16
--- src/sys/dev/dm/dm_table.c:1.15	Sun Dec 15 09:42:29 2019
+++ src/sys/dev/dm/dm_table.c	Sun Dec 15 14:39:42 2019
@@ -1,4 +1,4 @@
-/*        $NetBSD: dm_table.c,v 1.15 2019/12/15 09:42:29 tkusumi Exp $      */
+/*        $NetBSD: dm_table.c,v 1.16 2019/12/15 14:39:42 tkusumi Exp $      */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,11 +29,10 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dm_table.c,v 1.15 2019/12/15 09:42:29 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_table.c,v 1.16 2019/12/15 14:39:42 tkusumi Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
-
 #include <sys/kmem.h>
 
 #include "dm.h"
@@ -86,6 +85,7 @@ dm_table_busy(dm_table_head_t *head, uin
 static void
 dm_table_unbusy(dm_table_head_t *head)
 {
+
 	KASSERT(head->io_cnt != 0);
 
 	mutex_enter(&head->table_mtx);
@@ -114,6 +114,7 @@ dm_table_get_entry(dm_table_head_t *head
 void
 dm_table_release(dm_table_head_t *head, uint8_t table_id)
 {
+
 	dm_table_unbusy(head);
 }
 
@@ -123,6 +124,7 @@ dm_table_release(dm_table_head_t *head, 
 void
 dm_table_switch_tables(dm_table_head_t *head)
 {
+
 	mutex_enter(&head->table_mtx);
 
 	while (head->io_cnt != 0)
@@ -164,7 +166,6 @@ dm_table_destroy(dm_table_head_t *head, 
 		SLIST_REMOVE(tbl, table_en, dm_table_entry, next);
 		if (table_en->target->destroy(table_en) == 0)
 			table_en->target_config = NULL;
-
 		kmem_free(table_en, sizeof(*table_en));
 	}
 	KASSERT(SLIST_EMPTY(tbl));
@@ -210,6 +211,7 @@ dm_table_size_impl(dm_table_head_t *head
 uint64_t
 dm_table_size(dm_table_head_t *head)
 {
+
 	return dm_table_size_impl(head, DM_TABLE_ACTIVE);
 }
 
@@ -219,6 +221,7 @@ dm_table_size(dm_table_head_t *head)
 uint64_t
 dm_inactive_table_size(dm_table_head_t *head)
 {
+
 	return dm_table_size_impl(head, DM_TABLE_INACTIVE);
 }
 
@@ -226,7 +229,8 @@ dm_inactive_table_size(dm_table_head_t *
  * Return combined disk geometry
  */
 void
-dm_table_disksize(dm_table_head_t *head, uint64_t *numsecp, unsigned int *secsizep)
+dm_table_disksize(dm_table_head_t *head, uint64_t *numsecp,
+    unsigned int *secsizep)
 {
 	dm_table_t *tbl;
 	dm_table_entry_t *table_en;
@@ -278,7 +282,6 @@ dm_table_get_target_count(dm_table_head_
 	target_count = 0;
 
 	id = dm_table_busy(head, table_id);
-
 	tbl = &head->tables[id];
 
 	SLIST_FOREACH(table_en, tbl, next)
@@ -289,7 +292,6 @@ dm_table_get_target_count(dm_table_head_
 	return target_count;
 }
 
-
 /*
  * Initialize table_head structures, I'm trying to keep this structure as
  * opaque as possible.
@@ -297,6 +299,7 @@ dm_table_get_target_count(dm_table_head_
 void
 dm_table_head_init(dm_table_head_t *head)
 {
+
 	head->cur_active_table = 0;
 	head->io_cnt = 0;
 
@@ -314,6 +317,7 @@ dm_table_head_init(dm_table_head_t *head
 void
 dm_table_head_destroy(dm_table_head_t *head)
 {
+
 	KASSERT(!mutex_owned(&head->table_mtx));
 	KASSERT(!cv_has_waiters(&head->table_cv));
 	/* tables doens't exists when I call this routine, therefore it

Index: src/sys/dev/dm/dm_ioctl.c
diff -u src/sys/dev/dm/dm_ioctl.c:1.45 src/sys/dev/dm/dm_ioctl.c:1.46
--- src/sys/dev/dm/dm_ioctl.c:1.45	Sun Dec 15 05:56:02 2019
+++ src/sys/dev/dm/dm_ioctl.c	Sun Dec 15 14:39:42 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: dm_ioctl.c,v 1.45 2019/12/15 05:56:02 tkusumi Exp $      */
+/* $NetBSD: dm_ioctl.c,v 1.46 2019/12/15 14:39:42 tkusumi Exp $      */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dm_ioctl.c,v 1.45 2019/12/15 05:56:02 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_ioctl.c,v 1.46 2019/12/15 14:39:42 tkusumi Exp $");
 
 /*
  * Locking is used to synchronise between ioctl calls and between dm_table's
@@ -82,7 +82,6 @@ __KERNEL_RCSID(0, "$NetBSD: dm_ioctl.c,v
 
 #include <sys/types.h>
 #include <sys/param.h>
-
 #include <sys/device.h>
 #include <sys/disk.h>
 #include <sys/disklabel.h>
@@ -125,6 +124,7 @@ static int dm_table_init(dm_target_t *, 
 static int
 dm_dbg_print_flags(uint32_t flags)
 {
+
 	aprint_debug("dbg_print --- %d\n", flags);
 
 	if (flags & DM_READONLY_FLAG)
@@ -186,7 +186,6 @@ dm_list_versions_ioctl(prop_dictionary_t
 /*
  * Create in-kernel entry for device. Device attributes such as name, uuid are
  * taken from proplib dictionary.
- *
  */
 int
 dm_dev_create_ioctl(prop_dictionary_t dm_dict)
@@ -197,7 +196,6 @@ dm_dev_create_ioctl(prop_dictionary_t dm
 	uint32_t flags;
 	device_t devt;
 
-	r = 0;
 	flags = 0;
 	name = NULL;
 	uuid = NULL;
@@ -280,7 +278,6 @@ dm_dev_create_ioctl(prop_dictionary_t dm
  *    <integer>...</integer>
  *   </dict>
  *  </array>
- *
  */
 int
 dm_dev_list_ioctl(prop_dictionary_t dm_dict)
@@ -416,7 +413,6 @@ dm_dev_status_ioctl(prop_dictionary_t dm
 	name = NULL;
 	uuid = NULL;
 	flags = 0;
-	j = 0;
 
 	prop_dictionary_get_cstring_nocopy(dm_dict, DM_IOCTL_NAME, &name);
 	prop_dictionary_get_cstring_nocopy(dm_dict, DM_IOCTL_UUID, &uuid);
@@ -460,7 +456,6 @@ dm_dev_status_ioctl(prop_dictionary_t dm
 /*
  * Set only flag to suggest that device is suspended. This call is
  * not supported in NetBSD.
- *
  */
 int
 dm_dev_suspend_ioctl(prop_dictionary_t dm_dict)
@@ -561,7 +556,6 @@ dm_dev_resume_ioctl(prop_dictionary_t dm
 /*
  * Remove inactive table from device. Routines which work's with inactive tables
  * doesn't need to synchronise with dmstrategy. They can synchronise themselves with mutex?.
- *
  */
 int
 dm_table_clear_ioctl(prop_dictionary_t dm_dict)
@@ -570,7 +564,6 @@ dm_table_clear_ioctl(prop_dictionary_t d
 	const char *name, *uuid;
 	uint32_t flags, minor;
 
-	dmv = NULL;
 	name = NULL;
 	uuid = NULL;
 	flags = 0;
@@ -615,12 +608,10 @@ dm_table_deps_ioctl(prop_dictionary_t dm
 	prop_array_t cmd_array;
 	const char *name, *uuid;
 	uint32_t flags, minor;
-
 	int table_type;
 
 	name = NULL;
 	uuid = NULL;
-	dmv = NULL;
 	flags = 0;
 
 	prop_dictionary_get_cstring_nocopy(dm_dict, DM_IOCTL_NAME, &name);
@@ -687,16 +678,12 @@ dm_table_load_ioctl(prop_dictionary_t dm
 	prop_dictionary_t target_dict;
 
 	const char *name, *uuid, *type;
-	uint32_t flags, ret, minor;
-	char *str;
+	uint32_t flags, minor;
 
-	ret = 0;
 	flags = 0;
 	name = NULL;
 	uuid = NULL;
-	dmv = NULL;
 	last_table = NULL;
-	str = NULL;
 
 	/*
 	 * char *xml; xml = prop_dictionary_externalize(dm_dict);
@@ -735,6 +722,9 @@ dm_table_load_ioctl(prop_dictionary_t dm
 	prop_dictionary_set_uint32(dm_dict, DM_IOCTL_MINOR, dmv->minor);
 
 	while ((target_dict = prop_object_iterator_next(iter)) != NULL) {
+		int ret;
+		char *str = NULL;
+
 		prop_dictionary_get_cstring_nocopy(target_dict,
 		    DM_TABLE_TYPE, &type);
 		/*
@@ -853,7 +843,6 @@ dm_table_init(dm_target_t *target, dm_ta
  *    <string>...</string>
  *   </dict>
  * </array>
- *
  */
 int
 dm_table_status_ioctl(prop_dictionary_t dm_dict)
@@ -866,15 +855,11 @@ dm_table_status_ioctl(prop_dictionary_t 
 	prop_dictionary_t target_dict;
 
 	uint32_t minor, flags;
-
 	const char *name, *uuid;
-	char *params;
 	int table_type;
 
-	dmv = NULL;
 	uuid = NULL;
 	name = NULL;
-	params = NULL;
 	flags = 0;
 
 	prop_dictionary_get_cstring_nocopy(dm_dict, DM_IOCTL_NAME, &name);
@@ -919,6 +904,8 @@ dm_table_status_ioctl(prop_dictionary_t 
 	tbl = dm_table_get_entry(&dmv->table_head, table_type);
 
 	SLIST_FOREACH(table_en, tbl, next) {
+		char *params;
+
 		target_dict = prop_dictionary_create();
 		aprint_debug("%016" PRIu64 ", length %016" PRIu64
 		    ", target %s\n", table_en->start, table_en->length,

Index: src/sys/dev/dm/dm_pdev.c
diff -u src/sys/dev/dm/dm_pdev.c:1.20 src/sys/dev/dm/dm_pdev.c:1.21
--- src/sys/dev/dm/dm_pdev.c:1.20	Fri Dec 13 15:49:22 2019
+++ src/sys/dev/dm/dm_pdev.c	Sun Dec 15 14:39:42 2019
@@ -1,4 +1,4 @@
-/*        $NetBSD: dm_pdev.c,v 1.20 2019/12/13 15:49:22 tkusumi Exp $      */
+/*        $NetBSD: dm_pdev.c,v 1.21 2019/12/15 14:39:42 tkusumi Exp $      */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,11 +29,10 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dm_pdev.c,v 1.20 2019/12/13 15:49:22 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_pdev.c,v 1.21 2019/12/15 14:39:42 tkusumi Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
-
 #include <sys/disk.h>
 #include <sys/fcntl.h>
 #include <sys/kmem.h>
@@ -140,6 +139,7 @@ dm_pdev_insert(const char *dev_name)
 int
 dm_pdev_init(void)
 {
+
 	SLIST_INIT(&dm_pdev_list);	/* initialize global pdev list */
 	mutex_init(&dm_pdev_mutex, MUTEX_DEFAULT, IPL_NONE);
 
@@ -220,6 +220,7 @@ dm_pdev_destroy(void)
 int
 dm_pdev_decr(dm_pdev_t *dmp)
 {
+
 	KASSERT(dmp != NULL);
 	/*
 	 * If this was last reference remove dmp from
@@ -233,6 +234,7 @@ dm_pdev_decr(dm_pdev_t *dmp)
 		dm_pdev_rem(dmp);
 		return 0;
 	}
+
 	mutex_exit(&dm_pdev_mutex);
 	return 0;
 }

Index: src/sys/dev/dm/dm_target.c
diff -u src/sys/dev/dm/dm_target.c:1.31 src/sys/dev/dm/dm_target.c:1.32
--- src/sys/dev/dm/dm_target.c:1.31	Sun Dec 15 10:12:45 2019
+++ src/sys/dev/dm/dm_target.c	Sun Dec 15 14:39:42 2019
@@ -1,4 +1,4 @@
-/*        $NetBSD: dm_target.c,v 1.31 2019/12/15 10:12:45 tkusumi Exp $      */
+/*        $NetBSD: dm_target.c,v 1.32 2019/12/15 14:39:42 tkusumi Exp $      */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,15 +29,13 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dm_target.c,v 1.31 2019/12/15 10:12:45 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target.c,v 1.32 2019/12/15 14:39:42 tkusumi Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
-
 #include <sys/kmem.h>
 #include <sys/module.h>
 
-
 #include "netbsd-dm.h"
 #include "dm.h"
 
@@ -56,6 +54,7 @@ static kmutex_t dm_target_mutex;
 void
 dm_target_busy(dm_target_t *target)
 {
+
 	atomic_inc_32(&target->ref_cnt);
 }
 
@@ -65,6 +64,7 @@ dm_target_busy(dm_target_t *target)
 void
 dm_target_unbusy(dm_target_t *target)
 {
+
 	KASSERT(target->ref_cnt > 0);
 	atomic_dec_32(&target->ref_cnt);
 }
@@ -274,17 +274,18 @@ dm_target_alloc(const char *name)
 prop_array_t
 dm_target_prop_list(void)
 {
-	prop_array_t target_array, ver;
-	prop_dictionary_t target_dict;
+	prop_array_t target_array;
 	dm_target_t *dm_target;
 
-	size_t i;
-
 	target_array = prop_array_create();
 
 	mutex_enter(&dm_target_mutex);
 
 	TAILQ_FOREACH(dm_target, &dm_target_list, dm_target_next) {
+		prop_array_t ver;
+		prop_dictionary_t target_dict;
+		int i;
+
 		target_dict = prop_dictionary_create();
 		ver = prop_array_create();
 		prop_dictionary_set_cstring(target_dict, DM_TARGETS_NAME,
@@ -305,15 +306,15 @@ dm_target_prop_list(void)
 	return target_array;
 }
 
-/* Initialize dm_target subsystem. */
+/*
+ * Initialize dm_target subsystem.
+ */
 int
 dm_target_init(void)
 {
 	dm_target_t *dmt, *dmt3;
 	int r;
 
-	r = 0;
-
 	mutex_init(&dm_target_mutex, MUTEX_DEFAULT, IPL_NONE);
 
 	dmt = dm_target_alloc("linear");

Index: src/sys/dev/dm/dm_target_error.c
diff -u src/sys/dev/dm/dm_target_error.c:1.23 src/sys/dev/dm/dm_target_error.c:1.24
--- src/sys/dev/dm/dm_target_error.c:1.23	Sun Dec 15 10:12:45 2019
+++ src/sys/dev/dm/dm_target_error.c	Sun Dec 15 14:39:42 2019
@@ -1,4 +1,4 @@
-/*        $NetBSD: dm_target_error.c,v 1.23 2019/12/15 10:12:45 tkusumi Exp $      */
+/*        $NetBSD: dm_target_error.c,v 1.24 2019/12/15 14:39:42 tkusumi Exp $      */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,14 +29,13 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dm_target_error.c,v 1.23 2019/12/15 10:12:45 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_error.c,v 1.24 2019/12/15 14:39:42 tkusumi Exp $");
 
 /*
  * This file implements initial version of device-mapper error target.
  */
 #include <sys/types.h>
 #include <sys/param.h>
-
 #include <sys/buf.h>
 
 #include "dm.h"
@@ -67,7 +66,6 @@ dm_target_error_modcmd(modcmd_t cmd, voi
 {
 	dm_target_t *dmt;
 	int r;
-	dmt = NULL;
 
 	switch (cmd) {
 	case MODULE_CMD_INIT:
@@ -122,6 +120,7 @@ dm_target_error_init(dm_table_entry_t *t
 char *
 dm_target_error_table(void *target_config)
 {
+
 	return NULL;
 }
 
@@ -142,6 +141,7 @@ dm_target_error_strategy(dm_table_entry_
 int
 dm_target_error_destroy(dm_table_entry_t *table_en)
 {
+
 	/* Unbusy target so we can unload it */
 	dm_target_unbusy(table_en->target);
 
@@ -152,6 +152,7 @@ dm_target_error_destroy(dm_table_entry_t
 int
 dm_target_error_deps(dm_table_entry_t *table_en, prop_array_t prop_array)
 {
+
 	return 0;
 }
 
@@ -159,5 +160,6 @@ dm_target_error_deps(dm_table_entry_t *t
 int
 dm_target_error_upcall(dm_table_entry_t *table_en, struct buf *bp)
 {
+
 	return 0;
 }

Index: src/sys/dev/dm/dm_target_linear.c
diff -u src/sys/dev/dm/dm_target_linear.c:1.30 src/sys/dev/dm/dm_target_linear.c:1.31
--- src/sys/dev/dm/dm_target_linear.c:1.30	Sun Dec 15 09:22:28 2019
+++ src/sys/dev/dm/dm_target_linear.c	Sun Dec 15 14:39:42 2019
@@ -1,4 +1,4 @@
-/*        $NetBSD: dm_target_linear.c,v 1.30 2019/12/15 09:22:28 tkusumi Exp $      */
+/*        $NetBSD: dm_target_linear.c,v 1.31 2019/12/15 14:39:42 tkusumi Exp $      */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dm_target_linear.c,v 1.30 2019/12/15 09:22:28 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_linear.c,v 1.31 2019/12/15 14:39:42 tkusumi Exp $");
 
 /*
  * This file implements initial version of device-mapper dklinear target.
@@ -37,7 +37,6 @@ __KERNEL_RCSID(0, "$NetBSD: dm_target_li
 
 #include <sys/types.h>
 #include <sys/param.h>
-
 #include <sys/buf.h>
 #include <sys/kmem.h>
 #include <sys/lwp.h>
@@ -190,6 +189,7 @@ dm_target_linear_deps(dm_table_entry_t *
 int
 dm_target_linear_upcall(dm_table_entry_t *table_en, struct buf *bp)
 {
+
 	return 0;
 }
 

Index: src/sys/dev/dm/dm_target_mirror.c
diff -u src/sys/dev/dm/dm_target_mirror.c:1.21 src/sys/dev/dm/dm_target_mirror.c:1.22
--- src/sys/dev/dm/dm_target_mirror.c:1.21	Sun Dec 15 09:42:29 2019
+++ src/sys/dev/dm/dm_target_mirror.c	Sun Dec 15 14:39:42 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target_mirror.c,v 1.21 2019/12/15 09:42:29 tkusumi Exp $*/
+/*$NetBSD: dm_target_mirror.c,v 1.22 2019/12/15 14:39:42 tkusumi Exp $*/
 
 /*
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -29,14 +29,13 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dm_target_mirror.c,v 1.21 2019/12/15 09:42:29 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_mirror.c,v 1.22 2019/12/15 14:39:42 tkusumi Exp $");
 
 /*
  * This file implements initial version of device-mapper mirror target.
  */
 #include <sys/types.h>
 #include <sys/param.h>
-
 #include <sys/buf.h>
 
 #include "dm.h"
@@ -80,7 +79,6 @@ dm_target_mirror_modcmd(modcmd_t cmd, vo
 {
 	dm_target_t *dmt;
 	int r;
-	dmt = NULL;
 
 	switch (cmd) {
 	case MODULE_CMD_INIT:
@@ -140,6 +138,7 @@ dm_target_mirror_init(dm_table_entry_t *
 char *
 dm_target_mirror_table(void *target_config)
 {
+
 	return NULL;
 }
 
@@ -168,6 +167,7 @@ dm_target_mirror_sync(dm_table_entry_t *
 int
 dm_target_mirror_destroy(dm_table_entry_t *table_en)
 {
+
 	/* Unbusy target so we can unload it */
 	dm_target_unbusy(table_en->target);
 
@@ -178,6 +178,7 @@ dm_target_mirror_destroy(dm_table_entry_
 int
 dm_target_mirror_deps(dm_table_entry_t *table_en, prop_array_t prop_array)
 {
+
 	return 0;
 }
 
@@ -185,5 +186,6 @@ dm_target_mirror_deps(dm_table_entry_t *
 int
 dm_target_mirror_upcall(dm_table_entry_t *table_en, struct buf *bp)
 {
+
 	return 0;
 }

Index: src/sys/dev/dm/dm_target_snapshot.c
diff -u src/sys/dev/dm/dm_target_snapshot.c:1.34 src/sys/dev/dm/dm_target_snapshot.c:1.35
--- src/sys/dev/dm/dm_target_snapshot.c:1.34	Sun Dec 15 10:12:45 2019
+++ src/sys/dev/dm/dm_target_snapshot.c	Sun Dec 15 14:39:42 2019
@@ -1,4 +1,4 @@
-/*        $NetBSD: dm_target_snapshot.c,v 1.34 2019/12/15 10:12:45 tkusumi Exp $      */
+/*        $NetBSD: dm_target_snapshot.c,v 1.35 2019/12/15 14:39:42 tkusumi Exp $      */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dm_target_snapshot.c,v 1.34 2019/12/15 10:12:45 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_snapshot.c,v 1.35 2019/12/15 14:39:42 tkusumi Exp $");
 
 /*
  * 1. Suspend my_data to temporarily stop any I/O while the snapshot is being
@@ -80,7 +80,6 @@ __KERNEL_RCSID(0, "$NetBSD: dm_target_sn
  */
 #include <sys/types.h>
 #include <sys/param.h>
-
 #include <sys/buf.h>
 #include <sys/kmem.h>
 
@@ -137,9 +136,6 @@ dm_target_snapshot_modcmd(modcmd_t cmd, 
 	dm_target_t *dmt, *dmt1;
 	int r;
 
-	dmt = NULL;
-	dmt1 = NULL;
-
 	switch (cmd) {
 	case MODULE_CMD_INIT:
 		if (((dmt = dm_target_lookup("snapshot")) != NULL)) {
@@ -309,6 +305,7 @@ dm_target_snapshot_strategy(dm_table_ent
 int
 dm_target_snapshot_sync(dm_table_entry_t *table_en)
 {
+
 	return 0;
 }
 
@@ -367,6 +364,7 @@ dm_target_snapshot_deps(dm_table_entry_t
 int
 dm_target_snapshot_upcall(dm_table_entry_t *table_en, struct buf *bp)
 {
+
 	printf("dm_target_snapshot_upcall called\n");
 
 	printf("upcall buf flags %s %s\n",
@@ -533,5 +531,6 @@ dm_target_snapshot_orig_deps(dm_table_en
 int
 dm_target_snapshot_orig_upcall(dm_table_entry_t *table_en, struct buf *bp)
 {
+
 	return 0;
 }

Index: src/sys/dev/dm/dm_target_stripe.c
diff -u src/sys/dev/dm/dm_target_stripe.c:1.37 src/sys/dev/dm/dm_target_stripe.c:1.38
--- src/sys/dev/dm/dm_target_stripe.c:1.37	Sun Dec 15 09:22:28 2019
+++ src/sys/dev/dm/dm_target_stripe.c	Sun Dec 15 14:39:42 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target_stripe.c,v 1.37 2019/12/15 09:22:28 tkusumi Exp $*/
+/*$NetBSD: dm_target_stripe.c,v 1.38 2019/12/15 14:39:42 tkusumi Exp $*/
 
 /*
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -29,14 +29,13 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dm_target_stripe.c,v 1.37 2019/12/15 09:22:28 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_stripe.c,v 1.38 2019/12/15 14:39:42 tkusumi Exp $");
 
 /*
  * This file implements initial version of device-mapper stripe target.
  */
 #include <sys/types.h>
 #include <sys/param.h>
-
 #include <sys/buf.h>
 #include <sys/kmem.h>
 #include <sys/lwp.h>
@@ -68,7 +67,6 @@ dm_target_stripe_modcmd(modcmd_t cmd, vo
 {
 	dm_target_t *dmt;
 	int r;
-	dmt = NULL;
 
 	switch (cmd) {
 	case MODULE_CMD_INIT:
@@ -300,6 +298,7 @@ dm_target_stripe_sync(dm_table_entry_t *
 int
 dm_target_stripe_destroy(dm_table_entry_t *table_en)
 {
+
 	dm_target_stripe_fini(table_en->target_config);
 
 	/* Unbusy target so we can unload it */
@@ -332,6 +331,7 @@ dm_target_stripe_deps(dm_table_entry_t *
 int
 dm_target_stripe_upcall(dm_table_entry_t *table_en, struct buf *bp)
 {
+
 	return 0;
 }
 

Index: src/sys/dev/dm/dm_target_zero.c
diff -u src/sys/dev/dm/dm_target_zero.c:1.25 src/sys/dev/dm/dm_target_zero.c:1.26
--- src/sys/dev/dm/dm_target_zero.c:1.25	Sun Dec 15 10:12:45 2019
+++ src/sys/dev/dm/dm_target_zero.c	Sun Dec 15 14:39:42 2019
@@ -1,4 +1,4 @@
-/*        $NetBSD: dm_target_zero.c,v 1.25 2019/12/15 10:12:45 tkusumi Exp $      */
+/*        $NetBSD: dm_target_zero.c,v 1.26 2019/12/15 14:39:42 tkusumi Exp $      */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,14 +29,13 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dm_target_zero.c,v 1.25 2019/12/15 10:12:45 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_target_zero.c,v 1.26 2019/12/15 14:39:42 tkusumi Exp $");
 
 /*
  * This file implements initial version of device-mapper zero target.
  */
 #include <sys/types.h>
 #include <sys/param.h>
-
 #include <sys/buf.h>
 
 #include "dm.h"
@@ -67,7 +66,6 @@ dm_target_zero_modcmd(modcmd_t cmd, void
 {
 	dm_target_t *dmt;
 	int r;
-	dmt = NULL;
 
 	switch (cmd) {
 	case MODULE_CMD_INIT:
@@ -125,10 +123,10 @@ dm_target_zero_init(dm_table_entry_t *ta
 char *
 dm_target_zero_table(void *target_config)
 {
+
 	return NULL;
 }
 
-
 /*
  * This routine does IO operations.
  */
@@ -139,7 +137,6 @@ dm_target_zero_strategy(dm_table_entry_t
 	memset(bp->b_data, 0, bp->b_bcount);
 	bp->b_resid = 0;	/* nestiobuf_done wants b_resid = 0 to be sure
 				 * that there is no other io to done  */
-
 	biodone(bp);
 
 	return 0;
@@ -149,6 +146,7 @@ dm_target_zero_strategy(dm_table_entry_t
 int
 dm_target_zero_destroy(dm_table_entry_t *table_en)
 {
+
 	/* Unbusy target so we can unload it */
 	dm_target_unbusy(table_en->target);
 
@@ -159,6 +157,7 @@ dm_target_zero_destroy(dm_table_entry_t 
 int
 dm_target_zero_deps(dm_table_entry_t *table_en, prop_array_t prop_array)
 {
+
 	return 0;
 }
 
@@ -166,5 +165,6 @@ dm_target_zero_deps(dm_table_entry_t *ta
 int
 dm_target_zero_upcall(dm_table_entry_t *table_en, struct buf *bp)
 {
+
 	return 0;
 }

Reply via email to