Re: [PATCH v4] module: replace module_layout with module_memory

From
Peter Zijlstra <peterz@infradead.org>
Date
2023-01-31 11:15:24
Also in
lkml
Reply to
Song Liu, 2023-01-30
On Mon, Jan 30, 2023 at 10:21:09AM -0800, Song Liu wrote:
quoted hunk ↗ jump to hunk
+#define for_each_mod_mem_type(type)	\
+	for ((type) = MOD_TEXT;	\
+	     (type) < MOD_MEM_NUM_TYPES; (type)++)
 
+#define for_core_mod_mem_type(type)		\
+	for ((type) = MOD_TEXT;		\
+	     (type) < MOD_INIT_TEXT; (type)++)
+
+#define for_init_mod_mem_type(type)		\
+	for ((type) = MOD_INIT_TEXT;		\
+	     (type) < MOD_MEM_NUM_TYPES; (type)++)
#define __for_each_mod_mem_types(type, _from, _to)	\
	for (enum mod_mem_type type = _from; type <= _to; type++;)

also to be used in the previously suggested within_module_mem_types()
function.

also note the C99 variable in for-loop decl thing

#define for_code_mod_mem_type(type)			\
	__for_each_mod_mem_types(type, MOD_TEXT, MOD_RO_AFTER_INIT)

#define for_code_mod_mem_type(type)			\
	__for_each_mod_mem_types(type, MOD_INIT_TEXT, MOD_INIT_RODATA)


Thread (12 messages) 12 messages, 5 authors, last reply 2023-02-01
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help