Skip to content

Commit

Permalink
7951 loader: disk_print should open nested partition with disk_open
Browse files Browse the repository at this point in the history
Reviewed by: Marcel Telka <marcel@telka.sk>
Reviewed by: Jason King <jason.brian.king@gmail.com>
Approved by: Robert Mustacchi <rm@joyent.com>
  • Loading branch information
tsoome authored and rmustacc committed Mar 21, 2017
1 parent fe1911a commit 0eec6d6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
2 changes: 1 addition & 1 deletion usr/src/boot/Makefile.version
Expand Up @@ -33,4 +33,4 @@ LOADER_VERSION = 1.1
# Use date like formatting here, YYYY.MM.DD.XX, without leading zeroes.
# The version is processed from left to right, the version number can only
# be increased.
BOOT_VERSION = $(LOADER_VERSION)-2017.3.15.1
BOOT_VERSION = $(LOADER_VERSION)-2017.3.16.1
30 changes: 19 additions & 11 deletions usr/src/boot/sys/boot/common/disk.c
Expand Up @@ -93,6 +93,7 @@ ptblread(void *d, void *buf, size_t blocks, uint64_t offset)
static int
ptable_print(void *arg, const char *pname, const struct ptable_entry *part)
{
struct disk_devdesc dev;
struct print_args *pa, bsd;
struct open_disk *od;
struct ptable *table;
Expand All @@ -113,17 +114,24 @@ ptable_print(void *arg, const char *pname, const struct ptable_entry *part)
return (ret);
if (part->type == PART_FREEBSD || part->type == PART_SOLARIS2) {
/* Open slice with BSD or VTOC label */
pa->dev->d_offset = part->start;
table = ptable_open(pa->dev, part->end - part->start + 1,
od->sectorsize, ptblread);
if (table == NULL)
return (ret);
sprintf(line, " %s%s", pa->prefix, pname);
bsd.dev = pa->dev;
bsd.prefix = line;
bsd.verbose = pa->verbose;
ret = ptable_iterate(table, &bsd, ptable_print);
ptable_close(table);
dev.d_dev = pa->dev->d_dev;
dev.d_unit = pa->dev->d_unit;
dev.d_slice = part->index;
dev.d_partition = -1;
if (disk_open(&dev, part->end - part->start + 1,
od->sectorsize) == 0) {
table = ptable_open(&dev, part->end - part->start + 1,
od->sectorsize, ptblread);
if (table != NULL) {
sprintf(line, " %s%s", pa->prefix, pname);
bsd.dev = &dev;
bsd.prefix = line;
bsd.verbose = pa->verbose;
ret = ptable_iterate(table, &bsd, ptable_print);
ptable_close(table);
}
disk_close(&dev);
}
}
return (ret);
}
Expand Down

0 comments on commit 0eec6d6

Please sign in to comment.