|
@@ -74,7 +74,11 @@ static int fill_read_buffer(struct dentry * dentry, struct configfs_buffer * buf
|
|
if (!buffer->page)
|
|
if (!buffer->page)
|
|
return -ENOMEM;
|
|
return -ENOMEM;
|
|
|
|
|
|
- count = ops->show_attribute(item,attr,buffer->page);
|
|
|
|
|
|
+ if (ops->show_attribute)
|
|
|
|
+ count = ops->show_attribute(item, attr, buffer->page);
|
|
|
|
+ else
|
|
|
|
+ count = attr->show(item, buffer->page);
|
|
|
|
+
|
|
buffer->needs_read_fill = 0;
|
|
buffer->needs_read_fill = 0;
|
|
BUG_ON(count > (ssize_t)SIMPLE_ATTR_SIZE);
|
|
BUG_ON(count > (ssize_t)SIMPLE_ATTR_SIZE);
|
|
if (count >= 0)
|
|
if (count >= 0)
|
|
@@ -173,7 +177,9 @@ flush_write_buffer(struct dentry * dentry, struct configfs_buffer * buffer, size
|
|
struct config_item * item = to_item(dentry->d_parent);
|
|
struct config_item * item = to_item(dentry->d_parent);
|
|
struct configfs_item_operations * ops = buffer->ops;
|
|
struct configfs_item_operations * ops = buffer->ops;
|
|
|
|
|
|
- return ops->store_attribute(item,attr,buffer->page,count);
|
|
|
|
|
|
+ if (ops->store_attribute)
|
|
|
|
+ return ops->store_attribute(item, attr, buffer->page, count);
|
|
|
|
+ return attr->store(item, buffer->page, count);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -237,8 +243,8 @@ static int check_perm(struct inode * inode, struct file * file)
|
|
* and we must have a store method.
|
|
* and we must have a store method.
|
|
*/
|
|
*/
|
|
if (file->f_mode & FMODE_WRITE) {
|
|
if (file->f_mode & FMODE_WRITE) {
|
|
-
|
|
|
|
- if (!(inode->i_mode & S_IWUGO) || !ops->store_attribute)
|
|
|
|
|
|
+ if (!(inode->i_mode & S_IWUGO) ||
|
|
|
|
+ (!ops->store_attribute && !attr->store))
|
|
goto Eaccess;
|
|
goto Eaccess;
|
|
|
|
|
|
}
|
|
}
|
|
@@ -248,7 +254,8 @@ static int check_perm(struct inode * inode, struct file * file)
|
|
* must be a show method for it.
|
|
* must be a show method for it.
|
|
*/
|
|
*/
|
|
if (file->f_mode & FMODE_READ) {
|
|
if (file->f_mode & FMODE_READ) {
|
|
- if (!(inode->i_mode & S_IRUGO) || !ops->show_attribute)
|
|
|
|
|
|
+ if (!(inode->i_mode & S_IRUGO) ||
|
|
|
|
+ (!ops->show_attribute && !attr->show))
|
|
goto Eaccess;
|
|
goto Eaccess;
|
|
}
|
|
}
|
|
|
|
|