+};
+
+#define DEVICE_METADATA \
+ union { \
+ struct device_meta meta; \
+ struct { \
+ u32_t magic; \
+ struct llist_header siblings; \
+ struct llist_header children; \
+ struct device_meta* parent; \
+ struct hstr name; \
+ \
+ u32_t dev_uid; \
+ \
+ char name_val[DEVICE_NAME_SIZE]; \
+ }; \
+ }
+
+#define dev_meta(dev) (&(dev)->meta)
+#define to_dev(dev) (container_of(dev,struct device, meta))
+#define to_catdev(dev) (container_of(dev,struct device_cat, meta))
+#define to_aliasdev(dev) (container_of(dev,struct device_alias, meta))
+
+struct device_alias {
+ DEVICE_METADATA;
+ struct device_meta* alias;
+};
+
+struct device_cat {
+ DEVICE_METADATA;
+};
+
+struct device
+{
+ /* -- device structing -- */
+
+ DEVICE_METADATA;
+
+ capability_list_t capabilities;
+
+ /* -- device state -- */
+
+ mutex_t lock;
+
+ int dev_type;
+ struct devident ident;