views:

60

answers:

1

I've seen some sample code that does this:

proc_entry->read_proc = module_read;
proc_entry->write_proc = module_write;

However, in my module, I've used ioctls instead of the read and write. Here is my ioctl function prototype:

int mytimer_ioctl(struct inode *inode, struct file *file, unsigned int fcn, unsigned long args)

For read, my "fcn" is IOCTL_GET_TIMER, and for write, my "fcn" is IOCTL_SET_TIMER.

Anyway to do something like this:

proc_entry->read_proc = module_ioctl(IOCTL_GET_TIMER);
proc_entry->write_proc = module_ioctl(IOCTL_SET_TIMER);

But not pass in the "args" argument?

Or maybe the easier way is to just write the module_read and module_write function, and have those call the ioctl?

Thanks for the help guys!

+1  A: 

No way to do this. Just implement forwarding functions.

Nikolai N Fetissov
Thanks, I will work on that... However, I'm not sure how I can forward them anymore since the ioctl call requires *inode and *file inputs also... What would I do for that?
hahuang65
read and write calls take "struct file* pfil", don't they? Then I believe it's "filp->f_dentry->d_inode".
Nikolai N Fetissov