Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/random/random_harvestq.h
Show All 32 Lines | |||||
/* These are used to queue harvested packets of entropy. The entropy | /* These are used to queue harvested packets of entropy. The entropy | ||||
* buffer size is pretty arbitrary. | * buffer size is pretty arbitrary. | ||||
*/ | */ | ||||
struct harvest_event { | struct harvest_event { | ||||
uint32_t he_somecounter; /* fast counter for clock jitter */ | uint32_t he_somecounter; /* fast counter for clock jitter */ | ||||
uint32_t he_entropy[HARVESTSIZE];/* some harvested entropy */ | uint32_t he_entropy[HARVESTSIZE];/* some harvested entropy */ | ||||
uint8_t he_size; /* harvested entropy byte count */ | uint8_t he_size; /* harvested entropy byte count */ | ||||
uint8_t he_bits; /* stats about the entropy */ | |||||
uint8_t he_destination; /* destination pool of this entropy */ | uint8_t he_destination; /* destination pool of this entropy */ | ||||
uint8_t he_source; /* origin of the entropy */ | uint8_t he_source; /* origin of the entropy */ | ||||
} __packed; | }; | ||||
cem: Can we remove `__packed`? Given `struct harvest_event` is used in arrays, it seems like a bad… | |||||
Done Inline ActionsYes we can! Its been a long day... markm: Yes we can! Its been a long day... | |||||
void read_rate_increment(u_int); | void read_rate_increment(u_int); | ||||
#define RANDOM_HARVEST_INIT_LOCK(x) mtx_init(&harvest_context.hc_mtx, "entropy harvest mutex", NULL, MTX_SPIN) | #define RANDOM_HARVEST_INIT_LOCK(x) mtx_init(&harvest_context.hc_mtx, "entropy harvest mutex", NULL, MTX_SPIN) | ||||
#define RANDOM_HARVEST_LOCK(x) mtx_lock_spin(&harvest_context.hc_mtx) | #define RANDOM_HARVEST_LOCK(x) mtx_lock_spin(&harvest_context.hc_mtx) | ||||
#define RANDOM_HARVEST_UNLOCK(x) mtx_unlock_spin(&harvest_context.hc_mtx) | #define RANDOM_HARVEST_UNLOCK(x) mtx_unlock_spin(&harvest_context.hc_mtx) | ||||
#endif /* SYS_DEV_RANDOM_RANDOM_HARVESTQ_H_INCLUDED */ | #endif /* SYS_DEV_RANDOM_RANDOM_HARVESTQ_H_INCLUDED */ |
Can we remove __packed? Given struct harvest_event is used in arrays, it seems like a bad idea to misalign most entries. Alternatively, he_bits could be replaced with an explicit padding byte.