提交 6d9fcd04 编写于 作者: B bernard

[Kernel] Change the order of initialization.

1. Remove INIT_FS_EXPORT and change INIT_DEVICE_EXPORT as the first item
in the initalization thread.
2. Move the eth_system_device_init into INIT_PREV_EXPORT item.
上级 f08d1f50
...@@ -820,7 +820,7 @@ int elm_init(void) ...@@ -820,7 +820,7 @@ int elm_init(void)
return 0; return 0;
} }
INIT_FS_EXPORT(elm_init); INIT_COMPONENT_EXPORT(elm_init);
/* /*
* RT-Thread Device Interface for ELM FatFs * RT-Thread Device Interface for ELM FatFs
......
...@@ -726,5 +726,5 @@ int dfs_jffs2_init(void) ...@@ -726,5 +726,5 @@ int dfs_jffs2_init(void)
rt_kprintf("init jffs2 lock mutex okay\n"); rt_kprintf("init jffs2 lock mutex okay\n");
return 0; return 0;
} }
INIT_FS_EXPORT(dfs_jffs2_init); INIT_COMPONENT_EXPORT(dfs_jffs2_init);
...@@ -1159,4 +1159,5 @@ int nfs_init(void) ...@@ -1159,4 +1159,5 @@ int nfs_init(void)
return RT_EOK; return RT_EOK;
} }
INIT_FS_EXPORT(nfs_init); INIT_COMPONENT_EXPORT(nfs_init);
...@@ -427,7 +427,7 @@ int dfs_ramfs_init(void) ...@@ -427,7 +427,7 @@ int dfs_ramfs_init(void)
return 0; return 0;
} }
INIT_FS_EXPORT(dfs_ramfs_init); INIT_COMPONENT_EXPORT(dfs_ramfs_init);
struct dfs_ramfs* dfs_ramfs_create(rt_uint8_t *pool, rt_size_t size) struct dfs_ramfs* dfs_ramfs_create(rt_uint8_t *pool, rt_size_t size)
{ {
......
...@@ -330,5 +330,5 @@ int dfs_romfs_init(void) ...@@ -330,5 +330,5 @@ int dfs_romfs_init(void)
dfs_register(&_romfs); dfs_register(&_romfs);
return 0; return 0;
} }
INIT_FS_EXPORT(dfs_romfs_init); INIT_COMPONENT_EXPORT(dfs_romfs_init);
...@@ -24,22 +24,23 @@ ...@@ -24,22 +24,23 @@
#include <rtthread.h> #include <rtthread.h>
#include <dfs.h> #include <dfs.h>
#include <dfs_fs.h> #include <dfs_fs.h>
#include <dfs_file.h>
#include "dfs_skt_fs.h" #include "dfs_skt_fs.h"
int dfs_skt_mount(struct dfs_filesystem* fs, unsigned long rwflag, const void* data) int dfs_skt_mount(struct dfs_filesystem* fs, unsigned long rwflag, const void* data)
{ {
return DFS_STATUS_OK; return RT_EOK;
} }
int dfs_skt_unmount(struct dfs_filesystem* fs) int dfs_skt_unmount(struct dfs_filesystem* fs)
{ {
return DFS_STATUS_OK; return RT_EOK;
} }
int dfs_skt_ioctl(struct dfs_fd* file, int cmd, void* args) int dfs_skt_ioctl(struct dfs_fd* file, int cmd, void* args)
{ {
return -DFS_STATUS_EIO; return -RT_EIO;
} }
int dfs_skt_read(struct dfs_fd* file, void *buf, rt_size_t count) int dfs_skt_read(struct dfs_fd* file, void *buf, rt_size_t count)
...@@ -49,22 +50,22 @@ int dfs_skt_read(struct dfs_fd* file, void *buf, rt_size_t count) ...@@ -49,22 +50,22 @@ int dfs_skt_read(struct dfs_fd* file, void *buf, rt_size_t count)
int dfs_skt_lseek(struct dfs_fd* file, rt_off_t offset) int dfs_skt_lseek(struct dfs_fd* file, rt_off_t offset)
{ {
return -DFS_STATUS_EIO; return -RT_EIO;
} }
int dfs_skt_close(struct dfs_fd* file) int dfs_skt_close(struct dfs_fd* file)
{ {
return DFS_STATUS_OK; return RT_EOK;
} }
int dfs_skt_open(struct dfs_fd* file) int dfs_skt_open(struct dfs_fd* file)
{ {
return DFS_STATUS_OK; return RT_EOK;
} }
int dfs_skt_stat(struct dfs_filesystem* fs, const char *path, struct stat *st) int dfs_skt_stat(struct dfs_filesystem* fs, const char *path, struct stat *st)
{ {
return DFS_STATUS_OK; return RT_EOK;
} }
int dfs_skt_getdents(struct dfs_fd* file, struct dirent* dirp, rt_uint32_t count) int dfs_skt_getdents(struct dfs_fd* file, struct dirent* dirp, rt_uint32_t count)
...@@ -72,26 +73,32 @@ int dfs_skt_getdents(struct dfs_fd* file, struct dirent* dirp, rt_uint32_t count ...@@ -72,26 +73,32 @@ int dfs_skt_getdents(struct dfs_fd* file, struct dirent* dirp, rt_uint32_t count
return count * sizeof(struct dirent); return count * sizeof(struct dirent);
} }
static const struct dfs_filesystem_operation _skt_fs = static const struct dfs_file_ops _skt_fops =
{ {
"skt",
DFS_FS_FLAG_DEFAULT,
dfs_skt_mount,
dfs_skt_unmount,
RT_NULL,
RT_NULL,
dfs_skt_open, dfs_skt_open,
dfs_skt_close, dfs_skt_close,
dfs_skt_ioctl, dfs_skt_ioctl,
dfs_skt_read, dfs_skt_read,
RT_NULL, NULL, /* write */
RT_NULL, NULL, /* flush */
dfs_skt_lseek, dfs_skt_lseek,
dfs_skt_getdents, dfs_skt_getdents,
RT_NULL, };
static const struct dfs_filesystem_ops _skt_fs =
{
"skt",
DFS_FS_FLAG_DEFAULT,
&_skt_fops,
dfs_skt_mount,
dfs_skt_unmount,
NULL, /* mkfs */
NULL, /* statfs */
NULL, /* unlink */
dfs_skt_stat, dfs_skt_stat,
RT_NULL, NULL, /* rename */
}; };
int dfs_skt_init(void) int dfs_skt_init(void)
...@@ -100,4 +107,5 @@ int dfs_skt_init(void) ...@@ -100,4 +107,5 @@ int dfs_skt_init(void)
dfs_register(&_skt_fs); dfs_register(&_skt_fs);
return 0; return 0;
} }
INIT_FS_EXPORT(dfs_skt_init); INIT_COMPONENT_EXPORT(dfs_skt_init);
...@@ -668,5 +668,5 @@ int dfs_uffs_init(void) ...@@ -668,5 +668,5 @@ int dfs_uffs_init(void)
} }
return -RT_ERROR; return -RT_ERROR;
} }
INIT_FS_EXPORT(dfs_uffs_init); INIT_COMPONENT_EXPORT(dfs_uffs_init);
...@@ -434,9 +434,9 @@ int eth_system_device_init(void) ...@@ -434,9 +434,9 @@ int eth_system_device_init(void)
RT_ASSERT(result == RT_EOK); RT_ASSERT(result == RT_EOK);
#endif #endif
return (int)result; return (int)result;
} }
INIT_DEVICE_EXPORT(eth_system_device_init); INIT_PREV_EXPORT(eth_system_device_init);
#ifdef RT_USING_FINSH #ifdef RT_USING_FINSH
#include <finsh.h> #include <finsh.h>
......
...@@ -452,7 +452,7 @@ int eth_system_device_init(void) ...@@ -452,7 +452,7 @@ int eth_system_device_init(void)
return (int)result; return (int)result;
} }
INIT_DEVICE_EXPORT(eth_system_device_init); INIT_PREV_EXPORT(eth_system_device_init);
#ifdef RT_USING_FINSH #ifdef RT_USING_FINSH
#include <finsh.h> #include <finsh.h>
......
...@@ -199,15 +199,14 @@ typedef int (*init_fn_t)(void); ...@@ -199,15 +199,14 @@ typedef int (*init_fn_t)(void);
/* board init routines will be called in board_init() function */ /* board init routines will be called in board_init() function */
#define INIT_BOARD_EXPORT(fn) INIT_EXPORT(fn, "1") #define INIT_BOARD_EXPORT(fn) INIT_EXPORT(fn, "1")
/* device/component/fs/app init routines will be called in init_thread */
/* device initialization */ /* pre/device/component/env/app init routines will be called in init_thread */
#define INIT_DEVICE_EXPORT(fn) INIT_EXPORT(fn, "2")
/* components pre-initialization (pure software initilization) */ /* components pre-initialization (pure software initilization) */
#define INIT_PREV_EXPORT(fn) INIT_EXPORT(fn, "2") #define INIT_PREV_EXPORT(fn) INIT_EXPORT(fn, "2")
/* device initialization */
#define INIT_DEVICE_EXPORT(fn) INIT_EXPORT(fn, "3")
/* components initialization (dfs, lwip, ...) */ /* components initialization (dfs, lwip, ...) */
#define INIT_COMPONENT_EXPORT(fn) INIT_EXPORT(fn, "3") #define INIT_COMPONENT_EXPORT(fn) INIT_EXPORT(fn, "4")
/* file system initialization (dfs-elm, dfs-rom, ...) */
#define INIT_FS_EXPORT(fn) INIT_EXPORT(fn, "4")
/* environment initialization (mount disk, ...) */ /* environment initialization (mount disk, ...) */
#define INIT_ENV_EXPORT(fn) INIT_EXPORT(fn, "5") #define INIT_ENV_EXPORT(fn) INIT_EXPORT(fn, "5")
/* appliation initialization (rtgui application etc ...) */ /* appliation initialization (rtgui application etc ...) */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册