linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fix the sysfs_add_file_to_group interfaces
@ 2008-01-03  0:44 James Bottomley
  2008-01-12  5:11 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: James Bottomley @ 2008-01-03  0:44 UTC (permalink / raw)
  To: Greg KH, Kay Sievers; +Cc: linux-kernel, linux-scsi

I can't see a reason why these shouldn't work on every group.  However,
they only seem to work on named groups.  This patch allows the group
functions to work on anonymous groups (those with NULL names).

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>

---

Again, this is something that's needed by the code to convert the SCSI
transport classes to groups (because we currently have the attributes
set up as anonymous groups on class devices).  So, taking this via the
SCSI tree would be appreciated.

Thanks,

James

diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index 4045bdc..b834f17 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -568,7 +568,11 @@ int sysfs_add_file_to_group(struct kobject *kobj,
 	struct sysfs_dirent *dir_sd;
 	int error;
 
-	dir_sd = sysfs_get_dirent(kobj->sd, group);
+	if (group)
+		dir_sd = sysfs_get_dirent(kobj->sd, group);
+	else
+		dir_sd = sysfs_get(kobj->sd);
+
 	if (!dir_sd)
 		return -ENOENT;
 
@@ -656,7 +660,10 @@ void sysfs_remove_file_from_group(struct kobject *kobj,
 {
 	struct sysfs_dirent *dir_sd;
 
-	dir_sd = sysfs_get_dirent(kobj->sd, group);
+	if (group)
+		dir_sd = sysfs_get_dirent(kobj->sd, group);
+	else
+		dir_sd = sysfs_get(kobj->sd);
 	if (dir_sd) {
 		sysfs_hash_and_remove(dir_sd, attr->name);
 		sysfs_put(dir_sd);



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

* Re: [PATCH] fix the sysfs_add_file_to_group interfaces
  2008-01-03  0:44 [PATCH] fix the sysfs_add_file_to_group interfaces James Bottomley
@ 2008-01-12  5:11 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2008-01-12  5:11 UTC (permalink / raw)
  To: James Bottomley; +Cc: Kay Sievers, linux-kernel, linux-scsi

On Wed, Jan 02, 2008 at 06:44:05PM -0600, James Bottomley wrote:
> I can't see a reason why these shouldn't work on every group.  However,
> they only seem to work on named groups.  This patch allows the group
> functions to work on anonymous groups (those with NULL names).
> 
> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>

Feel free to add:
	Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
and take it through your tree.

thanks,

greg k-h

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

end of thread, other threads:[~2008-01-12  5:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-03  0:44 [PATCH] fix the sysfs_add_file_to_group interfaces James Bottomley
2008-01-12  5:11 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).