mirror of
https://github.com/ipxe/ipxe
synced 2025-12-24 15:23:42 +03:00
[libc] Allow container_of() to be used on volatile pointers
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -34,7 +34,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|||||||
*/
|
*/
|
||||||
#define container_of( ptr, type, field ) ( { \
|
#define container_of( ptr, type, field ) ( { \
|
||||||
type *__container; \
|
type *__container; \
|
||||||
const typeof ( __container->field ) *__field = (ptr); \
|
const volatile typeof ( __container->field ) *__field = (ptr); \
|
||||||
__container = ( ( ( void * ) __field ) - \
|
__container = ( ( ( void * ) __field ) - \
|
||||||
offsetof ( type, field ) ); \
|
offsetof ( type, field ) ); \
|
||||||
__container; } )
|
__container; } )
|
||||||
|
|||||||
Reference in New Issue
Block a user