* How to read file in kernel module?
@ 2005-02-07 6:17 linux lover
2005-02-07 6:38 ` Arjan van de Ven
2005-02-07 14:29 ` Olaf Dietsche
0 siblings, 2 replies; 8+ messages in thread
From: linux lover @ 2005-02-07 6:17 UTC (permalink / raw)
To: linux-kernel
Hello,
I have written one /proc file creation kernel
module. This module creates /proc/file and defied
operations on it. Also i have written user program
that will read & write to /proc files from user space.
Now what i want is to use same bufproc_read &
bufproc_write functions defined in /proc file
handling kernel module to be used in another kernel
module to read that /proc/file in kernel module.The
second kernel module only used to read /proc file in
kernel. I am not understanding how can i open that
/proc/file in second kenrel module to read in kernel?
regards,
linux_lover.
__________________________________
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.
http://promotions.yahoo.com/new_mail
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to read file in kernel module?
2005-02-07 6:17 How to read file in kernel module? linux lover
@ 2005-02-07 6:38 ` Arjan van de Ven
2005-02-07 10:13 ` Marcel Holtmann
` (2 more replies)
2005-02-07 14:29 ` Olaf Dietsche
1 sibling, 3 replies; 8+ messages in thread
From: Arjan van de Ven @ 2005-02-07 6:38 UTC (permalink / raw)
To: linux lover; +Cc: linux-kernel
On Sun, 2005-02-06 at 22:17 -0800, linux lover wrote:
> Hello,
> I have written one /proc file creation kernel
> module. This module creates /proc/file and defied
> operations on it. Also i have written user program
> that will read & write to /proc files from user space.
> Now what i want is to use same bufproc_read &
> bufproc_write functions defined in /proc file
> handling kernel module to be used in another kernel
> module to read that /proc/file in kernel module.The
> second kernel module only used to read /proc file in
> kernel. I am not understanding how can i open that
> /proc/file in second kenrel module to read in kernel?
> regards,
the answer really is that you should not read files from kernel
modules; /proc or otherwise.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to read file in kernel module?
2005-02-07 6:38 ` Arjan van de Ven
@ 2005-02-07 10:13 ` Marcel Holtmann
2005-02-07 13:00 ` Michelle Konzack
2005-02-07 16:52 ` Valdis.Kletnieks
2 siblings, 0 replies; 8+ messages in thread
From: Marcel Holtmann @ 2005-02-07 10:13 UTC (permalink / raw)
To: Arjan van de Ven; +Cc: linux lover, Linux Kernel Mailing List
Hi,
> > I have written one /proc file creation kernel
> > module. This module creates /proc/file and defied
> > operations on it. Also i have written user program
> > that will read & write to /proc files from user space.
> > Now what i want is to use same bufproc_read &
> > bufproc_write functions defined in /proc file
> > handling kernel module to be used in another kernel
> > module to read that /proc/file in kernel module.The
> > second kernel module only used to read /proc file in
> > kernel. I am not understanding how can i open that
> > /proc/file in second kenrel module to read in kernel?
> > regards,
>
> the answer really is that you should not read files from kernel
> modules; /proc or otherwise.
the only thing that is may needed by a kernel driver should be an
external firmware file and for that we have request_firmware(). For
everything else you are on the wrong track.
Regards
Marcel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to read file in kernel module?
2005-02-07 6:38 ` Arjan van de Ven
2005-02-07 10:13 ` Marcel Holtmann
@ 2005-02-07 13:00 ` Michelle Konzack
2005-02-07 16:52 ` Valdis.Kletnieks
2 siblings, 0 replies; 8+ messages in thread
From: Michelle Konzack @ 2005-02-07 13:00 UTC (permalink / raw)
To: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 574 bytes --]
Am 2005-02-07 07:38:36, schrieb Arjan van de Ven:
> the answer really is that you should not read files from kernel
> modules; /proc or otherwise.
I think, he mean something like
echo "1" >/proc/sys/net/ipv4/ip_forward
Where you can (de)activate Kernel functions.
Greetings
Michelle
--
Linux-User #280138 with the Linux Counter, http://counter.li.org/
Michelle Konzack Apt. 917 ICQ #328449886
50, rue de Soultz MSM LinuxMichi
0033/3/88452356 67100 Strasbourg/France IRC #Debian (irc.icq.com)
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to read file in kernel module?
2005-02-07 6:17 How to read file in kernel module? linux lover
2005-02-07 6:38 ` Arjan van de Ven
@ 2005-02-07 14:29 ` Olaf Dietsche
1 sibling, 0 replies; 8+ messages in thread
From: Olaf Dietsche @ 2005-02-07 14:29 UTC (permalink / raw)
To: linux lover; +Cc: linux-kernel
linux lover <linux_lover2004@yahoo.com> writes:
> Now what i want is to use same bufproc_read &
> bufproc_write functions defined in /proc file
> handling kernel module to be used in another kernel
> module to read that /proc/file in kernel module.The
> second kernel module only used to read /proc file in
> kernel. I am not understanding how can i open that
> /proc/file in second kenrel module to read in kernel?
Look at kernel_read() in fs/exec.c and fs/binfmt_*.c
Regards, Olaf.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to read file in kernel module?
2005-02-07 6:38 ` Arjan van de Ven
2005-02-07 10:13 ` Marcel Holtmann
2005-02-07 13:00 ` Michelle Konzack
@ 2005-02-07 16:52 ` Valdis.Kletnieks
2 siblings, 0 replies; 8+ messages in thread
From: Valdis.Kletnieks @ 2005-02-07 16:52 UTC (permalink / raw)
To: Arjan van de Ven; +Cc: linux lover, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1234 bytes --]
On Mon, 07 Feb 2005 07:38:36 +0100, Arjan van de Ven said:
> On Sun, 2005-02-06 at 22:17 -0800, linux lover wrote:
> > Now what i want is to use same bufproc_read &
> > bufproc_write functions defined in /proc file
> > handling kernel module to be used in another kernel
> > module to read that /proc/file in kernel module.The
> > second kernel module only used to read /proc file in
> > kernel. I am not understanding how can i open that
> > /proc/file in second kenrel module to read in kernel?
> > regards,
>
> the answer really is that you should not read files from kernel
> modules; /proc or otherwise.
As Arjan said - what you probably want to be doing instead is changing
the code in your first module that provides the bufproc_* functions so
that they're wrappers around some code that does the "real work", and
then call the real_work function from your second module. Most likely,
what you *really* want to be passing around is some 'struct *foo', and
the bufproc_* functions are converting to/from a struct foo and a linear
byte stream. (In the limiting case where it's just one variable, why not
just 'EXPORT_SYMBOL(variable)' in the first module and then just assign or
read the variable from the second module?)
[-- Attachment #2: Type: application/pgp-signature, Size: 226 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to read file in kernel module?
2005-01-10 13:30 linux lover
@ 2005-01-10 16:15 ` Fao, Sean
0 siblings, 0 replies; 8+ messages in thread
From: Fao, Sean @ 2005-01-10 16:15 UTC (permalink / raw)
To: linux lover; +Cc: linux-kernel
linux lover wrote:
> I want to read file in kernel module. can
>anybody help me by giving code for that?
>Also whats suitable way to do that in kernel /proc or
>shared memory? what i want is to read and write a user
>file frequently.
>regards,
>
Linux Lover,
After reading a number of posts from you in the past couple of months,
it's become rather obvious that you're taking a brute force approach to
Linux kernel development rather than starting from the beginning and
working your way up. Furthermore, some of the questions you ask
indicate that you're approaching kernel programming the same way you
would program in user space.
Others (myself included) have suggested a couple of books to get you
started quickly. It will take some work on your part, however, if you
ever want to be a proficient kernel developer. Examples are good to
back up theory, but are a horrible way to learn any kind of programming.
Please take us up on our advise to do some reading. I can promiss you
that the energy you spend on reading will be time well spent if Linux
kernel programming is for you. If you have questions about portions you
read in the book, somebody here might be willing to give you a hand.
Please do not take this as an insult. You sound like you have a lot of
interest in Kernel development. If that's the case, I'd like to see you
turn into a good developer, not just another "so-so" programmer.
Good luck,
--
Sean
^ permalink raw reply [flat|nested] 8+ messages in thread
* How to read file in kernel module?
@ 2005-01-10 13:30 linux lover
2005-01-10 16:15 ` Fao, Sean
0 siblings, 1 reply; 8+ messages in thread
From: linux lover @ 2005-01-10 13:30 UTC (permalink / raw)
To: linux-kernel
I want to read file in kernel module. can
anybody help me by giving code for that?
Also whats suitable way to do that in kernel /proc or
shared memory? what i want is to read and write a user
file frequently.
regards,
linux_lover
__________________________________
Do you Yahoo!?
Yahoo! Mail - now with 250MB free storage. Learn more.
http://info.mail.yahoo.com/mail_250
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2005-02-07 16:53 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-07 6:17 How to read file in kernel module? linux lover
2005-02-07 6:38 ` Arjan van de Ven
2005-02-07 10:13 ` Marcel Holtmann
2005-02-07 13:00 ` Michelle Konzack
2005-02-07 16:52 ` Valdis.Kletnieks
2005-02-07 14:29 ` Olaf Dietsche
-- strict thread matches above, loose matches on Subject: below --
2005-01-10 13:30 linux lover
2005-01-10 16:15 ` Fao, Sean
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).