All of lore.kernel.org
 help / color / mirror / Atom feed
From: hujianyang <hujianyang@huawei.com>
To: linux-mtd <linux-mtd@lists.infradead.org>
Cc: Artem Bityutskiy <dedekind1@gmail.com>
Subject: [PATCH 2/7] Add new ioctl in userspace
Date: Mon, 7 Jul 2014 15:19:17 +0800	[thread overview]
Message-ID: <53BA49F5.5020605@huawei.com> (raw)
In-Reply-To: <53BA491E.8060502@huawei.com>

Add same ioctl in user space.


Signed-off-by: hujianyang <hujianyang@huawei.com>
---
 include/mtd/ubi-user.h | 15 +++++++++++++++
 ubi-utils/libubi.c     |  8 ++++++++
 2 files changed, 23 insertions(+)

diff --git a/include/mtd/ubi-user.h b/include/mtd/ubi-user.h
index 2b50dad..cc867a2 100644
--- a/include/mtd/ubi-user.h
+++ b/include/mtd/ubi-user.h
@@ -200,6 +200,8 @@
 #define UBI_IOCVOLCRBLK _IOW(UBI_VOL_IOC_MAGIC, 7, struct ubi_blkcreate_req)
 /* Remove the R/O block device */
 #define UBI_IOCVOLRMBLK _IO(UBI_VOL_IOC_MAGIC, 8)
+/* Dump LEB header */
+#define UBI_IOCEBDUMP _IOW(UBI_VOL_IOC_MAGIC, 9, struct ubi_ebdump_req)

 /* Maximum MTD device name length supported by UBI */
 #define MAX_UBI_MTD_NAME_LEN 127
@@ -437,4 +439,17 @@ struct ubi_blkcreate_req {
 	int8_t  padding[128];
 }  __attribute__((packed));

+/**
+ * struct ubi_ebdump_req - a data structure used in dump eraseblock header.
+ * @lnum: logical eraseblock num to dump
+ * @ec_hdr: ec_hdr to set
+ * @vid_hdr: vid_hdr to set
+ */
+struct ubi_ebdump_req {
+	int32_t lnum;
+	int32_t pnum;
+	char	ec_hdr[64];
+	char	vid_hdr[64];
+}  __attribute__((packed));
+
 #endif /* __UBI_USER_H__ */
diff --git a/ubi-utils/libubi.c b/ubi-utils/libubi.c
index 1e08b7d..39bfa1c 100644
--- a/ubi-utils/libubi.c
+++ b/ubi-utils/libubi.c
@@ -1123,6 +1123,14 @@ int ubi_vol_block_remove(int fd)
 	return ioctl(fd, UBI_IOCVOLRMBLK);
 }

+int ubi_leb_dump_header(libubi_t desc, int fd, struct ubi_ebdump_req *request)
+{
+	desc = desc;
+	if (ioctl(fd, UBI_IOCEBDUMP, request))
+		return -1;
+	return 0;
+}
+
 int ubi_update_start(libubi_t desc, int fd, long long bytes)
 {
 	desc = desc;
-- 
1.8.1.4

  parent reply	other threads:[~2014-07-07  7:20 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-07  7:15 [PATCH RFC] ubi-utils: Add a new utility ubidump hujianyang
2014-07-07  7:17 ` [PATCH 1/7] UBI: Add a new ioctl to support ubidump hujianyang
2014-07-16  7:59   ` Artem Bityutskiy
2014-07-16  8:47     ` hujianyang
2014-07-16 10:30       ` Artem Bityutskiy
2014-07-07  7:19 ` hujianyang [this message]
2014-07-07  7:20 ` [PATCH 3/7] Add ubifs-media.h hujianyang
2014-07-07  7:22 ` [PATCH 4/7] Add libubifs.h hujianyang
2014-07-07  7:24 ` [PATCH 5/7] Add libubifs.c hujianyang
2014-07-07  7:26 ` [PATCH 6/7] New utility ubidump hujianyang
2014-07-16  8:05   ` Artem Bityutskiy
2014-07-16  8:53     ` hujianyang
2014-07-16 10:37       ` Artem Bityutskiy
2014-07-16 11:27         ` hujianyang
2014-07-16 11:37           ` Artem Bityutskiy
2014-07-16 11:43           ` Artem Bityutskiy
2014-07-16 11:57             ` hujianyang
2014-07-21 16:20           ` Bill Pringlemeir
2014-07-22  8:15             ` hujianyang
2014-07-22 15:42               ` Bill Pringlemeir
2014-07-29  9:14               ` Artem Bityutskiy
2014-07-29 10:01                 ` hujianyang
2014-07-07  7:27 ` [PATCH 7/7] Compile support hujianyang

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=53BA49F5.5020605@huawei.com \
    --to=hujianyang@huawei.com \
    --cc=dedekind1@gmail.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.