Teach gpart about bootcode on APM.

This commit is contained in:
Nathan Whitehorn 2010-05-16 22:21:33 +00:00
parent 4a26780b9a
commit 0532c3a5a5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=208173
2 changed files with 27 additions and 1 deletions

View File

@ -705,7 +705,7 @@ gpart_bootcode(struct gctl_req *req, unsigned int fl)
if (gctl_has_param(req, bootcode_param)) {
s = gctl_get_ascii(req, bootcode_param);
bootsize = 64 * 1024; /* Arbitrary limit. */
bootsize = 800 * 1024; /* Arbitrary limit. */
bootcode = gpart_bootfile_read(s, &bootsize);
error = gctl_change_param(req, bootcode_param, bootsize,
bootcode);

View File

@ -131,6 +131,26 @@ apm_parse_type(const char *type, char *buf, size_t bufsz)
strncpy(buf, type, bufsz);
return (0);
}
alias = g_part_alias_name(G_PART_ALIAS_APPLE_BOOT);
if (!strcasecmp(type, alias)) {
strcpy(buf, APM_ENT_TYPE_APPLE_BOOT);
return (0);
}
alias = g_part_alias_name(G_PART_ALIAS_APPLE_HFS);
if (!strcasecmp(type, alias)) {
strcpy(buf, APM_ENT_TYPE_APPLE_HFS);
return (0);
}
alias = g_part_alias_name(G_PART_ALIAS_APPLE_UFS);
if (!strcasecmp(type, alias)) {
strcpy(buf, APM_ENT_TYPE_APPLE_UFS);
return (0);
}
alias = g_part_alias_name(G_PART_ALIAS_FREEBSD_BOOT);
if (!strcasecmp(type, alias)) {
strcpy(buf, APM_ENT_TYPE_APPLE_BOOT);
return (0);
}
alias = g_part_alias_name(G_PART_ALIAS_FREEBSD);
if (!strcasecmp(type, alias)) {
strcpy(buf, APM_ENT_TYPE_FREEBSD);
@ -445,6 +465,12 @@ g_part_apm_type(struct g_part_table *basetable, struct g_part_entry *baseentry,
entry = (struct g_part_apm_entry *)baseentry;
type = entry->ent.ent_type;
if (!strcmp(type, APM_ENT_TYPE_APPLE_BOOT))
return (g_part_alias_name(G_PART_ALIAS_APPLE_BOOT));
if (!strcmp(type, APM_ENT_TYPE_APPLE_HFS))
return (g_part_alias_name(G_PART_ALIAS_APPLE_HFS));
if (!strcmp(type, APM_ENT_TYPE_APPLE_UFS))
return (g_part_alias_name(G_PART_ALIAS_APPLE_UFS));
if (!strcmp(type, APM_ENT_TYPE_FREEBSD))
return (g_part_alias_name(G_PART_ALIAS_FREEBSD));
if (!strcmp(type, APM_ENT_TYPE_FREEBSD_SWAP))