Re: Accessing a File System/ Files from kernel space

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

 



On 3/21/06, Avishay Traeger <atraeger@xxxxxxxxxxxxx> wrote:
> On Tue, 2006-03-21 at 02:59 -0800, George Joseph wrote:
> >    I am a relatively new entry to Linux kernel space programming and
> > have worked on RTOSs like os20,vxworks etc etc...
> >
> >    I would like to know whether it is possible to access a file on a
> > filesystem by a driver loaded in the kernel and what would be the
> > issues I face while doing so - practically and theoritically. Sorry
> > the question is a bit blunt since this is a new activity I am planning
> > to pursue. TIA.BTW I am planning to use kernel 2.6.15 for
> > developement.
>
> I don't know much about drivers so I'll let someone else answer that,
> but from a file system perspective:
> 1. I assume this is for an exercise, otherwise, why not just use the
> file system?
> 2. What do you mean by "access"?  Do you mean read?  Read/write?  Stat?
> I'll assume you don't want to make changes to the file system, since you
> will need to duplicate the whole file system within the driver.
> 3. You should be aware that each file system has its own meta-data, it's
> own on-disk format, etc.  Unless your driver simply uses the file system
> methods, it will by specific to file systems that use a single format
> that you code.
> 4. You will need to be familiar with where meta-data is stored on the
> file system, how to parse it, how to use it to find data blocks, and any
> other quirks that the specific file system has.
>

I think George wants to access a file (lying on any file system) from
the kernel space or driver. If this is the case then:

1) You can access files from the driver, but it won't be done due to
many issues especially security issues. (just search kernelnewbies and
linux-kernel archieves for reasons in detail)

2) If you want to get data in driver from file then use user space
program to read that file and send data to driver through sysfs or
netlink_sockets. You can also use netlink_sockets to send data from
kernel space or driver to user program and write into the file.

I hope it helps too with Avishay's reply :)

--
Fawad Lateef

--
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