Kernel Programming Questions

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

 



On Sat, May 24, 2008 at 05:47:15PM -0600, Vadim Klishko wrote:
> On Friday, May 23, 2008 5:01 PM, "Greg KH" wrote:
> 
> > On Fri, May 23, 2008 at 04:42:41PM -0600, Vadim Klishko wrote:
> >> On Friday, May 23, 2008 4:00 PM, "Greg KH" wrote:
> >> 
> >> > On Fri, May 23, 2008 at 02:32:46PM -0600, Vadim Klishko wrote:
> >> >> Hello Everybody,
> >> >> 
> >> >> Could anyone please tell me what functions I could call from a Linux kernel module to:
> >> >> 
> >> >> 1) dynamically load a library,
> >> > 
> >> > None.
> >> > 
> >> >> 2) get the address of an exported function,
> >> > 
> >> > None.
> >> > 
> >> >> 3) unload the library?
> >> > 
> >> > None.
> >> > 
> >> > None of these things are things that you should do from within a kernel
> >> > module.
> >> > 
> 
> First of all, I want to thank all those who answered for their
> suggestions.
> 
> Second of all, I suspect my question about loading a library within a
> kernel module may have been misunderstood. I am not talking about
> loading a user-space library. I am talking about loading my own
> library written specifically to be used in kernel space.

The kernel does not have "libraries", it allows the loading of kernel
"modules" at any time though.

> The idea is that the library is optional. If it is found on the
> system, then it is used. If it is not present, the module uses its
> internal, simpler algorithm. Any suggestions?

Just use the existing module loading functions to attempt to load your
module, if present.  But I would wonder why you would make such a thing
"optional" at all?  Either you need it or you do not, there should not
be a real issue here.

> >> >> Also, what are the functions that would allow me to read from and
> >> >> write to a binary or text file from within a kernel module?
> >> > 
> >> > None, this is not what a kernel module should ever be doing.
> >> > 
> >> > Let's turn it around the other way, what are you trying to achieve that
> >> > makes you think the above things are necessary to do?
> >> > 
> >> By reading a file, I am trying to load a system-wide device
> >> configuration. Of course, it could be hard-coded into the module, but
> >> why not try having it adjustable?
> > 
> > It's fine to be configurable, that's wonderful and something we do all
> > the time.
> > 
> > But it is userspace sending the data into the kernel driver, not the
> > other way around.  With the plethera of different filesystems, mount
> > points, boot sequences, namespaces and the like, the kernel can not
> > specific a single location of a config file and have it work with all
> > systems.
> > 
> > So have a startup script that parses the config file in userspace and
> > then writes the needed info into the driver using sysfs, or better yet,
> > configfs (which is sounds like what you need to use here.)
> 
> That would work. How do I read and write settings using configfs?

See the configfs documentation in the kernel tree :)

thanks,

greg k-h


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux