LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 04-21-2011, 11:58 AM   #31
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940

Quote:
Originally Posted by eantoranz View Post
I checked the values that IS_ERR returns. It's always 0. 0 before switching fs, after switching fs, after vfs_read and after switch back fs. How about that?
That means the "if" statement is not doing any tricks here, returning 0 means IS_ERR is not creating any problems which is a nice thing, now the next statement in that function is a call to vfs_read function, its declaration is shown in fs.h as:
extern ssize_t vfs_read(struct file *, char __user *, size_t, loff_t *);
You need to verify whether the parameters you are throwing in it have exactly the same types as above, do they need a typecast. I haven't used vfs_read before, so you also need to see whether what these parameters mean is same as your understanding of them!

Quote:
Originally Posted by eantoranz View Post
What technique could I apply so that I can handle this part in userspace?
You mean receiving the data from the device in user space? If yes, then you can read it in the kernel space and then "copy" it to the user space, there are predefined kernel functions for handling the same.

Quote:
Originally Posted by eantoranz View Post
Also, wasn't there an addition to new kernels that is the equivalent of fuse but for block devices?
One thing I would like to clarify, I am no expert in these kernel matters. One year back I wrote the interrupt handlers for the keyboard and the serial port rs232, that's it. And secondly posting in the wrong forum is also not going to help you, "kernel section" post there.
Also: http://kernelnewbies.org/MailingList
 
Old 04-21-2011, 12:17 PM   #32
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Costa Rica
Distribution: Kubuntu, Debian, Knoppix
Posts: 2,092

Original Poster
Blog Entries: 1

Rep: Reputation: 90
About what you did on the kernel.... that's so much more than what I've done. :-)

ANd yes, I think taking this whole thing to userspace will be the right thing to try. I'll think it over and look around for samples of code.
 
Old 04-21-2011, 12:21 PM   #33
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
Quote:
Originally Posted by eantoranz View Post
ANd yes, I think taking this whole thing to userspace will be the right thing to try.
I was referring to: copy_to_user.
 
Old 04-21-2011, 12:53 PM   #34
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Costa Rica
Distribution: Kubuntu, Debian, Knoppix
Posts: 2,092

Original Poster
Blog Entries: 1

Rep: Reputation: 90
I don't mean taking the whole driver to user space... just reading from the files so that I can skip this mess. I'll take a look at your link. Thank you very much.
 
Old 04-23-2011, 10:56 PM   #35
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Costa Rica
Distribution: Kubuntu, Debian, Knoppix
Posts: 2,092

Original Poster
Blog Entries: 1

Rep: Reputation: 90
Reading about call_usermodehelper_setup I'm wondering if it's possible to call an application and and communicate with it through its stdin/stdout? I'd like to keep implementation as simple as possible.

Other mechanism I found around is communicating through UDP. I was able to see messages sent from an application to the kernel, but I haven't been able to send information form the kernel to the outside world. Do you know of a simple example? Being able to send "hello world" through the net would be enough. Don't have to have a listening application on the other side to know that it's working.
 
Old 04-24-2011, 06:06 AM   #36
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
I haven't used/read about the function you mentioned.
Quote:
Originally Posted by eantoranz View Post
I'm wondering if it's possible to call an application and and communicate with it through its stdin/stdout?
Do you mean to ask whether it is possible to pass arguments to a kernel module?
Which application are you asking about?

Quote:
Originally Posted by eantoranz View Post
but I haven't been able to send information form the kernel to the outside world. Do you know of a simple example? Being able to send "hello world" through the net would be enough.
Sending information from kernel to outside world means what? I don't understand sending "hello world through net".

Is all this related to the driver errors? If no, then there should be a new thread for a new problem.
P.S. Did you verify vfs_read as I mentioned in post 31?
 
Old 05-04-2011, 12:10 AM   #37
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Costa Rica
Distribution: Kubuntu, Debian, Knoppix
Posts: 2,092

Original Poster
Blog Entries: 1

Rep: Reputation: 90
I've been following the inner workings of the kernel when I call vfs_read (by cloning function, adding my debug messages, recompiling and so on). The error (one of the possible errors, that is...) is being generated on file->f_ops->read() from vfs_read(). How can I know where that function is going? By the fs? I mean, if the file is being read from an ext3 partition, I'd check the function used to read files on ext3 and so on?
 
Old 06-24-2013, 11:22 AM   #38
Nemo2000
LQ Newbie
 
Registered: Jun 2013
Distribution: Fedora
Posts: 3

Rep: Reputation: Disabled
Hi,eantoranz.
I know this thread is very old, but did you manage to read block device data from kernel module?
Or maybe anybody else know answer to that question?
Thanks.
 
Old 06-24-2013, 11:24 AM   #39
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Costa Rica
Distribution: Kubuntu, Debian, Knoppix
Posts: 2,092

Original Poster
Blog Entries: 1

Rep: Reputation: 90
I did a lot of experimentation but was getting an exception brick... I'll someday retake this stuff... won't happen in the short term though.
 
Old 06-25-2013, 04:46 AM   #40
Nemo2000
LQ Newbie
 
Registered: Jun 2013
Distribution: Fedora
Posts: 3

Rep: Reputation: Disabled
Thanks. If I find a solution, I will post here about that. This is a horrible and frustrating task
 
Old 06-25-2013, 08:14 AM   #41
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Costa Rica
Distribution: Kubuntu, Debian, Knoppix
Posts: 2,092

Original Poster
Blog Entries: 1

Rep: Reputation: 90
Sure, let me know what you find.
 
Old 07-08-2013, 08:11 AM   #42
Nemo2000
LQ Newbie
 
Registered: Jun 2013
Distribution: Fedora
Posts: 3

Rep: Reputation: Disabled
Here is an answer
http://stackoverflow.com/questions/1...27300#17527300
 
  


Reply

Tags
block devices, linux, module



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Alan Cox on open-source development vs. proprietary development LXer Syndicated Linux News 0 10-25-2007 04:21 PM
LXer: Tools and open standards through Open Source development LXer Syndicated Linux News 0 04-24-2007 01:01 AM
LXer: Open Community Tools: An open stack development platform LXer Syndicated Linux News 0 04-07-2007 01:46 PM
how to open a file inside a kernel module yugandhar Linux - Kernel 2 08-11-2006 06:43 AM
Novell to Open SuSE Pro for open development HenchmenResourc Linux - News 0 08-02-2005 10:57 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 11:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration