Finish conversion to generic partitioning backend
This commit is contained in:
parent
3f4e05bdbc
commit
0e36a5a930
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: md.c,v 1.8 2019/07/13 17:13:38 martin Exp $ */
|
/* $NetBSD: md.c,v 1.9 2020/02/10 16:08:58 martin Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 1997 Piermont Information Systems Inc.
|
* Copyright 1997 Piermont Information Systems Inc.
|
||||||
|
@ -247,12 +247,13 @@ md_get_info(struct install_partition_desc *install)
|
||||||
bool
|
bool
|
||||||
md_make_bsd_partitions(struct install_partition_desc *install)
|
md_make_bsd_partitions(struct install_partition_desc *install)
|
||||||
{
|
{
|
||||||
int rv;
|
int i, j, rv;
|
||||||
#if 0 // XXX
|
|
||||||
FILE *f;
|
|
||||||
int i, j, pl;
|
|
||||||
EBZB *bzb;
|
EBZB *bzb;
|
||||||
#endif
|
struct disk_part_info info;
|
||||||
|
uint fs_type;
|
||||||
|
const char *mountpoint;
|
||||||
|
part_id pid;
|
||||||
|
size_t ndx;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Scan for any problems and report them before continuing.
|
* Scan for any problems and report them before continuing.
|
||||||
|
@ -272,15 +273,9 @@ md_make_bsd_partitions(struct install_partition_desc *install)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0 // XXX
|
/* Start with empty fake disklabel partitions */
|
||||||
/* Build standard partitions */
|
pm->parts->pscheme->delete_all_partitions(pm->parts);
|
||||||
memset(&pm->bsdlabel, 0, sizeof pm->bsdlabel);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The mac68k port has a predefined partition for "c" which
|
|
||||||
* is the size of the disk, everything else is unused.
|
|
||||||
*/
|
|
||||||
pm->bsdlabel[RAW_PART].pi_size = pm->dlsize;
|
|
||||||
/*
|
/*
|
||||||
* Now, scan through the Disk Partition Map and transfer the
|
* Now, scan through the Disk Partition Map and transfer the
|
||||||
* information into the incore disklabel.
|
* information into the incore disklabel.
|
||||||
|
@ -289,80 +284,63 @@ md_make_bsd_partitions(struct install_partition_desc *install)
|
||||||
j = map.mblk[i];
|
j = map.mblk[i];
|
||||||
bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
|
bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
|
||||||
if (bzb->flags.part) {
|
if (bzb->flags.part) {
|
||||||
pl = bzb->flags.part - 'a';
|
mountpoint = NULL;
|
||||||
|
fs_type = FS_UNUSED;
|
||||||
switch (whichType(&map.blk[j])) {
|
switch (whichType(&map.blk[j])) {
|
||||||
case HFS_PART:
|
case HFS_PART:
|
||||||
pm->bsdlabel[pl].pi_fstype = FS_HFS;
|
fs_type = FS_HFS;
|
||||||
strcpy (pm->bsdlabel[pl].pi_mount, (char *)bzb->mount_point);
|
mountpoint = (const char*)bzb->mount_point;
|
||||||
break;
|
break;
|
||||||
case ROOT_PART:
|
case ROOT_PART:
|
||||||
case UFS_PART:
|
case UFS_PART:
|
||||||
pm->bsdlabel[pl].pi_fstype = FS_BSDFFS;
|
fs_type = FS_BSDFFS;
|
||||||
strcpy (pm->bsdlabel[pl].pi_mount, (char *)bzb->mount_point);
|
mountpoint = (const char*)bzb->mount_point;
|
||||||
pm->bsdlabel[pl].pi_flags |= PIF_NEWFS | PIF_MOUNT;
|
|
||||||
break;
|
break;
|
||||||
case SWAP_PART:
|
case SWAP_PART:
|
||||||
pm->bsdlabel[pl].pi_fstype = FS_SWAP;
|
fs_type = FS_SWAP;
|
||||||
break;
|
break;
|
||||||
case SCRATCH_PART:
|
case SCRATCH_PART:
|
||||||
pm->bsdlabel[pl].pi_fstype = FS_OTHER;
|
fs_type = FS_OTHER;
|
||||||
strcpy (pm->bsdlabel[pl].pi_mount, (char *)bzb->mount_point);
|
mountpoint = (const char*)bzb->mount_point;
|
||||||
default:
|
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
if (pm->bsdlabel[pl].pi_fstype != FS_UNUSED) {
|
if (fs_type != FS_UNUSED) {
|
||||||
pm->bsdlabel[pl].pi_size = map.blk[j].pmPartBlkCnt;
|
memset(&info, 0, sizeof info);
|
||||||
pm->bsdlabel[pl].pi_offset = map.blk[j].pmPyPartStart;
|
info.start = map.blk[j].pmPyPartStart;
|
||||||
if (pm->bsdlabel[pl].pi_fstype != FS_SWAP) {
|
info.size = map.blk[j].pmPartBlkCnt;
|
||||||
pm->bsdlabel[pl].pi_frag = 8;
|
info.fs_type = fs_type;
|
||||||
pm->bsdlabel[pl].pi_fsize = 1024;
|
info.last_mounted = mountpoint;
|
||||||
}
|
info.nat_type = pm->parts->pscheme->get_fs_part_type(
|
||||||
|
PT_root, fs_type, 0);
|
||||||
|
pid = pm->parts->pscheme->add_outer_partition(pm->parts,
|
||||||
|
&info, NULL);
|
||||||
|
if (pid == NO_PART)
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Disk name - don't bother asking, just use the physical name*/
|
/* Disk name - don't bother asking, just use the physical name*/
|
||||||
strcpy (pm->bsddiskname, pm->diskdev);
|
pm->parts->pscheme->set_disk_pack_name(pm->parts, pm->diskdev);
|
||||||
|
|
||||||
#ifdef DEBUG
|
/* Write the converted partitions */
|
||||||
f = fopen ("/tmp/disktab", "w");
|
if (!pm->parts->pscheme->write_to_disk(pm->parts))
|
||||||
#else
|
return false;
|
||||||
f = fopen ("/etc/disktab", "w");
|
|
||||||
#endif
|
/* now convert to install info */
|
||||||
if (f == NULL) {
|
if (!install_desc_from_parts(install, pm->parts))
|
||||||
endwin();
|
return false;
|
||||||
(void) fprintf (stderr, "Could not open /etc/disktab");
|
|
||||||
exit (1);
|
/* set newfs flag for all FFS partitions */
|
||||||
}
|
for (ndx = 0; ndx < install->num; ndx++) {
|
||||||
(void)fprintf (f, "%s|NetBSD installation generated:\\\n", pm->bsddiskname);
|
if (install->infos[ndx].fs_type == FS_BSDFFS &&
|
||||||
(void)fprintf (f, "\t:dt=%s:ty=winchester:\\\n", pm->disktype);
|
install->infos[ndx].size > 0 &&
|
||||||
(void)fprintf (f, "\t:nc#%d:nt#%d:ns#%d:\\\n", pm->dlcyl, pm->dlhead, pm->dlsec);
|
(install->infos[ndx].instflags & PUIINST_MOUNT))
|
||||||
(void)fprintf (f, "\t:sc#%d:su#%" PRIu32 ":\\\n", pm->dlhead*pm->dlsec, (uint32_t)pm->dlsize);
|
install->infos[ndx].instflags |= PUIINST_NEWFS;
|
||||||
(void)fprintf (f, "\t:se#%d:%s\\\n", blk_size, pm->doessf);
|
}
|
||||||
for (i=0; i<8; i++) {
|
|
||||||
if (pm->bsdlabel[i].pi_fstype == FS_HFS)
|
|
||||||
(void)fprintf (f, "\t:p%c#%d:o%c#%d:t%c=macos:",
|
|
||||||
'a'+i, pm->bsdlabel[i].pi_size,
|
|
||||||
'a'+i, pm->bsdlabel[i].pi_offset,
|
|
||||||
'a'+i);
|
|
||||||
else
|
|
||||||
(void)fprintf (f, "\t:p%c#%d:o%c#%d:t%c=%s:",
|
|
||||||
'a'+i, pm->bsdlabel[i].pi_size,
|
|
||||||
'a'+i, pm->bsdlabel[i].pi_offset,
|
|
||||||
'a'+i, getfslabelname(pm->bsdlabel[i].pi_fstype));
|
|
||||||
if (pm->bsdlabel[i].pi_fstype == FS_BSDFFS)
|
|
||||||
(void)fprintf (f, "b%c#%d:f%c#%d",
|
|
||||||
'a'+i, pm->bsdlabel[i].pi_fsize * pm->bsdlabel[i].pi_frag,
|
|
||||||
'a'+i, pm->bsdlabel[i].pi_fsize);
|
|
||||||
if (i < 7)
|
|
||||||
(void)fprintf (f, "\\\n");
|
|
||||||
else
|
|
||||||
(void)fprintf (f, "\n");
|
|
||||||
}
|
|
||||||
fclose (f);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Everything looks OK. */
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue