X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/99f2ed669601a61f4f0210e0b481ff877cd9bea7..35a7d633d3f16c1e0539af6ca5d8e7482926cd93:/lunaix-os/kernel/device/potentem.c diff --git a/lunaix-os/kernel/device/potentem.c b/lunaix-os/kernel/device/potentem.c new file mode 100644 index 0000000..b7de144 --- /dev/null +++ b/lunaix-os/kernel/device/potentem.c @@ -0,0 +1,33 @@ +#include +#include + +struct potens_meta* +alloc_potens(int cap, unsigned int size) +{ + struct potens_meta* cm = (struct potens_meta*)vzalloc(size); + + cm->pot_type = cap; + + return cm; +} + +void +device_grant_potens(struct device* dev, struct potens_meta* cap) +{ + llist_append(&dev->potentium, &cap->potentes); + cap->owner = dev; +} + +struct potens_meta* +device_get_potens(struct device* dev, unsigned int pot_type) +{ + struct potens_meta *pos, *n; + + llist_for_each(pos, n, &dev->potentium, potentes) { + if (pos->pot_type == pot_type){ + return pos; + } + } + + return NULL; +} \ No newline at end of file