From bdeee1b234c7bb6bf79e146cc9945ef415f51d66 Mon Sep 17 00:00:00 2001 From: Allan Jude Date: Sat, 16 Jun 2018 04:50:40 +0000 Subject: [PATCH] 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 --- stand/i386/libi386/biosdisk.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/stand/i386/libi386/biosdisk.c b/stand/i386/libi386/biosdisk.c index 194e28327db..dc541489c67 100644 --- a/stand/i386/libi386/biosdisk.c +++ b/stand/i386/libi386/biosdisk.c @@ -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");