[DFS] make comments cleanup.

This commit is contained in:
bernard 2014-08-01 12:03:11 +08:00
parent 94883a92fb
commit 516711dc1d
2 changed files with 20 additions and 9 deletions

View File

@ -555,7 +555,7 @@ void ls(const char *pathname)
if (pathname == RT_NULL)
rt_free(path);
}
FINSH_FUNCTION_EXPORT(ls, list directory contents)
FINSH_FUNCTION_EXPORT(ls, list directory contents);
void rm(const char *filename)
{
@ -564,7 +564,7 @@ void rm(const char *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)
{
@ -590,7 +590,7 @@ void cat(const char* filename)
dfs_file_close(&fd);
}
FINSH_FUNCTION_EXPORT(cat, print file)
FINSH_FUNCTION_EXPORT(cat, print file);
#define BUF_SZ 4096
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);
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);

View File

@ -33,11 +33,11 @@
/**
* 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 flags the file open flags.
* @param mode
* @param mode ignored parameter
*
* @return the non-negative integer on successful open, others for failed.
*/
@ -120,7 +120,8 @@ RTM_EXPORT(close);
* @param buf the buffer to save the read data.
* @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)
{
@ -200,7 +201,7 @@ RTM_EXPORT(write);
* @param offset the offset to be seeked.
* @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)
{
@ -336,6 +337,8 @@ RTM_EXPORT(stat);
*
* @param fildes the file description
* @param buf the data buffer to save stat description.
*
* @return 0 on successful, -1 on failed.
*/
int fstat(int fildes, struct stat *buf)
{
@ -470,7 +473,7 @@ RTM_EXPORT(rmdir);
*
* @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)
{