From: Cyrill Gorcunov <gorcunov@gmail.com>
To: Andi Kleen <andi@firstfloor.org>,
David Miller <davem@davemloft.net>,
"H. Peter Anvin" <hpa@zytor.com>,
Alexander Viro <aviro@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>,
Andrew Morton <akpm@linux-foundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [RFC] init: introduce boot param alias
Date: Sun, 3 Aug 2008 18:22:51 +0400 [thread overview]
Message-ID: <20080803142251.GA16487@lenovo> (raw)
By introducing the macroses __setup_alias and early_param_alias
we are allowed to use boot param aliases.
Here is an example:
static int __init parse_func(char *arg)
{
/* set some flag or do something */
return 0;
}
early_param("param1", parse_func);
early_param_alias("param1-alias", parse_func);
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
I found it usefull while was looking for APIC code merging.
Please review! Any comments are _quite_welcome_!!!
I use __LINE__ macro to define salt for names. Not sure
if this is really that good way to produce unique names.
But anyway i think it's better then define different functions
with same functionallity.
I'm on really slow GPRS connection now and can't reply fast so
forgive me for that :)
Index: linux-2.6.git/include/linux/init.h
===================================================================
--- linux-2.6.git.orig/include/linux/init.h 2008-08-03 17:32:25.000000000 +0400
+++ linux-2.6.git/include/linux/init.h 2008-08-03 18:02:48.000000000 +0400
@@ -247,6 +247,25 @@ struct obs_kernel_param {
#define early_param(str, fn) \
__setup_param(str, fn, fn, 1)
+/*
+ * Sometimes we need to define boot parameter alias
+ * ie different boot options with the same functionality
+ * so we could use one parsing function for all of them
+ * NOTE: these macroses _MUST_ be placed on different lines
+ */
+#define __setup_param_alias(str, unique_id, salt, fn, early) \
+ static char __setup_str_##unique_id##salt[] __initdata __aligned(1) = str; \
+ static struct obs_kernel_param __setup_##unique_id##salt \
+ __used __section(.init.setup) \
+ __attribute__((aligned((sizeof(long))))) \
+ = { __setup_str_##unique_id##salt, fn, early }
+
+#define __setup_alias(str, fn) \
+ __setup_param_alias(str, fn, __LINE__, fn, 0)
+
+#define early_param_alias(str, fn) \
+ __setup_param_alias(str, fn, __LINE__, fn, 1)
+
/* Relies on boot_command_line being set */
void __init parse_early_param(void);
#endif /* __ASSEMBLY__ */
reply other threads:[~2008-08-03 14:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080803142251.GA16487@lenovo \
--to=gorcunov@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=andi@firstfloor.org \
--cc=aviro@redhat.com \
--cc=davem@davemloft.net \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®