summaryrefslogtreecommitdiff
path: root/fs/fifo.h
blob: 1ba716833838ee6ee473b064417145ff1b73a92e (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
typedef struct S_FIFO_FILE FIFO_FILE;
#ifndef FIFO_H
#define FIFO_H
#include "vfs.h"
#include <stddef.h>
#include <stdint.h>

struct S_FIFO_FILE {
  char *buffer;
  uint64_t buffer_len;
  uint64_t write_len;
  uint8_t is_blocking;
  uint8_t has_data;
  uint8_t can_write;
};

int create_fifo(void);
FIFO_FILE *create_fifo_object(void);
int fifo_object_write(uint8_t *buffer, uint64_t offset, uint64_t len,
                      FIFO_FILE *file);
int fifo_object_read(uint8_t *buffer, uint64_t offset, uint64_t len,
                     FIFO_FILE *file);
int fifo_write(uint8_t *buffer, uint64_t offset, uint64_t len,
               vfs_fd_t *fd);
int fifo_read(uint8_t *buffer, uint64_t offset, uint64_t len,
              vfs_fd_t *fd);
#endif