diff options
| author | Bernard Xiong <[email protected]> | 2017-12-13 14:14:40 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2017-12-13 14:14:40 +0800 |
| commit | 6962bd1f1e3a7e3197170c74e4909035e7fb3255 (patch) | |
| tree | 0fdcac7ad204b43d006b2d78348ab74a03efb56a /components | |
| parent | f4353bec2f07aaa00b9d958724ae649b0734f3c4 (diff) | |
| parent | 37b8532216879f08d3d7a4ca5b351eecb053b830 (diff) | |
Merge pull request #1101 from BernardXiong/master
[Kernel] Use rt_object_get_information to get object chain
Diffstat (limited to 'components')
| -rw-r--r-- | components/dfs/filesystems/devfs/devfs.c | 5 | ||||
| -rw-r--r-- | components/dfs/src/dfs.c | 3 | ||||
| -rw-r--r-- | components/finsh/cmd.c | 58 | ||||
| -rw-r--r-- | components/net/Kconfig | 27 | ||||
| -rw-r--r-- | components/net/lwip-1.3.2/src/arch/sys_arch_init.c | 6 | ||||
| -rw-r--r-- | components/net/lwip-1.4.1/src/arch/sys_arch.c | 5 | ||||
| -rw-r--r-- | components/net/lwip-2.0.2/src/arch/sys_arch.c | 5 |
7 files changed, 71 insertions, 38 deletions
diff --git a/components/dfs/filesystems/devfs/devfs.c b/components/dfs/filesystems/devfs/devfs.c index 6bfeccb578..4f2f0ebcd9 100644 --- a/components/dfs/filesystems/devfs/devfs.c +++ b/components/dfs/filesystems/devfs/devfs.c @@ -150,13 +150,12 @@ int dfs_device_fs_open(struct dfs_fd *file) struct device_dirent *root_dirent; rt_uint32_t count = 0; - extern struct rt_object_information rt_object_container[]; - /* lock scheduler */ rt_enter_critical(); /* traverse device object */ - information = &rt_object_container[RT_Object_Class_Device]; + information = rt_object_get_information(RT_Object_Class_Device); + RT_ASSERT(information != RT_NULL); for (node = information->object_list.next; node != &(information->object_list); node = node->next) { count ++; diff --git a/components/dfs/src/dfs.c b/components/dfs/src/dfs.c index 97e9ae5b22..51aa777484 100644 --- a/components/dfs/src/dfs.c +++ b/components/dfs/src/dfs.c @@ -20,6 +20,7 @@ * Change Logs: * Date Author Notes * 2005-02-22 Bernard The first version. + * 2017-12-11 Bernard Use rt_free to instead of free in fd_is_open(). */ #include <dfs.h> @@ -219,7 +220,7 @@ int fd_is_open(const char *pathname) if (fs == NULL) { /* can't find mounted file system */ - free(fullpath); + rt_free(fullpath); return -1; } diff --git a/components/finsh/cmd.c b/components/finsh/cmd.c index 995ec2a109..9cd292d570 100644 --- a/components/finsh/cmd.c +++ b/components/finsh/cmd.c @@ -67,8 +67,6 @@ long version(void) FINSH_FUNCTION_EXPORT(version, show RT-Thread version information); MSH_CMD_EXPORT(version, show RT-Thread version information); -extern struct rt_object_information rt_object_container[]; - static int object_name_maxlen(struct rt_list_node *list) { struct rt_list_node *node; @@ -135,7 +133,10 @@ static long _list_thread(struct rt_list_node *list) long list_thread(void) { - return _list_thread(&rt_object_container[RT_Object_Class_Thread].object_list); + struct rt_object_information *info; + + info = rt_object_get_information(RT_Object_Class_Thread); + return _list_thread(&info->object_list); } FINSH_FUNCTION_EXPORT(list_thread, list thread); MSH_CMD_EXPORT(list_thread, list thread); @@ -195,7 +196,11 @@ static long _list_sem(struct rt_list_node *list) long list_sem(void) { - return _list_sem(&rt_object_container[RT_Object_Class_Semaphore].object_list); + struct rt_object_information *info; + + info = rt_object_get_information(RT_Object_Class_Semaphore); + + return _list_sem(&info->object_list); } FINSH_FUNCTION_EXPORT(list_sem, list semaphone in system); MSH_CMD_EXPORT(list_sem, list semaphore in system); @@ -237,7 +242,10 @@ static long _list_event(struct rt_list_node *list) long list_event(void) { - return _list_event(&rt_object_container[RT_Object_Class_Event].object_list); + struct rt_object_information *info; + + info = rt_object_get_information(RT_Object_Class_Event); + return _list_event(&info->object_list); } FINSH_FUNCTION_EXPORT(list_event, list event in system); MSH_CMD_EXPORT(list_event, list event in system); @@ -270,7 +278,11 @@ static long _list_mutex(struct rt_list_node *list) long list_mutex(void) { - return _list_mutex(&rt_object_container[RT_Object_Class_Mutex].object_list); + struct rt_object_information *info; + + info = rt_object_get_information(RT_Object_Class_Mutex); + + return _list_mutex(&info->object_list); } FINSH_FUNCTION_EXPORT(list_mutex, list mutex in system); MSH_CMD_EXPORT(list_mutex, list mutex in system); @@ -321,7 +333,10 @@ static long _list_mailbox(struct rt_list_node *list) long list_mailbox(void) { - return _list_mailbox(&rt_object_container[RT_Object_Class_MailBox].object_list); + struct rt_object_information *info; + + info = rt_object_get_information(RT_Object_Class_MailBox); + return _list_mailbox(&info->object_list); } FINSH_FUNCTION_EXPORT(list_mailbox, list mail box in system); MSH_CMD_EXPORT(list_mailbox, list mail box in system); @@ -370,7 +385,10 @@ static long _list_msgqueue(struct rt_list_node *list) long list_msgqueue(void) { - return _list_msgqueue(&rt_object_container[RT_Object_Class_MessageQueue].object_list); + struct rt_object_information *info; + + info = rt_object_get_information(RT_Object_Class_MessageQueue); + return _list_msgqueue(&info->object_list); } FINSH_FUNCTION_EXPORT(list_msgqueue, list message queue in system); MSH_CMD_EXPORT(list_msgqueue, list message queue in system); @@ -404,7 +422,10 @@ static long _list_memheap(struct rt_list_node *list) long list_memheap(void) { - return _list_memheap(&rt_object_container[RT_Object_Class_MemHeap].object_list); + struct rt_object_information *info; + + info = rt_object_get_information(RT_Object_Class_MemHeap); + return _list_memheap(&info->object_list); } FINSH_FUNCTION_EXPORT(list_memheap, list memory heap in system); MSH_CMD_EXPORT(list_memheap, list memory heap in system); @@ -453,7 +474,10 @@ static long _list_mempool(struct rt_list_node *list) long list_mempool(void) { - return _list_mempool(&rt_object_container[RT_Object_Class_MemPool].object_list); + struct rt_object_information *info; + + info = rt_object_get_information(RT_Object_Class_MemPool); + return _list_mempool(&info->object_list); } FINSH_FUNCTION_EXPORT(list_mempool, list memory pool in system) MSH_CMD_EXPORT(list_mempool, list memory pool in system); @@ -490,7 +514,10 @@ static long _list_timer(struct rt_list_node *list) long list_timer(void) { - return _list_timer(&rt_object_container[RT_Object_Class_Timer].object_list); + struct rt_object_information *info; + + info = rt_object_get_information(RT_Object_Class_Timer); + return _list_timer(&info->object_list); } FINSH_FUNCTION_EXPORT(list_timer, list timer in system); MSH_CMD_EXPORT(list_timer, list timer in system); @@ -550,7 +577,10 @@ static long _list_device(struct rt_list_node *list) long list_device(void) { - return _list_device(&rt_object_container[RT_Object_Class_Device].object_list); + struct rt_object_information *info; + + info = rt_object_get_information(RT_Object_Class_Device); + return _list_device(&info->object_list); } FINSH_FUNCTION_EXPORT(list_device, list device in system); MSH_CMD_EXPORT(list_device, list device in system); @@ -564,8 +594,10 @@ int list_module(void) int maxlen; struct rt_module *module; struct rt_list_node *list, *node; + struct rt_object_information *info; - list = &rt_object_container[RT_Object_Class_Module].object_list; + info = rt_object_get_information(RT_Object_Class_Module); + list = &info->object_list; maxlen = object_name_maxlen(list); diff --git a/components/net/Kconfig b/components/net/Kconfig index f86e7416eb..af375e6c03 100644 --- a/components/net/Kconfig +++ b/components/net/Kconfig @@ -55,10 +55,6 @@ config RT_USING_LWIP config IP_SOF_BROADCAST_RECV int "SOF broadcast recv" default 1 - - config LWIP_USING_DHCPD - bool "Enable DHCP server" - default n endif menu "Static IPv4 Address" @@ -91,14 +87,16 @@ config RT_USING_LWIP bool "PPP protocol" default n - config RT_LWIP_PPPOE - bool "PPPoE protocol" - default n - - config RT_LWIP_PPPOS - bool "PPPoS protocol" - default n - + if RT_LWIP_PPP + config RT_LWIP_PPPOE + bool "PPPoE protocol" + default n + + config RT_LWIP_PPPOS + bool "PPPoS protocol" + default n + endif + config RT_MEMP_NUM_NETCONN int "the number of struct netconns" default 8 @@ -187,6 +185,11 @@ endmenu source "$RTT_DIR/components/net/freemodbus/Kconfig" if RT_USING_LWIP + +config LWIP_USING_DHCPD + bool "Enable DHCP server" + default n + config RT_USING_NETUTILS bool "Enable net utils" default n diff --git a/components/net/lwip-1.3.2/src/arch/sys_arch_init.c b/components/net/lwip-1.3.2/src/arch/sys_arch_init.c index 73aa34171c..f70de7cc0a 100644 --- a/components/net/lwip-1.3.2/src/arch/sys_arch_init.c +++ b/components/net/lwip-1.3.2/src/arch/sys_arch_init.c @@ -41,8 +41,6 @@ static void tcpip_init_done_callback(void *arg) struct rt_object* object; struct rt_object_information *information; - extern struct rt_object_information rt_object_container[]; - LWIP_ASSERT("invalid arg.\n",arg); IP4_ADDR(&gw, 0,0,0,0); @@ -53,7 +51,9 @@ static void tcpip_init_done_callback(void *arg) rt_enter_critical(); /* for each network interfaces */ - information = &rt_object_container[RT_Object_Class_Device]; + information = rt_object_get_information(RT_Object_Class_Device); + RT_ASSERT(information != RT_NULL); + for (node = information->object_list.next; node != &(information->object_list); node = node->next) { object = rt_list_entry(node, struct rt_object, list); diff --git a/components/net/lwip-1.4.1/src/arch/sys_arch.c b/components/net/lwip-1.4.1/src/arch/sys_arch.c index 3ae6360198..d480242cd0 100644 --- a/components/net/lwip-1.4.1/src/arch/sys_arch.c +++ b/components/net/lwip-1.4.1/src/arch/sys_arch.c @@ -72,8 +72,6 @@ static void tcpip_init_done_callback(void *arg) struct rt_object* object; struct rt_object_information *information; - extern struct rt_object_information rt_object_container[]; - LWIP_ASSERT("invalid arg.\n",arg); IP4_ADDR(&gw, 0,0,0,0); @@ -84,7 +82,8 @@ static void tcpip_init_done_callback(void *arg) rt_enter_critical(); /* for each network interfaces */ - information = &rt_object_container[RT_Object_Class_Device]; + information = rt_object_get_information(RT_Object_Class_Device); + RT_ASSERT(information != RT_NULL); for (node = information->object_list.next; node != &(information->object_list); node = node->next) diff --git a/components/net/lwip-2.0.2/src/arch/sys_arch.c b/components/net/lwip-2.0.2/src/arch/sys_arch.c index 06198d5191..c8e1fe1d33 100644 --- a/components/net/lwip-2.0.2/src/arch/sys_arch.c +++ b/components/net/lwip-2.0.2/src/arch/sys_arch.c @@ -74,8 +74,6 @@ static void tcpip_init_done_callback(void *arg) struct rt_object* object; struct rt_object_information *information; - extern struct rt_object_information rt_object_container[]; - LWIP_ASSERT("invalid arg.\n",arg); IP4_ADDR(&gw, 0,0,0,0); @@ -86,7 +84,8 @@ static void tcpip_init_done_callback(void *arg) rt_enter_critical(); /* for each network interfaces */ - information = &rt_object_container[RT_Object_Class_Device]; + information = rt_object_get_information(RT_Object_Class_Device); + RT_ASSERT(information != RT_NULL); for (node = information->object_list.next; node != &(information->object_list); node = node->next) |
