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");
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to