Re: Calling driver functions from kernel space

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

 



#include <linux/module.h>

2009/11/9 Sam Carter <sam.w.carter@xxxxxxxxx>:
> When I try to compile the kernel with my changes to readdir.c, my function
> in the driver is undefined and it therefore won't compile. This also happens
> after I've compiled my driver against the kernel tree with the EXPORT_SYMBOL
> in place.
>
> Any more thoughts on this?
>
> 2009/11/9 Zhu Yanhai <zhu.yanhai@xxxxxxxxx>
>>
>> EXPORT_SYMBOL_GPL(your func);
>> Then this function can be called outside.
>>
>> For the second question, does this one work?
>>
>> /* Search for module by name: must hold module_mutex. */
>> struct module *find_module(const char *name)
>>
>> It's in kernel/module.c and has been exported.
>>
>> Regards,
>> Zhu Yanhai
>>
>>
>>
>> 2009/11/8 Sam Carter <sam.w.carter@xxxxxxxxx>:
>> > Hi all,
>> >
>> > I have a char driver/module which compiles and loads into the linux
>> > kernel
>> > just fine. In this driver are some functions which I would like to
>> > access
>> > from the kernel file 'fs/readdir.c'. Additionally, how can I test if a
>> > driver is loaded?
>> >
>> > I need something like the following.
>> >
>> > if(myDriver is loaded){
>> >
>> >     myDriver.functionCall();
>> > }
>> >
>> > All examples I've found on internet searches are doing it from userspace
>> > applications.
>> >
>> > Thanks for any help
>> >
>> >
>
>

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at 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