From owner-svn-src-all@freebsd.org Tue Aug 1 11:09:19 2017 Return-Path: Delivered-To: svn-src-all@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 5DB8BDD0735; Tue, 1 Aug 2017 11:09:19 +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 2B77671C7B; Tue, 1 Aug 2017 11:09:19 +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 v71B9I1m086113; Tue, 1 Aug 2017 11:09:18 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v71B9IN1086112; Tue, 1 Aug 2017 11:09:18 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201708011109.v71B9IN1086112@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 1 Aug 2017 11:09:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321865 - head/tools/tools/zfsboottest X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/tools/tools/zfsboottest X-SVN-Commit-Revision: 321865 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Aug 2017 11:09:19 -0000 Author: avg Date: Tue Aug 1 11:09:18 2017 New Revision: 321865 URL: https://svnweb.freebsd.org/changeset/base/321865 Log: zfsboottest: catch up with r316585 and provide ldi_get_size method This method is required for querying file / disk sizes which is needed at least for finding all copies of ZFS VDEV labels. Reported by: ngie MFC after: 1 week Modified: head/tools/tools/zfsboottest/zfsboottest.c Modified: head/tools/tools/zfsboottest/zfsboottest.c ============================================================================== --- head/tools/tools/zfsboottest/zfsboottest.c Tue Aug 1 11:00:04 2017 (r321864) +++ head/tools/tools/zfsboottest/zfsboottest.c Tue Aug 1 11:09:18 2017 (r321865) @@ -28,7 +28,9 @@ /* $FreeBSD$ */ #include +#include #include +#include #include #include #include @@ -49,6 +51,20 @@ pager_output(const char *line) fprintf(stderr, "%s", line); return (0); +} + +uint64_t +ldi_get_size(void *priv) +{ + struct stat sb; + int fd; + + fd = *(int *)priv; + if (fstat(fd, &sb) != 0) + return (0); + if (S_ISCHR(sb.st_mode) && ioctl(fd, DIOCGMEDIASIZE, &sb.st_size) != 0) + return (0); + return (sb.st_size); } #define ZFS_TEST