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
This commit is contained in:
parent
86981e426d
commit
bdeee1b234
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=335246
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user