From 213adc7632584cef219e4cae71127253cb849600 Mon Sep 17 00:00:00 2001 From: Thomas Schoebel-Theuer Date: Mon, 28 Mar 2022 16:18:41 +0200 Subject: [PATCH] all: pack enums --- kernel/brick.h | 4 ++-- kernel/brick_say.h | 6 ++---- kernel/lib_mapfree.h | 2 +- kernel/mars.h | 4 ++-- kernel/mars_net.h | 4 ++-- kernel/meta.h | 2 +- 6 files changed, 10 insertions(+), 12 deletions(-) diff --git a/kernel/brick.h b/kernel/brick.h index ec9542db..9ca1b51f 100644 --- a/kernel/brick.h +++ b/kernel/brick.h @@ -675,7 +675,7 @@ extern void set_button_wait(struct generic_brick *brick, bool val, bool force, i * There is one exception: when @force is set, only the direction to * "off" remains possible. This is useful for emergency shutdowns. */ -typedef enum { +typedef enum brick_switch { // only one brick instance BR_ON_ONE, // switch on one brick instance BR_OFF_ONE, // just switch off (may be switched on again) @@ -686,7 +686,7 @@ typedef enum { BR_OFF_ALL, BR_KILL_ALL, BR_FREE_ALL, -} brick_switch_t; +} __packed brick_switch_t; ///////////////////////////////////////////////////////////////////////// diff --git a/kernel/brick_say.h b/kernel/brick_say.h index e2e99639..d029a6a3 100644 --- a/kernel/brick_say.h +++ b/kernel/brick_say.h @@ -40,9 +40,7 @@ extern int brick_say_syslog_flood_limit; extern int brick_say_syslog_flood_recovery; extern int delay_say_on_overflow; -// printk() replacements - -enum { +enum _say_mode { SAY_DEBUG, SAY_INFO, SAY_WARN, @@ -50,7 +48,7 @@ enum { SAY_FATAL, SAY_TOTAL, MAX_SAY_CLASS -}; +} __packed; extern const char *say_class[MAX_SAY_CLASS]; diff --git a/kernel/lib_mapfree.h b/kernel/lib_mapfree.h index 4fed3900..3a484d2d 100644 --- a/kernel/lib_mapfree.h +++ b/kernel/lib_mapfree.h @@ -53,7 +53,7 @@ enum dirty_stage { DIRTY_FINISHED, /* Keep this the last element */ DIRTY_MAX -}; +} __packed; struct dirty_length { rwlock_t dl_lock; diff --git a/kernel/mars.h b/kernel/mars.h index 0ffad1ae..da08daf5 100644 --- a/kernel/mars.h +++ b/kernel/mars.h @@ -183,7 +183,7 @@ enum _MREF_FLAGS { _MREF_COMPRESS_LZ4, _MREF_COMPRESS_ZLIB, _MREF_COMPRESS_LAST, -}; +} __packed; #define MREF_UPTODATE (1UL << _MREF_UPTODATE) #define MREF_READING (1UL << _MREF_READING) @@ -414,7 +414,7 @@ enum mars_trigger_mode { _MARS_TRIGGER_TO_REMOTE, _MARS_TRIGGER_TO_REMOTE_ALL, _MARS_TRIGGER_FULL, -}; +} __packed; #define MARS_TRIGGER_LOCAL (1 << _MARS_TRIGGER_LOCAL) #define MARS_TRIGGER_FROM_REMOTE (1 << _MARS_TRIGGER_FROM_REMOTE) diff --git a/kernel/mars_net.h b/kernel/mars_net.h index ef1625f2..bb91501f 100644 --- a/kernel/mars_net.h +++ b/kernel/mars_net.h @@ -105,7 +105,7 @@ enum mars_traffic_types { MARS_TRAFFIC_REPLICATION, MARS_TRAFFIC_SYNC, MARS_TRAFFIC_MAX /* this must come last */ -}; +} __packed; extern struct mars_tcp_params mars_tcp_params[MARS_TRAFFIC_MAX]; @@ -122,7 +122,7 @@ enum { CMD_PUSH_CHECK, /* keep last element */ CMD_LAST -}; +} __packed; #define CMD_FLAG_MASK 255 #define CMD_FLAG_HAS_DATA 256 diff --git a/kernel/meta.h b/kernel/meta.h index a2dc2f99..b51312d9 100644 --- a/kernel/meta.h +++ b/kernel/meta.h @@ -64,7 +64,7 @@ enum field_type { FIELD_RAW, FIELD_INT, FIELD_UINT, -}; +} __packed; struct meta { //char field_name[MAX_FIELD_LEN];