summaryrefslogtreecommitdiff
path: root/components/dfs
diff options
context:
space:
mode:
authorbernard.xiong <[email protected]>2010-10-22 07:26:26 +0000
committerbernard.xiong <[email protected]>2010-10-22 07:26:26 +0000
commitbd6d16ecdef9ed7a7e33e12dceb189d500b3e379 (patch)
treed5b137ce70c6b6d46ca232e84899ac99bf0325f3 /components/dfs
parentaf2019888f9e9ace79a569c39892648849655e52 (diff)
fix DFS elm struct mismatch issue.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1027 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'components/dfs')
-rw-r--r--components/dfs/dfs_config.h75
-rw-r--r--components/dfs/filesystems/elmfat/dfs_elm.c1
-rw-r--r--components/dfs/src/dfs_file.c19
3 files changed, 22 insertions, 73 deletions
diff --git a/components/dfs/dfs_config.h b/components/dfs/dfs_config.h
index 378030f742..1681737121 100644
--- a/components/dfs/dfs_config.h
+++ b/components/dfs/dfs_config.h
@@ -16,85 +16,28 @@
#ifndef __DFS_CONFIG_H__
#define __DFS_CONFIG_H__
-/*
-+------------------------------------------------------------------------------
-| Device Manager options
-+------------------------------------------------------------------------------
-*/
-/* Device Options parameters */
-#define DEVICES_MAX 8
-#define DEVICE_NAME_MAX 8
-
-/*
-+------------------------------------------------------------------------------
-| Device Filesystem options
-+------------------------------------------------------------------------------
-*/
-/* the max length of filesystem name */
-#define DFS_FS_NAME_MAX 4
/* the max type of filesystem */
-#define DFS_FILESYSTEM_TYPES_MAX 2
+#define DFS_FILESYSTEM_TYPES_MAX 4
/* the max length of path name */
-#define DFS_PATH_MAX 256
-/* the max length of file name */
-#define DFS_FILE_MAX 256
-
-/* options for server task */
-#define DFS_MBOX_NUMBER 32
-#define DFS_SERVER_STACK 1024
-#define DFS_SERVER_PRI 110
-#define DFS_SERVER_SLICE 20
-
-/*
-+------------------------------------------------------------------------------
-| FAT filesystem options
-+------------------------------------------------------------------------------
-*/
-/* file name max length */
-#define FAT_NAME_MAX 256
-/* max number of FAT filesystem */
-#define FATFS_MAX 2
+#define DFS_PATH_MAX 256
/* the size of sector */
-#define SECTOR_SIZE 512
-
-/* FAT table sector cache options */
-#define FAT_CACHE_SIZE 0x10 /* config parameter */
-#define FAT_CACHE_MASK (FAT_CACHE_SIZE-1)
+#define SECTOR_SIZE 512
-#define GET16(x) (*(x)) | (*((x)+1) << 8)
-#define GET32(x) (*(x)) | (*((x)+1) << 8) | (*((x)+2) << 16) | (*((x)+3) << 24)
-
-#define SET16(x, v) \
- do \
- { \
- *(x) = (v) & 0x00ff; \
- (*((x)+1)) = (v) >> 8; \
- } while ( 0 )
-
-#define SET32(x, v) \
- do \
- { \
- *(x) = (v) & 0x000000ff; \
- (*((x)+1)) = ((v) >> 8) & 0x000000ff; \
- (*((x)+2)) = ((v) >> 16) & 0x000000ff; \
- (*((x)+3)) = ((v) >> 24); \
- } while ( 0 )
-
-#define DFS_DEBUG_INFO 0x01
-#define DFS_DEBUG_WARNING 0x02
-#define DFS_DEBUG_ERROR 0x04
-
-#define DFS_DEBUG_LEVEL (DFS_DEBUG_INFO | DFS_DEBUG_WARNING | DFS_DEBUG_ERROR)
+#define DFS_DEBUG_INFO 0x01
+#define DFS_DEBUG_WARNING 0x02
+#define DFS_DEBUG_ERROR 0x04
+#define DFS_DEBUG_LEVEL (DFS_DEBUG_INFO | DFS_DEBUG_WARNING | DFS_DEBUG_ERROR)
/* #define DFS_DEBUG */
#ifdef DFS_DEBUG
#define dfs_log(level, x) do { if (level & DFS_DEBUG_LEVEL) \
- {rt_kprintf("DFS %s, %d:", __FILE__, __LINE__); rt_kprintf x; \
+ {rt_kprintf("DFS %s, %d:", __FUNCTION__, __LINE__); rt_kprintf x; \
rt_kprintf ("\n");}}while (0)
#else
#define dfs_log(level, x)
#endif
#endif
+
diff --git a/components/dfs/filesystems/elmfat/dfs_elm.c b/components/dfs/filesystems/elmfat/dfs_elm.c
index a130e40ff8..0271fc72d6 100644
--- a/components/dfs/filesystems/elmfat/dfs_elm.c
+++ b/components/dfs/filesystems/elmfat/dfs_elm.c
@@ -1,3 +1,4 @@
+#include <rtthread.h>
#include "ffconf.h"
#include "ff.h"
diff --git a/components/dfs/src/dfs_file.c b/components/dfs/src/dfs_file.c
index c326052090..05b082e4ae 100644
--- a/components/dfs/src/dfs_file.c
+++ b/components/dfs/src/dfs_file.c
@@ -460,16 +460,21 @@ void ls(const char* pathname)
rt_snprintf(fullpath, DFS_PATH_MAX + 1, "%s%c%s", pathname, '/', dirent.d_name);
else
rt_snprintf(fullpath, DFS_PATH_MAX + 1, "%s%s", pathname, dirent.d_name);
-
- dfs_file_stat(fullpath, &stat);
- if ( stat.st_mode & DFS_S_IFDIR )
+
+ if (dfs_file_stat(fullpath, &stat) == 0)
{
- rt_kprintf("%s\t\t<DIR>\n", dirent.d_name);
+ if ( stat.st_mode & DFS_S_IFDIR )
+ {
+ rt_kprintf("%s\t\t<DIR>\n", dirent.d_name);
+ }
+ else
+ {
+ rt_kprintf("%s\t\t%lu\n", dirent.d_name, stat.st_size);
+ }
}
else
- {
- rt_kprintf("%s\t\t%lu\n", dirent.d_name, stat.st_size);
- }
+ rt_kprintf("BAD file: %s\n", dirent.d_name);
+
}
}while(length > 0);