提交 516711dc 编写于 作者: B bernard

[DFS] make comments cleanup.

上级 94883a92
...@@ -555,7 +555,7 @@ void ls(const char *pathname) ...@@ -555,7 +555,7 @@ void ls(const char *pathname)
if (pathname == RT_NULL) if (pathname == RT_NULL)
rt_free(path); rt_free(path);
} }
FINSH_FUNCTION_EXPORT(ls, list directory contents) FINSH_FUNCTION_EXPORT(ls, list directory contents);
void rm(const char *filename) void rm(const char *filename)
{ {
...@@ -564,7 +564,7 @@ void rm(const char *filename) ...@@ -564,7 +564,7 @@ void rm(const char *filename)
rt_kprintf("Delete %s failed\n", filename); rt_kprintf("Delete %s failed\n", filename);
} }
} }
FINSH_FUNCTION_EXPORT(rm, remove files or directories) FINSH_FUNCTION_EXPORT(rm, remove files or directories);
void cat(const char* filename) void cat(const char* filename)
{ {
...@@ -590,7 +590,7 @@ void cat(const char* filename) ...@@ -590,7 +590,7 @@ void cat(const char* filename)
dfs_file_close(&fd); dfs_file_close(&fd);
} }
FINSH_FUNCTION_EXPORT(cat, print file) FINSH_FUNCTION_EXPORT(cat, print file);
#define BUF_SZ 4096 #define BUF_SZ 4096
static void copyfile(const char *src, const char *dst) static void copyfile(const char *src, const char *dst)
...@@ -629,7 +629,15 @@ static void copyfile(const char *src, const char *dst) ...@@ -629,7 +629,15 @@ static void copyfile(const char *src, const char *dst)
read_bytes = dfs_file_read(&src_fd, block_ptr, BUF_SZ); read_bytes = dfs_file_read(&src_fd, block_ptr, BUF_SZ);
if (read_bytes > 0) if (read_bytes > 0)
{ {
dfs_file_write(&fd, block_ptr, read_bytes); int length;
length = dfs_file_write(&fd, block_ptr, read_bytes);
if (length != read_bytes)
{
/* write failed. */
rt_kprintf("Write file data failed, errno=%d\n", length);
break;
}
} }
} while (read_bytes > 0); } while (read_bytes > 0);
......
...@@ -33,11 +33,11 @@ ...@@ -33,11 +33,11 @@
/** /**
* this function is a POSIX compliant version, which will open a file and * this function is a POSIX compliant version, which will open a file and
* return a file descriptor. * return a file descriptor according specified flags.
* *
* @param file the path name of file. * @param file the path name of file.
* @param flags the file open flags. * @param flags the file open flags.
* @param mode * @param mode ignored parameter
* *
* @return the non-negative integer on successful open, others for failed. * @return the non-negative integer on successful open, others for failed.
*/ */
...@@ -120,7 +120,8 @@ RTM_EXPORT(close); ...@@ -120,7 +120,8 @@ RTM_EXPORT(close);
* @param buf the buffer to save the read data. * @param buf the buffer to save the read data.
* @param len the maximal length of data buffer * @param len the maximal length of data buffer
* *
* @return the actual read data buffer length * @return the actual read data buffer length. If the returned value is 0, it
* may be reach the end of file, please check errno.
*/ */
int read(int fd, void *buf, size_t len) int read(int fd, void *buf, size_t len)
{ {
...@@ -200,7 +201,7 @@ RTM_EXPORT(write); ...@@ -200,7 +201,7 @@ RTM_EXPORT(write);
* @param offset the offset to be seeked. * @param offset the offset to be seeked.
* @param whence the directory of seek. * @param whence the directory of seek.
* *
* @return the current file position, or -1 on failed. * @return the current read/write position in the file, or -1 on failed.
*/ */
off_t lseek(int fd, off_t offset, int whence) off_t lseek(int fd, off_t offset, int whence)
{ {
...@@ -336,6 +337,8 @@ RTM_EXPORT(stat); ...@@ -336,6 +337,8 @@ RTM_EXPORT(stat);
* *
* @param fildes the file description * @param fildes the file description
* @param buf the data buffer to save stat description. * @param buf the data buffer to save stat description.
*
* @return 0 on successful, -1 on failed.
*/ */
int fstat(int fildes, struct stat *buf) int fstat(int fildes, struct stat *buf)
{ {
...@@ -470,7 +473,7 @@ RTM_EXPORT(rmdir); ...@@ -470,7 +473,7 @@ RTM_EXPORT(rmdir);
* *
* @param name the path name to be open. * @param name the path name to be open.
* *
* @return the DIR pointer of directory, NULL on open failed. * @return the DIR pointer of directory, NULL on open directory failed.
*/ */
DIR *opendir(const char *name) DIR *opendir(const char *name)
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册