From fbc2cc52c8a38c3c63a34f5547ba7c4209a667ac Mon Sep 17 00:00:00 2001 From: Aleksa Vuckovic Date: Thu, 2 Mar 2023 20:30:55 +0100 Subject: scheduling usermode processes & code refactoring --- kernel/include/containter_of.h | 20 -------------------- 1 file changed, 20 deletions(-) (limited to 'kernel/include/containter_of.h') diff --git a/kernel/include/containter_of.h b/kernel/include/containter_of.h index 9cadd91..9672988 100644 --- a/kernel/include/containter_of.h +++ b/kernel/include/containter_of.h @@ -5,7 +5,6 @@ #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr) #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) -#define typeof_member(T, m) typeof(((T *)0)->m) /** * container_of - cast a member of a structure out to the containing structure @@ -23,23 +22,4 @@ ((type *)(__mptr - offsetof(type, member))); \ }) -/** - * container_of_safe - cast a member of a structure out to the containing structure - * @ptr: the pointer to the member. - * @type: the type of the container struct this is embedded in. - * @member: the name of the member within the struct. - * - * If IS_ERR_OR_NULL(ptr), ptr is returned unchanged. - */ -#define container_of_safe(ptr, type, member) \ - ({ \ - void *__mptr = (void *)(ptr); \ - static_assert(__same_type(*(ptr), ((type *)0)->member) || \ - __same_type(*(ptr), void), \ - "pointer type mismatch in container_of_safe()"); \ - IS_ERR_OR_NULL(__mptr) ? \ - ERR_CAST(__mptr) : \ - ((type *)(__mptr - offsetof(type, member))); \ - }) - #endif -- cgit v1.2.3