Date: Fri, 13 Dec 2019 09:28:44 +0000 (UTC) From: Edward Tomasz Napierala <trasz@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355705 - in head: lib/geom/part sys/geom/part Message-ID: <201912130928.xBD9SiYX005183@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: trasz Date: Fri Dec 13 09:28:44 2019 New Revision: 355705 URL: https://svnweb.freebsd.org/changeset/base/355705 Log: 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 Modified: head/lib/geom/part/gpart.8 head/sys/geom/part/g_part.c head/sys/geom/part/g_part.h head/sys/geom/part/g_part_if.m Modified: head/lib/geom/part/gpart.8 ============================================================================== --- head/lib/geom/part/gpart.8 Fri Dec 13 09:19:24 2019 (r355704) +++ head/lib/geom/part/gpart.8 Fri Dec 13 09:28:44 2019 (r355705) @@ -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 modul 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. Modified: head/sys/geom/part/g_part.c ============================================================================== --- head/sys/geom/part/g_part.c Fri Dec 13 09:19:24 2019 (r355704) +++ head/sys/geom/part/g_part.c Fri Dec 13 09:28:44 2019 (r355705) @@ -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. Modified: head/sys/geom/part/g_part.h ============================================================================== --- head/sys/geom/part/g_part.h Fri Dec 13 09:19:24 2019 (r355704) +++ head/sys/geom/part/g_part.h Fri Dec 13 09:28:44 2019 (r355705) @@ -228,6 +228,8 @@ void g_part_geometry_heads(off_t, u_int, off_t *, u_in 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) \ { \ Modified: head/sys/geom/part/g_part_if.m ============================================================================== --- head/sys/geom/part/g_part_if.m Fri Dec 13 09:19:24 2019 (r355704) +++ head/sys/geom/part/g_part_if.m Fri Dec 13 09:28:44 2019 (r355705) @@ -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))); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201912130928.xBD9SiYX005183>