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
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
>
© 2016 - 2026 Red Hat, Inc.