public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dhruv Gami <dhruvgami@yahoo.com>
To: linux-kernel@vger.kernel.org
Subject: module programming blues
Date: Tue, 28 Jan 2003 20:56:33 -0800 (PST)	[thread overview]
Message-ID: <20030129045633.45161.qmail@web14201.mail.yahoo.com> (raw)

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 dhruvgami@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://mailplus.yahoo.com

             reply	other threads:[~2003-01-29  4:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-29  4:56 Dhruv Gami [this message]
2003-02-03 21:57 ` module programming blues Daniel Heater
2003-02-03 22:23   ` Richard B. Johnson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030129045633.45161.qmail@web14201.mail.yahoo.com \
    --to=dhruvgami@yahoo.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox