On 10/7/15 6:43 AM, Daniel Borkmann wrote:
+void prandom_init_state_once(void *pcpu_state);
+
+#define prandom_init_once(pcpu_state)                          \
+       ({ do_once(prandom_init_state_once, (pcpu_state)); })

  /**
   * prandom_u32_max - returns a pseudo-random number in interval [0, ep_ro)
diff --git a/lib/random32.c b/lib/random32.c
index 36c09fb..b166237 100644
--- a/lib/random32.c
+++ b/lib/random32.c
@@ -256,6 +256,11 @@ static void prandom_seed_full_state(struct rnd_state 
__percpu *pcpu_state)
        }
  }

+void prandom_init_state_once(void *pcpu_state)
+{
+       prandom_seed_full_state((struct rnd_state __percpu *)pcpu_state);
+}
+

prandom_seed_full_state() is likely not inlined in the above.
Why introduce this helper instead of making prandom_seed_full_state() global? with my other suggestion the void cast will be avoided as well
and compiler will do type checking.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to