257
257
#define GET_FATTIME () get_fattime()
258
258
#endif
259
259
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
260
265
261
266
/* File lock controls */
262
267
#if FF_FS_LOCK != 0
@@ -5421,6 +5426,7 @@ FRESULT f_mkfs (
5421
5426
DWORD tbl [3 ];
5422
5427
#endif
5423
5428
5429
+ DWORD volid = MAKE_VOLID ();
5424
5430
5425
5431
/* Check mounted drive and clear work area */
5426
5432
fs -> fs_type = 0 ; /* Clear mounted volume */
@@ -5622,7 +5628,7 @@ FRESULT f_mkfs (
5622
5628
st_dword (buf + BPB_DataOfsEx , b_data - b_vol ); /* Data offset [sector] */
5623
5629
st_dword (buf + BPB_NumClusEx , n_clst ); /* Number of clusters */
5624
5630
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 */
5626
5632
st_word (buf + BPB_FSVerEx , 0x100 ); /* Filesystem version (1.00) */
5627
5633
for (buf [BPB_BytsPerSecEx ] = 0 , i = ss ; i >>= 1 ; buf [BPB_BytsPerSecEx ]++ ) ; /* Log2 of sector size [byte] */
5628
5634
for (buf [BPB_SecPerClusEx ] = 0 , i = au ; i >>= 1 ; buf [BPB_SecPerClusEx ]++ ) ; /* Log2 of cluster size [sector] */
@@ -5758,7 +5764,7 @@ FRESULT f_mkfs (
5758
5764
st_dword (buf + BPB_HiddSec , b_vol ); /* Volume offset in the physical drive [sector] */
5759
5765
#if FF_MKFS_FAT32
5760
5766
if (fmt == FS_FAT32 ) {
5761
- st_dword (buf + BS_VolID32 , GET_FATTIME () ); /* VSN */
5767
+ st_dword (buf + BS_VolID32 , volid ); /* VSN */
5762
5768
st_dword (buf + BPB_FATSz32 , sz_fat ); /* FAT size [sector] */
5763
5769
st_dword (buf + BPB_RootClus32 , 2 ); /* Root directory cluster # (2) */
5764
5770
st_word (buf + BPB_FSInfo32 , 1 ); /* Offset of FSINFO sector (VBR + 1) */
@@ -5769,7 +5775,7 @@ FRESULT f_mkfs (
5769
5775
} else
5770
5776
#endif
5771
5777
{
5772
- st_dword (buf + BS_VolID , GET_FATTIME () ); /* VSN */
5778
+ st_dword (buf + BS_VolID , volid ); /* VSN */
5773
5779
st_word (buf + BPB_FATSz16 , (WORD )sz_fat ); /* FAT size [sector] */
5774
5780
buf [BS_DrvNum ] = 0x80 ; /* Drive number (for int13) */
5775
5781
buf [BS_BootSig ] = 0x29 ; /* Extended boot signature */
0 commit comments