Use a couple local variables to avoid repetitive long expressions that
cause line-wrapping.
This commit is contained in:
parent
4d02caf7cb
commit
71c96def1c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=344239
@ -112,15 +112,18 @@ ptable_print(void *arg, const char *pname, const struct ptable_entry *part)
|
||||
struct ptable *table;
|
||||
char line[80];
|
||||
int res;
|
||||
u_int sectsize;
|
||||
uint64_t partsize;
|
||||
|
||||
pa = (struct print_args *)arg;
|
||||
od = (struct open_disk *)pa->dev->dd.d_opendata;
|
||||
sectsize = od->sectorsize;
|
||||
partsize = part->end - part->start + 1;
|
||||
sprintf(line, " %s%s: %s", pa->prefix, pname,
|
||||
parttype2str(part->type));
|
||||
if (pa->verbose)
|
||||
sprintf(line, "%-*s%s", PWIDTH, line,
|
||||
display_size(part->end - part->start + 1,
|
||||
od->sectorsize));
|
||||
display_size(partsize, sectsize));
|
||||
strcat(line, "\n");
|
||||
if (pager_output(line))
|
||||
return 1;
|
||||
@ -131,8 +134,7 @@ ptable_print(void *arg, const char *pname, const struct ptable_entry *part)
|
||||
dev.dd.d_unit = pa->dev->dd.d_unit;
|
||||
dev.d_slice = part->index;
|
||||
dev.d_partition = -1;
|
||||
if (disk_open(&dev, part->end - part->start + 1,
|
||||
od->sectorsize) == 0) {
|
||||
if (disk_open(&dev, partsize, sectsize) == 0) {
|
||||
/*
|
||||
* disk_open() for partition -1 on a bsd slice assumes
|
||||
* you want the first bsd partition. Reset things so
|
||||
@ -140,8 +142,7 @@ ptable_print(void *arg, const char *pname, const struct ptable_entry *part)
|
||||
*/
|
||||
dev.d_partition = -1;
|
||||
dev.d_offset = part->start;
|
||||
table = ptable_open(&dev, part->end - part->start + 1,
|
||||
od->sectorsize, ptblread);
|
||||
table = ptable_open(&dev, partsize, sectsize, ptblread);
|
||||
if (table != NULL) {
|
||||
sprintf(line, " %s%s", pa->prefix, pname);
|
||||
bsd.dev = pa->dev;
|
||||
|
Loading…
Reference in New Issue
Block a user