From owner-svn-src-head@freebsd.org Sat Jun 16 04:50:42 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F386F100971B; Sat, 16 Jun 2018 04:50:41 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0459573C02; Sat, 16 Jun 2018 04:50:41 +0000 (UTC) (envelope-from allanjude@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 DAAD121A15; Sat, 16 Jun 2018 04:50:40 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w5G4oeTx095889; Sat, 16 Jun 2018 04:50:40 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w5G4oe5M095888; Sat, 16 Jun 2018 04:50:40 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201806160450.w5G4oe5M095888@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude Date: Sat, 16 Jun 2018 04:50:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r335246 - head/stand/i386/libi386 X-SVN-Group: head X-SVN-Commit-Author: allanjude X-SVN-Commit-Paths: head/stand/i386/libi386 X-SVN-Commit-Revision: 335246 X-SVN-Commit-Repository: base 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.26 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: Sat, 16 Jun 2018 04:50:42 -0000 Author: allanjude Date: Sat Jun 16 04:50:40 2018 New Revision: 335246 URL: https://svnweb.freebsd.org/changeset/base/335246 Log: biosdisk.c remove redundant variable `rdev` and `disk` serve the same purpose, read the partition table without the `d_offset` or `d_slice` set, so the read is relative to the start of the disk. Reuse the already initialized `disk` instead of making another copy later. Sponsored by: Klara Systems Modified: head/stand/i386/libi386/biosdisk.c Modified: head/stand/i386/libi386/biosdisk.c ============================================================================== --- head/stand/i386/libi386/biosdisk.c Sat Jun 16 02:50:29 2018 (r335245) +++ head/stand/i386/libi386/biosdisk.c Sat Jun 16 04:50:40 2018 (r335246) @@ -379,7 +379,7 @@ bd_print(int verbose) static int bd_open(struct open_file *f, ...) { - struct disk_devdesc *dev, rdev; + struct disk_devdesc *dev; struct disk_devdesc disk; int err, g_err; va_list ap; @@ -445,11 +445,8 @@ bd_open(struct open_file *f, ...) dskp.part = dev->d_partition; dskp.start = dev->d_offset; - memcpy(&rdev, dev, sizeof(rdev)); - /* to read the GPT table, we need to read the first sector */ - rdev.d_offset = 0; /* We need the LBA of the end of the partition */ - table = ptable_open(&rdev, BD(dev).bd_sectors, + table = ptable_open(&disk, BD(dev).bd_sectors, BD(dev).bd_sectorsize, ptblread); if (table == NULL) { DEBUG("Can't read partition table");