[PATCH] sysfs: export the vfs release call of binary attribute

From: Kay Sievers
Date: Thu Jan 27 2005 - 05:08:49 EST


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 <kay.sievers@xxxxxxxx>

===== fs/sysfs/bin.c 1.20 vs edited =====
--- 1.20/fs/sysfs/bin.c 2004-12-21 18:32:08 +01:00
+++ edited/fs/sysfs/bin.c 2005-01-26 20:56:07 +01:00
@@ -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 =====
--- 1.39/include/linux/sysfs.h 2004-12-21 18:31:01 +01:00
+++ edited/include/linux/sysfs.h 2005-01-26 20:34:01 +01:00
@@ -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);
};

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/