Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Apr 2017 18:21:58 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org
Subject:   svn commit: r316909 - vendor/illumos/dist/lib/libzfs/common
Message-ID:  <201704141821.v3EILwpH070316@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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@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@omniti.com>
  Reviewed by: Jason King <jason.brian.king@gmail.com>
  Reviewed by: Marcel Telka <marcel@telka.sk>
  Reviewed by: Prakash Surya <prakash.surya@delphix.com>
  Approved by: Robert Mustacchi <rm@joyent.com>
  Author: Yuri Pankov <yuri.pankov@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) {



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