| 90 | } |
| 91 | |
| 92 | static rt_list_t *list_get_next(rt_list_t *current, list_get_next_t *arg) |
| 93 | { |
| 94 | int first_flag = 0; |
| 95 | rt_base_t level; |
| 96 | rt_list_t *node, *list; |
| 97 | rt_list_t **array; |
| 98 | struct rt_object_information *info; |
| 99 | int nr; |
| 100 | |
| 101 | arg->nr_out = 0; |
| 102 | |
| 103 | if (!arg->nr || !arg->type) |
| 104 | { |
| 105 | return (rt_list_t *)RT_NULL; |
| 106 | } |
| 107 | |
| 108 | list = arg->list; |
| 109 | info = rt_list_entry(list, struct rt_object_information, object_list); |
| 110 | |
| 111 | if (!current) /* find first */ |
| 112 | { |
| 113 | node = list; |
| 114 | first_flag = 1; |
| 115 | } |
| 116 | else |
| 117 | { |
| 118 | node = current; |
| 119 | } |
| 120 | |
| 121 | level = rt_spin_lock_irqsave(&info->spinlock); |
| 122 | |
| 123 | if (!first_flag) |
| 124 | { |
| 125 | struct rt_object *obj; |
| 126 | /* The node in the list? */ |
| 127 | obj = rt_list_entry(node, struct rt_object, list); |
| 128 | if ((obj->type & ~RT_Object_Class_Static) != arg->type) |
| 129 | { |
| 130 | rt_spin_unlock_irqrestore(&info->spinlock, level); |
| 131 | return (rt_list_t *)RT_NULL; |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | nr = 0; |
| 136 | array = arg->array; |
| 137 | while (1) |
| 138 | { |
| 139 | node = node->next; |
| 140 | |
| 141 | if (node == list) |
| 142 | { |
| 143 | node = (rt_list_t *)RT_NULL; |
| 144 | break; |
| 145 | } |
| 146 | nr++; |
| 147 | *array++ = node; |
| 148 | if (nr == arg->nr) |
| 149 | { |
no test coverage detected