From 924e1d741d0b8f1b144b3061a0629cf41c99335c Mon Sep 17 00:00:00 2001 From: Christian Helmuth Date: Mon, 11 Jul 2022 15:18:35 +0200 Subject: [PATCH] lx_emul: cleanup naming of lx_emul_random_gen* Issue #4544 --- repos/dde_linux/src/app/wireguard/lx_emul.c | 8 ++++---- repos/dde_linux/src/include/lx_emul/random.h | 6 +++--- repos/dde_linux/src/lib/lx_emul/random.cc | 8 ++++---- repos/pc/src/lib/pc/lx_emul/shadow/drivers/char/random.c | 6 +++--- repos/pc/src/lib/wifi/lx_emul.c | 4 ++-- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/repos/dde_linux/src/app/wireguard/lx_emul.c b/repos/dde_linux/src/app/wireguard/lx_emul.c index f0dcb94780..e3cf11c81c 100644 --- a/repos/dde_linux/src/app/wireguard/lx_emul.c +++ b/repos/dde_linux/src/app/wireguard/lx_emul.c @@ -32,7 +32,7 @@ void __icmp_send(struct sk_buff * skb_in,int type,int code,__be32 info,const str void get_random_bytes(void * buf,int nbytes) { - lx_emul_gen_random_bytes(buf, nbytes); + lx_emul_random_gen_bytes(buf, nbytes); } @@ -49,7 +49,7 @@ int wait_for_random_bytes(void) u32 get_random_u32(void) { - return lx_emul_gen_random_u32(); + return lx_emul_random_gen_u32(); } @@ -57,7 +57,7 @@ u32 get_random_u32(void) u32 prandom_u32(void) { - return lx_emul_gen_random_u32(); + return lx_emul_random_gen_u32(); } @@ -65,7 +65,7 @@ u32 prandom_u32(void) int __must_check get_random_bytes_arch(void * buf, int nbytes) { - lx_emul_gen_random_bytes(buf, nbytes); + lx_emul_random_gen_bytes(buf, nbytes); return nbytes; } diff --git a/repos/dde_linux/src/include/lx_emul/random.h b/repos/dde_linux/src/include/lx_emul/random.h index d35faf6b04..c978e5ece9 100644 --- a/repos/dde_linux/src/include/lx_emul/random.h +++ b/repos/dde_linux/src/include/lx_emul/random.h @@ -37,14 +37,14 @@ extern "C" { * Write a certain number of consecutive, random byte values beginning at * a given address. */ -void lx_emul_gen_random_bytes(void *dst, +void lx_emul_random_gen_bytes(void *dst, unsigned long nr_of_bytes); /** * Return a random unsigned integer value. */ -genode_uint32_t lx_emul_gen_random_u32(void); -genode_uint64_t lx_emul_gen_random_u64(void); +genode_uint32_t lx_emul_random_gen_u32(void); +genode_uint64_t lx_emul_random_gen_u64(void); #ifdef __cplusplus } diff --git a/repos/dde_linux/src/lib/lx_emul/random.cc b/repos/dde_linux/src/lib/lx_emul/random.cc index 7accd38cc6..b71c1944d3 100644 --- a/repos/dde_linux/src/lib/lx_emul/random.cc +++ b/repos/dde_linux/src/lib/lx_emul/random.cc @@ -190,12 +190,12 @@ static Xoroshiro_128_plus_reseeding &xoroshiro() } -void lx_emul_gen_random_bytes(void *dst, +void lx_emul_random_gen_bytes(void *dst, unsigned long nr_of_bytes) { /* validate arguments */ if (dst == nullptr || nr_of_bytes == 0) { - error("lx_emul_gen_random_bytes called with invalid args!"); + error(__func__, " called with invalid args!"); return; } /* fill up the destination with random 64-bit values as far as possible */ @@ -217,13 +217,13 @@ void lx_emul_gen_random_bytes(void *dst, } -genode_uint32_t lx_emul_gen_random_u32() +genode_uint32_t lx_emul_random_gen_u32() { return (genode_uint32_t)xoroshiro().get_u64(); } -genode_uint64_t lx_emul_gen_random_u64() +genode_uint64_t lx_emul_random_gen_u64() { return (genode_uint64_t)xoroshiro().get_u64(); } diff --git a/repos/pc/src/lib/pc/lx_emul/shadow/drivers/char/random.c b/repos/pc/src/lib/pc/lx_emul/shadow/drivers/char/random.c index 4f4068eee3..4ba978e2dc 100644 --- a/repos/pc/src/lib/pc/lx_emul/shadow/drivers/char/random.c +++ b/repos/pc/src/lib/pc/lx_emul/shadow/drivers/char/random.c @@ -26,13 +26,13 @@ void add_input_randomness(unsigned int type,unsigned int code,unsigned int value u32 get_random_u32(void) { - return lx_emul_gen_random_u32(); + return lx_emul_random_gen_u32(); } u64 get_random_u64(void) { - return lx_emul_gen_random_u64(); + return lx_emul_random_gen_u64(); } @@ -41,7 +41,7 @@ int __must_check get_random_bytes_arch(void *buf, int nbytes) if (nbytes < 0) return -1; - lx_emul_gen_random_bytes(buf, nbytes); + lx_emul_random_gen_bytes(buf, nbytes); return nbytes; } diff --git a/repos/pc/src/lib/wifi/lx_emul.c b/repos/pc/src/lib/wifi/lx_emul.c index 57305e989c..61a3c0474f 100644 --- a/repos/pc/src/lib/wifi/lx_emul.c +++ b/repos/pc/src/lib/wifi/lx_emul.c @@ -459,13 +459,13 @@ void __put_page(struct page * page) void prandom_bytes(void *buf, size_t bytes) { - lx_emul_gen_random_bytes(buf, bytes); + lx_emul_random_gen_bytes(buf, bytes); } u32 prandom_u32(void) { - return lx_emul_gen_random_u32(); + return lx_emul_random_gen_u32(); }