#ifndef __FILES_H #define __FILES_H #include struct fs_stats_t { int serial; char label[SUPERBLOCK_LABEL_SIZE]; inode_t root_inode; unsigned int free_space; }; struct fs_stats_t fs_info(); int mount(unsigned int volume); int umount(); /* return RETURN_FAILURE in of failure (pre-existing file, full volume...) */ int create_file(const char *pathname, enum file_type_e type); /* return RETURN_FAILURE in of failure (non pre-existing file, non empty directory...) */ int delete_file(const char *pathname); int open_file(struct file_desc_t *fd, const char *pathname); void close_file(struct file_desc_t *fd); void flush_file(struct file_desc_t *fd); void seek_file(struct file_desc_t *fd, int offset); /* return the conversion to an int of the current char in the file. Return READ_EOF if the file is at end-of-file. */ int readc_file(struct file_desc_t *fd); /* write a char in the file. Fail if there is no place on device. */ int writec_file(struct file_desc_t *fd, char c); /* read nbytes char from the file and copy them in the buffer. Return the number of actually read char; READ_EOF if the file is at end-of-file. */ int read_file(struct file_desc_t *fd, void *buf, unsigned int nbyte); /* write nbyte char from the buffer on the file. Return the number of char writen, RETURN_FAILURE in case of error. */ int write_file(struct file_desc_t *fd, const void *buf, unsigned int nbyte); #endif /* __FILES_H */