2929#include "components/dfs/include/dfs_fs.h"
3030#include "components/dfs/include/dfs_file.h"
3131
32- static rt_device_t disk [_VOLUMES ] = {0 };
32+ static rt_device_t disk [FF_VOLUMES ] = {0 };
3333
3434static int elm_result_to_dfs (FRESULT result )
3535{
@@ -86,7 +86,7 @@ static int get_disk(rt_device_t id)
8686{
8787 int index ;
8888
89- for (index = 0 ; index < _VOLUMES ; index ++ )
89+ for (index = 0 ; index < FF_VOLUMES ; index ++ )
9090 {
9191 if (disk [index ] == id )
9292 return index ;
@@ -114,7 +114,7 @@ int dfs_elm_mount(struct dfs_filesystem *fs, unsigned long rwflag, const void *d
114114 /* check sector size */
115115 if (rt_device_control (fs -> dev_id , RT_DEVICE_CTRL_BLK_GETGEOME , & geometry ) == RT_EOK )
116116 {
117- if (geometry .bytes_per_sector > _MAX_SS )
117+ if (geometry .bytes_per_sector > FF_MAX_SS )
118118 {
119119 rt_kprintf ("The sector size of device is greater than the sector size of FAT.\n" );
120120 return - EINVAL ;
@@ -202,7 +202,7 @@ int dfs_elm_mkfs(rt_device_t dev_id)
202202 int index ;
203203 char logic_nbr [2 ] = {'0' ,':' };
204204
205- work = rt_malloc (_MAX_SS );
205+ work = rt_malloc (FF_MAX_SS );
206206 if (RT_NULL == work ) {
207207 return - ENOMEM ;
208208 }
@@ -265,7 +265,7 @@ int dfs_elm_mkfs(rt_device_t dev_id)
265265 /* [IN] Size of the allocation unit */
266266 /* [-] Working buffer */
267267 /* [IN] Size of working buffer */
268- result = f_mkfs (logic_nbr , FM_ANY |FM_SFD , 0 , work , _MAX_SS );
268+ result = f_mkfs (logic_nbr , FM_ANY |FM_SFD , 0 , work , FF_MAX_SS );
269269 rt_free (work ); work = RT_NULL ;
270270
271271 /* check flag status, we need clear the temp driver stored in disk[] */
@@ -299,7 +299,7 @@ int dfs_elm_statfs(struct dfs_filesystem *fs, struct statfs *buf)
299299
300300 f = (FATFS * )fs -> data ;
301301
302- rt_snprintf (driver , sizeof (driver ), "%d:" , f -> drv );
302+ rt_snprintf (driver , sizeof (driver ), "%d:" , f -> pdrv );
303303 res = f_getfree (driver , & fre_clust , & f );
304304 if (res )
305305 return elm_result_to_dfs (res );
@@ -310,7 +310,7 @@ int dfs_elm_statfs(struct dfs_filesystem *fs, struct statfs *buf)
310310
311311 buf -> f_bfree = fre_sect ;
312312 buf -> f_blocks = tot_sect ;
313- #if _MAX_SS != 512
313+ #if FF_MAX_SS != 512
314314 buf -> f_bsize = f -> ssize ;
315315#else
316316 buf -> f_bsize = 512 ;
@@ -326,7 +326,7 @@ int dfs_elm_open(struct dfs_fd *file)
326326 FRESULT result ;
327327 char * drivers_fn ;
328328
329- #if (_VOLUMES > 1 )
329+ #if (FF_VOLUMES > 1 )
330330 int vol ;
331331 struct dfs_filesystem * fs = (struct dfs_filesystem * )file -> data ;
332332 extern int elm_get_vol (FATFS * fat );
@@ -356,7 +356,7 @@ int dfs_elm_open(struct dfs_fd *file)
356356 result = f_mkdir (drivers_fn );
357357 if (result != FR_OK )
358358 {
359- #if _VOLUMES > 1
359+ #if FF_VOLUMES > 1
360360 rt_free (drivers_fn );
361361#endif
362362 return elm_result_to_dfs (result );
@@ -367,14 +367,14 @@ int dfs_elm_open(struct dfs_fd *file)
367367 dir = (DIR * )rt_malloc (sizeof (DIR ));
368368 if (dir == RT_NULL )
369369 {
370- #if _VOLUMES > 1
370+ #if FF_VOLUMES > 1
371371 rt_free (drivers_fn );
372372#endif
373373 return - ENOMEM ;
374374 }
375375
376376 result = f_opendir (dir , drivers_fn );
377- #if _VOLUMES > 1
377+ #if FF_VOLUMES > 1
378378 rt_free (drivers_fn );
379379#endif
380380 if (result != FR_OK )
@@ -408,14 +408,14 @@ int dfs_elm_open(struct dfs_fd *file)
408408 fd = (FIL * )rt_malloc (sizeof (FIL ));
409409 if (fd == RT_NULL )
410410 {
411- #if _VOLUMES > 1
411+ #if FF_VOLUMES > 1
412412 rt_free (drivers_fn );
413413#endif
414414 return - ENOMEM ;
415415 }
416416
417417 result = f_open (fd , drivers_fn , mode );
418- #if _VOLUMES > 1
418+ #if FF_VOLUMES > 1
419419 rt_free (drivers_fn );
420420#endif
421421 if (result == FR_OK )
@@ -637,7 +637,7 @@ int dfs_elm_unlink(struct dfs_filesystem *fs, const char *path)
637637{
638638 FRESULT result ;
639639
640- #if _VOLUMES > 1
640+ #if FF_VOLUMES > 1
641641 int vol ;
642642 char * drivers_fn ;
643643 extern int elm_get_vol (FATFS * fat );
@@ -657,7 +657,7 @@ int dfs_elm_unlink(struct dfs_filesystem *fs, const char *path)
657657#endif
658658
659659 result = f_unlink (drivers_fn );
660- #if _VOLUMES > 1
660+ #if FF_VOLUMES > 1
661661 rt_free (drivers_fn );
662662#endif
663663 return elm_result_to_dfs (result );
@@ -667,7 +667,7 @@ int dfs_elm_rename(struct dfs_filesystem *fs, const char *oldpath, const char *n
667667{
668668 FRESULT result ;
669669
670- #if _VOLUMES > 1
670+ #if FF_VOLUMES > 1
671671 char * drivers_oldfn ;
672672 const char * drivers_newfn ;
673673 int vol ;
@@ -692,7 +692,7 @@ int dfs_elm_rename(struct dfs_filesystem *fs, const char *oldpath, const char *n
692692#endif
693693
694694 result = f_rename (drivers_oldfn , drivers_newfn );
695- #if _VOLUMES > 1
695+ #if FF_VOLUMES > 1
696696 rt_free (drivers_oldfn );
697697#endif
698698 return elm_result_to_dfs (result );
@@ -703,7 +703,7 @@ int dfs_elm_stat(struct dfs_filesystem *fs, const char *path, struct stat *st)
703703 FILINFO file_info ;
704704 FRESULT result ;
705705
706- #if _VOLUMES > 1
706+ #if FF_VOLUMES > 1
707707 int vol ;
708708 char * drivers_fn ;
709709 extern int elm_get_vol (FATFS * fat );
@@ -723,7 +723,7 @@ int dfs_elm_stat(struct dfs_filesystem *fs, const char *path, struct stat *st)
723723#endif
724724
725725 result = f_stat (drivers_fn , & file_info );
726- #if _VOLUMES > 1
726+ #if FF_VOLUMES > 1
727727 rt_free (drivers_fn );
728728#endif
729729 if (result == FR_OK )
0 commit comments