1 /*-----------------------------------------------------------------------*/
 2 /* Mount/Unmount a Logical Drive                                         */
 3 /*-----------------------------------------------------------------------*/
 4 
 5 FRESULT f_mount (
 6     BYTE vol,        /* Logical drive number to be mounted/unmounted */
 7     FATFS *fs        /* Pointer to new file system object (NULL for unmount)*/
 8 )
 9 {
10     FATFS *rfs;
11 
12 
13     if (vol >= _VOLUMES)        /* Check if the drive number is valid */
14         return FR_INVALID_DRIVE;
15     rfs = FatFs[vol];            /* Get current fs object */
16 
17     if (rfs) {
18 #if _FS_SHARE
19         clear_lock(rfs);
20 #endif
21 #if _FS_REENTRANT                /* Discard sync object of the current volume */
22         if (!ff_del_syncobj(rfs->sobj)) return FR_INT_ERR;
23 #endif
24         rfs->fs_type = 0;        /* Clear old fs object */
25     }
26 
27     if (fs) {
28         fs->fs_type = 0;        /* Clear new fs object */
29 #if _FS_REENTRANT                /* Create sync object for the new volume */
30         if (!ff_cre_syncobj(vol, &fs->sobj)) return FR_INT_ERR;
31 #endif
32     }
33     FatFs[vol] = fs;            /* Register new fs object */
34 
35     return FR_OK;
36 }
View Code

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-25
  • 2022-01-21
  • 2021-04-27
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案