2024-10-08 23:01:29 +02:00
|
|
|
#ifndef IO_H_
|
|
|
|
#define IO_H_
|
|
|
|
|
|
|
|
#define MAX_FDS 1024
|
|
|
|
|
2024-11-13 17:24:31 +01:00
|
|
|
#include <stdarg.h>
|
2024-10-08 23:01:29 +02:00
|
|
|
#include "inode.h"
|
|
|
|
|
2024-11-13 17:24:31 +01:00
|
|
|
enum Flags {
|
|
|
|
O_READ = 1,
|
|
|
|
O_WRITE = 2,
|
|
|
|
O_APPEND = 4,
|
|
|
|
O_CREATE = 8
|
|
|
|
};
|
|
|
|
|
2024-10-08 23:01:29 +02:00
|
|
|
struct file_descriptor {
|
|
|
|
Inode *inode;
|
|
|
|
off_t offset;
|
|
|
|
int flags;
|
|
|
|
int ref_count;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Process {
|
|
|
|
struct file_descriptor fd_table[MAX_FDS];
|
|
|
|
};
|
|
|
|
|
2024-11-13 17:24:31 +01:00
|
|
|
struct Process* initialize_process();
|
|
|
|
int allocate_fd(struct Process proc, Inode inode, int flags, ...);
|
2024-10-08 23:01:29 +02:00
|
|
|
int emmafs_open(char name[]);
|
|
|
|
int emmafs_close(char name[]);
|
|
|
|
//int emmafs_read(int fd)
|
|
|
|
//int emmafs_write(int fd)
|
|
|
|
|
|
|
|
#endif // IO_H_
|