Both callsites call them as a pair, and the buildid really is as much a part
of the version as the changeset.

This involves rearranging console_init_preirq() to ensure xen_build_init() is
ahead of print_version().

No functional change.

Signed-off-by: Andrew Cooper <andrew.coop...@citrix.com>
---
CC: Anthony PERARD <anthony.per...@vates.tech>
CC: Michal Orzel <michal.or...@amd.com>
CC: Jan Beulich <jbeul...@suse.com>
CC: Julien Grall <jul...@xen.org>
CC: Roger Pau Monné <roger....@citrix.com>
CC: Stefano Stabellini <sstabell...@kernel.org>
CC: Ross Lagerwall <ross.lagerw...@citrix.com>
---
 xen/common/keyhandler.c    |  1 -
 xen/common/version.c       | 19 ++++++-------------
 xen/drivers/char/console.c |  7 +++----
 xen/include/xen/lib.h      |  1 -
 4 files changed, 9 insertions(+), 19 deletions(-)

diff --git a/xen/common/keyhandler.c b/xen/common/keyhandler.c
index b0a2051408d5..cb6df2823b00 100644
--- a/xen/common/keyhandler.c
+++ b/xen/common/keyhandler.c
@@ -131,7 +131,6 @@ static void cf_check show_handlers(unsigned char key)
     printk("'%c' pressed -> showing installed handlers\n", key);
 
     print_version();
-    print_build_id();
 
     for ( i = 0; i < ARRAY_SIZE(key_table); i++ )
         if ( key_table[i].fn )
diff --git a/xen/common/version.c b/xen/common/version.c
index 56b51c81d2fc..84bd77e74653 100644
--- a/xen/common/version.c
+++ b/xen/common/version.c
@@ -94,6 +94,9 @@ const char *xen_build_info(void)
     return build_info;
 }
 
+static const void *build_id_p __read_mostly;
+static unsigned int build_id_len __read_mostly;
+
 void print_version(void)
 {
     printk("Xen version %d.%d%s (%s@%s) (%s) %s %s\n",
@@ -102,10 +105,10 @@ void print_version(void)
            xen_build_info(), xen_compile_date());
 
     printk("Latest ChangeSet: %s\n", xen_changeset());
-}
 
-static const void *build_id_p __read_mostly;
-static unsigned int build_id_len __read_mostly;
+    if ( build_id_len )
+        printk("build-id: %*phN\n", build_id_len, build_id_p);
+}
 
 int xen_build_id(const void **p, unsigned int *len)
 {
@@ -118,16 +121,6 @@ int xen_build_id(const void **p, unsigned int *len)
     return 0;
 }
 
-void print_build_id(void)
-{
-    /*
-     * NB: build_id_len may be 0 if XEN_HAS_BUILD_ID=n.
-     * Do not print empty build-id.
-     */
-    if ( build_id_len )
-        printk("build-id: %*phN\n", build_id_len, build_id_p);
-}
-
 #ifdef BUILD_ID
 /* Defined in linker script. */
 extern const Elf_Note __note_gnu_build_id_start[], __note_gnu_build_id_end[];
diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index 963c7b043cd8..a5af66023975 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -1105,11 +1105,10 @@ void __init console_init_preirq(void)
     __putstr(xen_banner());
     nrspin_unlock(&console_lock);
 
-    print_version();
-
-    /* Locate and print the buildid, if applicable. */
+    /* Locate the buildid, if possible. */
     xen_build_init();
-    print_build_id();
+
+    print_version();
 
     if ( opt_sync_console )
     {
diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h
index e63ec5039f92..36d904ba1a3c 100644
--- a/xen/include/xen/lib.h
+++ b/xen/include/xen/lib.h
@@ -48,7 +48,6 @@ int parse_signed_integer(const char *name, const char *s, 
const char *e,
 int cmdline_strcmp(const char *frag, const char *name);
 
 void print_version(void);
-void print_build_id(void);
 
 #ifdef CONFIG_DEBUG_TRACE
 extern void debugtrace_dump(void);
-- 
2.39.5


Reply via email to