mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-04 05:58:57 +00:00
Only automatically create an 'a' partition when there is nothing
but a 'c' partition.
This commit is contained in:
parent
cbef13d877
commit
427823d576
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=121222
@ -84,6 +84,7 @@ static int readlabel(int flag);
|
||||
static void display(FILE *, const struct disklabel *);
|
||||
static int edit(void);
|
||||
static int editit(void);
|
||||
static void fixlabel(struct disklabel *);
|
||||
static char *skip(char *);
|
||||
static char *word(char *);
|
||||
static int getasciilabel(FILE *, struct disklabel *);
|
||||
@ -235,6 +236,7 @@ main(int argc, char *argv[])
|
||||
if (argc != 1)
|
||||
usage();
|
||||
readlabel(1);
|
||||
fixlabel(&lab);
|
||||
error = edit();
|
||||
break;
|
||||
|
||||
@ -266,6 +268,7 @@ main(int argc, char *argv[])
|
||||
usage();
|
||||
readlabel(0);
|
||||
makelabel(name, &lab);
|
||||
fixlabel(&lab);
|
||||
if (checklabel(NULL) == 0)
|
||||
error = writelabel();
|
||||
break;
|
||||
@ -273,6 +276,7 @@ main(int argc, char *argv[])
|
||||
case WRITEBOOT:
|
||||
|
||||
readlabel(1);
|
||||
fixlabel(&lab);
|
||||
if (argc == 2)
|
||||
makelabel(argv[1], &lab);
|
||||
if (checklabel(NULL) == 0)
|
||||
@ -282,6 +286,24 @@ main(int argc, char *argv[])
|
||||
exit(error);
|
||||
}
|
||||
|
||||
static void
|
||||
fixlabel(struct disklabel *lp)
|
||||
{
|
||||
struct partition *dp;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAXPARTITIONS; i++) {
|
||||
if (i == RAW_PART)
|
||||
continue;
|
||||
if (lp->d_partitions[i].p_size)
|
||||
return;
|
||||
}
|
||||
|
||||
dp = &lp->d_partitions[0];
|
||||
dp->p_offset = BBSIZE / secsize;
|
||||
dp->p_size = lp->d_secperunit - dp->p_offset;
|
||||
}
|
||||
|
||||
/*
|
||||
* Construct a prototype disklabel from /etc/disktab.
|
||||
*/
|
||||
@ -1338,10 +1360,6 @@ getvirginlabel(void)
|
||||
strncpy(loclab.d_typename, "amnesiac",
|
||||
sizeof(loclab.d_typename));
|
||||
|
||||
dp = &loclab.d_partitions[0];
|
||||
dp->p_offset = BBSIZE / secsize;
|
||||
dp->p_size = loclab.d_secperunit - dp->p_offset;
|
||||
|
||||
dp = &loclab.d_partitions[RAW_PART];
|
||||
dp->p_size = loclab.d_secperunit;
|
||||
loclab.d_checksum = dkcksum(&loclab);
|
||||
|
Loading…
Reference in New Issue
Block a user