lkml.org 
[lkml]   [2010]   [Feb]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 05/14] blktrans: allow FTL drivers to export sysfs attributes
    Date
    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>
    ---
    drivers/mtd/mtd_blkdevs.c | 9 +++++++++
    include/linux/mtd/blktrans.h | 2 ++
    2 files changed, 11 insertions(+), 0 deletions(-)

    diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c
    index 1bc9c76..6850091 100644
    --- a/drivers/mtd/mtd_blkdevs.c
    +++ b/drivers/mtd/mtd_blkdevs.c
    @@ -359,6 +359,11 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new)

    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);
    @@ -387,6 +392,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);

    diff --git a/include/linux/mtd/blktrans.h b/include/linux/mtd/blktrans.h
    index d89b8fb..b481ccd 100644
    --- a/include/linux/mtd/blktrans.h
    +++ b/include/linux/mtd/blktrans.h
    @@ -10,6 +10,7 @@

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

    struct hd_geometry;
    struct mtd_info;
    @@ -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;
    --
    1.6.3.3


    \
     
     \ /
      Last update: 2010-02-17 22:55    [W:0.021 / U:61.580 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site