提交 23839bc8 编写于 作者: B bernard.xiong@gmail.com

fix rename issue in DFS.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1890 bbd45198-f89e-11dd-88c7-29a3b14d5316
上级 e76ac34f
...@@ -588,7 +588,6 @@ int dfs_elm_stat(struct dfs_filesystem *fs, const char *path, struct stat *st) ...@@ -588,7 +588,6 @@ int dfs_elm_stat(struct dfs_filesystem *fs, const char *path, struct stat *st)
FILINFO file_info; FILINFO file_info;
FRESULT result; FRESULT result;
#if _VOLUMES > 1 #if _VOLUMES > 1
int vol; int vol;
char *drivers_fn; char *drivers_fn;
...@@ -679,7 +678,7 @@ int elm_init(void) ...@@ -679,7 +678,7 @@ int elm_init(void)
*/ */
#include "diskio.h" #include "diskio.h"
/* Inidialize a Drive */ /* Initialize a Drive */
DSTATUS disk_initialize(BYTE drv) DSTATUS disk_initialize(BYTE drv)
{ {
return 0; return 0;
......
...@@ -263,7 +263,7 @@ const char *dfs_subdir(const char *directory, const char *filename) ...@@ -263,7 +263,7 @@ const char *dfs_subdir(const char *directory, const char *filename)
* @param directory the parent path * @param directory the parent path
* @param filename the file name * @param filename the file name
* *
* @return the built full file path (absoluted path) * @return the built full file path (absolute path)
*/ */
char *dfs_normalize_path(const char *directory, const char *filename) char *dfs_normalize_path(const char *directory, const char *filename)
{ {
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes
* 2005-02-22 Bernard The first version. * 2005-02-22 Bernard The first version.
* 2011-12-08 Bernard Merges rename patch from iamcacy.
*/ */
#include <dfs.h> #include <dfs.h>
...@@ -24,7 +25,7 @@ ...@@ -24,7 +25,7 @@
* this function will open a file which specified by path with specified flags. * this function will open a file which specified by path with specified flags.
* *
* @param fd the file descriptor pointer to return the corresponding result. * @param fd the file descriptor pointer to return the corresponding result.
* @param path the spaciefied file path. * @param path the specified file path.
* @param flags the flags for open operator. * @param flags the flags for open operator.
* *
* @return 0 on successful, -1 on failed. * @return 0 on successful, -1 on failed.
...@@ -70,7 +71,7 @@ int dfs_file_open(struct dfs_fd *fd, const char *path, int flags) ...@@ -70,7 +71,7 @@ int dfs_file_open(struct dfs_fd *fd, const char *path, int flags)
else else
fd->path = rt_strdup(dfs_subdir(fs->path, fullpath)); fd->path = rt_strdup(dfs_subdir(fs->path, fullpath));
rt_free(fullpath); rt_free(fullpath);
dfs_log(DFS_DEBUG_INFO, ("actul file path: %s\n", fd->path)); dfs_log(DFS_DEBUG_INFO, ("Actual file path: %s\n", fd->path));
/* specific file system open routine */ /* specific file system open routine */
if (fs->ops->open == RT_NULL) if (fs->ops->open == RT_NULL)
...@@ -181,9 +182,9 @@ int dfs_file_read(struct dfs_fd *fd, void *buf, rt_size_t len) ...@@ -181,9 +182,9 @@ int dfs_file_read(struct dfs_fd *fd, void *buf, rt_size_t len)
/** /**
* this function will fetch directory entries from a directory descriptor. * this function will fetch directory entries from a directory descriptor.
* *
* @param fd the directory decriptor. * @param fd the directory descriptor.
* @param dirp the dirent buffer to save result. * @param dirp the dirent buffer to save result.
* @param nbytes the aviable room in the buffer. * @param nbytes the available room in the buffer.
* *
* @return the read dirent, others on failed. * @return the read dirent, others on failed.
*/ */
...@@ -388,7 +389,7 @@ int dfs_file_stat(const char *path, struct stat *buf) ...@@ -388,7 +389,7 @@ int dfs_file_stat(const char *path, struct stat *buf)
} }
/** /**
* this funciton will rename an old path name to a new path name. * this function will rename an old path name to a new path name.
* *
* @param oldpath the old path name. * @param oldpath the old path name.
* @param newpath the new path name. * @param newpath the new path name.
...@@ -438,7 +439,9 @@ int dfs_file_rename(const char *oldpath, const char *newpath) ...@@ -438,7 +439,9 @@ int dfs_file_rename(const char *oldpath, const char *newpath)
goto __exit; goto __exit;
} }
result = oldfs->ops->rename(oldfs, oldfullpath, newfullpath); /* use sub directory to rename in file system */
result = oldfs->ops->rename(oldfs, dfs_subdir(oldfs->path, oldfullpath),
dfs_subdir(newfs->path, newfullpath));
goto __exit; goto __exit;
} }
......
...@@ -129,7 +129,7 @@ int read(int fd, void *buf, size_t len) ...@@ -129,7 +129,7 @@ int read(int fd, void *buf, size_t len)
} }
/** /**
* this function is a POSIX compliant version, which will write pecified data buffer * this function is a POSIX compliant version, which will write specified data buffer
* length for an open file descriptor. * length for an open file descriptor.
* *
* @param fd the file descriptor * @param fd the file descriptor
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册