[Midnightbsd-cvs] src: usr.sbin/sysinstall: Somehow we screwed up the label steps.
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Thu May 29 16:50:14 EDT 2008
Log Message:
-----------
Somehow we screwed up the label steps. Let's back that out and see if we can narrow it down to this file.
Modified Files:
--------------
src/usr.sbin/sysinstall:
disks.c (r1.4 -> r1.5)
label.c (r1.7 -> r1.8)
-------------- next part --------------
Index: label.c
===================================================================
RCS file: /home/cvs/src/usr.sbin/sysinstall/label.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -L usr.sbin/sysinstall/label.c -L usr.sbin/sysinstall/label.c -u -r1.7 -r1.8
--- usr.sbin/sysinstall/label.c
+++ usr.sbin/sysinstall/label.c
@@ -364,7 +364,11 @@
pi->newfs_data.newfs_ufs.acls = FALSE;
pi->newfs_data.newfs_ufs.multilabel = FALSE;
pi->newfs_data.newfs_ufs.softupdates = strcmp(mpoint, "/");
+#ifdef PC98
+ pi->newfs_data.newfs_ufs.ufs1 = TRUE;
+#else
pi->newfs_data.newfs_ufs.ufs1 = FALSE;
+#endif
}
return pi;
@@ -489,7 +493,7 @@
snprintf(buffer, NEWFS_CMD_ARGS_MAX, "%s", NEWFS_MSDOS_CMD);
break;
case NEWFS_CUSTOM:
- strlcpy(buffer, p->newfs_data.newfs_custom.command, sizeof(buffer));
+ strcpy(buffer, p->newfs_data.newfs_custom.command);
break;
}
@@ -704,14 +708,14 @@
/* Now display the newfs field */
if (label_chunk_info[i].type == PART_FAT)
- strlcpy(newfs, "DOS", sizeof(newfs));
+ strcpy(newfs, "DOS");
#if defined(__ia64__)
else if (label_chunk_info[i].type == PART_EFI) {
- strlcpy(newfs, "EFI", sizeof(newfs));
+ strcpy(newfs, "EFI");
if (label_chunk_info[i].c->private_data) {
- strlcat(newfs, " ", sizeof(newfs));
+ strcat(newfs, " ");
PartInfo *pi = (PartInfo *)label_chunk_info[i].c->private_data;
- strlcat(newfs, pi->do_newfs ? " Y" : " N", sizeof(newfs));
+ strcat(newfs, pi->do_newfs ? " Y" : " N");
}
}
#endif
@@ -720,30 +724,30 @@
switch (pi->newfs_type) {
case NEWFS_UFS:
- strlcpy(newfs, NEWFS_UFS_STRING, sizeof(newfs));
+ strcpy(newfs, NEWFS_UFS_STRING);
if (pi->newfs_data.newfs_ufs.ufs1)
- strlcat(newfs, "1", sizeof(newfs));
+ strcat(newfs, "1");
else
- strlcat(newfs, "2", sizeof(newfs));
+ strcat(newfs, "2");
if (pi->newfs_data.newfs_ufs.softupdates)
- strlcat(newfs, "+S", sizeof(newfs));
+ strcat(newfs, "+S");
else
- strlcat(newfs, " ", sizeof(newfs));
+ strcat(newfs, " ");
break;
case NEWFS_MSDOS:
- strlcpy(newfs, "FAT", sizeof(newfs));
+ strcpy(newfs, "FAT");
break;
case NEWFS_CUSTOM:
- strlcpy(newfs, "CUST", sizeof(newfs));
+ strcpy(newfs, "CUST");
break;
}
- strlcat(newfs, pi->do_newfs ? " Y" : " N ", sizeof(newfs));
+ strcat(newfs, pi->do_newfs ? " Y" : " N ");
}
else if (label_chunk_info[i].type == PART_SWAP)
- strlcpy(newfs, "SWAP", sizeof(newfs));
+ strcpy(newfs, "SWAP");
else
- strlcpy(newfs, "*", sizeof(newfs));
+ strcpy(newfs, "*");
for (j = 0; j < MAX_MOUNT_NAME && mountpoint[j]; j++)
onestr[PART_MOUNT_COL + j] = mountpoint[j];
if (label_chunk_info[i].c->size == 0)
@@ -766,7 +770,7 @@
/*** lazy man's way of expensively padding this string ***/
while (strlen(onestr) < 37)
- strlcat(onestr, " ", sizeof(newfs));
+ strcat(onestr, " ");
mvwaddstr(ChunkWin, prow, pcol, onestr);
wattrset(ChunkWin, A_NORMAL);
@@ -983,7 +987,7 @@
char osize[80];
u_long flags = 0;
- snprintf(osize, sizeof(osize), "%jd", (intmax_t)sz);
+ sprintf(osize, "%jd", (intmax_t)sz);
val = msgGetInput(osize,
"Please specify the partition size in blocks or append a trailing G for\n"
#ifdef __ia64__
@@ -1129,7 +1133,7 @@
!strcmp(p->mountpoint, "/usr") ||
!strcmp(p->mountpoint, "/var"))) {
msgConfirm("%s is an invalid mount point for a DOS partition!", p->mountpoint);
- strlcpy(p->mountpoint, "/bogus", sizeof(p->mountpoint));
+ strcpy(p->mountpoint, "/bogus");
}
}
if (variable_cmp(DISK_LABELLED, "written"))
@@ -1288,7 +1292,7 @@
default:
beep();
- snprintf(_msg, sizeof(_msg), "Invalid key %d - Type F1 or ? for help", key);
+ sprintf(_msg, "Invalid key %d - Type F1 or ? for help", key);
msg = _msg;
break;
}
@@ -1595,7 +1599,7 @@
flags = 0;
if (!strcmp(typ, "swap")) {
type = PART_SWAP;
- strlcpy(mpoint, "SWAP", sizeof(mpoint));
+ strcpy(mpoint, "SWAP");
} else {
type = PART_FILESYSTEM;
if (!strcmp(mpoint, "/"))
@@ -1638,7 +1642,7 @@
if (c1->private_data) {
p = c1->private_data;
p->do_newfs = newfs;
- strlcpy(p->mountpoint, mpoint, sizeof(p->mountpoint));
+ strcpy(p->mountpoint, mpoint);
}
else {
c1->private_data = new_part(PART_FILESYSTEM, mpoint, newfs);
Index: disks.c
===================================================================
RCS file: /home/cvs/src/usr.sbin/sysinstall/disks.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -L usr.sbin/sysinstall/disks.c -L usr.sbin/sysinstall/disks.c -u -r1.4 -r1.5
--- usr.sbin/sysinstall/disks.c
+++ usr.sbin/sysinstall/disks.c
@@ -46,25 +46,14 @@
#ifdef WITH_SLICES
enum size_units_t { UNIT_BLOCKS, UNIT_KILO, UNIT_MEG, UNIT_GIG, UNIT_SIZE };
-#ifdef PC98
-#define SUBTYPE_FREEBSD 50324
-#define SUBTYPE_FAT 37218
-#else
#define SUBTYPE_FREEBSD 165
#define SUBTYPE_FAT 6
-#endif
#define SUBTYPE_EFI 239
-#ifdef PC98
-#define OTHER_SLICE_VALUES \
- "Other popular values are 37218 for a\n" \
- "DOS FAT partition.\n\n"
-#else
#define OTHER_SLICE_VALUES \
"Other popular values are 6 for a\n" \
"DOS FAT partition, 131 for a Linux ext2fs partition, or\n" \
"130 for a Linux swap partition.\n\n"
-#endif
#define NON_FREEBSD_NOTE \
"Note: If you choose a non-MidnightBSD partition type, it will not\n" \
"be formatted or otherwise prepared, it will simply reserve space\n" \
@@ -120,11 +109,7 @@
Total = 0;
for (i = 0; chunk_info[i]; i++)
Total += chunk_info[i]->size;
-#ifdef PC98
- if (d->bios_cyl >= 65536 || d->bios_hd > 256 || d->bios_sect >= 256) {
-#else
if (d->bios_cyl > 65536 || d->bios_hd > 256 || d->bios_sect >= 64) {
-#endif
if (!variable_get(VAR_NONINTERACTIVE)) {
dialog_clear_norefresh();
msgConfirm("WARNING: A geometry of %lu/%lu/%lu for %s is incorrect. Using\n"
@@ -200,53 +185,6 @@
move(0, 0);
}
-#ifdef PC98
-static void
-getBootMgr(char *dname, u_char **bootipl, size_t *bootipl_size,
- u_char **bootmenu, size_t *bootmenu_size)
-{
- static u_char *boot0;
- static size_t boot0_size;
- static u_char *boot05;
- static size_t boot05_size;
-
- char str[80];
- char *cp;
- int i = 0;
-
- cp = variable_get(VAR_BOOTMGR);
- if (!cp) {
- /* Figure out what kind of IPL the user wants */
- snprintf(str, sizeof(str), "Install Boot Manager for drive %s?", dname);
- MenuIPLType.title = str;
- i = dmenuOpenSimple(&MenuIPLType, FALSE);
- } else {
- if (!strncmp(cp, "boot", 4))
- BootMgr = 0;
- else
- BootMgr = 1;
- }
- if (cp || i) {
- switch (BootMgr) {
- case 0:
- if (!boot0) boot0 = bootalloc("boot0", &boot0_size);
- *bootipl = boot0;
- *bootipl_size = boot0_size;
- if (!boot05) boot05 = bootalloc("boot0.5", &boot05_size);
- *bootmenu = boot05;
- *bootmenu_size = boot05_size;
- return;
- case 1:
- default:
- break;
- }
- }
- *bootipl = NULL;
- *bootipl_size = 0;
- *bootmenu = NULL;
- *bootmenu_size = 0;
-}
-#else
static void
getBootMgr(char *dname, u_char **bootCode, size_t *bootCodeSize)
{
@@ -293,7 +231,6 @@
*bootCode = NULL;
*bootCodeSize = 0;
}
-#endif
#endif /* WITH_SLICES */
int
@@ -324,15 +261,8 @@
int i;
Boolean chunking;
char *msg = NULL;
-#ifdef PC98
- u_char *bootipl;
- size_t bootipl_size;
- u_char *bootmenu;
- size_t bootmenu_size;
-#else
u_char *mbrContents;
size_t mbrSize;
-#endif
WINDOW *w = savescr();
Disk *d = (Disk *)dev->private;
int size_unit;
@@ -439,15 +369,7 @@
daddr_t size;
int subtype;
chunk_e partitiontype;
-#ifdef PC98
- snprintf(name, sizeof (name), "%s", "MidnightBSD");
- val = msgGetInput(name,
- "Please specify the name for new MidnightBSD slice.");
- if (val)
- strncpy(name, val, sizeof (name));
-#else
name[0] = '\0';
-#endif
snprintf(tmp, 20, "%jd", (intmax_t)chunk_info[current_chunk]->size);
val = msgGetInput(tmp, "Please specify the size for new MidnightBSD slice in blocks\n"
"or append a trailing `M' for megabytes (e.g. 20M).");
@@ -496,7 +418,7 @@
if (chunk_info[current_chunk]->type == unused)
msg = "Slice is currently unused (use create instead)";
else {
- char *val, tmp[20];
+ char *val, tmp[24];
int subtype;
chunk_e partitiontype;
@@ -577,31 +499,6 @@
"Are you absolutely sure you want to do this now?")) {
variable_set2(DISK_PARTITIONED, "yes", 0);
-#ifdef PC98
- /*
- * Don't trash the IPL if the first (and therefore only) chunk
- * is marked for a truly dedicated disk (i.e., the disklabel
- * starts at sector 0), even in cases where the user has
- * requested a MidnightBSD Boot Manager -- both would be fatal in
- * this case.
- */
- /*
- * Don't offer to update the IPL on this disk if the first
- * "real" chunk looks like a MidnightBSD "all disk" partition,
- * or the disk is entirely MidnightBSD.
- */
- if ((d->chunks->part->type != freebsd) ||
- (d->chunks->part->offset > 1))
- getBootMgr(d->name, &bootipl, &bootipl_size,
- &bootmenu, &bootmenu_size);
- else {
- bootipl = NULL;
- bootipl_size = 0;
- bootmenu = NULL;
- bootmenu_size = 0;
- }
- Set_Boot_Mgr(d, bootipl, bootipl_size, bootmenu, bootmenu_size);
-#else
/*
* Don't trash the MBR if the first (and therefore only) chunk
* is marked for a truly dedicated disk (i.e., the disklabel
@@ -622,7 +519,6 @@
mbrSize = 0;
}
Set_Boot_Mgr(d, mbrContents, mbrSize);
-#endif
if (DITEM_STATUS(diskPartitionWrite(NULL)) != DITEM_SUCCESS)
msgConfirm("Disk partition write returned an error status!");
@@ -649,29 +545,6 @@
case '\033': /* ESC */
case 'Q':
chunking = FALSE;
-#ifdef PC98
- /*
- * Don't trash the IPL if the first (and therefore only) chunk
- * is marked for a truly dedicated disk (i.e., the disklabel
- * starts at sector 0), even in cases where the user has requested
- * a MidnightBSD Boot Manager -- both would be fatal in this case.
- */
- /*
- * Don't offer to update the IPL on this disk if the first "real"
- * chunk looks like a MidnightBSD "all disk" partition, or the disk is
- * entirely MidnightBSD.
- */
- if ((d->chunks->part->type != freebsd) ||
- (d->chunks->part->offset > 1)) {
- if (variable_cmp(DISK_PARTITIONED, "written")) {
- getBootMgr(d->name, &bootipl, &bootipl_size,
- &bootmenu, &bootmenu_size);
- if (bootipl != NULL && bootmenu != NULL)
- Set_Boot_Mgr(d, bootipl, bootipl_size,
- bootmenu, bootmenu_size);
- }
- }
-#else
/*
* Don't trash the MBR if the first (and therefore only) chunk
* is marked for a truly dedicated disk (i.e., the disklabel
@@ -691,7 +564,6 @@
Set_Boot_Mgr(d, mbrContents, mbrSize);
}
}
-#endif
break;
case 'Z':
@@ -896,15 +768,8 @@
char *cp;
int i, all_disk = 0;
daddr_t sz;
-#ifdef PC98
- u_char *bootipl;
- size_t bootipl_size;
- u_char *bootmenu;
- size_t bootmenu_size;
-#else
u_char *mbrContents;
size_t mbrSize;
-#endif
Disk *d = (Disk *)dev->private;
record_chunks(d);
@@ -986,14 +851,8 @@
return;
}
if (!all_disk) {
-#ifdef PC98
- getBootMgr(d->name, &bootipl, &bootipl_size,
- &bootmenu, &bootmenu_size);
- Set_Boot_Mgr(d, bootipl, bootipl_size, bootmenu, bootmenu_size);
-#else
getBootMgr(d->name, &mbrContents, &mbrSize);
Set_Boot_Mgr(d, mbrContents, mbrSize);
-#endif
}
variable_set2(DISK_PARTITIONED, "yes", 0);
}
More information about the Midnightbsd-cvs
mailing list