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, George Joseph <george_linuxprogrammer@xxxxxxxxx> wrote:
>
> Hello Guys,
>
>     Ooops looks like I did not enumerate the purpose of the driver. Well the
> use is simple - I am going to write a driver which reads some(a whole lot
> still) packet data from a file stored on  a file system - just reading
> nothing else. The file per se will be created by another application and
> stored on an ext2FS or FAT32FS . Now, All that I wish to do is access the
> file from kernel space because a high level user land API will be able to
> open/read the file. But, again the data will be present in user space . This
> data has to be moved to kernel space(for my driver) using copy_from_user()
> and considering the fact that the file itself could be 1 GB + in size  - I
> believe I might loose a lot of cycles doing this conversion . Please do let
> me know if there is something else we could do for this in the kernel itself
> rather than doing it in user land.

What you can do is:

1) From user application read the file and provide the data to driver
through sysfs, this is secure (I think its fast too)
2) Directly call the file system functions to access the file (I think
its difficult)
3) Directly call the user space file accessing functions through doing
system-calls from kernel (its the worst thing to do)

See this thread
(http://mail.nl.linux.org/kernelnewbies/2005-11/msg00025.html) and for
point number 3 although its bad see
(http://mail.nl.linux.org/kernelnewbies/2005-10/msg00249.html)

I hope this helps.



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