[libc] Allow container_of() to be used on volatile pointers
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
parent
04ef198d2f
commit
ef0297b527
|
@ -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