It is currently Mon, 26 Oct 2020 04:04:47 GMT



 
Author Message
 module programming blues
Hello Everyone,

I am trying to develop a kernel module that will read
some user input (being given to a file) and perform
certain flag settings based on the information dumped
in the file.

After reading up on the basics of kernel programming
etc (im a newbie), i wrote a code that creates a
character device, and uses ioctl to read and write
from the file kept in user space.

I got sample code from The Linux Kernel Module
Programming Guide by Ori Pomerantz. In chapter 5, it
talks about talking to character devices.

I am able to compile the code, and insmod my module.
The problem is that the function device_open is not
being called on accessing it. It calls device_release
TWICE, and thus reduces  reference count by 2, taking
the count in negatives. That way im unable to rmmod
this module.

Also, I am not able to figure out how to interact with
this module. If i cat something onto it, it goes into
an infinite loop echo'ing the file again n again.

If i do "/dev/char_dev < params" where /dev/char_dev
is the device i made using mknod(and giving major
number returned by my module), it gives an error
saying Permission Denied.

Can somebody tell me what i'm doing wrong ? Or give me
some pointers to text that can explain how things work
in a module. I dont know how control flows within a
module once init_module has been called.

Kindly CC replies to dhruvg...@yahoo.com as i am not
subscribed to the list.

thanks in advance
regards,
Gami

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://www.**-**.com/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at   http://www.**-**.com/
Please read the FAQ at   http://www.**-**.com/



 Sun, 17 Jul 2005 06:00:10 GMT   
 module programming blues
* Dhruv Gami (dhruvg...@yahoo.com) wrote:

Could this task be handled using module parameters instead?

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



 Fri, 22 Jul 2005 23:10:06 GMT   
 module programming blues

Easy. You have a user-program open the device and send it
parameters via ioctl(). That's the way it's supposed to be
done in a Unix environment. Devices get their parameters via
ioctls.

I have modules that get the entire contents of ASICs from
the contents of user-mode files. Something, at some time,
needs to `insmod` the module anyway. The exact same procedure
that does that can run a program that configures the module
dynamicaly, based, not only on the contents of files, but also
anything else. Do not make hacks to read files from the kernel.

Cheers,
{*filter*} Johnson
Penguin : Linux version 2.4.18 on an i686 machine (797.90 BogoMips).
Why is the government concerned about the lunatic fringe? Think about it.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at   http://www.**-**.com/
Please read the FAQ at   http://www.**-**.com/



 Fri, 22 Jul 2005 23:30:17 GMT   
 
   [ 3 post ] 

Similar Threads

1. 2.1.131: modules blues

2. Module Programming: module version vs. kernel version

3. C program: name of program/main module?

4. programming blues

5. cdrom Install hangs- SCO Blue screen blues

6. Running program before loadng sound module

7. Help for socket programming as kernel module

8. socket programming in module HOWTO?

9. Problem with kernel module programming...

10. module program


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software