Re: Little favour

From: Richard B. Johnson (root@chaos.analogic.com)
Date: Fri Aug 04 2000 - 07:49:14 EST


On Fri, 4 Aug 2000, Md A Saifulla wrote:

>
> Hello,
>
> I am writing a linux kernel char device driver. I have to access a file in
> kernel driver, i used sys_open, sys_read, .. and i included <linux/fs.h>
> which has all the required declarations. Compilation was successful. But
> when i added this module into kernel, "unresolved symbol: sys_open,
> sys_read" came. Can you please help me in locating this error.
>
> Thanks in advance,
> Saif.
>

These symbols are not exported. If you really need them, you need to
use the macro, EXPORT_SYMBOL(symbol_name) and compile with EXPORT_SYMTAB
defined.

A module that requires access to a file is broken by design. In order
for a file descriptor to mean anything, it must be associated with
a process. The kernel is not a process. To access a file within the
kernel requires either a kernel thread, or stealing the context of
some poor slob that happens to be executing at that instant.

Note that you never need a file anyway. What you need is the contents
of some file. You get the contents of a file to your driver by using
a ioctl() function you create. The file is opened by some program
you write in user-space. It opens the device you designed. Then
it takes the contents of a file you open in user-space and sends it
to your driver.

Cheers,
Dick Johnson

Penguin : Linux version 2.2.15 on an i686 machine (797.90 BogoMips).

"Memory is like gasoline. You use it up when you are running. Of
course you get it all back when you reboot..."; Actual explanation
obtained from the Micro$oft help desk.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Aug 07 2000 - 21:00:12 EST