From b2dcbdf490252c9476a9e2b1871cf90c40325bca Mon Sep 17 00:00:00 2001
From: Brian Behlendorf <behlendorf1@llnl.gov>
Date: Wed, 8 Jul 2009 09:04:21 -0700
Subject: [PATCH 1/4] Resolve a 2 new cases of for loop variable declared in
 for()

---
 cmd/ztest/ztest.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/cmd/ztest/ztest.c b/cmd/ztest/ztest.c
index d56cb03b51..bdb0416773 100644
--- a/cmd/ztest/ztest.c
+++ b/cmd/ztest/ztest.c
@@ -1218,6 +1218,8 @@ online_vdev(vdev_t *vd, void *arg)
 vdev_t *
 vdev_walk_tree(vdev_t *vd, vdev_t *(*func)(vdev_t *, void *), void *arg)
 {
+	uint_t c;
+
 	if (vd->vdev_ops->vdev_op_leaf) {
 		if (func == NULL)
 			return (vd);
@@ -1225,7 +1227,7 @@ vdev_walk_tree(vdev_t *vd, vdev_t *(*func)(vdev_t *, void *), void *arg)
 			return (func(vd, arg));
 	}
 
-	for (uint_t c = 0; c < vd->vdev_children; c++) {
+	for (c = 0; c < vd->vdev_children; c++) {
 		vdev_t *cvd = vd->vdev_child[c];
 		if ((cvd = vdev_walk_tree(cvd, func, arg)) != NULL)
 			return (cvd);

From 58f5e63293535d543ec9f51a4cd43227a2001dff Mon Sep 17 00:00:00 2001
From: Brian Behlendorf <behlendorf1@llnl.gov>
Date: Wed, 8 Jul 2009 09:05:37 -0700
Subject: [PATCH 2/4] Resolve a 2 new cases of for loop variable declared in
 for()

---
 module/zfs/vdev_label.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/module/zfs/vdev_label.c b/module/zfs/vdev_label.c
index b2f45d366e..b858edef18 100644
--- a/module/zfs/vdev_label.c
+++ b/module/zfs/vdev_label.c
@@ -508,6 +508,7 @@ vdev_label_init(vdev_t *vd, uint64_t crtxg, vdev_labeltype_t reason)
 	uint64_t spare_guid, l2cache_guid;
 	int flags = ZIO_FLAG_CONFIG_WRITER | ZIO_FLAG_CANFAIL;
 	int c, l, n;
+	vdev_t *pvd;
 
 	ASSERT(spa_config_held(spa, SCL_ALL, RW_WRITER) == SCL_ALL);
 

From 55344474772b79ba53006b3cca25a3075c3c3e56 Mon Sep 17 00:00:00 2001
From: Brian Behlendorf <behlendorf1@llnl.gov>
Date: Wed, 8 Jul 2009 09:06:03 -0700
Subject: [PATCH 3/4] Add explicit casts for (u_longlong_t) when printing
 uint64_t.

---
 cmd/zfs/zfs_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c
index fe0ca75985..0bc86f84ba 100644
--- a/cmd/zfs/zfs_main.c
+++ b/cmd/zfs/zfs_main.c
@@ -2389,7 +2389,7 @@ zfs_do_set(int argc, char **argv)
 		usage(B_FALSE);
 	}
 
-	ret = zfs_for_each(argc - 2, argv + 2, NULL,
+	ret = zfs_for_each(argc - 2, argv + 2, 0,
 	    ZFS_TYPE_DATASET, NULL, NULL, 0, set_callback, &cb);
 
 	return (ret);

From b2e459dab08d702888324f2f8841b628ff0b80f1 Mon Sep 17 00:00:00 2001
From: Brian Behlendorf <behlendorf1@llnl.gov>
Date: Wed, 8 Jul 2009 09:07:13 -0700
Subject: [PATCH 4/4] Add explicit casts for (u_longlong_t) when printing
 uint64_t.

---
 cmd/ztest/ztest.c | 30 ++++++++++++++++++++----------
 1 file changed, 20 insertions(+), 10 deletions(-)

diff --git a/cmd/ztest/ztest.c b/cmd/ztest/ztest.c
index 746db0c070..ad8d47fbc1 100644
--- a/cmd/ztest/ztest.c
+++ b/cmd/ztest/ztest.c
@@ -1608,11 +1608,16 @@ ztest_dsl_dataset_cleanup(char *osname, uint64_t curval)
 	char snap3name[100];
 	int error;
 
-	(void) snprintf(snap1name, 100, "%s@s1_%llu", osname, curval);
-	(void) snprintf(clone1name, 100, "%s/c1_%llu", osname, curval);
-	(void) snprintf(snap2name, 100, "%s@s2_%llu", clone1name, curval);
-	(void) snprintf(clone2name, 100, "%s/c2_%llu", osname, curval);
-	(void) snprintf(snap3name, 100, "%s@s3_%llu", clone1name, curval);
+	(void) snprintf(snap1name, 100, "%s@s1_%llu",
+			osname, (u_longlong_t)curval);
+	(void) snprintf(clone1name, 100, "%s/c1_%llu",
+			osname, (u_longlong_t)curval);
+	(void) snprintf(snap2name, 100, "%s@s2_%llu",
+			clone1name, (u_longlong_t)curval);
+	(void) snprintf(clone2name, 100, "%s/c2_%llu",
+			osname, (u_longlong_t)curval);
+	(void) snprintf(snap3name, 100, "%s@s3_%llu",
+			clone1name, (u_longlong_t)curval);
 
 	error = dmu_objset_destroy(clone2name);
 	if (error && error != ENOENT)
@@ -1654,11 +1659,16 @@ ztest_dsl_dataset_promote_busy(ztest_args_t *za)
 	dmu_objset_name(os, osname);
 	ztest_dsl_dataset_cleanup(osname, curval);
 
-	(void) snprintf(snap1name, 100, "%s@s1_%llu", osname, curval);
-	(void) snprintf(clone1name, 100, "%s/c1_%llu", osname, curval);
-	(void) snprintf(snap2name, 100, "%s@s2_%llu", clone1name, curval);
-	(void) snprintf(clone2name, 100, "%s/c2_%llu", osname, curval);
-	(void) snprintf(snap3name, 100, "%s@s3_%llu", clone1name, curval);
+	(void) snprintf(snap1name, 100, "%s@s1_%llu",
+			osname, (u_longlong_t)curval);
+	(void) snprintf(clone1name, 100, "%s/c1_%llu",
+			osname, (u_longlong_t)curval);
+	(void) snprintf(snap2name, 100, "%s@s2_%llu",
+			clone1name, (u_longlong_t)curval);
+	(void) snprintf(clone2name, 100, "%s/c2_%llu",
+			osname, (u_longlong_t)curval);
+	(void) snprintf(snap3name, 100, "%s@s3_%llu",
+			clone1name, (u_longlong_t)curval);
 
 	error = dmu_objset_snapshot(osname, strchr(snap1name, '@')+1,
 	    NULL, FALSE);