* [PATCH 0/2] mini-os: config related cleanups
@ 2021-08-17 9:54 Juergen Gross
2021-08-17 9:54 ` [PATCH 1/2] mini-os: make config handling more generic Juergen Gross
2021-08-17 9:54 ` [PATCH 2/2] mini-os: move test functions under CONFIG_TEST Juergen Gross
0 siblings, 2 replies; 5+ messages in thread
From: Juergen Gross @ 2021-08-17 9:54 UTC (permalink / raw)
To: minios-devel, xen-devel; +Cc: samuel.thibault, wl, Juergen Gross
While writing patch 2 I stumbled over CONFIG_TEST having no effect at
the C source level, so I added patch 1 to avoid further similar
problems.
The additionally fixed CONFIG_XC issue wasn't triggered in any known
case, probably as FTYPE_XC hasn't been used in our code base.
Juergen Gross (2):
mini-os: make config handling more generic
mini-os: move test functions under CONFIG_TEST
Config.mk | 66 +++++++++++++++++++++----------------------------
xenbus/xenbus.c | 32 +++++++++++++-----------
2 files changed, 45 insertions(+), 53 deletions(-)
--
2.26.2
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] mini-os: make config handling more generic
2021-08-17 9:54 [PATCH 0/2] mini-os: config related cleanups Juergen Gross
@ 2021-08-17 9:54 ` Juergen Gross
2021-08-17 10:14 ` Samuel Thibault
2021-08-17 9:54 ` [PATCH 2/2] mini-os: move test functions under CONFIG_TEST Juergen Gross
1 sibling, 1 reply; 5+ messages in thread
From: Juergen Gross @ 2021-08-17 9:54 UTC (permalink / raw)
To: minios-devel, xen-devel; +Cc: samuel.thibault, wl, Juergen Gross
When adding a new CONFIG_ variable this needs to be done in multiple
places. Change the handling to be more generic.
This at once fixes a bug with CONFIG_XC which was not defined for the
C preprocessor (it seems that this never resulted in any real issues,
though).
Signed-off-by: Juergen Gross <jgross@suse.com>
---
Config.mk | 66 +++++++++++++++++++++++--------------------------------
1 file changed, 28 insertions(+), 38 deletions(-)
diff --git a/Config.mk b/Config.mk
index cb823c2..15311ef 100644
--- a/Config.mk
+++ b/Config.mk
@@ -171,49 +171,39 @@ endif
# CONFIG_ variables.
# Configuration defaults
+CONFIG-y += CONFIG_START_NETWORK
+CONFIG-y += CONFIG_SPARSE_BSS
+CONFIG-y += CONFIG_BLKFRONT
+CONFIG-y += CONFIG_NETFRONT
+CONFIG-y += CONFIG_FBFRONT
+CONFIG-y += CONFIG_KBDFRONT
+CONFIG-y += CONFIG_CONSFRONT
+CONFIG-y += CONFIG_XENBUS
+CONFIG-y += CONFIG_XC
+CONFIG-n += CONFIG_QEMU_XS_ARGS
+CONFIG-n += CONFIG_TEST
+CONFIG-n += CONFIG_PCIFRONT
+CONFIG-n += CONFIG_TPMFRONT
+CONFIG-n += CONFIG_TPM_TIS
+CONFIG-n += CONFIG_TPMBACK
+CONFIG-n += CONFIG_BALLOON
+# Setting CONFIG_USE_XEN_CONSOLE copies all print output to the Xen emergency
+# console apart of standard dom0 handled console.
+CONFIG-n += CONFIG_USE_XEN_CONSOLE
ifeq ($(TARGET_ARCH_FAM),x86)
-CONFIG_PARAVIRT ?= y
+CONFIG-y += CONFIG_PARAVIRT
else
-CONFIG_PARAVIRT ?= n
+CONFIG-n += CONFIG_PARAVIRT
endif
-CONFIG_START_NETWORK ?= y
-CONFIG_SPARSE_BSS ?= y
-CONFIG_QEMU_XS_ARGS ?= n
-CONFIG_TEST ?= n
-CONFIG_PCIFRONT ?= n
-CONFIG_BLKFRONT ?= y
-CONFIG_TPMFRONT ?= n
-CONFIG_TPM_TIS ?= n
-CONFIG_TPMBACK ?= n
-CONFIG_NETFRONT ?= y
-CONFIG_FBFRONT ?= y
-CONFIG_KBDFRONT ?= y
-CONFIG_CONSFRONT ?= y
-CONFIG_XENBUS ?= y
-CONFIG_XC ?=y
-CONFIG_LWIP ?= $(lwip)
-CONFIG_BALLOON ?= n
-# Setting CONFIG_USE_XEN_CONSOLE copies all print output to the Xen emergency
-# console apart of standard dom0 handled console.
-CONFIG_USE_XEN_CONSOLE ?= n
+CONFIG-$(lwip) += CONFIG_LWIP
+
+$(foreach i,$(CONFIG-y),$(eval $(i) ?= y))
+$(foreach i,$(CONFIG-n),$(eval $(i) ?= n))
+
+CONFIG-all := $(CONFIG-y) $(CONFIG-n)
# Export config items as compiler directives
-DEFINES-$(CONFIG_PARAVIRT) += -DCONFIG_PARAVIRT
-DEFINES-$(CONFIG_START_NETWORK) += -DCONFIG_START_NETWORK
-DEFINES-$(CONFIG_SPARSE_BSS) += -DCONFIG_SPARSE_BSS
-DEFINES-$(CONFIG_QEMU_XS_ARGS) += -DCONFIG_QEMU_XS_ARGS
-DEFINES-$(CONFIG_PCIFRONT) += -DCONFIG_PCIFRONT
-DEFINES-$(CONFIG_BLKFRONT) += -DCONFIG_BLKFRONT
-DEFINES-$(CONFIG_TPMFRONT) += -DCONFIG_TPMFRONT
-DEFINES-$(CONFIG_TPM_TIS) += -DCONFIG_TPM_TIS
-DEFINES-$(CONFIG_TPMBACK) += -DCONFIG_TPMBACK
-DEFINES-$(CONFIG_NETFRONT) += -DCONFIG_NETFRONT
-DEFINES-$(CONFIG_KBDFRONT) += -DCONFIG_KBDFRONT
-DEFINES-$(CONFIG_FBFRONT) += -DCONFIG_FBFRONT
-DEFINES-$(CONFIG_CONSFRONT) += -DCONFIG_CONSFRONT
-DEFINES-$(CONFIG_XENBUS) += -DCONFIG_XENBUS
-DEFINES-$(CONFIG_BALLOON) += -DCONFIG_BALLOON
-DEFINES-$(CONFIG_USE_XEN_CONSOLE) += -DCONFIG_USE_XEN_CONSOLE
+$(foreach i,$(CONFIG-all),$(eval DEFINES-$($(i)) += -D$(i)))
DEFINES-y += -D__XEN_INTERFACE_VERSION__=$(XEN_INTERFACE_VERSION)
--
2.26.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] mini-os: move test functions under CONFIG_TEST
2021-08-17 9:54 [PATCH 0/2] mini-os: config related cleanups Juergen Gross
2021-08-17 9:54 ` [PATCH 1/2] mini-os: make config handling more generic Juergen Gross
@ 2021-08-17 9:54 ` Juergen Gross
2021-08-17 10:16 ` Samuel Thibault
1 sibling, 1 reply; 5+ messages in thread
From: Juergen Gross @ 2021-08-17 9:54 UTC (permalink / raw)
To: minios-devel, xen-devel; +Cc: samuel.thibault, wl, Juergen Gross
There is no need to have the xenbus test support functions always
included in Mini-OS. Move them inside #ifdef CONFIG_TEST.
Signed-off-by: Juergen Gross <jgross@suse.com>
---
xenbus/xenbus.c | 32 +++++++++++++++++---------------
1 file changed, 17 insertions(+), 15 deletions(-)
diff --git a/xenbus/xenbus.c b/xenbus/xenbus.c
index fdb0934..11427ba 100644
--- a/xenbus/xenbus.c
+++ b/xenbus/xenbus.c
@@ -573,21 +573,6 @@ static char *errmsg(struct xsd_sockmsg *rep)
return res;
}
-/* Send a debug message to xenbus. Can block. */
-static void xenbus_debug_msg(const char *msg)
-{
- int len = strlen(msg);
- struct write_req req[] = {
- { "print", sizeof("print") },
- { msg, len },
- { "", 1 }};
- struct xsd_sockmsg *reply;
-
- reply = xenbus_msg_reply(XS_DEBUG, 0, req, ARRAY_SIZE(req));
- printk("Got a reply, type %d, id %d, len %d.\n",
- reply->type, reply->req_id, reply->len);
-}
-
/* List the contents of a directory. Returns a malloc()ed array of
pointers to malloc()ed strings. The array is NULL terminated. May
block. */
@@ -882,6 +867,22 @@ domid_t xenbus_get_self_id(void)
return ret;
}
+#ifdef CONFIG_TEST
+/* Send a debug message to xenbus. Can block. */
+static void xenbus_debug_msg(const char *msg)
+{
+ int len = strlen(msg);
+ struct write_req req[] = {
+ { "print", sizeof("print") },
+ { msg, len },
+ { "", 1 }};
+ struct xsd_sockmsg *reply;
+
+ reply = xenbus_msg_reply(XS_DEBUG, 0, req, ARRAY_SIZE(req));
+ printk("Got a reply, type %d, id %d, len %d.\n",
+ reply->type, reply->req_id, reply->len);
+}
+
static void do_ls_test(const char *pre)
{
char **dirs, *msg;
@@ -968,6 +969,7 @@ void test_xenbus(void)
do_read_test("device/vif/0/flibble");
printk("(Should have said ENOENT)\n");
}
+#endif /* CONFIG_TEST */
/*
* Local variables:
--
2.26.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] mini-os: make config handling more generic
2021-08-17 9:54 ` [PATCH 1/2] mini-os: make config handling more generic Juergen Gross
@ 2021-08-17 10:14 ` Samuel Thibault
0 siblings, 0 replies; 5+ messages in thread
From: Samuel Thibault @ 2021-08-17 10:14 UTC (permalink / raw)
To: Juergen Gross; +Cc: minios-devel, xen-devel, wl
Juergen Gross, le mar. 17 août 2021 11:54:58 +0200, a ecrit:
> When adding a new CONFIG_ variable this needs to be done in multiple
> places. Change the handling to be more generic.
>
> This at once fixes a bug with CONFIG_XC which was not defined for the
> C preprocessor (it seems that this never resulted in any real issues,
> though).
>
> Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
> ---
> Config.mk | 66 +++++++++++++++++++++++--------------------------------
> 1 file changed, 28 insertions(+), 38 deletions(-)
>
> diff --git a/Config.mk b/Config.mk
> index cb823c2..15311ef 100644
> --- a/Config.mk
> +++ b/Config.mk
> @@ -171,49 +171,39 @@ endif
> # CONFIG_ variables.
>
> # Configuration defaults
> +CONFIG-y += CONFIG_START_NETWORK
> +CONFIG-y += CONFIG_SPARSE_BSS
> +CONFIG-y += CONFIG_BLKFRONT
> +CONFIG-y += CONFIG_NETFRONT
> +CONFIG-y += CONFIG_FBFRONT
> +CONFIG-y += CONFIG_KBDFRONT
> +CONFIG-y += CONFIG_CONSFRONT
> +CONFIG-y += CONFIG_XENBUS
> +CONFIG-y += CONFIG_XC
> +CONFIG-n += CONFIG_QEMU_XS_ARGS
> +CONFIG-n += CONFIG_TEST
> +CONFIG-n += CONFIG_PCIFRONT
> +CONFIG-n += CONFIG_TPMFRONT
> +CONFIG-n += CONFIG_TPM_TIS
> +CONFIG-n += CONFIG_TPMBACK
> +CONFIG-n += CONFIG_BALLOON
> +# Setting CONFIG_USE_XEN_CONSOLE copies all print output to the Xen emergency
> +# console apart of standard dom0 handled console.
> +CONFIG-n += CONFIG_USE_XEN_CONSOLE
> ifeq ($(TARGET_ARCH_FAM),x86)
> -CONFIG_PARAVIRT ?= y
> +CONFIG-y += CONFIG_PARAVIRT
> else
> -CONFIG_PARAVIRT ?= n
> +CONFIG-n += CONFIG_PARAVIRT
> endif
> -CONFIG_START_NETWORK ?= y
> -CONFIG_SPARSE_BSS ?= y
> -CONFIG_QEMU_XS_ARGS ?= n
> -CONFIG_TEST ?= n
> -CONFIG_PCIFRONT ?= n
> -CONFIG_BLKFRONT ?= y
> -CONFIG_TPMFRONT ?= n
> -CONFIG_TPM_TIS ?= n
> -CONFIG_TPMBACK ?= n
> -CONFIG_NETFRONT ?= y
> -CONFIG_FBFRONT ?= y
> -CONFIG_KBDFRONT ?= y
> -CONFIG_CONSFRONT ?= y
> -CONFIG_XENBUS ?= y
> -CONFIG_XC ?=y
> -CONFIG_LWIP ?= $(lwip)
> -CONFIG_BALLOON ?= n
> -# Setting CONFIG_USE_XEN_CONSOLE copies all print output to the Xen emergency
> -# console apart of standard dom0 handled console.
> -CONFIG_USE_XEN_CONSOLE ?= n
> +CONFIG-$(lwip) += CONFIG_LWIP
> +
> +$(foreach i,$(CONFIG-y),$(eval $(i) ?= y))
> +$(foreach i,$(CONFIG-n),$(eval $(i) ?= n))
> +
> +CONFIG-all := $(CONFIG-y) $(CONFIG-n)
>
> # Export config items as compiler directives
> -DEFINES-$(CONFIG_PARAVIRT) += -DCONFIG_PARAVIRT
> -DEFINES-$(CONFIG_START_NETWORK) += -DCONFIG_START_NETWORK
> -DEFINES-$(CONFIG_SPARSE_BSS) += -DCONFIG_SPARSE_BSS
> -DEFINES-$(CONFIG_QEMU_XS_ARGS) += -DCONFIG_QEMU_XS_ARGS
> -DEFINES-$(CONFIG_PCIFRONT) += -DCONFIG_PCIFRONT
> -DEFINES-$(CONFIG_BLKFRONT) += -DCONFIG_BLKFRONT
> -DEFINES-$(CONFIG_TPMFRONT) += -DCONFIG_TPMFRONT
> -DEFINES-$(CONFIG_TPM_TIS) += -DCONFIG_TPM_TIS
> -DEFINES-$(CONFIG_TPMBACK) += -DCONFIG_TPMBACK
> -DEFINES-$(CONFIG_NETFRONT) += -DCONFIG_NETFRONT
> -DEFINES-$(CONFIG_KBDFRONT) += -DCONFIG_KBDFRONT
> -DEFINES-$(CONFIG_FBFRONT) += -DCONFIG_FBFRONT
> -DEFINES-$(CONFIG_CONSFRONT) += -DCONFIG_CONSFRONT
> -DEFINES-$(CONFIG_XENBUS) += -DCONFIG_XENBUS
> -DEFINES-$(CONFIG_BALLOON) += -DCONFIG_BALLOON
> -DEFINES-$(CONFIG_USE_XEN_CONSOLE) += -DCONFIG_USE_XEN_CONSOLE
> +$(foreach i,$(CONFIG-all),$(eval DEFINES-$($(i)) += -D$(i)))
>
> DEFINES-y += -D__XEN_INTERFACE_VERSION__=$(XEN_INTERFACE_VERSION)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] mini-os: move test functions under CONFIG_TEST
2021-08-17 9:54 ` [PATCH 2/2] mini-os: move test functions under CONFIG_TEST Juergen Gross
@ 2021-08-17 10:16 ` Samuel Thibault
0 siblings, 0 replies; 5+ messages in thread
From: Samuel Thibault @ 2021-08-17 10:16 UTC (permalink / raw)
To: Juergen Gross; +Cc: minios-devel, xen-devel, wl
Juergen Gross, le mar. 17 août 2021 11:54:59 +0200, a ecrit:
> There is no need to have the xenbus test support functions always
> included in Mini-OS. Move them inside #ifdef CONFIG_TEST.
>
> Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
> ---
> xenbus/xenbus.c | 32 +++++++++++++++++---------------
> 1 file changed, 17 insertions(+), 15 deletions(-)
>
> diff --git a/xenbus/xenbus.c b/xenbus/xenbus.c
> index fdb0934..11427ba 100644
> --- a/xenbus/xenbus.c
> +++ b/xenbus/xenbus.c
> @@ -573,21 +573,6 @@ static char *errmsg(struct xsd_sockmsg *rep)
> return res;
> }
>
> -/* Send a debug message to xenbus. Can block. */
> -static void xenbus_debug_msg(const char *msg)
> -{
> - int len = strlen(msg);
> - struct write_req req[] = {
> - { "print", sizeof("print") },
> - { msg, len },
> - { "", 1 }};
> - struct xsd_sockmsg *reply;
> -
> - reply = xenbus_msg_reply(XS_DEBUG, 0, req, ARRAY_SIZE(req));
> - printk("Got a reply, type %d, id %d, len %d.\n",
> - reply->type, reply->req_id, reply->len);
> -}
> -
> /* List the contents of a directory. Returns a malloc()ed array of
> pointers to malloc()ed strings. The array is NULL terminated. May
> block. */
> @@ -882,6 +867,22 @@ domid_t xenbus_get_self_id(void)
> return ret;
> }
>
> +#ifdef CONFIG_TEST
> +/* Send a debug message to xenbus. Can block. */
> +static void xenbus_debug_msg(const char *msg)
> +{
> + int len = strlen(msg);
> + struct write_req req[] = {
> + { "print", sizeof("print") },
> + { msg, len },
> + { "", 1 }};
> + struct xsd_sockmsg *reply;
> +
> + reply = xenbus_msg_reply(XS_DEBUG, 0, req, ARRAY_SIZE(req));
> + printk("Got a reply, type %d, id %d, len %d.\n",
> + reply->type, reply->req_id, reply->len);
> +}
> +
> static void do_ls_test(const char *pre)
> {
> char **dirs, *msg;
> @@ -968,6 +969,7 @@ void test_xenbus(void)
> do_read_test("device/vif/0/flibble");
> printk("(Should have said ENOENT)\n");
> }
> +#endif /* CONFIG_TEST */
>
> /*
> * Local variables:
> --
> 2.26.2
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-08-17 10:16 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-17 9:54 [PATCH 0/2] mini-os: config related cleanups Juergen Gross
2021-08-17 9:54 ` [PATCH 1/2] mini-os: make config handling more generic Juergen Gross
2021-08-17 10:14 ` Samuel Thibault
2021-08-17 9:54 ` [PATCH 2/2] mini-os: move test functions under CONFIG_TEST Juergen Gross
2021-08-17 10:16 ` Samuel Thibault
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).