34 lines
578 B
C
34 lines
578 B
C
#ifndef IO_H_
|
|
#define IO_H_
|
|
|
|
#define MAX_FDS 1024
|
|
|
|
#include <stdarg.h>
|
|
#include "inode.h"
|
|
|
|
enum Flags {
|
|
O_READ = 1,
|
|
O_WRITE = 2,
|
|
O_APPEND = 4,
|
|
O_CREATE = 8
|
|
};
|
|
|
|
struct file_descriptor {
|
|
Inode *inode;
|
|
off_t offset;
|
|
int flags;
|
|
int ref_count;
|
|
};
|
|
|
|
struct Process {
|
|
struct file_descriptor fd_table[MAX_FDS];
|
|
};
|
|
|
|
struct Process* initialize_process();
|
|
int allocate_fd(struct Process proc, Inode inode, int flags, ...);
|
|
int emmafs_open(char name[]);
|
|
int emmafs_close(char name[]);
|
|
//int emmafs_read(int fd)
|
|
//int emmafs_write(int fd)
|
|
|
|
#endif // IO_H_
|