Use rt_object_get_information to get object chain
This commit is contained in:
parent
2f409c85f1
commit
a3d96ed555
|
@ -164,15 +164,15 @@ rt_module_t rt_module_find(const char *name)
|
|||
struct rt_object *object;
|
||||
struct rt_list_node *node;
|
||||
|
||||
extern struct rt_object_information rt_object_container[];
|
||||
|
||||
RT_DEBUG_NOT_IN_INTERRUPT;
|
||||
|
||||
/* enter critical */
|
||||
rt_enter_critical();
|
||||
|
||||
/* try to find device object */
|
||||
information = &rt_object_container[RT_Object_Class_Module];
|
||||
information = rt_object_get_information(RT_Object_Class_Module);
|
||||
RT_ASSERT(information != RT_NULL);
|
||||
|
||||
for (node = information->object_list.next;
|
||||
node != &(information->object_list);
|
||||
node = node->next)
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue