From: "Américo Wang" <xiyou.wangcong@gmail.com>
To: runcoderen <runcoderzhcn@gmail.com>
Cc: Linux Kernel List <linux-kernel@vger.kernel.org>
Subject: Re: ldd module param practice
Date: Mon, 23 Aug 2010 10:19:02 +0800 [thread overview]
Message-ID: <20100823021902.GA5168@cr0.nay.redhat.com> (raw)
In-Reply-To: <1282518018.1661.15.camel@bencharluo-laptop>
On Mon, Aug 23, 2010 at 07:00:18AM +0800, runcoderen wrote:
>hi all:
>
>#include <linux/init.h>
>#include <linux/module.h>
>#include <linux/moduleparam.h>
>
>MODULE_LICENSE("Dual BSD/GPL");
>
>static char *whom = "world";
>static char howmany = 1;
>
>module_param(howmany, int, S_IRUGO);
>module_param(whom, charp, S_IRUGO);
>
>static int hello_init(void)
>{
>printk(KERN_ALERT "Hello, world\n");
>return 0;
>}
>
>static void hello_exit(void)
>{
>printk(KERN_ALERT "Goodbye, cruel world\n");
>}
>
>module_init(hello_init);
>module_exit(hello_exit);
>
>insmod hellop.ko howmany=10 whom="Mom"
>
>this code I want to printk "hello Mom" 10 times.
How can it work? You neither have a loop nor use 'whom'
in your hello_init()...
You need:
statick int hello_init(void)
{
int i;
for (i=0; i<howmany; i++)
printk(KERN_WARNING "Hello, %s\n", whom);
return 0;
}
prev parent reply other threads:[~2010-08-23 2:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-22 23:00 runcoderen
2010-08-23 2:12 ` rdunlap
2010-08-23 2:19 ` Américo Wang [this message]
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=20100823021902.GA5168@cr0.nay.redhat.com \
--to=xiyou.wangcong@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=runcoderzhcn@gmail.com \
/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®