* [PATCH][RFC][REPOST] __init_msg(x) and friends macro
@ 2001-05-28 11:58 pazke
2001-05-28 15:31 ` Martin Mares
0 siblings, 1 reply; 2+ messages in thread
From: pazke @ 2001-05-28 11:58 UTC (permalink / raw)
To: linux-kernel
[-- Attachment #1.1: Type: text/plain, Size: 723 bytes --]
Hi all,
soryy for such ugly subject line, but I already sent this patch
to LKML and didn't get any reply.
Patch adds __init_msg (and friends) macro that places its argument
(string constant) into corresponding .data.init section and returns
pointer to it. The goal of this patch is to allow constructions like this:
static void __init foo(void)
{
printk(__init_msg(KERN_INFO "Some random long message "
"going to .data.init and then to bit bucket\n"));
}
I hope this patch can save some memory and will be usefull :))
Best regards.
--
Andrey Panin | Embedded systems software engineer
pazke@orbita1.ru | PGP key: http://www.orbita1.ru/~pazke/AndreyPanin.asc
[-- Attachment #1.2: patch-__init_msg --]
[-- Type: text/plain, Size: 590 bytes --]
diff -ur linux.vanilla/include/linux/init.h linux/include/linux/init.h
--- linux.vanilla/include/linux/init.h Mon May 14 15:51:20 2001
+++ linux/include/linux/init.h Mon May 14 15:54:05 2001
@@ -155,4 +155,9 @@
#define __devexitdata __exitdata
#endif
+#define __init_msg(x) ({ static char msg[] __initdata = (x); msg; })
+#define __exit_msg(x) ({ static char msg[] __exitdata = (x); msg; })
+#define __devinit_msg(x) ({ static char msg[] __devinitdata = (x); msg; })
+#define __devexit_msg(x) ({ static char msg[] __devexitdata = (x); msg; })
+
#endif /* _LINUX_INIT_H */
[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH][RFC][REPOST] __init_msg(x) and friends macro
2001-05-28 11:58 [PATCH][RFC][REPOST] __init_msg(x) and friends macro pazke
@ 2001-05-28 15:31 ` Martin Mares
0 siblings, 0 replies; 2+ messages in thread
From: Martin Mares @ 2001-05-28 15:31 UTC (permalink / raw)
To: pazke; +Cc: linux-kernel
Hi!
> Patch adds __init_msg (and friends) macro that places its argument
> (string constant) into corresponding .data.init section and returns
> pointer to it. The goal of this patch is to allow constructions like this:
>
> static void __init foo(void)
> {
> printk(__init_msg(KERN_INFO "Some random long message "
> "going to .data.init and then to bit bucket\n"));
> }
>
> I hope this patch can save some memory and will be usefull :))
I think it's better to teach GCC understanding another function attribute
defining the default section of all read-only data defined in the function.
Have a nice fortnight
--
Martin `MJ' Mares <mj@ucw.cz> <mj@suse.cz> http://atrey.karlin.mff.cuni.cz/~mj/
Even nostalgia isn't what it used to be.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2001-05-28 15:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-05-28 11:58 [PATCH][RFC][REPOST] __init_msg(x) and friends macro pazke
2001-05-28 15:31 ` Martin Mares
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.