From patchwork Wed Jan 7 09:29:18 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Chary X-Patchwork-Id: 17080 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@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 4B6DB474C1 for ; Wed, 7 Jan 2009 21:01:39 +1100 (EST) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.68 #1 (Red Hat Linux)) id 1LKVCP-0005EO-J7; Wed, 07 Jan 2009 09:59:41 +0000 Received: from fg-out-1718.google.com ([72.14.220.153]) by bombadil.infradead.org with esmtp (Exim 4.68 #1 (Red Hat Linux)) id 1LKUmx-0001au-TW for linux-mtd@lists.infradead.org; Wed, 07 Jan 2009 09:33:24 +0000 Received: by fg-out-1718.google.com with SMTP id 13so957453fge.26 for ; Wed, 07 Jan 2009 01:33:23 -0800 (PST) Received: by 10.86.74.4 with SMTP id w4mr13425663fga.2.1231320803137; Wed, 07 Jan 2009 01:33:23 -0800 (PST) Received: from iit-chary_c.localnet (cxr69-11-88-180-139-205.fbx.proxad.net [88.180.139.205]) by mx.google.com with ESMTPS id d4sm20689208fga.51.2009.01.07.01.33.22 (version=SSLv3 cipher=RC4-MD5); Wed, 07 Jan 2009 01:33:22 -0800 (PST) From: Corentin Chary To: linux-mtd@lists.infradead.org Subject: [PATCH 3/3] UBI: is_mapped operation via ioctl Date: Wed, 7 Jan 2009 10:29:18 +0100 User-Agent: KMail/1.10.92 (Linux/2.6.28-gentoo; KDE/4.1.87; x86_64; ; ) References: <200901071022.46343.corentincj@iksaif.net> In-Reply-To: <200901071022.46343.corentincj@iksaif.net> MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200901071029.18625.corentincj@iksaif.net> X-Bad-Reply: References and In-Reply-To but no 'Re:' in Subject. X-Spam-Score: 0.0 (/) X-Mailman-Approved-At: Wed, 07 Jan 2009 04:59:38 -0500 X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org >From dbccb9a0ed4d9b9b45cbad2d13432bad6e9ca886 Mon Sep 17 00:00:00 2001 From: Corentin Chary Date: Mon, 5 Jan 2009 14:48:59 +0100 UBI: is_mapped operation via ioctl Signed-off-by: Corentin Chary --- drivers/mtd/ubi/cdev.c | 12 ++++++++++++ include/mtd/ubi-user.h | 2 ++ 2 files changed, 14 insertions(+), 0 deletions(-) diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c index 7a9080c..1bf21eb 100644 --- a/drivers/mtd/ubi/cdev.c +++ b/drivers/mtd/ubi/cdev.c @@ -542,6 +542,18 @@ static int vol_cdev_ioctl(struct inode *inode, struct file *file, err = ubi_leb_unmap(desc, lnum); break; } + case UBI_IOISMAP: + { + int32_t lnum; + + err = get_user(lnum, (__user int32_t *)argp); + if (err) { + err = -EFAULT; + break; + } + err = ubi_is_mapped(desc, lnum); + break; + } #endif diff --git a/include/mtd/ubi-user.h b/include/mtd/ubi-user.h index bcff3a0..a65c4ab 100644 --- a/include/mtd/ubi-user.h +++ b/include/mtd/ubi-user.h @@ -137,6 +137,8 @@ #define UBI_IOMAP _IOW(UBI_VOL_IOC_MAGIC, 3, struct ubi_map_req) /* Unmap an eraseblock */ #define UBI_IOUNMAP _IOW(UBI_VOL_IOC_MAGIC, 4, int32_t) +/* Check whether an eraseblock is mapped */ +#define UBI_IOISMAP _IOR(UBI_VOL_IOC_MAGIC, 5, int32_t) /* Maximum MTD device name length supported by UBI */ #define MAX_UBI_MTD_NAME_LEN 127