Skip to content

Commit

Permalink
mtd: blktrans: allow FTL drivers to export sysfs attributes
Browse files Browse the repository at this point in the history
This patch adds an ability to export sysfs attributes below
the block disk device.

This can be used to pass the udev an information about the FTL
and could include the vendor, serial, version, etc...

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
Maxim Levitsky authored and David Woodhouse committed Feb 26, 2010
1 parent 75c0b84 commit 026ec57
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/mtd/mtd_blkdevs.c
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,10 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new)
set_disk_ro(gd, 1);

add_disk(gd);

if (new->disk_attributes)
sysfs_create_group(&disk_to_dev(gd)->kobj,
new->disk_attributes);
return 0;
error4:
module_put(tr->owner);
Expand All @@ -405,6 +409,10 @@ int del_mtd_blktrans_dev(struct mtd_blktrans_dev *old)
/* Stop new requests to arrive */
del_gendisk(old->disk);

if (old->disk_attributes)
sysfs_remove_group(&disk_to_dev(old->disk)->kobj,
old->disk_attributes);

/* Stop the thread */
kthread_stop(old->thread);

Expand Down
2 changes: 2 additions & 0 deletions include/linux/mtd/blktrans.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include <linux/mutex.h>
#include <linux/kref.h>
#include <linux/sysfs.h>

struct hd_geometry;
struct mtd_info;
Expand All @@ -28,6 +29,7 @@ struct mtd_blktrans_dev {
int open;
struct kref ref;
struct gendisk *disk;
struct attribute_group *disk_attributes;
struct task_struct *thread;
struct request_queue *rq;
spinlock_t queue_lock;
Expand Down

0 comments on commit 026ec57

Please sign in to comment.