From c15925a24efe14f437d8a2699500241a58fdc8f9 Mon Sep 17 00:00:00 2001 From: Miguel Date: Fri, 17 Aug 2018 21:41:21 +0200 Subject: cleanup and working on fifo pipes --- kernel/fd.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 kernel/fd.h (limited to 'kernel/fd.h') diff --git a/kernel/fd.h b/kernel/fd.h new file mode 100644 index 0000000..fe048f4 --- /dev/null +++ b/kernel/fd.h @@ -0,0 +1,30 @@ +// SIMPLE FILE DESCRIPTOR // + +#ifndef FD_H +#define FD_H + +#include +#include + +#include "fifo.h" + +typedef struct fd_struct +{ + bool (*write)(struct fd_struct*,uint8_t); + uint8_t (*read)(struct fd_struct*); + bool (*has)(struct fd_struct*); + bool (*close)(struct fd_struct*); + + void *data; // opaque data + +}fd; + +uint8_t fd_read(fd*); +bool fd_has(fd*); +bool fd_write(fd*,uint8_t); +bool fd_close(fd*); + +fd fd_from_fifo(fifo* f); +//fd fd_from_path(char *path); + +#endif -- cgit v1.2.3