summaryrefslogtreecommitdiff
path: root/kernel/fd.h
blob: 8c7ea450f91025e4874334e9e33e1a71d2fadf1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// SIMPLE FILE DESCRIPTOR //

#ifndef FD_H
#define FD_H

#include <stdint.h>
#include <stdbool.h>

#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