svn commit: r316909 - vendor/illumos/dist/lib/libzfs/common

Andriy Gapon avg at FreeBSD.org
Fri Apr 14 18:21:59 UTC 2017


Author: avg
Date: Fri Apr 14 18:21:58 2017
New Revision: 316909
URL: https://svnweb.freebsd.org/changeset/base/316909

Log:
  7803 want devid_str_from_path(3devid)
  
  illumos/illumos-gate at 46d46cd4fa12218e54fa3d73a9be825ed504cabb
  https://github.com/illumos/illumos-gate/commit/46d46cd4fa12218e54fa3d73a9be825ed504cabb
  
  https://www.illumos.org/issues/7803
    Make get_devid() from libzfs a public function in libdevid, as its pretty
    usable in other places and duplicating all the logic required to get string
    encoded devid from path seems counter-productive.
  
  Reviewed by: Dan McDonald <danmcd at omniti.com>
  Reviewed by: Jason King <jason.brian.king at gmail.com>
  Reviewed by: Marcel Telka <marcel at telka.sk>
  Reviewed by: Prakash Surya <prakash.surya at delphix.com>
  Approved by: Robert Mustacchi <rm at joyent.com>
  Author: Yuri Pankov <yuri.pankov at nexenta.com>

Modified:
  vendor/illumos/dist/lib/libzfs/common/libzfs_import.c

Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_import.c
==============================================================================
--- vendor/illumos/dist/lib/libzfs/common/libzfs_import.c	Fri Apr 14 18:20:56 2017	(r316908)
+++ vendor/illumos/dist/lib/libzfs/common/libzfs_import.c	Fri Apr 14 18:21:58 2017	(r316909)
@@ -23,7 +23,7 @@
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2012, 2016 by Delphix. All rights reserved.
  * Copyright 2015 RackTop Systems.
- * Copyright 2016 Nexenta Systems, Inc.
+ * Copyright 2017 Nexenta Systems, Inc.
  */
 
 /*
@@ -95,31 +95,6 @@ typedef struct pool_list {
 	name_entry_t		*names;
 } pool_list_t;
 
-static char *
-get_devid(const char *path)
-{
-	int fd;
-	ddi_devid_t devid;
-	char *minor, *ret;
-
-	if ((fd = open(path, O_RDONLY)) < 0)
-		return (NULL);
-
-	minor = NULL;
-	ret = NULL;
-	if (devid_get(fd, &devid) == 0) {
-		if (devid_get_minor_name(fd, &minor) == 0)
-			ret = devid_str_encode(devid, minor);
-		if (minor != NULL)
-			devid_str_free(minor);
-		devid_free(devid);
-	}
-	(void) close(fd);
-
-	return (ret);
-}
-
-
 /*
  * Go through and fix up any path and/or devid information for the given vdev
  * configuration.
@@ -195,7 +170,7 @@ fix_paths(nvlist_t *nv, name_entry_t *na
 	if (nvlist_add_string(nv, ZPOOL_CONFIG_PATH, best->ne_name) != 0)
 		return (-1);
 
-	if ((devid = get_devid(best->ne_name)) == NULL) {
+	if ((devid = devid_str_from_path(best->ne_name)) == NULL) {
 		(void) nvlist_remove_all(nv, ZPOOL_CONFIG_DEVID);
 	} else {
 		if (nvlist_add_string(nv, ZPOOL_CONFIG_DEVID, devid) != 0) {


More information about the svn-src-vendor mailing list