28 #include <linux/module.h>
29 #include <linux/slab.h>
31 #include <asm/uaccess.h>
42 #define SIMPLE_ATTR_SIZE 4096
107 configfs_read_file(
struct file *
file,
char __user *
buf,
size_t count, loff_t *ppos)
114 if ((retval = fill_read_buffer(file->
f_path.dentry,buffer)))
117 pr_debug(
"%s: count = %zd, ppos = %lld, buf = %s\n",
118 __func__, count, *ppos, buffer->
page);
138 fill_write_buffer(
struct configfs_buffer * buffer,
const char __user * buf,
size_t count)
198 configfs_write_file(
struct file *file,
const char __user *buf,
size_t count, loff_t *ppos)
204 len = fill_write_buffer(buffer, buf, count);
213 static int check_perm(
struct inode *
inode,
struct file * file)
215 struct config_item *item = configfs_get_config_item(file->
f_path.dentry->d_parent);
225 if (!try_module_get(attr->
ca_owner)) {
231 ops = item->
ci_type->ct_item_ops;
282 static int configfs_open_file(
struct inode * inode,
struct file * filp)
284 return check_perm(inode,filp);
287 static int configfs_release(
struct inode * inode,
struct file * filp)
309 .read = configfs_read_file,
310 .write = configfs_write_file,
312 .open = configfs_open_file,
313 .release = configfs_release,