257257#define GET_FATTIME () get_fattime()
258258#endif
259259
260+ #if FF_FS_MAKE_VOLID == 1
261+ #define MAKE_VOLID (x ) (make_volid())
262+ #else
263+ #define MAKE_VOLID (x ) (GET_FATTIME())
264+ #endif
260265
261266/* File lock controls */
262267#if FF_FS_LOCK != 0
@@ -5421,6 +5426,7 @@ FRESULT f_mkfs (
54215426 DWORD tbl [3 ];
54225427#endif
54235428
5429+ DWORD volid = MAKE_VOLID ();
54245430
54255431 /* Check mounted drive and clear work area */
54265432 fs -> fs_type = 0 ; /* Clear mounted volume */
@@ -5622,7 +5628,7 @@ FRESULT f_mkfs (
56225628 st_dword (buf + BPB_DataOfsEx , b_data - b_vol ); /* Data offset [sector] */
56235629 st_dword (buf + BPB_NumClusEx , n_clst ); /* Number of clusters */
56245630 st_dword (buf + BPB_RootClusEx , 2 + tbl [0 ] + tbl [1 ]); /* Root dir cluster # */
5625- st_dword (buf + BPB_VolIDEx , GET_FATTIME () ); /* VSN */
5631+ st_dword (buf + BPB_VolIDEx , volid ); /* VSN */
56265632 st_word (buf + BPB_FSVerEx , 0x100 ); /* Filesystem version (1.00) */
56275633 for (buf [BPB_BytsPerSecEx ] = 0 , i = ss ; i >>= 1 ; buf [BPB_BytsPerSecEx ]++ ) ; /* Log2 of sector size [byte] */
56285634 for (buf [BPB_SecPerClusEx ] = 0 , i = au ; i >>= 1 ; buf [BPB_SecPerClusEx ]++ ) ; /* Log2 of cluster size [sector] */
@@ -5758,7 +5764,7 @@ FRESULT f_mkfs (
57585764 st_dword (buf + BPB_HiddSec , b_vol ); /* Volume offset in the physical drive [sector] */
57595765#if FF_MKFS_FAT32
57605766 if (fmt == FS_FAT32 ) {
5761- st_dword (buf + BS_VolID32 , GET_FATTIME () ); /* VSN */
5767+ st_dword (buf + BS_VolID32 , volid ); /* VSN */
57625768 st_dword (buf + BPB_FATSz32 , sz_fat ); /* FAT size [sector] */
57635769 st_dword (buf + BPB_RootClus32 , 2 ); /* Root directory cluster # (2) */
57645770 st_word (buf + BPB_FSInfo32 , 1 ); /* Offset of FSINFO sector (VBR + 1) */
@@ -5769,7 +5775,7 @@ FRESULT f_mkfs (
57695775 } else
57705776#endif
57715777 {
5772- st_dword (buf + BS_VolID , GET_FATTIME () ); /* VSN */
5778+ st_dword (buf + BS_VolID , volid ); /* VSN */
57735779 st_word (buf + BPB_FATSz16 , (WORD )sz_fat ); /* FAT size [sector] */
57745780 buf [BS_DrvNum ] = 0x80 ; /* Drive number (for int13) */
57755781 buf [BS_BootSig ] = 0x29 ; /* Extended boot signature */
0 commit comments