How to create sysfs file and associate it with file operations like mmap

Niroj Pokhrel nirojpokhrel at gmail.com
Wed Sep 18 06:19:56 EDT 2013


Hi all,
I want to create a sysfs file and associate it with several file opeations
like open,close and mmap.
But when coming across sysfs file creation I saw that I can create a file
using
device_create_file(struct device*,struct device_attributes*);
The device attributes were initialized using following
DEVICE_ATTR(_name,_permission,_show,_store);
But I want to associate my file with following operations
struct file_operations my_fops
{
      .open = my_open,
      .close = my_close,
      .mmap = my_mmap,
};

I was able to do this using
debugfs_create_file(...,&my_fops);
But is there anyway if I want to put this file in sec_class.
Thanking you in advance.

Thanks and Regards,
Niroj Pokhrel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130918/25913664/attachment.html 


More information about the Kernelnewbies mailing list