stubbing out reading from the /dev/helloctl
based on reading ./arch/um/drivers/random.c
This commit is contained in:
parent
5eae9089e8
commit
80848e7688
1 changed files with 17 additions and 3 deletions
20
mod_hello.c
20
mod_hello.c
|
@ -25,13 +25,29 @@ hello_control_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
hello_control_open (struct inode *inode, struct file *filp)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
hello_control_read (struct file *filp, char __user *buf, size_t size, loff_t *offp)
|
||||
{
|
||||
int ret = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct file_operations hello_ctl_fops = {
|
||||
.unlocked_ioctl = hello_control_ioctl,
|
||||
.compat_ioctl = hello_control_ioctl,
|
||||
.owner = THIS_MODULE,
|
||||
.llseek = noop_llseek,
|
||||
.open = hello_control_open,
|
||||
.read = hello_control_read,
|
||||
};
|
||||
|
||||
|
||||
static struct miscdevice hello_misc = {
|
||||
.minor = MISC_DYNAMIC_MINOR,
|
||||
.name = "helloctl",
|
||||
|
@ -114,9 +130,7 @@ static int __init hello_init(void)
|
|||
|
||||
static void __exit hello_cleanup(void)
|
||||
{
|
||||
if (misc_deregister(&hello_misc) < 0) {
|
||||
printk(KERN_INFO "[%s] misc_deregister failed for control device.\n", __this_module.name);
|
||||
}
|
||||
misc_deregister(&hello_misc);
|
||||
printk(KERN_INFO "[%s] module unloaded.\n", __this_module.name);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue