public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: "Corentin Chary" <corentincj@iksaif.net>
To: linux-mtd@lists.infradead.org
Subject: [PATCH 3/3] UBI: is_mapped operation via ioctl
Date: Mon, 5 Jan 2009 15:07:19 +0100	[thread overview]
Message-ID: <71cd59b00901050607l4356c850y2be8ea93d8437fbd@mail.gmail.com> (raw)

From: Corentin Chary <corentincj@iksaif.net>

UBI: is_mapped operation via ioctl

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
---
 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 _IOW(UBI_VOL_IOC_MAGIC, 5, int32_t)

 /* Maximum MTD device name length supported by UBI */
 #define MAX_UBI_MTD_NAME_LEN 127
-- 
1.6.0.6

             reply	other threads:[~2009-01-05 14:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-05 14:07 Corentin Chary [this message]
2009-01-05 14:33 ` [PATCH 3/3] UBI: is_mapped operation via ioctl Artem Bityutskiy
2009-01-06  9:25   ` Corentin Chary
2009-01-06 11:58     ` Artem Bityutskiy
  -- strict thread matches above, loose matches on Subject: below --
2009-01-07  9:22 [PATCH 0/3] Export UBI map/unmap/is_mapped in userspace v2 Corentin Chary
2009-01-07  9:29 ` [PATCH 3/3] UBI: is_mapped operation via ioctl Corentin Chary

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=71cd59b00901050607l4356c850y2be8ea93d8437fbd@mail.gmail.com \
    --to=corentincj@iksaif.net \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox