From owner-svn-src-stable@freebsd.org Mon Aug 12 20:34:57 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 95BA4C159D; Mon, 12 Aug 2019 20:34:57 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 466nds2zmFz41X0; Mon, 12 Aug 2019 20:34:57 +0000 (UTC) (envelope-from mav@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 45596462A; Mon, 12 Aug 2019 20:34:57 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7CKYv31030352; Mon, 12 Aug 2019 20:34:57 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7CKYvqR030350; Mon, 12 Aug 2019 20:34:57 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201908122034.x7CKYvqR030350@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 12 Aug 2019 20:34:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r350960 - stable/11/sbin/nvmecontrol X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sbin/nvmecontrol X-SVN-Commit-Revision: 350960 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Aug 2019 20:34:57 -0000 Author: mav Date: Mon Aug 12 20:34:56 2019 New Revision: 350960 URL: https://svnweb.freebsd.org/changeset/base/350960 Log: MFC r342358 (by imp): Try the first 256 units with nvmecontrol devlist. The nvmecontrol code that did the devlist assumed that we had a tightly-packed allocation of units. Since pci writing exists, this isn't the case. Loop over the first 256 units, which is a reasonable number of possible units. Modified: stable/11/sbin/nvmecontrol/devlist.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/nvmecontrol/devlist.c ============================================================================== --- stable/11/sbin/nvmecontrol/devlist.c Mon Aug 12 20:32:47 2019 (r350959) +++ stable/11/sbin/nvmecontrol/devlist.c Mon Aug 12 20:34:56 2019 (r350960) @@ -51,6 +51,8 @@ devlist_usage(void) exit(1); } +#define NVME_MAX_UNIT 256 + static inline uint32_t ns_get_sector_size(struct nvme_namespace_data *nsdata) { @@ -78,19 +80,17 @@ devlist(int argc, char *argv[]) ctrlr = -1; found = 0; - while (1) { + while (ctrlr < NVME_MAX_UNIT) { ctrlr++; sprintf(name, "%s%d", NVME_CTRLR_PREFIX, ctrlr); ret = open_dev(name, &fd, 0, 0); - if (ret != 0) { - if (ret == EACCES) { - warnx("could not open "_PATH_DEV"%s\n", name); - continue; - } else - break; - } + if (ret == EACCES) { + warnx("could not open "_PATH_DEV"%s\n", name); + continue; + } else if (ret != 0) + continue; found++; read_controller_data(fd, &cdata);