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
1212
1313 struct notifier_block;
1414
15−void add_device_randomness(const void *, size_t);
16−void add_bootloader_randomness(const void *, size_t);
15+void add_device_randomness(const void *buf, size_t len);
16+void add_bootloader_randomness(const void *buf, size_t len);
1717 void add_input_randomness(unsigned int type, unsigned int code,
1818 unsigned int value) __latent_entropy;
1919 void add_interrupt_randomness(int irq) __latent_entropy;
20−void add_hwgenerator_randomness(const void *buffer, size_t count, size_t entropy);
20+void add_hwgenerator_randomness(const void *buf, size_t len, size_t entropy);
2121
2222 #if defined(LATENT_ENTROPY_PLUGIN) && !defined(__CHECKER__)
2323 static inline void add_latent_entropy(void)
@@ -29,7 +29,7 @@ static inline void add_latent_entropy(void) { } · 5 unmodified lines
2929 #endif
3030
3131 #if IS_ENABLED(CONFIG_VMGENID)
32−void add_vmfork_randomness(const void *unique_vm_id, size_t size);
32+void add_vmfork_randomness(const void *unique_vm_id, size_t len);
3333 int register_random_vmfork_notifier(struct notifier_block *nb);
3434 int unregister_random_vmfork_notifier(struct notifier_block *nb);
3535 #else
@@ -37,8 +37,8 @@ static inline int register_random_vmfork_notifier(struct notifier_block *nb) { r · 1 unmodified line
3737 static inline int unregister_random_vmfork_notifier(struct notifier_block *nb) { return 0; }
3838 #endif
3939
40−void get_random_bytes(void *buf, size_t nbytes);
41−size_t __must_check get_random_bytes_arch(void *buf, size_t nbytes);
40+void get_random_bytes(void *buf, size_t len);
41+size_t __must_check get_random_bytes_arch(void *buf, size_t len);
4242 u32 get_random_u32(void);
4343 u64 get_random_u64(void);
4444 static inline unsigned int get_random_int(void)