Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Mar 2016 00:25:26 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r297119 - stable/10/cddl/contrib/opensolaris/cmd/zpool
Message-ID:  <201603210025.u2L0PQ2D038723@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Mon Mar 21 00:25:26 2016
New Revision: 297119
URL: https://svnweb.freebsd.org/changeset/base/297119

Log:
  MFC r296537: MFV r296536: 6551 cmd/zpool: cleanup gcc warnings
  
  Reviewed by: Matthew Ahrens <mahrens@delphix.com>
  Reviewed by: Andy Stormont <astormont@racktopsystems.com>
  Approved by: Robert Mustacchi <rm@joyent.com>
  
  illumos/illumos-gate@b327cd3f3b4dab4f29e7140159b1e01ed2ceef2a

Modified:
  stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_iter.c
  stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
  stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_iter.c
==============================================================================
--- stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_iter.c	Mon Mar 21 00:24:37 2016	(r297118)
+++ stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_iter.c	Mon Mar 21 00:25:26 2016	(r297119)
@@ -22,8 +22,9 @@
  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
-
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
+/*
+ * Copyright 2016 Igor Kozhukhov <ikozhukhov@gmail.com>.
+ */
 
 #include <solaris.h>
 #include <libintl.h>
@@ -132,7 +133,8 @@ pool_list_get(int argc, char **argv, zpr
 		for (i = 0; i < argc; i++) {
 			zpool_handle_t *zhp;
 
-			if (zhp = zpool_open_canfail(g_zfs, argv[i])) {
+			if ((zhp = zpool_open_canfail(g_zfs, argv[i])) !=
+			    NULL) {
 				if (add_pool(zhp, zlp) != 0)
 					*err = B_TRUE;
 			} else {

Modified: stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
==============================================================================
--- stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c	Mon Mar 21 00:24:37 2016	(r297118)
+++ stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c	Mon Mar 21 00:25:26 2016	(r297119)
@@ -26,6 +26,7 @@
  * Copyright (c) 2012 by Frederik Wessels. All rights reserved.
  * Copyright (c) 2012 Martin Matuska <mm@FreeBSD.org>. All rights reserved.
  * Copyright (c) 2013 by Prasad Joshi (sTec). All rights reserved.
+ * Copyright 2016 Igor Kozhukhov <ikozhukhov@gmail.com>.
  */
 
 #include <solaris.h>
@@ -3171,33 +3172,6 @@ zpool_do_list(int argc, char **argv)
 	return (ret);
 }
 
-static nvlist_t *
-zpool_get_vdev_by_name(nvlist_t *nv, char *name)
-{
-	nvlist_t **child;
-	uint_t c, children;
-	nvlist_t *match;
-	char *path;
-
-	if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN,
-	    &child, &children) != 0) {
-		verify(nvlist_lookup_string(nv, ZPOOL_CONFIG_PATH, &path) == 0);
-		if (strncmp(name, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0)
-			name += sizeof(_PATH_DEV) - 1;
-		if (strncmp(path, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0)
-			path += sizeof(_PATH_DEV) - 1;
-		if (strcmp(name, path) == 0)
-			return (nv);
-		return (NULL);
-	}
-
-	for (c = 0; c < children; c++)
-		if ((match = zpool_get_vdev_by_name(child[c], name)) != NULL)
-			return (match);
-
-	return (NULL);
-}
-
 static int
 zpool_do_attach_or_replace(int argc, char **argv, int replacing)
 {
@@ -3926,7 +3900,7 @@ print_scan_status(pool_scan_stat_t *ps)
 	 */
 	if (ps->pss_state == DSS_FINISHED) {
 		uint64_t minutes_taken = (end - start) / 60;
-		char *fmt;
+		char *fmt = NULL;
 
 		if (ps->pss_func == POOL_SCAN_SCRUB) {
 			fmt = gettext("scrub repaired %s in %lluh%um with "
@@ -5560,7 +5534,7 @@ find_command_idx(char *command, int *idx
 int
 main(int argc, char **argv)
 {
-	int ret;
+	int ret = 0;
 	int i;
 	char *cmdname;
 

Modified: stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c
==============================================================================
--- stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c	Mon Mar 21 00:24:37 2016	(r297118)
+++ stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c	Mon Mar 21 00:25:26 2016	(r297119)
@@ -22,6 +22,7 @@
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright 2016 Igor Kozhukhov <ikozhukhov@gmail.com>.
  */
 
 /*
@@ -588,7 +589,9 @@ get_replication(nvlist_t *nvroot, boolea
 	uint_t c, children;
 	nvlist_t *nv;
 	char *type;
-	replication_level_t lastrep, rep, *ret;
+	replication_level_t lastrep = {0};
+	replication_level_t rep;
+	replication_level_t *ret;
 	boolean_t dontreport;
 
 	ret = safe_malloc(sizeof (replication_level_t));
@@ -1076,7 +1079,7 @@ is_device_in_use(nvlist_t *config, nvlis
 	nvlist_t **child;
 	uint_t c, children;
 	char *type, *path;
-	int ret;
+	int ret = 0;
 	char buf[MAXPATHLEN];
 	uint64_t wholedisk;
 	boolean_t anyinuse = B_FALSE;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201603210025.u2L0PQ2D038723>