git: 6c7bc93da699 - main - g_part_ebr: always create "compat" aliases
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 01 Mar 2023 18:47:34 UTC
The branch main has been updated by emaste:
URL: https://cgit.FreeBSD.org/src/commit/?id=6c7bc93da699054bb8ead58fdc226e084d929515
commit 6c7bc93da699054bb8ead58fdc226e084d929515
Author: Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2023-02-27 19:13:09 +0000
Commit: Ed Maste <emaste@FreeBSD.org>
CommitDate: 2023-03-01 18:44:01 +0000
g_part_ebr: always create "compat" aliases
The "canonical" EBR partition names like `ada0s4+00002081` are not
particularly meaningful. The "compat" aliases share the same namespace
as the parent MBR, resulting in user-friendly names like `ada0s6`.
These names are consistent with the way Linux names EBR partitions.
We previously provided a sysctl kern.features.geom_part_ebr_compat
(enabled by default) to control the "compat" names. Remove the sysctl
and always create the aliases.
Relnotes: yes
Reviewed by: cem, imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D38812
---
sys/geom/part/g_part_ebr.c | 34 +++++++++++-----------------------
1 file changed, 11 insertions(+), 23 deletions(-)
diff --git a/sys/geom/part/g_part_ebr.c b/sys/geom/part/g_part_ebr.c
index f7aaf1c45cb6..1eb8e30d8adf 100644
--- a/sys/geom/part/g_part_ebr.c
+++ b/sys/geom/part/g_part_ebr.c
@@ -59,11 +59,6 @@ SYSCTL_DECL(_kern_geom_part);
static SYSCTL_NODE(_kern_geom_part, OID_AUTO, ebr, CTLFLAG_RW | CTLFLAG_MPSAFE,
0, "GEOM_PART_EBR Extended Boot Record");
-static bool compat_aliases = true;
-SYSCTL_BOOL(_kern_geom_part_ebr, OID_AUTO, compat_aliases,
- CTLFLAG_RDTUN, &compat_aliases, 0,
- "Set non-zero to enable EBR compatibility alias names (e.g., ada0p5)");
-
#define EBRNAMFMT "+%08u"
#define EBRSIZE 512
@@ -284,12 +279,10 @@ g_part_ebr_add(struct g_part_table *basetable, struct g_part_entry *baseentry,
ebr_set_chs(basetable, baseentry->gpe_end, &entry->ent.dp_ecyl,
&entry->ent.dp_ehd, &entry->ent.dp_esect);
- if (compat_aliases) {
- idx = 5;
- LIST_FOREACH(iter, &basetable->gpt_entry, gpe_entry)
- idx++;
- entry->ebr_compat_idx = idx;
- }
+ idx = 5;
+ LIST_FOREACH(iter, &basetable->gpt_entry, gpe_entry)
+ idx++;
+ entry->ebr_compat_idx = idx;
return (ebr_parse_type(gpp->gpp_type, &entry->ent.dp_typ));
}
@@ -301,11 +294,9 @@ g_part_ebr_add_alias(struct g_part_table *table, struct g_provider *pp,
g_provider_add_alias(pp, "%s%s" EBRNAMFMT, pfx, g_part_separator,
baseentry->gpe_index);
- if (compat_aliases) {
- entry = (struct g_part_ebr_entry *)baseentry;
- g_provider_add_alias(pp, "%.*s%u", (int)strlen(pfx) - 1, pfx,
- entry->ebr_compat_idx);
- }
+ entry = (struct g_part_ebr_entry *)baseentry;
+ g_provider_add_alias(pp, "%.*s%u", (int)strlen(pfx) - 1, pfx,
+ entry->ebr_compat_idx);
}
static struct g_provider *
@@ -317,11 +308,9 @@ g_part_ebr_new_provider(struct g_part_table *table, struct g_geom *gp,
pp = g_new_providerf(gp, "%s%s" EBRNAMFMT, pfx, g_part_separator,
baseentry->gpe_index);
- if (compat_aliases) {
- entry = (struct g_part_ebr_entry *)baseentry;
- g_provider_add_alias(pp, "%.*s%u", (int)strlen(pfx) - 1, pfx,
- entry->ebr_compat_idx);
- }
+ entry = (struct g_part_ebr_entry *)baseentry;
+ g_provider_add_alias(pp, "%.*s%u", (int)strlen(pfx) - 1, pfx,
+ entry->ebr_compat_idx);
return (pp);
}
@@ -573,8 +562,7 @@ g_part_ebr_read(struct g_part_table *basetable, struct g_consumer *cp)
entry = (struct g_part_ebr_entry *)baseentry;
entry->ent = ent[0];
memcpy(entry->ebr, buf, sizeof(entry->ebr));
- if (compat_aliases)
- entry->ebr_compat_idx = idx++;
+ entry->ebr_compat_idx = idx++;
g_free(buf);
if (ent[1].dp_typ == 0)