[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] mini-os: move poor rand function to test.c



commit 7b4afdbe8199a85c4a187d4ee3763b09606df121
Author:     Thomas Leonard <talex5@xxxxxxxxx>
AuthorDate: Fri Aug 8 16:47:32 2014 +0100
Commit:     Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Mon Sep 8 12:15:36 2014 +0100

    mini-os: move poor rand function to test.c
    
    It's only used by test.c and probably isn't something that should be
    exposed for general use (it just calls gettimeofday).
    
    This is also useful for ARM, which doesn't use math.c, where this used
    to live.
    
    Signed-off-by: Thomas Leonard <talex5@xxxxxxxxx>
    Acked-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>
---
 extras/mini-os/lib/math.c |   13 -------------
 extras/mini-os/test.c     |   13 +++++++++++++
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/extras/mini-os/lib/math.c b/extras/mini-os/lib/math.c
index c941b4c..561393e 100644
--- a/extras/mini-os/lib/math.c
+++ b/extras/mini-os/lib/math.c
@@ -424,16 +424,3 @@ __moddi3(quad_t a, quad_t b)
        (void)__qdivrem(ua, ub, &ur);
        return (neg ? -ur : ur);
 }
-
-#ifndef HAVE_LIBC
-/* Should be random enough for our uses */
-int rand(void)
-{
-    static unsigned int previous;
-    struct timeval tv;
-    gettimeofday(&tv, NULL);
-    previous += tv.tv_sec + tv.tv_usec;
-    previous *= RAND_MIX;
-    return previous;
-}
-#endif
diff --git a/extras/mini-os/test.c b/extras/mini-os/test.c
index 20d372b..0d7aba4 100644
--- a/extras/mini-os/test.c
+++ b/extras/mini-os/test.c
@@ -60,6 +60,19 @@ static void xenbus_tester(void *p)
 }
 #endif
 
+#ifndef HAVE_LIBC
+/* Should be random enough for our uses */
+int rand(void)
+{
+    static unsigned int previous;
+    struct timeval tv;
+    gettimeofday(&tv, NULL);
+    previous += tv.tv_sec + tv.tv_usec;
+    previous *= RAND_MIX;
+    return previous;
+}
+#endif
+
 static void periodic_thread(void *p)
 {
     struct timeval tv;
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.