From 8c26c59fb8da85deb84c55d98f0c4dc9e384b397 Mon Sep 17 00:00:00 2001 From: Aminreza Abrahimi Saba Date: Fri, 4 Sep 2020 12:40:22 +0430 Subject: [PATCH] Added comments for API functions --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0dcb785..cb665e0 100644 --- a/README.md +++ b/README.md @@ -4,17 +4,21 @@ KUP is comprised of a FreeBSD kernel module, and a userspace library that provid The KUP kernel module, exposes an API in the kernel sapce, that a kernel module can use to definea pseudo-device and the max number of channels on that device. Then a userspace process can use the KUP userspace lib to communicate with the kernel-side client. # Example -You can take a look at the tests folder to see examples of how to use the kernel module and the usespace library. As a reference here is the KUP kernel API functions (see kupdev/kupdev.h) +You can take a look at the tests folder to see examples of how to use the kernel module and the usespace library. As a reference here is the KUP kernel API functions (see kuplib/kup.h and kupdev/kupdev.h) ```c +// Create a new KUP device with name /dev/name with a count of chan_cnt +// channels, each having a size of size pages. struct kupdev_softc * kupdev_create(const char *name, size_t size, size_t chan_cnt); +// Wait until a userspace process attaches a channel on this KUP device int kupdev_wait_channel(struct kupdev_softc *sc); int kupdev_unload(struct kupdev_softc* sc); +// Notify the userspace that a new KUP channel is available void kupdev_notify(struct kupdev_softc *sc); @@ -24,9 +28,11 @@ kupdev_send(struct kupdev_softc *sc, void *data, size_t len, int chan_id); void* kupdev_receive(struct kupdev_softc *sc, int chan_id); +// Free a receive cahnnel after we are done with the data in it. void kupdev_unlock_channel(struct kupdev_softc* sc, int chan_id); +// Pass the turn on channel chan_of of KUP device sc to the userspace process void kupdev_pass(struct kupdev_softc* sc, int chan_id); ``` @@ -37,6 +43,7 @@ int kernproxy_errno; void* kernproxy_open(char const *name); +// Attach to a specific channel of the KUP device represented by handle void* kernproxy_channel(void* handle, size_t chan_id, size_t size); void* kernproxy_receive(void *handle, int flags);