FatFS/documents/doc/sfatfs.html
savelij13 bf4615c01f fatfs v0.16 July 22, 2025:
- Removed a long-pending limitation that f_getcwd and double-dot .. in the path name did not work on the exFAT volume.
- Fixed f_readdir cannot detect end of directory and it leads the application process into infinite loop. (appeared at R0.15b)
- Fixed dot names with terminating separator or duplicated separator are rejected when LFN is not enabled.
2025-09-11 10:53:13 +03:00

62 lines
3.7 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<link rel="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">
<title>FatFs - FATFS</title>
</head>
<body>
<div class="para">
<h2>FATFS</h2>
<p>The <tt>FATFS</tt> structure (filesystem object) holds dynamic work area of individual logical drives. It is given by application program and registerd/unregisterd to the FatFs module with <tt>f_mount</tt> function. Initialization of the structure is done by volume mount process whenever necessary. Application program <em>must not</em> modify any member in this structure, or the FAT volume will be collapsed.</p>
<pre>
<span class="k">typedef</span> <span class="k">struct</span> {
BYTE fs_type; <span class="c">/* FAT type (0, FS_FAT12, FS_FAT16, FS_FAT32 or FS_EXFAT) */</span>
BYTE pdrv; <span class="c">/* Physical drive that holds this volume */</span>
BYTE ldrv; <span class="c">/* Logical drive number (used only when FF_FS_REENTRANT) */</span>
BYTE n_fats; <span class="c">/* Number of FAT copies (1,2) */</span>
BYTE wflag; <span class="c">/* win[] flag (b0:win[] is dirty) */</span>
BYTE fsi_flag; <span class="c">/* FSINFO flags (b7:Disabled, b0:Dirty) */</span>
WORD id; <span class="c">/* Volume mount ID */</span>
WORD n_rootdir; <span class="c">/* Number of root directory entries (FAT12/16) */</span>
WORD csize; <span class="c">/* Sectors per cluster */</span>
<span class="k">#if</span> FF_MAX_SS != FF_MIN_SS
WORD ssize; <span class="c">/* Sector size (512,1024,2048 or 4096) */</span>
<span class="k">#endif</span>
<span class="k">#if</span> FF_USE_LFN
WCHAR* lfnbuf; <span class="c">/* Pointer to LFN working buffer */</span>
<span class="k">#endif</span>
<span class="k">#if</span> !FF_FS_READONLY
DWORD last_clust; <span class="c">/* FSINFO: Last allocated cluster (invalid if &gt;=n_fatent) */</span>
DWORD free_clust; <span class="c">/* FSINFO: Number of free clusters (invalid if &gt;=fs->n_fatent-2) */</span>
<span class="k">#endif</span>
<span class="k">#if</span> FF_FS_RPATH
DWORD cdir; <span class="c">/* Cluster number of current directory (0:root) */</span>
<span class="k">#endif</span>
DWORD n_fatent; <span class="c">/* Number of FAT entries (Number of clusters + 2) */</span>
DWORD fsize; <span class="c">/* Sectors per FAT */</span>
LBA_t winsect; <span class="c">/* Sector LBA appearing in the win[] */</span>
LBA_t volbase; <span class="c">/* Volume base LBA */</span>
LBA_t fatbase; <span class="c">/* FAT base LBA */</span>
LBA_t dirbase; <span class="c">/* Root directory base (LBA|Cluster) */</span>
LBA_t database; <span class="c">/* Data base LBA */</span>
<span class="k">#if</span> FF_FS_EXFAT
LBA_t bitbase; <span class="c">/* Allocation bitmap base sector */</span>
BYTE* dirbuf; <span class="c">/* Directory entry block scratchpad buffer */</span>
<span class="k">#if</span> FF_FS_RPATH
<a href="sxcwds.html">FFXCWDS</a> xcwds; <span class="c">/* Current working directory structure */</span>
FFXCWDS xcwds2; <span class="c">/* Working buffer to follow the path */</span>
<span class="k">#endif</span>
<span class="k">#endif</span>
BYTE win[FF_MAX_SS]; <span class="c">/* Disk access window for directory, FAT (and file data at tiny cfg) */</span>
} FATFS;
</pre>
</div>
<p class="foot"><a href="../index.html">Return</a></p>
</body>
</html>