Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 Jun 2018 04:50:40 +0000 (UTC)
From:      Allan Jude <allanjude@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r335246 - head/stand/i386/libi386
Message-ID:  <201806160450.w5G4oe5M095888@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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");



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201806160450.w5G4oe5M095888>