LoginSignup
0
1

More than 5 years have passed since last update.

FatFS > R0.13 > fs->n_fats > 1(exFAT), 2(FAT)

Posted at

http://elm-chan.org/fsw/ff/00index_e.html
http://elm-chan.org/fsw/ff/archives.html

ChaNさんによるFatFSに関して見ている(ソースのバージョンはR0.13)。

ff.cにおいてfs->n_fatsの値によって異なる処理をしている。
n_fatsが1か2の時の処理をしているようである。

find_volume()において以下のような実装がある (fmt==1の時)。

ff.c
        fs->n_fats = fs->win[BPB_NumFATsEx];            /* Number of FATs */
        if (fs->n_fats != 1) return FR_NO_FILESYSTEM;   /* (Supports only 1 FAT) */

また、下記のような実装もある (fmt!=1の時)。

ff.c
        fs->n_fats = fs->win[BPB_NumFATs];              /* Number of FATs */
        if (fs->n_fats != 1 && fs->n_fats != 2) return FR_NO_FILESYSTEM;    /* (Must be 1 or 2) */

fmtはcheck_fs()により取得され、check_fs()のコメントで以下のように記載がある。

  • 0: FAT
  • 1: exFAT
  • ...

まとめると下記ということなのだろう。

  • exFATの時: n_fats == 1
  • FATの時: n_fats == 2

n_fatsが2に対する処理は、FAT関連の処理だと推測される(例としてsync_window())。

ff.c
if (fs->n_fats == 2) disk_write(fs->pdrv, fs->win, fs->winsect + fs->fsize, 1); /* Reflect it to 2nd FAT if needed */
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1