Add kern.geom.part.separator tunable. This makes it possible

to specify an optional separator to insert before partition name;
eg if it's set to "c/", you'll get "ada0c/s1" instead of "ada0s1".
(It cannot be set to just “/“, since ada0 is a device node, not
a directory.)

Reviewed by:	imp
MFC after:	2 weeks
Sponsored by:	Klara Inc.
Differential Revision:	https://reviews.freebsd.org/D22193
This commit is contained in:
trasz 2019-12-13 09:28:44 +00:00
parent 7320de6aed
commit 16c0bc8721
4 changed files with 16 additions and 2 deletions

View File

@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd September 3, 2019
.Dd December 13, 2019
.Dt GPART 8
.Os
.Sh NAME
@ -1260,6 +1260,14 @@ If this variable is set to a non-zero value, the module will automatically
recalculate the user-specified offset and size for alignment with the CHS
geometry.
Otherwise the values will be left unchanged.
.It Va kern.geom.part.separator : No ""
Specify an optional separator that will be inserted between the GEOM name
and partition name.
This variable is a
.Xr loader 8
tunable.
Note that setting this variable may break software which assumes a particular
naming scheme.
.El
.Sh EXIT STATUS
Exit status is 0 on success, and 1 if the command fails.

View File

@ -147,6 +147,10 @@ static u_int allow_nesting = 0;
SYSCTL_UINT(_kern_geom_part, OID_AUTO, allow_nesting,
CTLFLAG_RWTUN, &allow_nesting, 0,
"Allow additional levels of nesting");
char g_part_separator[MAXPATHLEN] = "";
SYSCTL_STRING(_kern_geom_part, OID_AUTO, separator,
CTLFLAG_RDTUN, &g_part_separator, sizeof(g_part_separator),
"Partition name separator");
/*
* The GEOM partitioning class.

View File

@ -228,6 +228,8 @@ void g_part_geometry_heads(off_t, u_int, off_t *, u_int *);
int g_part_modevent(module_t, int, struct g_part_scheme *);
extern char g_part_separator[];
#define G_PART_SCHEME_DECLARE(name) \
static int name##_modevent(module_t mod, int tp, void *d) \
{ \

View File

@ -48,7 +48,7 @@ CODE {
{
char buf[32];
sbuf_printf(sb, "%s%s", pfx,
sbuf_printf(sb, "%s%s%s", pfx, g_part_separator,
G_PART_NAME(table, entry, buf, sizeof(buf)));
}