Skip to contentSkip to conversation

move struct disk_attribute to genhd.h

RFC New Greg KH 1 participant 1 message Jan 11, 2005

Subsystems (2)
lore
Share & tools
lore

Greg KH

author
#0 lore raw

RFC 1/1 move struct disk_attribute to genhd.h

Hi,

Any complaints about me sending this patch onward? It's needed for drivers to put sysfs attributes in their block device subdirectory, like the aoe driver does.

It's against the latest -bk tree.

diffstat:

 drivers/block/aoe/aoeblk.c |    9 +--------
 drivers/block/genhd.c      |    6 ------
 include/linux/genhd.h      |    6 ++++++
 3 files changed, 7 insertions(+), 14 deletions(-)

thanks,

greg k-h

-----

Block: move struct disk_attribute to genhd.h

This allows other block devices to add attributes to their sysfs entries.

drivers/block/genhd.c +0 -6
@@ -322,12 +315,6 @@ subsys_initcall(device_init);
 /*
  * kobject & sysfs bindings for block devices
  */
-
-struct disk_attribute {
-	struct attribute attr;
-	ssize_t (*show)(struct gendisk *, char *);
-};
-
 static ssize_t disk_attr_show(struct kobject *kobj, struct attribute *attr,
 			      char *page)
 {
drivers/block/aoe/aoeblk.c +1 -8
@@ -12,14 +12,7 @@
 #include <linux/netdevice.h>
 #include "aoe.h"
 
-/* add attributes for our block devices in sysfs
- * (see drivers/block/genhd.c:disk_attr_show, etc.)
- */
-struct disk_attribute {
-	struct attribute attr;
-	ssize_t (*show)(struct gendisk *, char *);
-};
-
+/* add attributes for our block devices in sysfs */
 static ssize_t aoedisk_show_state(struct gendisk * disk, char *page)
 {
 	struct aoedev *d = disk->private_data;
include/linux/genhd.h +6 -0
@@ -128,6 +128,12 @@ struct gendisk {
 #endif
 };
 
+/* Structure for sysfs attributes on block devices */
+struct disk_attribute {
+	struct attribute attr;
+	ssize_t (*show)(struct gendisk *, char *);
+};
+
 /* 
  * Macros to operate on percpu disk statistics:
  *