mirror of https://github.com/ipxe/ipxe.git
[libc] Allow container_of() to be used on volatile pointers
Signed-off-by: Michael Brown <mcb30@ipxe.org>pull/51/head
parent
04ef198d2f
commit
ef0297b527
|
@ -34,7 +34,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|||
*/
|
||||
#define container_of( ptr, type, field ) ( { \
|
||||
type *__container; \
|
||||
const typeof ( __container->field ) *__field = (ptr); \
|
||||
const volatile typeof ( __container->field ) *__field = (ptr); \
|
||||
__container = ( ( ( void * ) __field ) - \
|
||||
offsetof ( type, field ) ); \
|
||||
__container; } )
|
||||
|
|
Loading…
Reference in New Issue