From owner-svn-src-vendor@freebsd.org Fri Apr 14 18:21:59 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B5C9CD3EF14; Fri, 14 Apr 2017 18:21:59 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 68E4861E; Fri, 14 Apr 2017 18:21:59 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3EILwMJ070317; Fri, 14 Apr 2017 18:21:58 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3EILwpH070316; Fri, 14 Apr 2017 18:21:58 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201704141821.v3EILwpH070316@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 14 Apr 2017 18:21:58 +0000 (UTC) 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 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Apr 2017 18:21:59 -0000 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 Reviewed by: Jason King Reviewed by: Marcel Telka Reviewed by: Prakash Surya Approved by: Robert Mustacchi Author: Yuri Pankov 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) {