From 23839bc886696aba1c912cd6d901f7d337470142 Mon Sep 17 00:00:00 2001 From: "bernard.xiong@gmail.com" Date: Sat, 31 Dec 2011 04:05:40 +0000 Subject: [PATCH] fix rename issue in DFS. git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1890 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- components/dfs/filesystems/elmfat/dfs_elm.c | 3 +-- components/dfs/src/dfs.c | 2 +- components/dfs/src/dfs_file.c | 15 +++++++++------ components/dfs/src/dfs_posix.c | 2 +- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/components/dfs/filesystems/elmfat/dfs_elm.c b/components/dfs/filesystems/elmfat/dfs_elm.c index d52874255..1beea7bbf 100644 --- a/components/dfs/filesystems/elmfat/dfs_elm.c +++ b/components/dfs/filesystems/elmfat/dfs_elm.c @@ -588,7 +588,6 @@ int dfs_elm_stat(struct dfs_filesystem *fs, const char *path, struct stat *st) FILINFO file_info; FRESULT result; - #if _VOLUMES > 1 int vol; char *drivers_fn; @@ -679,7 +678,7 @@ int elm_init(void) */ #include "diskio.h" -/* Inidialize a Drive */ +/* Initialize a Drive */ DSTATUS disk_initialize(BYTE drv) { return 0; diff --git a/components/dfs/src/dfs.c b/components/dfs/src/dfs.c index 33b8f497a..7ac596a2a 100644 --- a/components/dfs/src/dfs.c +++ b/components/dfs/src/dfs.c @@ -263,7 +263,7 @@ const char *dfs_subdir(const char *directory, const char *filename) * @param directory the parent path * @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) { diff --git a/components/dfs/src/dfs_file.c b/components/dfs/src/dfs_file.c index 2746a11b6..25de66af1 100644 --- a/components/dfs/src/dfs_file.c +++ b/components/dfs/src/dfs_file.c @@ -10,6 +10,7 @@ * Change Logs: * Date Author Notes * 2005-02-22 Bernard The first version. + * 2011-12-08 Bernard Merges rename patch from iamcacy. */ #include @@ -24,7 +25,7 @@ * 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 path the spaciefied file path. + * @param path the specified file path. * @param flags the flags for open operator. * * @return 0 on successful, -1 on failed. @@ -70,7 +71,7 @@ int dfs_file_open(struct dfs_fd *fd, const char *path, int flags) else fd->path = rt_strdup(dfs_subdir(fs->path, 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 */ if (fs->ops->open == RT_NULL) @@ -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. * - * @param fd the directory decriptor. + * @param fd the directory descriptor. * @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. */ @@ -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 newpath the new path name. @@ -438,7 +439,9 @@ int dfs_file_rename(const char *oldpath, const char *newpath) 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; } diff --git a/components/dfs/src/dfs_posix.c b/components/dfs/src/dfs_posix.c index c21917d29..a38547727 100644 --- a/components/dfs/src/dfs_posix.c +++ b/components/dfs/src/dfs_posix.c @@ -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. * * @param fd the file descriptor -- GitLab