Posted on 2004-03-27
Medium Priority
Last Modified: 2010-04-21
im opening a device file frm my kernel module,thers no particular existent device as such for this file ,& i need to communicate with the module from user space, one of the functions regestered for that device is like this,

 * File operations functions for control device

static int lwfw_ioctl(struct inode *inode, struct file *file,
                  unsigned int cmd, unsigned long arg)
   int ret = 0;
   switch (cmd) {
    case LWFW_GET_VERS:
      return LWFW_VERS;
    case LWFW_ACTIVATE: {
       active = 1;
       printk("LWFW: Activated.\n");
       if (!deny_if && !deny_ip && !deny_port) {
        printk("LWFW: No deny options set.\n");
       active ^= active;
       printk("LWFW: Deactivated.\n");
    case LWFW_GET_STATS: {
       ret = copy_stats((struct lwfw_stats *)arg);
    case LWFW_DENY_IF: {
       ret = set_if_rule((char *)arg);
    case LWFW_DENY_IP: {
       ret = set_ip_rule((unsigned int)arg);
    case LWFW_DENY_PORT: {
       ret = set_port_rule((unsigned short)arg);
      ret = -EBADRQC;
   return ret;


i need to communicate with the kernel module frm my GUI code in the user space.
Its like if i want to activate the module i need to enter the case LWFW_ACTIVATE. & so on...
How to do it...

the other functions are :

/* Called whenever open() is called on the device file */
static int lwfw_open(struct inode *inode, struct file *file){ ... }

/* Called whenever close() is called on the device file */
static int lwfw_release(struct inode *inode, struct file *file){ ... }

i dont understand the 'inode' & 'file' parameters, how to get their values for the device file.
any kinda help is appreciated... thx

Question by:namus
1 Comment

Accepted Solution

scn earned 200 total points
ID: 10702145
Driver operations are accessed from user applications through an inode entry in the filesystem  (e.g. /dev/mydriver).
Refer to the section "Major and minor numbers" in Rubini's book at http://www.xml.com/ldd/chapter/book/ch03.html.

Featured Post

Granular recovery for Microsoft Exchange

With Veeam Explorer for Microsoft Exchange you can choose the Exchange Servers and restore points you’re interested in, and Veeam Explorer will present the contents of those mailbox stores for browsing, searching and exporting.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses
Course of the Month13 days, 11 hours left to enroll

755 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question