1// Automatically generated. Do not modify. 2// 3// © 2021 Qualcomm Innovation Center, Inc. All rights reserved. 4// 5// SPDX-License-Identifier: BSD-3-Clause 6 7// The container_of macros for the tagged types 8 9#for $d in $definitions 10#if $d.is_container 11#set outer_type = d.type_name + '_t' 12#for $name, $type, $offset in $d.layout 13#if $type.is_contained 14static inline ${outer_type} * 15${d.type_name}_container_of_${name}(${type.pointer.gen_declaration('ptr')}) { 16 _Static_assert(offsetof(${outer_type}, ${name}) == $offset, 17 "Generated offset for ${name} in ${outer_type} is incorrect"); 18 return ((${outer_type} *)((uintptr_t)(ptr) - $offset)); 19} 20#end if 21#end for 22#end if 23 24#end for 25