delete the re-defined rt_list_entry(node, type, member) and format the code in devfs.c
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2211 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
961a6a51c9
commit
4b0e272644
|
@ -4,10 +4,6 @@
|
|||
|
||||
#include "devfs.h"
|
||||
|
||||
/* introduce from kservice.c */
|
||||
#define rt_list_entry(node, type, member) \
|
||||
((type *)((char *)(node) - (unsigned long)(&((type *)0)->member)))
|
||||
|
||||
struct device_dirent
|
||||
{
|
||||
rt_device_t *devices;
|
||||
|
@ -103,6 +99,7 @@ int dfs_device_fs_close(struct dfs_fd* file)
|
|||
if (result == RT_EOK)
|
||||
{
|
||||
file->data = RT_NULL;
|
||||
|
||||
return DFS_STATUS_OK;
|
||||
}
|
||||
|
||||
|
@ -113,7 +110,8 @@ int dfs_device_fs_open(struct dfs_fd* file)
|
|||
{
|
||||
rt_device_t device;
|
||||
|
||||
if (file->flags & DFS_O_CREAT) return -DFS_STATUS_EINVAL;
|
||||
if (file->flags & DFS_O_CREAT)
|
||||
return -DFS_STATUS_EINVAL;
|
||||
|
||||
/* open root directory */
|
||||
if ((file->path[0] == '/') && (file->path[1] == '\0') &&
|
||||
|
@ -157,6 +155,7 @@ int dfs_device_fs_open(struct dfs_fd* file)
|
|||
|
||||
/* set data */
|
||||
file->data = root_dirent;
|
||||
|
||||
return DFS_STATUS_OK;
|
||||
}
|
||||
|
||||
|
@ -165,6 +164,7 @@ int dfs_device_fs_open(struct dfs_fd* file)
|
|||
return -DFS_STATUS_ENODEV;
|
||||
|
||||
file->data = device;
|
||||
|
||||
return DFS_STATUS_OK;
|
||||
}
|
||||
|
||||
|
@ -183,6 +183,7 @@ int dfs_device_fs_stat(struct dfs_filesystem* fs, const char *path, struct stat
|
|||
st->st_size = 0;
|
||||
st->st_mtime = 0;
|
||||
st->st_blksize = 512;
|
||||
|
||||
return DFS_STATUS_OK;
|
||||
}
|
||||
else
|
||||
|
@ -207,6 +208,7 @@ int dfs_device_fs_stat(struct dfs_filesystem* fs, const char *path, struct stat
|
|||
st->st_size = 0;
|
||||
st->st_mtime = 0;
|
||||
st->st_blksize = 512;
|
||||
|
||||
return DFS_STATUS_OK;
|
||||
}
|
||||
}
|
||||
|
@ -226,7 +228,8 @@ int dfs_device_fs_getdents(struct dfs_fd* file, struct dirent* dirp, rt_uint32_t
|
|||
|
||||
/* make integer count */
|
||||
count = (count / sizeof(struct dirent));
|
||||
if ( count == 0 ) return -DFS_STATUS_EINVAL;
|
||||
if (count == 0)
|
||||
return -DFS_STATUS_EINVAL;
|
||||
|
||||
for (index = 0; index < count && index + root_dirent->read_index < root_dirent->device_count;
|
||||
index ++)
|
||||
|
|
|
@ -11,10 +11,6 @@
|
|||
#include "netif/ethernetif.h"
|
||||
#include "netif/etharp.h"
|
||||
|
||||
/* introduce from kservice.c */
|
||||
#define rt_list_entry(node, type, member) \
|
||||
((type *)((char *)(node) - (unsigned long)(&((type *)0)->member)))
|
||||
|
||||
static err_t netif_device_init(struct netif *netif)
|
||||
{
|
||||
struct eth_device *ethif;
|
||||
|
|
|
@ -12,10 +12,6 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
/* introduce from kservice.c */
|
||||
#define rt_list_entry(node, type, member) \
|
||||
((type *)((char *)(node) - (unsigned long)(&((type *)0)->member)))
|
||||
|
||||
static err_t netif_device_init(struct netif *netif)
|
||||
{
|
||||
struct eth_device *ethif;
|
||||
|
|
Loading…
Reference in New Issue