diff options
author | ivoras <ivoras@FreeBSD.org> | 2009-03-19 14:23:17 +0000 |
---|---|---|
committer | ivoras <ivoras@FreeBSD.org> | 2009-03-19 14:23:17 +0000 |
commit | 0b62006223bc72e894f48fd2da178bee0d0fb68a (patch) | |
tree | 2616b4fca459b1245428d70c1732e8dbdb3d5c9d /sys/geom | |
parent | 70bfeb48b5b4199951c4d138c3b0c3cd2b9dc760 (diff) | |
download | FreeBSD-src-0b62006223bc72e894f48fd2da178bee0d0fb68a.zip FreeBSD-src-0b62006223bc72e894f48fd2da178bee0d0fb68a.tar.gz |
Make GEOM provider names starting with "/dev/" acceptable as well as their
"raw" names. While there, change the formatting of extended MSDOS partitions
so that the dot (".") is not used to separate two numbers (which kind of
looks like the whole is a decimal number). Use "+" instead, which also
hints that the second part of the name is the offset from the start of
the partition in the first part of the name. Also change the offset from
decimal to hexadecimal notation, simply for aesthetic reasons and future
compatibility.
GEOM_PART is the default in 8-CURRENT but not yet in 7-STABLE so this
changeset can be MFC-ed without causing major problems from the second
part.
Reviewed by: marcel
Approved by: gnn (mentor)
MFC after: 2 weeks
Diffstat (limited to 'sys/geom')
-rw-r--r-- | sys/geom/part/g_part.c | 20 | ||||
-rw-r--r-- | sys/geom/part/g_part_ebr.c | 2 |
2 files changed, 17 insertions, 5 deletions
diff --git a/sys/geom/part/g_part.c b/sys/geom/part/g_part.c index 2e8bb98..b76d7f6 100644 --- a/sys/geom/part/g_part.c +++ b/sys/geom/part/g_part.c @@ -49,6 +49,10 @@ __FBSDID("$FreeBSD$"); #include "g_part_if.h" +#ifndef _PATH_DEV +#define _PATH_DEV "/dev/" +#endif + static kobj_method_t g_part_null_methods[] = { { 0, 0 } }; @@ -273,12 +277,17 @@ g_part_new_provider(struct g_geom *gp, struct g_part_table *table, } static int -g_part_parm_geom(const char *p, struct g_geom **v) +g_part_parm_geom(const char *rawname, struct g_geom **v) { struct g_geom *gp; + const char *pname; + if (strncmp(rawname, _PATH_DEV, strlen(_PATH_DEV)) == 0) + pname = rawname + strlen(_PATH_DEV); + else + pname = rawname; LIST_FOREACH(gp, &g_part_class.geom, geom) { - if (!strcmp(p, gp->name)) + if (!strcmp(pname, gp->name)) break; } if (gp == NULL) @@ -288,11 +297,14 @@ g_part_parm_geom(const char *p, struct g_geom **v) } static int -g_part_parm_provider(const char *p, struct g_provider **v) +g_part_parm_provider(const char *pname, struct g_provider **v) { struct g_provider *pp; - pp = g_provider_by_name(p); + if (strncmp(pname, _PATH_DEV, strlen(_PATH_DEV)) == 0) + pp = g_provider_by_name(pname + strlen(_PATH_DEV)); + else + pp = g_provider_by_name(pname); if (pp == NULL) return (EINVAL); *v = pp; diff --git a/sys/geom/part/g_part_ebr.c b/sys/geom/part/g_part_ebr.c index c307330..134a21b 100644 --- a/sys/geom/part/g_part_ebr.c +++ b/sys/geom/part/g_part_ebr.c @@ -343,7 +343,7 @@ g_part_ebr_name(struct g_part_table *table, struct g_part_entry *entry, char *buf, size_t bufsz) { - snprintf(buf, bufsz, ".%08u", entry->gpe_index); + snprintf(buf, bufsz, "+%08x", entry->gpe_index); return (buf); } |