aboutsummaryrefslogtreecommitdiff
path: root/sys/geom/part/g_part_gpt.c
diff options
context:
space:
mode:
authorMarcel Moolenaar <marcel@FreeBSD.org>2007-05-08 20:18:17 +0000
committerMarcel Moolenaar <marcel@FreeBSD.org>2007-05-08 20:18:17 +0000
commitd287f590628fdf4fbdef05005ce3c2f9c0dc5a8f (patch)
tree070fc043d16305f96576d840dde7f300001f7e6b /sys/geom/part/g_part_gpt.c
parent62c4e3f043760c276e8044d1864e03c966fe55db (diff)
downloadsrc-d287f590628fdf4fbdef05005ce3c2f9c0dc5a8f.tar.gz
src-d287f590628fdf4fbdef05005ce3c2f9c0dc5a8f.zip
MFp4:
119373: o Remove the query verb, along with the request and response parameters. o Add the version and output parameters. 119390: [APM,GPT] Properly clear deleted entries. 119394: o Make the alias the standard and use the '!' to prefix literal partition types. o Treat schemes and partition types as case insensitive. 119462: [GPT] Fix a page fault caused when modifying a partition entry without a new partition type.
Notes
Notes: svn path=/head/; revision=169389
Diffstat (limited to 'sys/geom/part/g_part_gpt.c')
-rw-r--r--sys/geom/part/g_part_gpt.c49
1 files changed, 35 insertions, 14 deletions
diff --git a/sys/geom/part/g_part_gpt.c b/sys/geom/part/g_part_gpt.c
index f8370a530f75..9f627b7b9714 100644
--- a/sys/geom/part/g_part_gpt.c
+++ b/sys/geom/part/g_part_gpt.c
@@ -272,10 +272,11 @@ static int
gpt_parse_type(const char *type, struct uuid *uuid)
{
struct uuid tmp;
+ const char *alias;
int error;
- if (type[0] != '@') {
- error = parse_uuid(type, &tmp);
+ if (type[0] == '!') {
+ error = parse_uuid(type + 1, &tmp);
if (error)
return (error);
if (EQUUID(&tmp, &gpt_uuid_unused))
@@ -283,21 +284,37 @@ gpt_parse_type(const char *type, struct uuid *uuid)
*uuid = tmp;
return (0);
}
- if (!strcmp(type, g_part_alias_name(G_PART_ALIAS_EFI)))
+ alias = g_part_alias_name(G_PART_ALIAS_EFI);
+ if (!strcasecmp(type, alias)) {
*uuid = gpt_uuid_efi;
- else if (!strcmp(type, g_part_alias_name(G_PART_ALIAS_FREEBSD)))
+ return (0);
+ }
+ alias = g_part_alias_name(G_PART_ALIAS_FREEBSD);
+ if (!strcasecmp(type, alias)) {
*uuid = gpt_uuid_freebsd;
- else if (!strcmp(type, g_part_alias_name(G_PART_ALIAS_FREEBSD_SWAP)))
+ return (0);
+ }
+ alias = g_part_alias_name(G_PART_ALIAS_FREEBSD_SWAP);
+ if (!strcasecmp(type, alias)) {
*uuid = gpt_uuid_freebsd_swap;
- else if (!strcmp(type, g_part_alias_name(G_PART_ALIAS_FREEBSD_UFS)))
+ return (0);
+ }
+ alias = g_part_alias_name(G_PART_ALIAS_FREEBSD_UFS);
+ if (!strcasecmp(type, alias)) {
*uuid = gpt_uuid_freebsd_ufs;
- else if (!strcmp(type, g_part_alias_name(G_PART_ALIAS_FREEBSD_VINUM)))
+ return (0);
+ }
+ alias = g_part_alias_name(G_PART_ALIAS_FREEBSD_VINUM);
+ if (!strcasecmp(type, alias)) {
*uuid = gpt_uuid_freebsd_vinum;
- else if (!strcmp(type, g_part_alias_name(G_PART_ALIAS_MBR)))
+ return (0);
+ }
+ alias = g_part_alias_name(G_PART_ALIAS_MBR);
+ if (!strcasecmp(type, alias)) {
*uuid = gpt_uuid_mbr;
- else
- return (EINVAL);
- return (0);
+ return (0);
+ }
+ return (EINVAL);
}
static int
@@ -391,9 +408,11 @@ g_part_gpt_modify(struct g_part_table *basetable,
int error;
entry = (struct g_part_gpt_entry *)baseentry;
- error = gpt_parse_type(gpp->gpp_type, &entry->ent.ent_type);
- if (error)
- return (error);
+ if (gpp->gpp_parms & G_PART_PARM_TYPE) {
+ error = gpt_parse_type(gpp->gpp_type, &entry->ent.ent_type);
+ if (error)
+ return (error);
+ }
/* XXX label */
return (0);
}
@@ -636,6 +655,8 @@ g_part_gpt_write(struct g_part_table *basetable, struct g_consumer *cp)
le32enc(buf + 84, table->hdr.hdr_entsz);
LIST_FOREACH(baseentry, &basetable->gpt_entry, gpe_entry) {
+ if (baseentry->gpe_deleted)
+ continue;
entry = (struct g_part_gpt_entry *)baseentry;
index = baseentry->gpe_index - 1;
bp = buf + pp->sectorsize + table->hdr.hdr_entsz * index;