sd-reader
Functions
fat.c File Reference

FAT implementation (license: GPLv2 or LGPLv2.1) More...

Functions

struct fat_fs_struct * fat_open (struct partition_struct *partition)
 Opens a FAT filesystem.
void fat_close (struct fat_fs_struct *fs)
 Closes a FAT filesystem.
uint8_t fat_get_dir_entry_of_path (struct fat_fs_struct *fs, const char *path, struct fat_dir_entry_struct *dir_entry)
 Retrieves the directory entry of a path.
struct fat_file_struct * fat_open_file (struct fat_fs_struct *fs, const struct fat_dir_entry_struct *dir_entry)
 Opens a file on a FAT filesystem.
void fat_close_file (struct fat_file_struct *fd)
 Closes a file.
intptr_t fat_read_file (struct fat_file_struct *fd, uint8_t *buffer, uintptr_t buffer_len)
 Reads data from a file.
intptr_t fat_write_file (struct fat_file_struct *fd, const uint8_t *buffer, uintptr_t buffer_len)
 Writes data to a file.
uint8_t fat_seek_file (struct fat_file_struct *fd, int32_t *offset, uint8_t whence)
 Repositions the read/write file offset.
uint8_t fat_resize_file (struct fat_file_struct *fd, uint32_t size)
 Resizes a file to have a specific size.
struct fat_dir_struct * fat_open_dir (struct fat_fs_struct *fs, const struct fat_dir_entry_struct *dir_entry)
 Opens a directory.
void fat_close_dir (struct fat_dir_struct *dd)
 Closes a directory descriptor.
uint8_t fat_read_dir (struct fat_dir_struct *dd, struct fat_dir_entry_struct *dir_entry)
 Reads the next directory entry contained within a parent directory.
uint8_t fat_reset_dir (struct fat_dir_struct *dd)
 Resets a directory handle.
uint8_t fat_create_file (struct fat_dir_struct *parent, const char *file, struct fat_dir_entry_struct *dir_entry)
 Creates a file.
uint8_t fat_delete_file (struct fat_fs_struct *fs, struct fat_dir_entry_struct *dir_entry)
 Deletes a file or directory.
uint8_t fat_move_file (struct fat_fs_struct *fs, struct fat_dir_entry_struct *dir_entry, struct fat_dir_struct *parent_new, const char *file_new)
 Moves or renames a file.
uint8_t fat_create_dir (struct fat_dir_struct *parent, const char *dir, struct fat_dir_entry_struct *dir_entry)
 Creates a directory.
uint8_t fat_delete_dir (struct fat_fs_struct *fs, struct fat_dir_entry_struct *dir_entry)
 Deletes a directory.
uint8_t fat_move_dir (struct fat_fs_struct *fs, struct fat_dir_entry_struct *dir_entry, struct fat_dir_struct *parent_new, const char *dir_new)
 Moves or renames a directory.
void fat_get_file_modification_date (const struct fat_dir_entry_struct *dir_entry, uint16_t *year, uint8_t *month, uint8_t *day)
 Returns the modification date of a file.
void fat_get_file_modification_time (const struct fat_dir_entry_struct *dir_entry, uint8_t *hour, uint8_t *min, uint8_t *sec)
 Returns the modification time of a file.
void fat_set_file_modification_date (struct fat_dir_entry_struct *dir_entry, uint16_t year, uint8_t month, uint8_t day)
 Sets the modification time of a date.
void fat_set_file_modification_time (struct fat_dir_entry_struct *dir_entry, uint8_t hour, uint8_t min, uint8_t sec)
 Sets the modification time of a file.
offset_t fat_get_fs_size (const struct fat_fs_struct *fs)
 Returns the amount of total storage capacity of the filesystem in bytes.
offset_t fat_get_fs_free (const struct fat_fs_struct *fs)
 Returns the amount of free storage capacity on the filesystem in bytes.
uint8_t fat_get_fs_free_32_callback (uint8_t *buffer, offset_t offset, void *p)
 Callback function used for counting free clusters in a FAT32.

Detailed Description

FAT implementation (license: GPLv2 or LGPLv2.1)

Author:
Roland Riegel