瀏覽代碼

[libc] Allow container_of() to be used on volatile pointers

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 9 年之前
父節點
當前提交
ef0297b527
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1
    1
      src/include/stddef.h

+ 1
- 1
src/include/stddef.h 查看文件

34
  */
34
  */
35
 #define container_of( ptr, type, field ) ( {				\
35
 #define container_of( ptr, type, field ) ( {				\
36
 	type *__container;						\
36
 	type *__container;						\
37
-	const typeof ( __container->field ) *__field = (ptr);		\
37
+	const volatile typeof ( __container->field ) *__field = (ptr);	\
38
 	__container = ( ( ( void * ) __field ) -			\
38
 	__container = ( ( ( void * ) __field ) -			\
39
 			offsetof ( type, field ) );			\
39
 			offsetof ( type, field ) );			\
40
 	__container; } )
40
 	__container; } )

Loading…
取消
儲存