kernel: use a union for kobject data values
Rather than stuffing various values in a uintptr_t based on
type using casts, use a union for this instead.
No functional difference, but the semantics of the data member
are now much clearer to the casual observer since it is now
formally defined by this union.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
diff --git a/scripts/gen_kobject_list.py b/scripts/gen_kobject_list.py
index e565835..18954fa 100755
--- a/scripts/gen_kobject_list.py
+++ b/scripts/gen_kobject_list.py
@@ -144,6 +144,12 @@
#endif
"""
+metadata_names = {
+ "K_OBJ_THREAD" : "thread_id",
+ "K_OBJ__THREAD_STACK_ELEMENT" : "stack_size",
+ "K_OBJ_SYS_MUTEX" : "mutex",
+ "K_OBJ_FUTEX" : "futex_data"
+}
def write_gperf_table(fp, eh, objs, static_begin, static_end):
fp.write(header)
@@ -204,7 +210,13 @@
if is_driver:
flags += " | K_OBJ_FLAG_DRIVER"
- fp.write("\", {}, %s, %s, %s\n" % (obj_type, flags, str(ko.data)))
+ if ko.type_name in metadata_names:
+ tname = metadata_names[ko.type_name]
+ else:
+ tname = "unused"
+
+ fp.write("\", {}, %s, %s, { .%s = %s }\n" % (obj_type, flags,
+ tname, str(ko.data)))
if obj_type == "K_OBJ_THREAD":
idx = math.floor(ko.data / 8)