kernel/util: Require passing a list_link to list_remove_link.

If something other than a list_link is passed, an explicit cast
will now be needed.

No functional change intended.
This commit is contained in:
Augustin Cavalier 2025-01-14 17:13:11 -05:00
parent 7d232f0cf8
commit 7331a67227
4 changed files with 4 additions and 6 deletions

View File

@ -54,7 +54,7 @@ extern void list_init(struct list *list);
extern void list_init_etc(struct list *list, int32 offset);
extern void list_add_link_to_head(struct list *list, void *_link);
extern void list_add_link_to_tail(struct list *list, void *_link);
extern void list_remove_link(void *_link);
extern void list_remove_link(struct list_link *_link);
extern void *list_get_next_item(struct list *list, void *item);
extern void *list_get_prev_item(struct list *list, void *item);
extern void *list_get_last_item(struct list *list);

View File

@ -339,7 +339,7 @@ NodeMonitorService::_RemoveListener(monitor_listener *listener)
// remove it from the listener and I/O context lists
monitor->listeners.Remove(listener);
list_remove_link(listener);
list_remove_link(&listener->context_link);
if (dynamic_cast<UserNodeListener*>(listener->listener) != NULL) {
// This is a listener we copied ourselves in UpdateUserListener(),

View File

@ -2604,7 +2604,7 @@ wait_for_thread_etc(thread_id id, uint32 flags, bigtime_t timeout,
// remove our death entry now.
thread = Thread::GetAndLock(id);
if (thread != NULL) {
list_remove_link(&death);
list_remove_link(&death.link);
thread->UnlockAndReleaseReference();
} else {
// The thread is already gone, so we need to wait uninterruptibly

View File

@ -81,10 +81,8 @@ list_add_link_to_tail(struct list *list, void *_link)
*/
void
list_remove_link(void *_link)
list_remove_link(list_link *link)
{
list_link *link = (list_link *)_link;
link->next->prev = link->prev;
link->prev->next = link->next;