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

Re: [Minios-devel] [UNIKRAFT PATCH] lib/ukwsrand: Make uk_swrand structure public



Hey Roxana,

On 19.07.2018 10:09, Roxana Nicolescu wrote:
Move definition of uk_swrand struct from mwc.c to swrand.h.

Signed-off-by: Roxana Nicolescu <nicolescu.roxana1996@xxxxxxxxx>
---
  lib/ukswrand/include/uk/swrand.h | 7 ++++++-
  lib/ukswrand/mwc.c               | 6 ------
  2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/lib/ukswrand/include/uk/swrand.h b/lib/ukswrand/include/uk/swrand.h
index e2e43f9..af85809 100644
--- a/lib/ukswrand/include/uk/swrand.h
+++ b/lib/ukswrand/include/uk/swrand.h
@@ -42,7 +42,12 @@
  extern "C" {
  #endif

For completeness and showcasing how this library can be extended with more algorithms in the future, could you guard the struct uk_swrand definition? I am thinking of:

struct uk_swrand {
#if CONFIG_LIBUKSWRAND_MWC
       __u32 Q[4096];
       __u32 c;
       __u32 i;
#endif
};

Make also sure to "include <uk/config.h>" ;-)

-struct uk_swrand;
+struct uk_swrand {
+        __u32 Q[4096];
+        __u32 c;
+        __u32 i;
+};
+
  extern struct uk_swrand uk_swrand_def;
void uk_swrand_init_r(struct uk_swrand *r, __u32 seed);
diff --git a/lib/ukswrand/mwc.c b/lib/ukswrand/mwc.c
index 60a5bf1..e3f4669 100644
--- a/lib/ukswrand/mwc.c
+++ b/lib/ukswrand/mwc.c
@@ -42,12 +42,6 @@
  #define PHI 0x9e3779b9
  #define UK_SWRAND_CTOR_PRIO    (200U)
-struct uk_swrand {
-       __u32 Q[4096];
-       __u32 c;
-       __u32 i;
-};
-
  struct uk_swrand uk_swrand_def;
/*


Thanks,

Simon

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

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