public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] sysfs: export the vfs release call of binary attribute
@ 2005-01-27 20:19 Kay Sievers
  2005-01-27 20:34 ` Kay Sievers
  0 siblings, 1 reply; 4+ messages in thread
From: Kay Sievers @ 2005-01-27 20:19 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg KH

Initialize the allocated bin_attribute structure, otherwise unused fields
are pointing to random places.

Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>

===== drivers/pci/pci-sysfs.c 1.16 vs edited =====
--- 1.16/drivers/pci/pci-sysfs.c	2005-01-06 21:30:29 +01:00
+++ edited/drivers/pci/pci-sysfs.c	2005-01-27 21:05:35 +01:00
@@ -435,6 +435,7 @@ int pci_create_sysfs_dev_files (struct p
 		struct bin_attribute *rom_attr;
 		
 		rom_attr = kmalloc(sizeof(*rom_attr), GFP_ATOMIC);
+		memset(rom_attr, 0x00, sizeof(*rom_attr));
 		if (rom_attr) {
 			pdev->rom_attr = rom_attr;
 			rom_attr->size = pci_resource_len(pdev, PCI_ROM_RESOURCE);


^ permalink raw reply	[flat|nested] 4+ messages in thread
* [PATCH] sysfs: export the vfs release call of binary attribute
@ 2005-01-27 10:07 Kay Sievers
  0 siblings, 0 replies; 4+ messages in thread
From: Kay Sievers @ 2005-01-27 10:07 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg KH

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@vrfy.org>

===== 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);
 };


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-02-01  0:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-27 20:19 [PATCH] sysfs: export the vfs release call of binary attribute Kay Sievers
2005-01-27 20:34 ` Kay Sievers
2005-02-01  0:15   ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2005-01-27 10:07 Kay Sievers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox