From owner-svn-src-head@freebsd.org Sun Apr 9 11:16:17 2017 Return-Path: Delivered-To: svn-src-head@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 DABD5D36AEE; Sun, 9 Apr 2017 11:16:17 +0000 (UTC) (envelope-from tsoome@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 9DE61A59; Sun, 9 Apr 2017 11:16:17 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v39BGGij001025; Sun, 9 Apr 2017 11:16:16 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v39BGGJu001023; Sun, 9 Apr 2017 11:16:16 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201704091116.v39BGGJu001023@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Sun, 9 Apr 2017 11:16:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r316654 - head/sys/boot/userboot/userboot X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Apr 2017 11:16:18 -0000 Author: tsoome Date: Sun Apr 9 11:16:16 2017 New Revision: 316654 URL: https://svnweb.freebsd.org/changeset/base/316654 Log: loader: r316585 did miss userboot update The work to implement zfs reader to inspect all pool label copies did miss the userboot, this update does correct this issue. Since userboot is already using common/disk.c API (disk_open() etc), the fix is quite simple - we only need to make sure the userdisk_iocl() will call disk_ioctl(). In addition, the diskioctl callback does return int, not pointer. Note, the review request is actually addressing the sparc and userboot, but as testing the fix for sparc will take some more time, I am posting the userboot fix now. This patch is part of the implementation presented in review: https://reviews.freebsd.org/D10302 Once we have the sparc part tested, we will have the complete fix for the issue. Reviewed by: imp Modified: head/sys/boot/userboot/userboot/main.c head/sys/boot/userboot/userboot/userboot_disk.c Modified: head/sys/boot/userboot/userboot/main.c ============================================================================== --- head/sys/boot/userboot/userboot/main.c Sun Apr 9 07:54:39 2017 (r316653) +++ head/sys/boot/userboot/userboot/main.c Sun Apr 9 11:16:16 2017 (r316654) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "bootstrap.h" #include "disk.h" @@ -270,6 +271,16 @@ command_reloadbe(int argc, char *argv[]) return (CMD_OK); } + +uint64_t +ldi_get_size(void *priv) +{ + int fd = (uintptr_t) priv; + uint64_t size; + + ioctl(fd, DIOCGMEDIASIZE, &size); + return (size); +} #endif /* USERBOOT_ZFS_SUPPORT */ COMMAND_SET(quit, "quit", "exit the loader", command_quit); Modified: head/sys/boot/userboot/userboot/userboot_disk.c ============================================================================== --- head/sys/boot/userboot/userboot/userboot_disk.c Sun Apr 9 07:54:39 2017 (r316653) +++ head/sys/boot/userboot/userboot/userboot_disk.c Sun Apr 9 11:16:16 2017 (r316654) @@ -91,8 +91,8 @@ userdisk_init(void) return (ENOMEM); for (i = 0; i < userdisk_maxunit; i++) { if (CALLBACK(diskioctl, i, DIOCGSECTORSIZE, - §orsize) != NULL || CALLBACK(diskioctl, i, - DIOCGMEDIASIZE, &mediasize) != NULL) + §orsize) != 0 || CALLBACK(diskioctl, i, + DIOCGMEDIASIZE, &mediasize) != 0) return (ENXIO); ud_info[i].mediasize = mediasize; ud_info[i].sectorsize = sectorsize; @@ -230,7 +230,12 @@ static int userdisk_ioctl(struct open_file *f, u_long cmd, void *data) { struct disk_devdesc *dev; + int rc; dev = (struct disk_devdesc *)f->f_devdata; + rc = disk_ioctl(dev, cmd, data); + if (rc != ENOTTY) + return (rc); + return (CALLBACK(diskioctl, dev->d_unit, cmd, data)); }