git: e1ebda4458bb - main - ffs: fix build with GEOM_LABEL and without FFS, e.g. MINIMAL

From: Gleb Smirnoff <glebius_at_FreeBSD.org>
Date: Sat, 01 Feb 2025 09:02:01 UTC
The branch main has been updated by glebius:

URL: https://cgit.FreeBSD.org/src/commit/?id=e1ebda4458bbaf7d85fb803e20f3afc5441f24d9

commit e1ebda4458bbaf7d85fb803e20f3afc5441f24d9
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2025-02-01 03:17:01 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2025-02-01 09:00:25 +0000

    ffs: fix build with GEOM_LABEL and without FFS, e.g. MINIMAL
    
    The root of vfs.ffs sysctl tree was declared in ffs_alloc.c.  The
    1111a44301da started to use the root in ffs_subr.c.  However, ffs_subr.c
    may be included in kernels that do not have FFS in their config.  Such
    kernel won't link after 1111a44301da.
    
    Fixes:  1111a44301da39d7b7459c784230e1405e8980f8
---
 sys/ufs/ffs/ffs_alloc.c | 3 +--
 sys/ufs/ffs/ffs_subr.c  | 4 +++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c
index 265daef14812..61fb6ccbfc68 100644
--- a/sys/ufs/ffs/ffs_alloc.c
+++ b/sys/ufs/ffs/ffs_alloc.c
@@ -489,8 +489,7 @@ nospace:
  * allocation will be used.
  */
 
-SYSCTL_NODE(_vfs, OID_AUTO, ffs, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,
-    "FFS filesystem");
+SYSCTL_DECL(_vfs_ffs);
 
 static int doasyncfree = 1;
 SYSCTL_INT(_vfs_ffs, OID_AUTO, doasyncfree, CTLFLAG_RW, &doasyncfree, 0,
diff --git a/sys/ufs/ffs/ffs_subr.c b/sys/ufs/ffs/ffs_subr.c
index e2b09da86ae5..c293cbbcbfb0 100644
--- a/sys/ufs/ffs/ffs_subr.c
+++ b/sys/ufs/ffs/ffs_subr.c
@@ -405,7 +405,9 @@ ffs_oldfscompat_write(struct fs *fs)
  */
 static int prttimechgs = 0;
 #ifdef _KERNEL
-SYSCTL_DECL(_vfs_ffs);
+SYSCTL_NODE(_vfs, OID_AUTO, ffs, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,
+    "FFS filesystem");
+
 SYSCTL_INT(_vfs_ffs, OID_AUTO, prttimechgs, CTLFLAG_RWTUN, &prttimechgs, 0,
 	"print UFS1 time changes made to inodes");
 #endif /* _KERNEL */