From patchwork Thu Feb 4 23:30:47 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Levitsky X-Patchwork-Id: 44565 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 3F105B7D30 for ; Fri, 5 Feb 2010 10:33:11 +1100 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1NdBAe-0007DC-Fd; Thu, 04 Feb 2010 23:31:36 +0000 Received: from fg-out-1718.google.com ([72.14.220.157]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1NdBAW-00078M-EV for linux-mtd@lists.infradead.org; Thu, 04 Feb 2010 23:31:35 +0000 Received: by fg-out-1718.google.com with SMTP id 22so15525fge.0 for ; Thu, 04 Feb 2010 15:31:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=Ti8vPsHRnmtuqwZXJqn4XWzuV4bHPYp8JZnZqXDezA4=; b=cZnPkR1o8VznR/P6DuyLB1z59cCTYcwIcDf/OAbb1Y1OKqdaxD7e3Zv6LBJ7ruyexK 3KRuojWiH/rFNF3p5uiKqI9dhJGsIAMwx/EH1y8uVPlsBMVS3B256rsknSky1chlSZ29 hyVxwMSBf+6o6dv+aHc0YARnl+Tpvr0eSEkVM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=JCQuBQbuZj38Pgo6Vg6m6WlCA2dQryLXFyeMZjSQPy/xka37eBduNI/ezC4/aAaZ5H ZiFgq6RhYEX6KCGR2u270UnNPDnpSgaTfUxxyLLf7q2iy7Graj/QV+EjO2VIQJXDQNov yz29uxdvD/frCJlhLEWZS1KrDL39nu6CUv/dQ= Received: by 10.102.207.40 with SMTP id e40mr1218843mug.86.1265326287060; Thu, 04 Feb 2010 15:31:27 -0800 (PST) Received: from localhost.localdomain (IGLD-84-229-248-49.inter.net.il [84.229.248.49]) by mx.google.com with ESMTPS id u9sm3865749muf.18.2010.02.04.15.31.25 (version=SSLv3 cipher=RC4-MD5); Thu, 04 Feb 2010 15:31:26 -0800 (PST) From: Maxim Levitsky To: David Woodhouse Subject: [PATCH 07/17] blktrans: allow FTL drivers to export sysfs attributes Date: Fri, 5 Feb 2010 01:30:47 +0200 Message-Id: <1265326257-4446-8-git-send-email-maximlevitsky@gmail.com> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <1265326257-4446-1-git-send-email-maximlevitsky@gmail.com> References: <1265326257-4446-1-git-send-email-maximlevitsky@gmail.com> X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20100204_183128_620614_CD05D95A X-CRM114-Status: GOOD ( 16.97 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.2.5 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- _SUMMARY_ Cc: Maxim Levitsky , Alex Dubov , Artem Bityutskiy , joern , linux-kernel , linux-mtd , Thomas Gleixner X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This patch add ability to export sysfs attributes below block disk device. This can be used to pass UDEV information about the FTL and could include vendor, serial, version, etc... Signed-off-by: Maxim Levitsky --- drivers/mtd/mtd_blkdevs.c | 11 ++++++++++- include/linux/mtd/blktrans.h | 2 ++ 2 files changed, 12 insertions(+), 1 deletions(-) diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c index 9992b2d..ac9d3f5 100644 --- a/drivers/mtd/mtd_blkdevs.c +++ b/drivers/mtd/mtd_blkdevs.c @@ -316,7 +316,6 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new) set_capacity(gd, (new->size * tr->blksize) >> 9); - /* Create the request queue */ spin_lock_init(&new->queue_lock); new->rq = blk_init_queue(mtd_blktrans_request, &new->queue_lock); @@ -349,6 +348,11 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new) new->open = 0; add_disk(gd); + if (new->disk_attributes) + sysfs_create_group(&disk_to_dev(gd)->kobj, + new->disk_attributes); + + return 0; error4: blk_cleanup_queue(new->rq); @@ -375,6 +379,11 @@ 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); + /* flush current requests */ spin_lock_irqsave(&old->queue_lock, flags); old->deleted = 1; diff --git a/include/linux/mtd/blktrans.h b/include/linux/mtd/blktrans.h index e276aca..faf1e54 100644 --- a/include/linux/mtd/blktrans.h +++ b/include/linux/mtd/blktrans.h @@ -9,6 +9,7 @@ #define __MTD_TRANS_H__ #include +#include struct hd_geometry; struct mtd_info; @@ -27,6 +28,7 @@ struct mtd_blktrans_dev { int deleted; int open; struct gendisk *disk; + struct attribute_group *disk_attributes; struct task_struct *thread; struct request_queue *rq; spinlock_t queue_lock;