[kernel] add rt_object_get_type() function who return type of object without static flag

This commit is contained in:
liang yongxiang 2018-07-11 11:45:37 +08:00
parent c5ed45237e
commit 7b984c2f54
2 changed files with 17 additions and 0 deletions

View File

@ -62,6 +62,7 @@ rt_object_t rt_object_allocate(enum rt_object_class_type type,
const char *name);
void rt_object_delete(rt_object_t object);
rt_bool_t rt_object_is_systemobject(rt_object_t object);
rt_uint8_t rt_object_get_type(rt_object_t object);
rt_object_t rt_object_find(const char *name, rt_uint8_t type);
#ifdef RT_USING_HOOK

View File

@ -418,6 +418,22 @@ rt_bool_t rt_object_is_systemobject(rt_object_t object)
return RT_FALSE;
}
/**
* This function will return the type of object without
* RT_Object_Class_Static flag.
*
* @param object the specified object to be get type.
*
* @return the type of object.
*/
rt_uint8_t rt_object_get_type(rt_object_t object)
{
/* object check */
RT_ASSERT(object != RT_NULL);
return object->type & ~RT_Object_Class_Static;
}
/**
* This function will find specified name object from object
* container.