LinuxQuestions.org
Visit the LQ Articles and Editorials section
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
 
LinkBack Search this Thread
Old 04-21-2011, 11:58 AM   #31
Anisha Kaul
Senior Member
 
Registered: Dec 2008
Location: Gurgaon, India
Distribution: Slackware 13.37, OpenSuse 11.3
Posts: 4,370
Blog Entries: 21

Rep: Reputation: 706Reputation: 706Reputation: 706Reputation: 706Reputation: 706Reputation: 706Reputation: 706

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: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,502
Blog Entries: 1

Original Poster
Rep: Reputation: 67
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
Anisha Kaul
Senior Member
 
Registered: Dec 2008
Location: Gurgaon, India
Distribution: Slackware 13.37, OpenSuse 11.3
Posts: 4,370
Blog Entries: 21

Rep: Reputation: 706Reputation: 706Reputation: 706Reputation: 706Reputation: 706Reputation: 706Reputation: 706
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: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,502
Blog Entries: 1

Original Poster
Rep: Reputation: 67
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: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,502
Blog Entries: 1

Original Poster
Rep: Reputation: 67
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
Anisha Kaul
Senior Member
 
Registered: Dec 2008
Location: Gurgaon, India
Distribution: Slackware 13.37, OpenSuse 11.3
Posts: 4,370
Blog Entries: 21

Rep: Reputation: 706Reputation: 706Reputation: 706Reputation: 706Reputation: 706Reputation: 706Reputation: 706
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: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,502
Blog Entries: 1

Original Poster
Rep: Reputation: 67
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?
 
  


Reply

Tags
block devices, linux, module


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are 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


All times are GMT -5. The time now is 12:36 PM.

Main Menu
 
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
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration