mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-20 17:44:20 +08:00
unify the components/dfs coding style according to the /documentation/coding_style_cn.txt
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1866 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* File : dfs.h
|
||||
* This file is part of Device File System in RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2004-2010, RT-Thread Development Team
|
||||
* COPYRIGHT (C) 2004-2011, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
@@ -21,14 +21,14 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
char* dfs_normalize_path(const char* directory, const char* filename);
|
||||
const char* dfs_subdir(const char* directory, const char* filename);
|
||||
char *dfs_normalize_path(const char *directory, const char *filename);
|
||||
const char *dfs_subdir(const char *directory, const char *filename);
|
||||
|
||||
/* FD APIs */
|
||||
int fd_new(void);
|
||||
struct dfs_fd* fd_get(int fd);
|
||||
void fd_put(struct dfs_fd* fd);
|
||||
int fd_is_open(const char* pathname);
|
||||
struct dfs_fd *fd_get(int fd);
|
||||
void fd_put(struct dfs_fd *fd);
|
||||
int fd_is_open(const char *pathname);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* File : dfs_def.h
|
||||
* This file is part of Device File System in RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2004-2010, RT-Thread Development Team
|
||||
* COPYRIGHT (C) 2004-2011, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
@@ -13,6 +13,7 @@
|
||||
* 2004-10-14 Beranard Clean up the code.
|
||||
* 2005-01-22 Beranard Clean up the code, port to MinGW
|
||||
*/
|
||||
|
||||
#ifndef __DFS_DEF_H__
|
||||
#define __DFS_DEF_H__
|
||||
|
||||
@@ -277,11 +278,11 @@ struct dirent
|
||||
/* file descriptor */
|
||||
struct dfs_fd
|
||||
{
|
||||
char* path; /* Name (below mount point) */
|
||||
char *path; /* Name (below mount point) */
|
||||
int type; /* Type (regular or socket) */
|
||||
int ref_count; /* Descriptor reference count */
|
||||
|
||||
struct dfs_filesystem* fs; /* Resident file system */
|
||||
struct dfs_filesystem *fs; /* Resident file system */
|
||||
|
||||
rt_uint32_t flags; /* Descriptor flags */
|
||||
rt_size_t size; /* Size in bytes */
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
/*
|
||||
+------------------------------------------------------------------------------
|
||||
| Project : Device Filesystem
|
||||
+------------------------------------------------------------------------------
|
||||
| Copyright 2004, 2005 www.fayfayspace.org.
|
||||
| All rights reserved.
|
||||
|------------------------------------------------------------------------------
|
||||
| File : dfs_efs.h
|
||||
|------------------------------------------------------------------------------
|
||||
| Chang Logs:
|
||||
| Date Author Notes
|
||||
| 2010-02-06 Bernard Add elm_init function declaration
|
||||
+------------------------------------------------------------------------------
|
||||
*/
|
||||
* File : dfs_elm.h
|
||||
* This file is part of Device File System in RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2008-2011, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2010-02-06 Bernard Add elm_init function declaration
|
||||
*/
|
||||
|
||||
#ifndef __DFS_ELM_H__
|
||||
#define __DFS_ELM_H__
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
/*
|
||||
+------------------------------------------------------------------------------
|
||||
| Project : Device Filesystem
|
||||
+------------------------------------------------------------------------------
|
||||
| Copyright 2004, 2005 www.fayfayspace.org.
|
||||
| All rights reserved.
|
||||
|------------------------------------------------------------------------------
|
||||
| File : dfs_raw.h, the raw APIs of Device FileSystem
|
||||
|------------------------------------------------------------------------------
|
||||
| Chang Logs:
|
||||
| Date Author Notes
|
||||
| 2005-01-26 ffxz The first version
|
||||
+------------------------------------------------------------------------------
|
||||
*/
|
||||
* File : dfs_file.c
|
||||
* This file is part of Device File System in RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2004-2011, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2005-01-26 Bernard The first version.
|
||||
*/
|
||||
|
||||
#ifndef __DFS_RAW_H__
|
||||
#define __DFS_RAW_H__
|
||||
@@ -20,16 +19,16 @@
|
||||
#include <dfs.h>
|
||||
#include <dfs_fs.h>
|
||||
|
||||
int dfs_file_open(struct dfs_fd* fd, const char *path, int flags);
|
||||
int dfs_file_close(struct dfs_fd* fd);
|
||||
int dfs_file_ioctl(struct dfs_fd* fd, int cmd, void *args);
|
||||
int dfs_file_read(struct dfs_fd* fd, void *buf, rt_size_t len);
|
||||
int dfs_file_getdents(struct dfs_fd* fd, struct dirent* dirp, rt_size_t nbytes);
|
||||
int dfs_file_open(struct dfs_fd *fd, const char *path, int flags);
|
||||
int dfs_file_close(struct dfs_fd *fd);
|
||||
int dfs_file_ioctl(struct dfs_fd *fd, int cmd, void *args);
|
||||
int dfs_file_read(struct dfs_fd *fd, void *buf, rt_size_t len);
|
||||
int dfs_file_getdents(struct dfs_fd *fd, struct dirent *dirp, rt_size_t nbytes);
|
||||
int dfs_file_unlink(const char *path);
|
||||
int dfs_file_write(struct dfs_fd* fd, const void *buf, rt_size_t len);
|
||||
int dfs_file_lseek(struct dfs_fd* fd, rt_off_t offset);
|
||||
int dfs_file_write(struct dfs_fd *fd, const void *buf, rt_size_t len);
|
||||
int dfs_file_lseek(struct dfs_fd *fd, rt_off_t offset);
|
||||
int dfs_file_stat(const char *path, struct stat *buf);
|
||||
int dfs_file_rename(const char* oldpath, const char* newpath);
|
||||
int dfs_file_rename(const char *oldpath, const char *newpath);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* File : dfs_fs.h
|
||||
* This file is part of Device File System in RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2004-2010, RT-Thread Development Team
|
||||
* COPYRIGHT (C) 2004-2011, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
@@ -11,6 +11,7 @@
|
||||
* Date Author Notes
|
||||
* 2005-02-22 Bernard The first version.
|
||||
*/
|
||||
|
||||
#ifndef __DFS_FS_H__
|
||||
#define __DFS_FS_H__
|
||||
|
||||
@@ -26,25 +27,25 @@ struct dfs_filesystem_operation
|
||||
char *name;
|
||||
|
||||
/* mount and unmount file system */
|
||||
int (*mount) (struct dfs_filesystem* fs, unsigned long rwflag, const void* data);
|
||||
int (*unmount) (struct dfs_filesystem* fs);
|
||||
int (*mount) (struct dfs_filesystem *fs, unsigned long rwflag, const void *data);
|
||||
int (*unmount) (struct dfs_filesystem *fs);
|
||||
|
||||
/* make a file system */
|
||||
int (*mkfs) (const char* device_name);
|
||||
int (*statfs) (struct dfs_filesystem* fs, struct statfs *buf);
|
||||
int (*mkfs) (const char *device_name);
|
||||
int (*statfs) (struct dfs_filesystem *fs, struct statfs *buf);
|
||||
|
||||
int (*open) (struct dfs_fd* fd);
|
||||
int (*close) (struct dfs_fd* fd);
|
||||
int (*ioctl) (struct dfs_fd* fd, int cmd, void *args);
|
||||
int (*read) (struct dfs_fd* fd, void* buf, rt_size_t count);
|
||||
int (*write) (struct dfs_fd* fd, const void* buf, rt_size_t count);
|
||||
int (*flush) (struct dfs_fd* fd);
|
||||
int (*lseek) (struct dfs_fd* fd, rt_off_t offset);
|
||||
int (*getdents) (struct dfs_fd* fd, struct dirent* dirp, rt_uint32_t count);
|
||||
int (*open) (struct dfs_fd *fd);
|
||||
int (*close) (struct dfs_fd *fd);
|
||||
int (*ioctl) (struct dfs_fd *fd, int cmd, void *args);
|
||||
int (*read) (struct dfs_fd *fd, void *buf, rt_size_t count);
|
||||
int (*write) (struct dfs_fd *fd, const void *buf, rt_size_t count);
|
||||
int (*flush) (struct dfs_fd *fd);
|
||||
int (*lseek) (struct dfs_fd *fd, rt_off_t offset);
|
||||
int (*getdents) (struct dfs_fd *fd, struct dirent *dirp, rt_uint32_t count);
|
||||
|
||||
int (*unlink) (struct dfs_filesystem* fs, const char* pathname);
|
||||
int (*stat) (struct dfs_filesystem* fs, const char* filename, struct stat* buf);
|
||||
int (*rename) (struct dfs_filesystem* fs, const char* oldpath, const char* newpath);
|
||||
int (*unlink) (struct dfs_filesystem *fs, const char *pathname);
|
||||
int (*stat) (struct dfs_filesystem *fs, const char *filename, struct stat *buf);
|
||||
int (*rename) (struct dfs_filesystem *fs, const char *oldpath, const char *newpath);
|
||||
};
|
||||
|
||||
/* Mounted file system */
|
||||
@@ -52,8 +53,8 @@ struct dfs_filesystem
|
||||
{
|
||||
rt_device_t dev_id; /* Attached device */
|
||||
|
||||
char* path; /* File system mount point */
|
||||
const struct dfs_filesystem_operation* ops; /* Operations for file system type */
|
||||
char *path; /* File system mount point */
|
||||
const struct dfs_filesystem_operation *ops; /* Operations for file system type */
|
||||
|
||||
void *data; /* Specific file system data */
|
||||
};
|
||||
@@ -67,23 +68,23 @@ struct dfs_partition
|
||||
rt_sem_t lock;
|
||||
};
|
||||
|
||||
int dfs_register(const struct dfs_filesystem_operation* ops);
|
||||
struct dfs_filesystem* dfs_filesystem_lookup(const char *path);
|
||||
rt_err_t dfs_filesystem_get_partition(struct dfs_partition* part, rt_uint8_t* buf, rt_uint32_t pindex);
|
||||
int dfs_register(const struct dfs_filesystem_operation *ops);
|
||||
struct dfs_filesystem *dfs_filesystem_lookup(const char *path);
|
||||
rt_err_t dfs_filesystem_get_partition(struct dfs_partition *part, rt_uint8_t *buf, rt_uint32_t pindex);
|
||||
|
||||
int dfs_mount(const char* device_name, const char* path,
|
||||
const char* filesystemtype, rt_uint32_t rwflag, const
|
||||
void* data);
|
||||
int dfs_mount(const char *device_name, const char *path,
|
||||
const char *filesystemtype, rt_uint32_t rwflag, const
|
||||
void *data);
|
||||
int dfs_unmount(const char *specialfile);
|
||||
|
||||
/* extern variable */
|
||||
extern const struct dfs_filesystem_operation* filesystem_operation_table[];
|
||||
extern const struct dfs_filesystem_operation *filesystem_operation_table[];
|
||||
extern struct dfs_filesystem filesystem_table[];
|
||||
|
||||
extern char working_directory[];
|
||||
|
||||
void dfs_lock(void);
|
||||
void dfs_unlock(void);
|
||||
int dfs_statfs(const char* path, struct statfs* buffer);
|
||||
int dfs_statfs(const char *path, struct statfs *buffer);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,26 +1,16 @@
|
||||
/*
|
||||
|
||||
+------------------------------------------------------------------------------
|
||||
|
||||
| Project : Device Filesystem
|
||||
|
||||
+------------------------------------------------------------------------------
|
||||
|
||||
| Copyright 2004, 2005 www.fayfayspace.org.
|
||||
|
||||
| All rights reserved.
|
||||
|
||||
|------------------------------------------------------------------------------
|
||||
|
||||
| File : dfs_init.h, the initilization definitions of Device FileSystem
|
||||
|------------------------------------------------------------------------------
|
||||
| Chang Logs:
|
||||
|
||||
| Date Author Notes
|
||||
|
||||
| 2005-02-21 ffxz The first version.
|
||||
+------------------------------------------------------------------------------
|
||||
*/
|
||||
* File : dfs_init.h
|
||||
* This file is part of Device File System in RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2004-2011, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2005-02-21 Bernard The first version.
|
||||
*/
|
||||
|
||||
#ifndef __DFS_INIT_H__
|
||||
#define __DFS_INIT_H__
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* File : dfs_def.h
|
||||
* This file is part of Device File System in RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2004-2010, RT-Thread Development Team
|
||||
* COPYRIGHT (C) 2004-2011, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
@@ -13,6 +13,7 @@
|
||||
* 2010-07-18 Bernard add stat and statfs structure definitions.
|
||||
* 2011-05-16 Yi.qiu Change parameter name of rename, "new" is C++ key word.
|
||||
*/
|
||||
|
||||
#ifndef __DFS_POSIX_H__
|
||||
#define __DFS_POSIX_H__
|
||||
|
||||
@@ -82,9 +83,9 @@ typedef struct
|
||||
} DIR;
|
||||
|
||||
/* directory api*/
|
||||
int mkdir (const char *path, mode_t mode);
|
||||
DIR* opendir(const char* name);
|
||||
struct dirent* readdir(DIR *d);
|
||||
int mkdir(const char *path, mode_t mode);
|
||||
DIR *opendir(const char *name);
|
||||
struct dirent *readdir(DIR *d);
|
||||
long telldir(DIR *d);
|
||||
void seekdir(DIR *d, off_t offset);
|
||||
void rewinddir(DIR *d);
|
||||
|
||||
Reference in New Issue
Block a user