sysfs: export the vfs release call of binary attribute
PATCH 1/1 sysfs: export the vfs release call of binary attribute
Currently there is no way to know what time userspace has finished writing to a binary sysfs attribute bigger than one page. The firmware_class code uses its own special file in the class directory to notify about this. This can be simplified by using this release callback.
Signed-off-by Kay Sievers <[email protected]>
===== fs/sysfs/bin.c 1.20 vs edited =====
fs/sysfs/bin.c +3 -0
@@ -156,6 +156,9 @@ static int release(struct inode * inode,struct bin_attribute * attr =to_bin_attr (file->f_dentry);u8 * buffer = file->private_data; +if (attr->release) + attr->release (kobj); +if (kobj)kobject_put (kobj);module_put (attr->attr.owner);
===== include/linux/sysfs.h 1.39 vs edited =====
include/linux/sysfs.h +1 -0
@@ -56,6 +56,7 @@ struct bin_attribute {void *private;ssize_t (*read)(struct kobject *,char *,loff_t ,size_t );ssize_t (*write)(struct kobject *,char *,loff_t ,size_t ); +int (*release)(struct kobject *);int (*mmap)(struct kobject *,struct bin_attribute *attr,struct vm_area_struct *vma); };