xref: /linux/arch/um/include/asm/archrandom.h (revision a108772d03d8bdb43258218b00bfe43bbe1e8800)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __ASM_UM_ARCHRANDOM_H__
3 #define __ASM_UM_ARCHRANDOM_H__
4 
5 #include <linux/types.h>
6 
7 /* This is from <os.h>, but better not to #include that in a global header here. */
8 ssize_t os_getrandom(void *buf, size_t len, unsigned int flags);
9 
10 static inline size_t __must_check arch_get_random_longs(unsigned long *v, size_t max_longs)
11 {
12 	ssize_t ret;
13 
14 	ret = os_getrandom(v, max_longs * sizeof(*v), 0);
15 	if (ret < 0)
16 		return 0;
17 	return ret / sizeof(*v);
18 }
19 
20 static inline size_t __must_check arch_get_random_seed_longs(unsigned long *v, size_t max_longs)
21 {
22 	return 0;
23 }
24 
25 #endif
26