#ifndef _FILESYSTEM_H_
#define _FILESYSTEM_H_
#define FS_FILE 0
#define FS_DIR 1
#define MAX_FILES 64
#define MAX_NAME 32
#define MAX_FILE_SIZE (64 * 1024)
#define FS_MAGIC 0x4F50454E
#define FS_VERSION 2
#define FS_START_SECTOR 0
#define INODE_START 1
#define DATA_START 16
struct Inode {
char name[MAX_NAME];
unsigned int size;
unsigned int start_sector;
int used;
int type;
int parent;
int owner;
unsigned int mode;
};
void fs_init(void);
int fs_find_in(int parent, const char *name);
int fs_create(int parent, const char *name, int type);
int fs_create_ex(int parent, const char *name, int type, int owner, unsigned int mode);
int fs_mkdir(int parent, const char *name);
int fs_delete(int parent, const char *name);
int fs_write(const char *name, const void *buf, int size);
int fs_read(const char *name, void *buf, int size);
int fs_list(int parent, char names[][MAX_NAME], int max);
int fs_cd(int current, const char *path);
void fs_get_path(int idx, char *buf);
int fs_read_at(int parent, const char *name, void *buf, int size);
int fs_write_at(int parent, const char *name, const void *buf, int size);
int fs_is_dir(int idx);
int fs_size_of(int idx);
int fs_get_parent(int idx);
int fs_get_owner(int idx);
unsigned int fs_get_mode(int idx);
int fs_chmod(int parent, const char *name, unsigned int mode);
int fs_chown(int parent, const char *name, int uid);
#endif