kernel: mem_domain: Use u8_t for number of partitions in struct
During system initialization, the global static variable (to mem_domain.c) is initialized with the number of maximum partitions per domain. This variable is of u8_t type. Assertions throughout the code will check ranges and test for overflow by relying on implicit type conversion. Use an u8_t instead of u32_t to avoid doubts. Also, reorder the k_mem_partition struct to remove the alignment hole created by reducing sizeof(num_partitions). Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
This commit is contained in:
parent
db094b8d88
commit
08de658eb9
2 changed files with 5 additions and 5 deletions
|
@ -4260,14 +4260,14 @@ struct k_mem_partition {
|
|||
|
||||
/* memory domian */
|
||||
struct k_mem_domain {
|
||||
/* number of partitions in the domain */
|
||||
u32_t num_partitions;
|
||||
#ifdef CONFIG_USERSPACE
|
||||
/* partitions in the domain */
|
||||
struct k_mem_partition partitions[CONFIG_MAX_DOMAIN_PARTITIONS];
|
||||
#endif /* CONFIG_USERSPACE */
|
||||
/* domain q */
|
||||
sys_dlist_t mem_domain_q;
|
||||
/* number of partitions in the domain */
|
||||
u8_t num_partitions;
|
||||
};
|
||||
|
||||
|
||||
|
@ -4282,7 +4282,7 @@ struct k_mem_domain {
|
|||
* if num_parts is zero.
|
||||
*/
|
||||
|
||||
extern void k_mem_domain_init(struct k_mem_domain *domain, u32_t num_parts,
|
||||
extern void k_mem_domain_init(struct k_mem_domain *domain, u8_t num_parts,
|
||||
struct k_mem_partition *parts[]);
|
||||
/**
|
||||
* @brief Destroy a memory domain.
|
||||
|
|
|
@ -68,8 +68,8 @@ static inline bool sane_partition_domain(const struct k_mem_domain *domain,
|
|||
#define sane_partition_domain(...) (true)
|
||||
#endif
|
||||
|
||||
void k_mem_domain_init(struct k_mem_domain *domain, u32_t num_parts,
|
||||
struct k_mem_partition *parts[])
|
||||
void k_mem_domain_init(struct k_mem_domain *domain, u8_t num_parts,
|
||||
struct k_mem_partition *parts[])
|
||||
{
|
||||
unsigned int key;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue