Interesting. Fine control of memory allocation strategies is harder to
achieve in C than it seems! In the example, I declared no statics,
and I thought that therefore the allocation of the temporary
constructor expression would come from the stack (causing me to
cringe and wait for the crash ..).
I'll repeat the code section, just to make it clear ...
init_module() {
FOO *foo;
....
foo = kmalloc(lots...);
__memcpy(foo,(FOO[]){ // use of constructor expression
...
{ 3, "holidays" },
...
},
many);
So, no win, no lose. I might have tried next
foo[0] = ..;
foo[1] = ..;
....
But that will expand the code section by a few hundred instructions!
Nevertheless, I'll try it.
Peter
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/