History

random: make consistent use of buf and len

The current code was a mix of "nbytes", "count", "size", "buffer", "in", and so forth. Instead, let's clean this up by naming input parameters "buf" (or "ubuf") and "len", so that you always understand that you're reading this variety of function argument.

Jason A. Donenfeld committed 4 years ago

Commit a1940261 parent 7c3a8a12 files · +103 −108Browse files

Showing the changes to include (1 of 2 files). Show all

Unified · Split

include/linux/random.h+6−6
@@ -12,12 +12,12 @@ · 11 unmodified lines
12 12
13struct notifier_block;13struct notifier_block;
14 14
15void add_device_randomness(const void *, size_t);15void add_device_randomness(const void *buf, size_t len);
16void add_bootloader_randomness(const void *, size_t);16void add_bootloader_randomness(const void *buf, size_t len);
17void add_input_randomness(unsigned int type, unsigned int code,17void add_input_randomness(unsigned int type, unsigned int code,
18 unsigned int value) __latent_entropy;18 unsigned int value) __latent_entropy;
19void add_interrupt_randomness(int irq) __latent_entropy;19void add_interrupt_randomness(int irq) __latent_entropy;
20void add_hwgenerator_randomness(const void *buffer, size_t count, size_t entropy);20void add_hwgenerator_randomness(const void *buf, size_t len, size_t entropy);
21 21
22#if defined(LATENT_ENTROPY_PLUGIN) && !defined(__CHECKER__)22#if defined(LATENT_ENTROPY_PLUGIN) && !defined(__CHECKER__)
23static inline void add_latent_entropy(void)23static inline void add_latent_entropy(void)
@@ -29,7 +29,7 @@ static inline void add_latent_entropy(void) { } · 5 unmodified lines
29#endif29#endif
30 30
31#if IS_ENABLED(CONFIG_VMGENID)31#if IS_ENABLED(CONFIG_VMGENID)
32void add_vmfork_randomness(const void *unique_vm_id, size_t size);32void add_vmfork_randomness(const void *unique_vm_id, size_t len);
33int register_random_vmfork_notifier(struct notifier_block *nb);33int register_random_vmfork_notifier(struct notifier_block *nb);
34int unregister_random_vmfork_notifier(struct notifier_block *nb);34int unregister_random_vmfork_notifier(struct notifier_block *nb);
35#else35#else
@@ -37,8 +37,8 @@ static inline int register_random_vmfork_notifier(struct notifier_block *nb) { r · 1 unmodified line
37static inline int unregister_random_vmfork_notifier(struct notifier_block *nb) { return 0; }37static inline int unregister_random_vmfork_notifier(struct notifier_block *nb) { return 0; }
38#endif38#endif
39 39
40void get_random_bytes(void *buf, size_t nbytes);40void get_random_bytes(void *buf, size_t len);
41size_t __must_check get_random_bytes_arch(void *buf, size_t nbytes);41size_t __must_check get_random_bytes_arch(void *buf, size_t len);
42u32 get_random_u32(void);42u32 get_random_u32(void);
43u64 get_random_u64(void);43u64 get_random_u64(void);
44static inline unsigned int get_random_int(void)44static inline unsigned int get_random_int(void)