Re: Accessing File System from Module

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Cced back to the mailing list, there's no reason to follow up in private
for a question posted publicly.

On Thu, Sep 19, 2002 at 10:42:31AM +0200, yaelgilad wrote:
> >
> > Yes, you should not ever access files from within the kernel.  Do not do
> > this, change your design, it is broken.
> 
> Can you elaborate on the "why" ?
> I actually recall from my Solaris days that this wasn't a good idea,
> but was told that in Linux there's no such problem.

It's _very_ difficult to get everything correct in order to read files
from the kernel.  You have to dig up the internal file structure, get
the segment register set up correctly (if you want to try to call a
system call), and do other horribly complex things that are guaranteed
to break from one kernel version to the next.  In short, it's a
technical and maintenance nightmare, with no speed benefit.

> What I am aiming at, is using the TUN (http://vtun.sourceforge.net/tun/)
> driver to capture packets sent to the net, and actually sending them
> to my PCI board. This looks like pure kernel activity. Can't it be
> done without involving userland ?

Why would you want to?  Just grab the packets from userspace, and then
send them to your driver from userspace.  You can do blocking reads much
easier that way, and don't have to worry about internal file handles,
and getting the segment registers correct, and other such stuff.

thanks,

greg k-h
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux