[prev in list] [next in list] [prev in thread] [next in thread]
List: linux-admin
Subject: Doubt
From: "T.Senthil Nathan" <tsenthil () nimbus ! ee ! iitm ! ernet ! in>
Date: 2001-12-16 11:48:36
[Download RAW message or body]
Dear sir,
I have a doubt in device driver, I have created device called NIC with
major number as 60 and minor 0, with a dummy device driver as follows.
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/ioport.h>
#include <linux/in.h>
#include <linux/malloc.h>
#include <linux/string.h>
#define EXPORT_SYMTAB
#include <asm/system.h>
#include <asm/bitops.h>
#include <asm/io.h>
#include <asm/dma.h>
#include <asm/segment.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/pci.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
#include <linux/if_arp.h>
#include <linux/if_slip.h>
/* #include <linux/vmalloc.h> */
/* #include "/usr/src/linux/include/asm-i386/io.h" */
#if CONFIG_MODVERSIONS==1
#define MODVERSIONS
#include <linux/modversions.h>
#endif
#define NIC_MAJOR 60
#define NIC_DEV "NIC"
static long NIC_read (struct inode* inode, struct file* file, char *buf,
int count)
{
printk("Trying to read something from the device\n");
}
static int NIC_write(struct inode* inode, struct file* file, const char
*buf, int count)
{
printk("Trying to write something into the device with count %d
\n",count);
}
static int NIC_open(struct inode *inode, struct file *file)
{
printk("Trying to open the device\n");
return 0;
}
static void NIC_close(struct inode *inode,struct file *file)
{
}
static int NIC_ioctl(struct inode *inode, struct file * file, unsigned
int cmd, unsigned long arg)
{
}
/* NIC file operation table */
static struct file_operations NIC_fops = {
NULL, /* NIC_lseek */
NIC_read, /* NIC_read */
NIC_write, /* NIC_write */
NULL, /* NIC_readdir */
NULL, /* NIC_select */
NIC_ioctl, /* NIC_ioctl */
NULL, /* NIC_mmap */
NIC_open, /* NIC_open */
NIC_close, /* NIC_release */
NULL,
NULL,
NULL,
NULL
};
int init_module(void)
{
if (register_chrdev(NIC_MAJOR, NIC_DEV, &NIC_fops))
{
printk("unable to get major %d for device OSI\n", NIC_MAJOR);
}
printk("init_module() : Installing driver for kNIC \n");
printk("PCI DETECTION&CONFIGURATION STARTED \n");
return 0;
}
This driver contains nothing just the printk for control flow and the
printk for no of bytes to be written in to device in NIC_write. The
printk added in NIC_write not printing the exact count(only in 6.2)
which I am passing from the application code, but it printing the proper
count in 5.2 can u please explain why this problem and give me some
solution for that. When compiling this code its giving some warning in
the intialisation of file_operation structure instance NIC-fops, this
can be taken as some clue.
Senthil.
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic