Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- enum FILETYPE
- {
- ftUNKNOWN, ftFILE, dtDIRECTORY,
- };
- // GENERIC API
- /**
- * Opens a file and gets a file handle.
- */
- int fs_open(char *name);
- /**
- * Returns the type of the given file.
- */
- FILETYPE fs_type(int file);
- /**
- * Releases a file handle.
- */
- void fs_close(int file);
- // FILE API
- /**
- * Reads a block of data from a file.
- * @param file The file handle.
- * @param buffer The target memory
- * @param offset The start position in the file
- * @param length Number of bytes to read.
- * @return Number of bytes read.
- */
- uint32_t file_read(
- int file,
- void *buffer,
- uint32_t offset,
- uint32_t length);
- /**
- * Returns the length of a file in bytes.
- */
- uint32_t file_length(int file);
- // DIRECTORY API
- struct NODE
- {
- char name[FILENAME_MAXLEN];
- FILETYPE type;
- };
- /**
- * Returns the number of entries in a directory.
- * @param file The file handle.
- */
- uint32_t dir_length(int file);
- /**
- * Gets a directory entry.
- * @param file The file handle
- * @param index The index of the node in the directory.
- * @param node A pointer to a node to store the information.
- */
- bool dir_get(int file, int index, NODE *node);
Advertisement
Add Comment
Please, Sign In to add comment