|
static cluster_t | fat_append_clusters (struct fat_fs_struct *fs, cluster_t cluster_num, cluster_t count) |
|
static uint8_t | fat_calc_83_checksum (const uint8_t *file_name_83) |
|
static uint8_t | fat_clear_cluster (const struct fat_fs_struct *fs, cluster_t cluster_num) |
|
static uintptr_t | fat_clear_cluster_callback (uint8_t *buffer, offset_t offset, void *p) |
|
void | fat_close (struct fat_fs_struct *fs) |
|
static offset_t | fat_cluster_offset (const struct fat_fs_struct *fs, cluster_t cluster_num) |
|
static uint8_t | fat_dir_entry_read_callback (uint8_t *buffer, offset_t offset, void *p) |
|
static offset_t | fat_find_offset_for_dir_entry (struct fat_fs_struct *fs, const struct fat_dir_struct *parent, const struct fat_dir_entry_struct *dir_entry) |
|
static uint8_t | fat_free_clusters (struct fat_fs_struct *fs, cluster_t cluster_num) |
|
offset_t | fat_get_fs_free (const struct fat_fs_struct *fs) |
|
static uint8_t | fat_get_fs_free_16_callback (uint8_t *buffer, offset_t offset, void *p) |
|
static uint8_t | fat_get_fs_free_32_callback (uint8_t *buffer, offset_t offset, void *p) |
|
offset_t | fat_get_fs_size (const struct fat_fs_struct *fs) |
|
static cluster_t | fat_get_next_cluster (const struct fat_fs_struct *fs, cluster_t cluster_num) |
|
struct fat_fs_struct * | fat_open (struct partition_struct *partition) |
|
static uint8_t | fat_read_header (struct fat_fs_struct *fs) |
|
static uint8_t | fat_terminate_clusters (struct fat_fs_struct *fs, cluster_t cluster_num) |
|
static uint8_t | fat_write_dir_entry (const struct fat_fs_struct *fs, struct fat_dir_entry_struct *dir_entry) |
|
Basic functions for handling a FAT filesystem.
cluster_t fat_append_clusters |
( |
struct fat_fs_struct * |
fs, |
|
|
cluster_t |
cluster_num, |
|
|
cluster_t |
count |
|
) |
| |
|
static |
Appends a new cluster chain to an existing one.
Set cluster_num to zero to create a completely new one.
- Parameter
-
[in] | fs | The file system on which to operate. |
[in] | cluster_num | The cluster to which to append the new chain. |
[in] | count | The number of clusters to allocate. |
- Rückgabe
- 0 on failure, the number of the first new cluster on success.
Definiert in Zeile 490 der Datei fat.c.
uint8_t fat_calc_83_checksum |
( |
const uint8_t * |
file_name_83 | ) |
|
|
static |
Calculates the checksum for 8.3 names used within the corresponding lfn directory entries.
- Parameter
-
[in] | file_name_83 | The 11-byte file name buffer. |
- Rückgabe
- The checksum of the given file name.
Definiert in Zeile 1638 der Datei fat.c.
uint8_t fat_clear_cluster |
( |
const struct fat_fs_struct * |
fs, |
|
|
cluster_t |
cluster_num |
|
) |
| |
|
static |
Clears a single cluster.
The complete cluster is filled with zeros.
- Parameter
-
[in] | fs | The filesystem on which to operate. |
[in] | cluster_num | The cluster to clear. |
- Rückgabe
- 0 on failure, 1 on success.
Definiert in Zeile 758 der Datei fat.c.
uintptr_t fat_clear_cluster_callback |
( |
uint8_t * |
buffer, |
|
|
offset_t |
offset, |
|
|
void * |
p |
|
) |
| |
|
static |
Callback function for clearing a cluster.
Definiert in Zeile 775 der Datei fat.c.
Closes a FAT filesystem.
When this function returns, the given filesystem descriptor will be invalid.
- Parameter
-
[in] | fs | The filesystem to close. |
- Siehe auch
- fat_open
Definiert in Zeile 302 der Datei fat.c.
offset_t fat_cluster_offset |
( |
const struct fat_fs_struct * |
fs, |
|
|
cluster_t |
cluster_num |
|
) |
| |
|
static |
Calculates the offset of the specified cluster.
- Parameter
-
[in] | fs | The filesystem on which to operate. |
[in] | cluster_num | The cluster whose offset to calculate. |
- Rückgabe
- The cluster offset.
Definiert in Zeile 789 der Datei fat.c.
uint8_t fat_dir_entry_read_callback |
( |
uint8_t * |
buffer, |
|
|
offset_t |
offset, |
|
|
void * |
p |
|
) |
| |
|
static |
Callback function for reading a directory entry.
Interprets a raw directory entry and puts the contained information into a fat_dir_entry_struct structure.
For a single file there may exist multiple directory entries. All except the last one are lfn entries, which contain parts of the long filename. The last directory entry is a traditional 8.3 style one. It contains all other information like size, cluster, date and time.
- Parameter
-
[in] | buffer | A pointer to 32 bytes of raw data. |
[in] | offset | The absolute offset of the raw data. |
[in,out] | p | An argument structure controlling operation. |
- Rückgabe
- 0 on failure or completion, 1 if reading has to be continued
Definiert in Zeile 1515 der Datei fat.c.
Searches for space where to store a directory entry.
- Parameter
-
[in] | fs | The filesystem on which to operate. |
[in] | parent | The directory in which to search. |
[in] | dir_entry | The directory entry for which to search space. |
- Rückgabe
- 0 on failure, a device offset on success.
Definiert in Zeile 1658 der Datei fat.c.
uint8_t fat_free_clusters |
( |
struct fat_fs_struct * |
fs, |
|
|
cluster_t |
cluster_num |
|
) |
| |
|
static |
Frees a cluster chain, or a part thereof.
Marks the specified cluster and all clusters which are sequentially referenced by it as free. They may then be used again for future file allocations.
- Zu beachten
- If this function is used for freeing just a part of a cluster chain, the new end of the chain is not correctly terminated within the FAT. Use fat_terminate_clusters() instead.
- Parameter
-
[in] | fs | The filesystem on which to operate. |
[in] | cluster_num | The starting cluster of the chain which to free. |
- Rückgabe
- 0 on failure, 1 on success.
- Siehe auch
- fat_terminate_clusters
Definiert in Zeile 638 der Datei fat.c.
Returns the amount of free storage capacity on the filesystem in bytes.
- Zu beachten
- As the FAT filesystem is cluster based, this function does not return continuous values but multiples of the cluster size.
- Parameter
-
[in] | fs | The filesystem on which to operate. |
- Rückgabe
- 0 on failure, the free filesystem space in bytes otherwise.
Definiert in Zeile 2348 der Datei fat.c.
uint8_t fat_get_fs_free_16_callback |
( |
uint8_t * |
buffer, |
|
|
offset_t |
offset, |
|
|
void * |
p |
|
) |
| |
|
static |
Callback function used for counting free clusters in a FAT.
Definiert in Zeile 2383 der Datei fat.c.
uint8_t fat_get_fs_free_32_callback |
( |
uint8_t * |
buffer, |
|
|
offset_t |
offset, |
|
|
void * |
p |
|
) |
| |
|
static |
Callback function used for counting free clusters in a FAT32.
Definiert in Zeile 2402 der Datei fat.c.
Returns the amount of total storage capacity of the filesystem in bytes.
- Parameter
-
[in] | fs | The filesystem on which to operate. |
- Rückgabe
- 0 on failure, the filesystem size in bytes otherwise.
Definiert in Zeile 2326 der Datei fat.c.
cluster_t fat_get_next_cluster |
( |
const struct fat_fs_struct * |
fs, |
|
|
cluster_t |
cluster_num |
|
) |
| |
|
static |
Retrieves the next following cluster of a given cluster.
Using the filesystem file allocation table, this function returns the number of the cluster containing the data directly following the data within the cluster with the given number.
- Parameter
-
[in] | fs | The filesystem for which to determine the next cluster. |
[in] | cluster_num | The number of the cluster for which to determine its successor. |
- Rückgabe
- The wanted cluster number, or 0 on error.
Definiert in Zeile 444 der Datei fat.c.
Opens a FAT filesystem.
- Parameter
-
[in] | partition | Discriptor of partition on which the filesystem resides. |
- Rückgabe
- 0 on error, a FAT filesystem descriptor on success.
- Siehe auch
- fat_close
Definiert in Zeile 250 der Datei fat.c.
Reads and parses the header of a FAT filesystem.
- Parameter
-
[in,out] | fs | The filesystem for which to parse the header. |
- Rückgabe
- 0 on failure, 1 on success.
Definiert in Zeile 320 der Datei fat.c.
uint8_t fat_terminate_clusters |
( |
struct fat_fs_struct * |
fs, |
|
|
cluster_t |
cluster_num |
|
) |
| |
|
static |
Frees a part of a cluster chain and correctly terminates the rest.
Marks the specified cluster as the new end of a cluster chain and frees all following clusters.
- Parameter
-
[in] | fs | The filesystem on which to operate. |
[in] | cluster_num | The new end of the cluster chain. |
- Rückgabe
- 0 on failure, 1 on success.
- Siehe auch
- fat_free_clusters
Definiert in Zeile 718 der Datei fat.c.
Writes a directory entry to disk.
- Zu beachten
- The file name is not checked for invalid characters.
-
The generation of the short 8.3 file name is quite simple. The first eight characters are used for the filename. The extension, if any, is made up of the first three characters following the last dot within the long filename. If the filename (without the extension) is longer than eight characters, the lower byte of the cluster number replaces the last two characters to avoid name clashes. In any other case, it is your responsibility to avoid name clashes.
- Parameter
-
[in] | fs | The filesystem on which to operate. |
[in] | dir_entry | The directory entry to write. |
- Rückgabe
- 0 on failure, 1 on success.
Definiert in Zeile 1783 der Datei fat.c.