Posted on 2004-03-27
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

Accepted Solution

scn earned 50 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

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
qos on linux 3 107
how does yum update work 2 58
Enhance Shell script so that it start up processes with limited RAM & CPU consumption 14 148
awk file 6 79
Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
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…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

828 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