From patchwork Wed Feb 17 21:49:15 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Levitsky X-Patchwork-Id: 45674 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 8A75DB7CFA for ; Thu, 18 Feb 2010 08:51:32 +1100 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1NhrmN-0005VZ-VR; Wed, 17 Feb 2010 21:49:56 +0000 Received: from fg-out-1718.google.com ([72.14.220.152]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1NhrmC-0005Fx-Ft for linux-mtd@lists.infradead.org; Wed, 17 Feb 2010 21:49:52 +0000 Received: by fg-out-1718.google.com with SMTP id e21so180865fga.0 for ; Wed, 17 Feb 2010 13:49:44 -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=NAr1Uziq+WxHvROO2SaU57jbLOzRYYgZNwwjwWzZ6yw=; b=CDeSSTaYNSVVxvgBq5i8MPYMYdrn+Ab1Z7bLRP/03NoJN6CziHPdTMz7QzokHQROv+ VZ8wI8D/PlzMYlaMoibQqjL3lk3xAevHN10KGwOtDHVQHdiLWADOii7N/RyNow/eKyZG hmw3VbWBQmRCUI64NCSOAfkpWd1H093tyktDQ= 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=dRCybW8DNX/2k0IJ/9+a6ZxiFxwFhPxzi+b1Y7Qep6lRGM+toxfjek1glRjohpjRca A4hZJAri2v7EriktZ1CWBhkbm8pq1sQfrNZwFHd3GAHNLg0E3sd0AChBGUKC/ioilwIe WjRibywwJLku3hh9yZZqABY4wVBhKeoXH1flg= Received: by 10.87.69.20 with SMTP id w20mr6036246fgk.78.1266443384170; Wed, 17 Feb 2010 13:49:44 -0800 (PST) Received: from localhost.localdomain ([77.126.218.27]) by mx.google.com with ESMTPS id d4sm3096749fga.8.2010.02.17.13.49.41 (version=SSLv3 cipher=RC4-MD5); Wed, 17 Feb 2010 13:49:43 -0800 (PST) From: Maxim Levitsky To: David Woodhouse Subject: [PATCH 05/14] blktrans: allow FTL drivers to export sysfs attributes Date: Wed, 17 Feb 2010 23:49:15 +0200 Message-Id: <1266443364-4538-6-git-send-email-maximlevitsky@gmail.com> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <1266443364-4538-1-git-send-email-maximlevitsky@gmail.com> References: <1266443364-4538-1-git-send-email-maximlevitsky@gmail.com> X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20100217_164944_815553_05AB6619 X-CRM114-Status: GOOD ( 17.80 ) 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 , Vitaly Wool , linux-kernel , "stanley.miao" , 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 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 --- 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 #include +#include 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;