+#define dev_object_root \
+ ({ extern morph_t* device_mobj_root; device_mobj_root; })
+
+/**
+ * A potens is a capability of the device
+ * ("potens", means "capable" in latin)
+ *
+ * A device can have multiple capabilities
+ * (or "potentes", plural form of potens)
+ *
+ * A group of devices with same capability will forms
+ * a "globus potentis" or "capability group". The
+ * group is completely a logical formation, meaning
+ * that it is not explictly coded.
+ *
+ * The idea of potens is to provide a unified and yet
+ * opaque method to decouple the device provide raw
+ * functionalities with any higher abstraction, such
+ * as other subsystem, or standard-compilance wrapper
+ * (e.g., POSIX terminal)
+ */
+struct potens_meta
+{
+ struct device* owner;
+
+ struct llist_header potentes;
+ unsigned int pot_type;
+};
+
+#define POTENS_META \
+ struct { \
+ union { \
+ struct potens_meta pot_meta; \
+ struct { \
+ struct llist_header potentes; \
+ unsigned int pot_type; \
+ }; \
+ }; \
+ }
+
+#define get_potens(cap, pot_struct) \
+ container_of((cap), pot_struct, pot_meta)
+#define potens_meta(cap) (&(cap)->pot_meta)
+#define potens_dev(cap) (potens_meta(cap)->owner)
+
+#define potens(name) POTENS_##name
+
+#define potens_check_unique(dev, pot_type) \
+ !device_get_potens(dev, pot_type)
+
+enum device_potens_type
+{
+ potens(NON),
+ #include <listings/device_potens.lst>
+};
+
+/**
+ * List of potentes of a device, pay attention to
+ * the spelling, "potentium", genitive plural of "potens".
+ */
+typedef struct llist_header potentium_list_t;
+
+
+#define DEVICE_META_FIELD \
+ struct { \
+ morph_t mobj; \
+ char name_val[DEVICE_NAME_SIZE]; \
+ };
+
+#define DEVICE_METADATA \
+ union { \
+ struct device_meta meta; \
+ DEVICE_META_FIELD; \
+ }
+
+#define devmeta_morpher morphable_attrs(device_meta, mobj)
+#define devalias_morpher morphable_attrs(device_alias, mobj)
+#define devcat_morpher morphable_attrs(device_cat, mobj)
+#define device_morpher morphable_attrs(device, mobj)
+
+#define dev_meta(dev) (&(dev)->meta)
+#define dev_mobj(dev) (&(dev)->mobj)
+#define dev_morph(dev) ({ likely(dev) ? &(dev)->mobj : dev_object_root; })
+#define dev_uid(dev) (morpher_uid(&(dev)->mobj))
+#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_meta
+{
+ DEVICE_META_FIELD;
+};
+
+struct device_alias {
+ DEVICE_METADATA;
+ struct device_meta* alias;
+};
+
+struct device_cat {
+ DEVICE_METADATA;
+};
+