From 22a7fe9695a6685994f516857f10a3e0efaf15c7 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Sun, 15 May 2011 16:33:30 +0000 Subject: [PATCH] Cleanup system-revision stuff. * move system_revision.h to headers/private/libroot * unify libroot's get_system_revision() (the one I introduced recently) with kernel's get_haiku_revision(), the function is now called get_haiku_revision() in the kernel and __get_haiku_revision() in libroot * system_revision.c is now being built as part of libroot and as part of the kernel * adjusted all callers of get_system_revision() accordingly git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41516 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../private/{system => libroot}/system_revision.h | 12 ++++++++---- src/apps/aboutsystem/AboutSystem.cpp | 2 +- src/apps/aboutsystem/Jamfile | 2 +- src/system/kernel/lib/Jamfile | 2 ++ src/system/kernel/system_info.cpp | 15 +-------------- src/system/libroot/os/system_revision.c | 6 +++++- src/system/libroot/posix/sys/uname.c | 2 +- 7 files changed, 19 insertions(+), 22 deletions(-) rename headers/private/{system => libroot}/system_revision.h (62%) diff --git a/headers/private/system/system_revision.h b/headers/private/libroot/system_revision.h similarity index 62% rename from headers/private/system/system_revision.h rename to headers/private/libroot/system_revision.h index 3b5a7541cd..27d1a429ec 100644 --- a/headers/private/system/system_revision.h +++ b/headers/private/libroot/system_revision.h @@ -2,8 +2,8 @@ * Copyright 2011, Oliver Tappe . * Distributed under the terms of the MIT License. */ -#ifndef _SYSTEM_SYSTEM_REVISION_H -#define _SYSTEM_SYSTEM_REVISION_H +#ifndef _LIBROOT_SYSTEM_REVISION_H +#define _LIBROOT_SYSTEM_REVISION_H /** The length of the system revision character array symbol living in libroot @@ -17,7 +17,11 @@ extern "C" { /** returns the system revision */ -const char* get_system_revision(); +#ifdef _KERNEL_MODE +const char* get_haiku_revision(void); +#else +const char* __get_haiku_revision(void); +#endif #ifdef __cplusplus @@ -25,4 +29,4 @@ const char* get_system_revision(); #endif -#endif /* _SYSTEM_SYSTEM_REVISION_H */ +#endif /* _LIBROOT_SYSTEM_REVISION_H */ diff --git a/src/apps/aboutsystem/AboutSystem.cpp b/src/apps/aboutsystem/AboutSystem.cpp index 61bffb5115..5caac8b9af 100644 --- a/src/apps/aboutsystem/AboutSystem.cpp +++ b/src/apps/aboutsystem/AboutSystem.cpp @@ -542,7 +542,7 @@ AboutView::AboutView() } // Add system revision - const char* haikuRevision = get_system_revision(); + const char* haikuRevision = __get_haiku_revision(); if (haikuRevision != NULL) { strlcat(string, " (", sizeof(string)); strlcat(string, B_TRANSLATE("Revision"), sizeof(string)); diff --git a/src/apps/aboutsystem/Jamfile b/src/apps/aboutsystem/Jamfile index 30fde5b78f..a32c40bca3 100644 --- a/src/apps/aboutsystem/Jamfile +++ b/src/apps/aboutsystem/Jamfile @@ -1,6 +1,6 @@ SubDir HAIKU_TOP src apps aboutsystem ; -UsePrivateHeaders app shared system ; +UsePrivateHeaders app libroot shared ; Application AboutSystem : AboutSystem.cpp diff --git a/src/system/kernel/lib/Jamfile b/src/system/kernel/lib/Jamfile index 7ac30bcb68..f6cf003a9a 100644 --- a/src/system/kernel/lib/Jamfile +++ b/src/system/kernel/lib/Jamfile @@ -9,6 +9,7 @@ KernelMergeObject kernel_os_main.o : driver_settings.cpp find_directory.cpp fs_info.c + system_revision.c wait_for_objects.cpp : $(TARGET_KERNEL_PIC_CCFLAGS) ; @@ -17,6 +18,7 @@ SEARCH on [ FGristFiles driver_settings.cpp find_directory.cpp fs_info.c + system_revision.c wait_for_objects.cpp ] = [ FDirName $(HAIKU_TOP) src system libroot os ] ; diff --git a/src/system/kernel/system_info.cpp b/src/system/kernel/system_info.cpp index 3823355ffc..0315c0d7ea 100644 --- a/src/system/kernel/system_info.cpp +++ b/src/system/kernel/system_info.cpp @@ -43,18 +43,12 @@ const static int64 kKernelVersion = 0x1; const static char *kKernelName = "kernel_" HAIKU_ARCH; -// Haiku SVN revision. Will be set when copying the kernel to the image. -// Lives in a separate section so that it can easily be found. -static char sHaikuRevision[SYSTEM_REVISION_LENGTH] - __attribute__((section("_haiku_revision"))); - - static int dump_info(int argc, char **argv) { kprintf("kernel build: %s %s (gcc%d %s)\n", __DATE__, __TIME__, __GNUC__, __VERSION__); - kprintf("revision: %s\n\n", sHaikuRevision); + kprintf("revision: %s\n\n", get_haiku_revision()); kprintf("cpu count: %ld, active times:\n", smp_get_num_cpus()); @@ -468,13 +462,6 @@ system_notifications_init() } -const char* -get_haiku_revision(void) -{ - return sHaikuRevision; -} - - // #pragma mark - diff --git a/src/system/libroot/os/system_revision.c b/src/system/libroot/os/system_revision.c index bf5f076d24..08172c32f8 100644 --- a/src/system/libroot/os/system_revision.c +++ b/src/system/libroot/os/system_revision.c @@ -14,7 +14,11 @@ static char sHaikuRevision[SYSTEM_REVISION_LENGTH] const char* -get_system_revision() +#ifdef _KERNEL_MODE +get_haiku_revision(void) +#else +__get_haiku_revision(void) +#endif { return sHaikuRevision; } diff --git a/src/system/libroot/posix/sys/uname.c b/src/system/libroot/posix/sys/uname.c index 06279302e0..3ff360888d 100644 --- a/src/system/libroot/posix/sys/uname.c +++ b/src/system/libroot/posix/sys/uname.c @@ -32,7 +32,7 @@ uname(struct utsname *info) strlcpy(info->sysname, "Haiku", sizeof(info->sysname)); - haikuRevision = get_system_revision(); + haikuRevision = __get_haiku_revision(); if (haikuRevision[0] != '\0') snprintf(info->version, sizeof(info->version), "%s ", haikuRevision); else