Skip to content

Commit

Permalink
Added comments for API functions
Browse files Browse the repository at this point in the history
  • Loading branch information
AmbrSb committed Sep 4, 2020
1 parent 5366edb commit 8c26c59
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);
```
Expand All @@ -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);
Expand Down

0 comments on commit 8c26c59

Please sign in to comment.