From ecb2afc2be137f56cd5ca665f09ff375b1dd6c79 Mon Sep 17 00:00:00 2001 From: bouyer Date: Tue, 26 May 2020 10:37:24 +0000 Subject: [PATCH] Add need-flags for kernfs. Compile Xen kernfs support only if kernfs is compiled in the kernel. Should fix MODULAR build. --- sys/arch/xen/conf/files.xen | 4 ++-- sys/arch/xen/xen/hypervisor.c | 7 +++++-- sys/arch/xen/xen/privcmd.c | 5 ++--- sys/arch/xen/xenbus/xenbus_probe.c | 8 ++++++-- sys/miscfs/kernfs/files.kernfs | 4 ++-- 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/sys/arch/xen/conf/files.xen b/sys/arch/xen/conf/files.xen index 13c882837322..10914dacfa83 100644 --- a/sys/arch/xen/conf/files.xen +++ b/sys/arch/xen/conf/files.xen @@ -1,4 +1,4 @@ -# $NetBSD: files.xen,v 1.185 2020/05/05 17:02:01 bouyer Exp $ +# $NetBSD: files.xen,v 1.186 2020/05/26 10:37:24 bouyer Exp $ defflag opt_xen.h XEN XENPVH XENPVHVM PAE DOM0OPS @@ -27,7 +27,7 @@ device xenbus {[id = -1]} attach xenbus at xendevbus file arch/xen/xenbus/xenbus_client.c xenbus needs-flag file arch/xen/xenbus/xenbus_comms.c xenbus needs-flag -file arch/xen/xenbus/xenbus_dev.c xenbus needs-flag +file arch/xen/xenbus/xenbus_dev.c xenbus & kernfs file arch/xen/xenbus/xenbus_probe.c xenbus needs-flag file arch/xen/xenbus/xenbus_xs.c xenbus needs-flag diff --git a/sys/arch/xen/xen/hypervisor.c b/sys/arch/xen/xen/hypervisor.c index 8da13cb42505..c3241238f03b 100644 --- a/sys/arch/xen/xen/hypervisor.c +++ b/sys/arch/xen/xen/hypervisor.c @@ -1,4 +1,4 @@ -/* $NetBSD: hypervisor.c,v 1.85 2020/05/21 21:12:31 ad Exp $ */ +/* $NetBSD: hypervisor.c,v 1.86 2020/05/26 10:37:25 bouyer Exp $ */ /* * Copyright (c) 2005 Manuel Bouyer. @@ -53,7 +53,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.85 2020/05/21 21:12:31 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.86 2020/05/26 10:37:25 bouyer Exp $"); #include #include @@ -65,6 +65,7 @@ __KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.85 2020/05/21 21:12:31 ad Exp $"); #include "isa.h" #include "pci.h" #include "acpica.h" +#include "kernfs.h" #include "opt_xen.h" #include "opt_mpbios.h" @@ -778,10 +779,12 @@ kernfs_parentdir_t *kernxen_pkt; void xenkernfs_init(void) { +#if NKERNFS > 0 kernfs_entry_t *dkt; KERNFS_ALLOCENTRY(dkt, KM_SLEEP); KERNFS_INITENTRY(dkt, DT_DIR, "xen", NULL, KFSsubdir, VDIR, DIR_MODE); kernfs_addentry(NULL, dkt); kernxen_pkt = KERNFS_ENTOPARENTDIR(dkt); +#endif } diff --git a/sys/arch/xen/xen/privcmd.c b/sys/arch/xen/xen/privcmd.c index b96295d89b0d..3e2722651ce2 100644 --- a/sys/arch/xen/xen/privcmd.c +++ b/sys/arch/xen/xen/privcmd.c @@ -1,4 +1,4 @@ -/* $NetBSD: privcmd.c,v 1.58 2020/05/26 10:11:56 bouyer Exp $ */ +/* $NetBSD: privcmd.c,v 1.59 2020/05/26 10:37:25 bouyer Exp $ */ /*- * Copyright (c) 2004 Christian Limpach. @@ -27,7 +27,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: privcmd.c,v 1.58 2020/05/26 10:11:56 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: privcmd.c,v 1.59 2020/05/26 10:37:25 bouyer Exp $"); #include #include @@ -782,7 +782,6 @@ privcmd_ioctl(void *v) case IOCTL_PRIVCMD_MMAPBATCH_V2: return privcmd_mmapbatch_v2(ap); - case IOCTL_PRIVCMD_MMAP_RESOURCE: return privcmd_mmap_resource(ap); diff --git a/sys/arch/xen/xenbus/xenbus_probe.c b/sys/arch/xen/xenbus/xenbus_probe.c index c38141e2dad3..3ed55e79e520 100644 --- a/sys/arch/xen/xenbus/xenbus_probe.c +++ b/sys/arch/xen/xenbus/xenbus_probe.c @@ -1,4 +1,4 @@ -/* $NetBSD: xenbus_probe.c,v 1.54 2020/05/14 13:18:55 jdolecek Exp $ */ +/* $NetBSD: xenbus_probe.c,v 1.55 2020/05/26 10:37:25 bouyer Exp $ */ /****************************************************************************** * Talks to Xen Store to figure out what devices we have. * @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xenbus_probe.c,v 1.54 2020/05/14 13:18:55 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xenbus_probe.c,v 1.55 2020/05/26 10:37:25 bouyer Exp $"); #if 0 #define DPRINTK(fmt, args...) \ @@ -56,6 +56,8 @@ __KERNEL_RCSID(0, "$NetBSD: xenbus_probe.c,v 1.54 2020/05/14 13:18:55 jdolecek E #include "xenbus_comms.h" +#include "kernfs.h" + static int xenbus_match(device_t, cfdata_t, void *); static void xenbus_attach(device_t, device_t, void *); static int xenbus_print(void *, const char *); @@ -719,8 +721,10 @@ xenbus_probe_init(void *unused) #endif /* DOM0OPS */ } +#if NKERNFS > 0 /* Publish xenbus and Xenstore info in /kern/xen */ xenbus_kernfs_init(); +#endif /* register event handler */ xb_init_comms(xenbus_dev); diff --git a/sys/miscfs/kernfs/files.kernfs b/sys/miscfs/kernfs/files.kernfs index 03b027e216bf..44881559ef28 100644 --- a/sys/miscfs/kernfs/files.kernfs +++ b/sys/miscfs/kernfs/files.kernfs @@ -1,7 +1,7 @@ -# $NetBSD: files.kernfs,v 1.6 2014/10/11 06:42:20 uebayasi Exp $ +# $NetBSD: files.kernfs,v 1.7 2020/05/26 10:37:25 bouyer Exp $ deffs KERNFS define kernfs: vfs file miscfs/kernfs/kernfs_vfsops.c kernfs -file miscfs/kernfs/kernfs_vnops.c kernfs +file miscfs/kernfs/kernfs_vnops.c kernfs needs-flag