* [PATCH 1/4] flash_info: convert to common.h
@ 2011-06-06 18:22 Mike Frysinger
2011-06-06 18:22 ` [PATCH 2/4] flash_info: allow people to get info on multiple devices Mike Frysinger
` (3 more replies)
0 siblings, 4 replies; 16+ messages in thread
From: Mike Frysinger @ 2011-06-06 18:22 UTC (permalink / raw)
To: linux-mtd
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
flash_info.c | 27 +++++++++++++++++----------
1 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/flash_info.c b/flash_info.c
index f8b7efa..d4887da 100644
--- a/flash_info.c
+++ b/flash_info.c
@@ -12,24 +12,31 @@
#include <sys/ioctl.h>
#include <sys/mount.h>
+#include "common.h"
#include <mtd/mtd-user.h>
+static void usage(int status)
+{
+ fprintf(status ? stderr : stdout,
+ "Usage: %s <device>\n",
+ PROGRAM_NAME);
+ exit(status);
+}
+
int main(int argc, char *argv[])
{
int regcount;
int fd;
- if (1 >= argc) {
- fprintf(stderr, "Usage: %s device\n", PROGRAM_NAME);
- return 16;
- }
+ if (argc < 2)
+ usage(1);
+ if (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help"))
+ usage(0);
/* Open and size the device */
fd = open(argv[1], O_RDONLY);
- if (fd < 0) {
- fprintf(stderr, "File open error\n");
- return 8;
- }
+ if (fd < 0)
+ sys_errmsg_die("could not open: %s", argv[1]);
if (ioctl(fd, MEMGETREGIONCOUNT, ®count) == 0) {
int i;
@@ -42,8 +49,8 @@ int main(int argc, char *argv[])
"has 0x%x blocks\n", i, reginfo.offset,
reginfo.erasesize, reginfo.numblocks);
} else {
- printf("Strange can not read region %d from a %d region device\n",
- i, regcount);
+ warnmsg("can not read region %d from a %d region device",
+ i, regcount);
}
}
}
--
1.7.5.3
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 2/4] flash_info: allow people to get info on multiple devices
2011-06-06 18:22 [PATCH 1/4] flash_info: convert to common.h Mike Frysinger
@ 2011-06-06 18:22 ` Mike Frysinger
2011-06-06 18:22 ` [PATCH 3/4] include/mtd: sync with kernel Mike Frysinger
` (2 subsequent siblings)
3 siblings, 0 replies; 16+ messages in thread
From: Mike Frysinger @ 2011-06-06 18:22 UTC (permalink / raw)
To: linux-mtd
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
flash_info.c | 36 +++++++++++++++++++++---------------
1 files changed, 21 insertions(+), 15 deletions(-)
diff --git a/flash_info.c b/flash_info.c
index d4887da..6c518b2 100644
--- a/flash_info.c
+++ b/flash_info.c
@@ -18,39 +18,45 @@
static void usage(int status)
{
fprintf(status ? stderr : stdout,
- "Usage: %s <device>\n",
+ "Usage: %s <device> [devices]\n",
PROGRAM_NAME);
exit(status);
}
int main(int argc, char *argv[])
{
- int regcount;
- int fd;
+ int fd, i, regcount;
if (argc < 2)
usage(1);
if (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help"))
usage(0);
- /* Open and size the device */
- fd = open(argv[1], O_RDONLY);
- if (fd < 0)
- sys_errmsg_die("could not open: %s", argv[1]);
-
- if (ioctl(fd, MEMGETREGIONCOUNT, ®count) == 0) {
- int i;
+ for (i = 1; i < argc; ++i) {
+ const char *dev = argv[i];
+ int r;
region_info_t reginfo;
- printf("Device %s has %d erase regions\n", argv[1], regcount);
- for (i = 0; i < regcount; i++) {
- reginfo.regionindex = i;
+
+ /* Open and size the device */
+ fd = open(dev, O_RDONLY);
+ if (fd < 0) {
+ sys_errmsg("could not open: %s", dev);
+ continue;
+ }
+
+ if (ioctl(fd, MEMGETREGIONCOUNT, ®count))
+ continue;
+
+ printf("%s: %d erase regions\n", dev, regcount);
+ for (r = 0; r < regcount; ++r) {
+ reginfo.regionindex = r;
if (ioctl(fd, MEMGETREGIONINFO, ®info) == 0) {
printf("Region %d is at 0x%x with size 0x%x and "
- "has 0x%x blocks\n", i, reginfo.offset,
+ "has 0x%x blocks\n", r, reginfo.offset,
reginfo.erasesize, reginfo.numblocks);
} else {
warnmsg("can not read region %d from a %d region device",
- i, regcount);
+ r, regcount);
}
}
}
--
1.7.5.3
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 3/4] include/mtd: sync with kernel
2011-06-06 18:22 [PATCH 1/4] flash_info: convert to common.h Mike Frysinger
2011-06-06 18:22 ` [PATCH 2/4] flash_info: allow people to get info on multiple devices Mike Frysinger
@ 2011-06-06 18:22 ` Mike Frysinger
2011-06-06 18:47 ` Brian Norris
2011-06-06 18:22 ` [PATCH 4/4] flash_info: display MEMGETINFO and MEMISLOCKED Mike Frysinger
2011-06-07 4:31 ` [PATCH 1/4] flash_info: convert to common.h Artem Bityutskiy
3 siblings, 1 reply; 16+ messages in thread
From: Mike Frysinger @ 2011-06-06 18:22 UTC (permalink / raw)
To: linux-mtd
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
include/mtd/mtd-abi.h | 34 ++++++++++++++++++++++++++++------
include/mtd/mtd-user.h | 19 ++++++++++++++++---
2 files changed, 44 insertions(+), 9 deletions(-)
diff --git a/include/mtd/mtd-abi.h b/include/mtd/mtd-abi.h
index c6954ed..a86364a 100644
--- a/include/mtd/mtd-abi.h
+++ b/include/mtd/mtd-abi.h
@@ -1,5 +1,20 @@
/*
- * Portions of MTD ABI definition which are shared by kernel and user space
+ * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org> et al.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
*/
#ifndef __MTD_ABI_H__
@@ -37,6 +52,7 @@ struct mtd_oob_buf64 {
#define MTD_NANDFLASH 4
#define MTD_DATAFLASH 6
#define MTD_UBIVOLUME 7
+#define MTD_MLCNANDFLASH 8
#define MTD_WRITEABLE 0x400 /* Device is writeable */
#define MTD_BIT_WRITEABLE 0x800 /* Single bits can be flipped */
@@ -104,12 +120,13 @@ struct otp_info {
#define OTPGETREGIONCOUNT _IOW('M', 14, int)
#define OTPGETREGIONINFO _IOW('M', 15, struct otp_info)
#define OTPLOCK _IOR('M', 16, struct otp_info)
-#define ECCGETLAYOUT _IOR('M', 17, struct nand_ecclayout)
+#define ECCGETLAYOUT _IOR('M', 17, struct nand_ecclayout_user)
#define ECCGETSTATS _IOR('M', 18, struct mtd_ecc_stats)
#define MTDFILEMODE _IO('M', 19)
#define MEMERASE64 _IOW('M', 20, struct erase_info_user64)
#define MEMWRITEOOB64 _IOWR('M', 21, struct mtd_oob_buf64)
#define MEMREADOOB64 _IOWR('M', 22, struct mtd_oob_buf64)
+#define MEMISLOCKED _IOR('M', 23, struct erase_info_user)
/*
* Obsolete legacy interface. Keep it in order not to break userspace
@@ -128,13 +145,18 @@ struct nand_oobfree {
};
#define MTD_MAX_OOBFREE_ENTRIES 8
+#define MTD_MAX_ECCPOS_ENTRIES 64
/*
- * ECC layout control structure. Exported to userspace for
- * diagnosis and to allow creation of raw images
+ * OBSOLETE: ECC layout control structure. Exported to user-space via ioctl
+ * ECCGETLAYOUT for backwards compatbility and should not be mistaken as a
+ * complete set of ECC information. The ioctl truncates the larger internal
+ * structure to retain binary compatibility with the static declaration of the
+ * ioctl. Note that the "MTD_MAX_..._ENTRIES" macros represent the max size of
+ * the user struct, not the MAX size of the internal struct nand_ecclayout.
*/
-struct nand_ecclayout {
+struct nand_ecclayout_user {
__u32 eccbytes;
- __u32 eccpos[64];
+ __u32 eccpos[MTD_MAX_ECCPOS_ENTRIES];
__u32 oobavail;
struct nand_oobfree oobfree[MTD_MAX_OOBFREE_ENTRIES];
};
diff --git a/include/mtd/mtd-user.h b/include/mtd/mtd-user.h
index 713f34d..83327c8 100644
--- a/include/mtd/mtd-user.h
+++ b/include/mtd/mtd-user.h
@@ -1,7 +1,20 @@
/*
- * $Id: mtd-user.h,v 1.2 2004/05/05 14:44:57 dwmw2 Exp $
+ * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
- * MTD ABI header for use by user space only.
*/
#ifndef __MTD_USER_H__
@@ -16,6 +29,6 @@ typedef struct mtd_info_user mtd_info_t;
typedef struct erase_info_user erase_info_t;
typedef struct region_info_user region_info_t;
typedef struct nand_oobinfo nand_oobinfo_t;
-typedef struct nand_ecclayout nand_ecclayout_t;
+typedef struct nand_ecclayout_user nand_ecclayout_t;
#endif /* __MTD_USER_H__ */
--
1.7.5.3
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 4/4] flash_info: display MEMGETINFO and MEMISLOCKED
2011-06-06 18:22 [PATCH 1/4] flash_info: convert to common.h Mike Frysinger
2011-06-06 18:22 ` [PATCH 2/4] flash_info: allow people to get info on multiple devices Mike Frysinger
2011-06-06 18:22 ` [PATCH 3/4] include/mtd: sync with kernel Mike Frysinger
@ 2011-06-06 18:22 ` Mike Frysinger
2011-06-07 5:01 ` Artem Bityutskiy
2011-06-07 4:31 ` [PATCH 1/4] flash_info: convert to common.h Artem Bityutskiy
3 siblings, 1 reply; 16+ messages in thread
From: Mike Frysinger @ 2011-06-06 18:22 UTC (permalink / raw)
To: linux-mtd
I found the existing flash_info output to be a little lacking, so
add decoders for MEMGETINFO and MEMISLOCKED.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
flash_info.c | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 87 insertions(+), 11 deletions(-)
diff --git a/flash_info.c b/flash_info.c
index 6c518b2..0e056f3 100644
--- a/flash_info.c
+++ b/flash_info.c
@@ -23,6 +23,52 @@ static void usage(int status)
exit(status);
}
+#define T(t) [MTD_##t] = #t
+static const char * const mtdtypes[] = {
+ T(ABSENT),
+ T(RAM),
+ T(ABSENT),
+ T(RAM),
+ T(ROM),
+ T(NORFLASH),
+ T(NANDFLASH),
+ T(DATAFLASH),
+ T(UBIVOLUME),
+};
+static const char *mtdtype(int type)
+{
+ if (type < ARRAY_SIZE(mtdtypes) && mtdtypes[type])
+ return mtdtypes[type];
+ return "UNKNOWN";
+}
+
+/* Show a pretty map of all the sectors on this device */
+static void show_sector_map(int fd, const region_info_t *reginfo)
+{
+ erase_info_t einfo;
+ int i, width;
+
+ printf(" sector map:\n");
+
+ einfo.length = reginfo->erasesize;
+ /* figure out the number of spaces to pad w/out libm */
+ for (i = 1, width = 0; i < reginfo->numblocks; i *= 10, ++width)
+ continue;
+
+ for (i = 0; i < reginfo->numblocks; ++i) {
+ einfo.start = reginfo->offset + i * reginfo->erasesize;
+ printf(" %*i: %08x ", width, i, einfo.start);
+ if (ioctl(fd, MEMISLOCKED, &einfo))
+ printf("RO ");
+ else
+ printf(" ");
+ if (((i + 1) % 4) == 0)
+ printf("\n");
+ }
+ if (i % 4)
+ printf("\n");
+}
+
int main(int argc, char *argv[])
{
int fd, i, regcount;
@@ -36,6 +82,7 @@ int main(int argc, char *argv[])
const char *dev = argv[i];
int r;
region_info_t reginfo;
+ mtd_info_t mtdinfo;
/* Open and size the device */
fd = open(dev, O_RDONLY);
@@ -44,20 +91,49 @@ int main(int argc, char *argv[])
continue;
}
- if (ioctl(fd, MEMGETREGIONCOUNT, ®count))
+ /* Print out general device info first */
+ if (ioctl(fd, MEMGETINFO, &mtdinfo)) {
+ sys_errmsg("could not get mtd info: %s", dev);
continue;
+ }
+
+ printf("%s: type: %i (%s)\n flags: %#x ( ",
+ dev, mtdinfo.type, mtdtype(mtdinfo.type), mtdinfo.flags);
+ if (mtdinfo.flags & MTD_POWERUP_LOCK)
+ printf("powerup_lock ");
+ if (mtdinfo.flags & MTD_NO_ERASE)
+ printf("no_erase ");
+ if (mtdinfo.flags & MTD_BIT_WRITEABLE)
+ printf("bit_writeable ");
+ if (mtdinfo.flags & MTD_WRITEABLE)
+ printf("writeable ");
+ printf(")\n sizes: total %#x write %#x erase %#x oob %#x\n",
+ mtdinfo.size, mtdinfo.writesize,
+ mtdinfo.erasesize, mtdinfo.oobsize);
- printf("%s: %d erase regions\n", dev, regcount);
- for (r = 0; r < regcount; ++r) {
- reginfo.regionindex = r;
- if (ioctl(fd, MEMGETREGIONINFO, ®info) == 0) {
- printf("Region %d is at 0x%x with size 0x%x and "
- "has 0x%x blocks\n", r, reginfo.offset,
- reginfo.erasesize, reginfo.numblocks);
- } else {
- warnmsg("can not read region %d from a %d region device",
- r, regcount);
+ /* Print out the region info (if the device has any) */
+ if (ioctl(fd, MEMGETREGIONCOUNT, ®count) == 0) {
+ printf(" erase regions: %i\n", regcount);
+ for (r = 0; r < regcount; ++r) {
+ reginfo.regionindex = r;
+ if (ioctl(fd, MEMGETREGIONINFO, ®info) == 0) {
+ printf(" region %i: offset: %#x size: %#x numblocks: %#x\n",
+ r, reginfo.offset, reginfo.erasesize,
+ reginfo.numblocks);
+ show_sector_map(fd, ®info);
+ } else
+ warnmsg(" region %i: can not read region info!?", r);
}
+ } else
+ regcount = 0;
+
+ /* If the flash has no regions, then show the whole thing */
+ if (regcount == 0) {
+ reginfo.offset = 0;
+ reginfo.erasesize = mtdinfo.erasesize;
+ reginfo.numblocks = mtdinfo.size / mtdinfo.erasesize,
+ reginfo.regionindex = 0;
+ show_sector_map(fd, ®info);
}
}
--
1.7.5.3
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH 3/4] include/mtd: sync with kernel
2011-06-06 18:22 ` [PATCH 3/4] include/mtd: sync with kernel Mike Frysinger
@ 2011-06-06 18:47 ` Brian Norris
0 siblings, 0 replies; 16+ messages in thread
From: Brian Norris @ 2011-06-06 18:47 UTC (permalink / raw)
To: Mike Frysinger; +Cc: linux-mtd
On Mon, Jun 6, 2011 at 11:22 AM, Mike Frysinger <vapier@gentoo.org> wrote:
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
I probably should have done this a while ago alongside the
ECCGETLAYOUT changes...
Acked-by: Brian Norris <computersforpeace@gmail.com>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 1/4] flash_info: convert to common.h
2011-06-06 18:22 [PATCH 1/4] flash_info: convert to common.h Mike Frysinger
` (2 preceding siblings ...)
2011-06-06 18:22 ` [PATCH 4/4] flash_info: display MEMGETINFO and MEMISLOCKED Mike Frysinger
@ 2011-06-07 4:31 ` Artem Bityutskiy
2011-06-07 4:41 ` Mike Frysinger
3 siblings, 1 reply; 16+ messages in thread
From: Artem Bityutskiy @ 2011-06-07 4:31 UTC (permalink / raw)
To: Mike Frysinger; +Cc: linux-mtd
On Mon, 2011-06-06 at 14:22 -0400, Mike Frysinger wrote:
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> ---
> flash_info.c | 27 +++++++++++++++++----------
> 1 files changed, 17 insertions(+), 10 deletions(-)
How about killing this utility completely and use mtdinfo from ubi-utils
instead? Yes, before creating mtdinfo I should have noticed flash_info,
but I did not. Did you look at mtdinfo?
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 1/4] flash_info: convert to common.h
2011-06-07 4:31 ` [PATCH 1/4] flash_info: convert to common.h Artem Bityutskiy
@ 2011-06-07 4:41 ` Mike Frysinger
2011-06-07 4:42 ` Artem Bityutskiy
0 siblings, 1 reply; 16+ messages in thread
From: Mike Frysinger @ 2011-06-07 4:41 UTC (permalink / raw)
To: dedekind1; +Cc: linux-mtd
On Tue, Jun 7, 2011 at 00:31, Artem Bityutskiy wrote:
> On Mon, 2011-06-06 at 14:22 -0400, Mike Frysinger wrote:
>> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
>> ---
>> flash_info.c | 27 +++++++++++++++++----------
>> 1 files changed, 17 insertions(+), 10 deletions(-)
>
> How about killing this utility completely and use mtdinfo from ubi-utils
> instead? Yes, before creating mtdinfo I should have noticed flash_info,
> but I did not. Did you look at mtdinfo?
didnt even notice it :P
if mtdinfo provides all the details that my new flash_info does, then
i dont care about punting it. be nice to merge my fixes before
deleting it though, otherwise i feel like i wasted quite a bit of time
for nothing ;).
-mike
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 1/4] flash_info: convert to common.h
2011-06-07 4:41 ` Mike Frysinger
@ 2011-06-07 4:42 ` Artem Bityutskiy
2011-06-07 4:45 ` Artem Bityutskiy
0 siblings, 1 reply; 16+ messages in thread
From: Artem Bityutskiy @ 2011-06-07 4:42 UTC (permalink / raw)
To: Mike Frysinger; +Cc: linux-mtd
On Tue, 2011-06-07 at 00:41 -0400, Mike Frysinger wrote:
> On Tue, Jun 7, 2011 at 00:31, Artem Bityutskiy wrote:
> > On Mon, 2011-06-06 at 14:22 -0400, Mike Frysinger wrote:
> >> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> >> ---
> >> flash_info.c | 27 +++++++++++++++++----------
> >> 1 files changed, 17 insertions(+), 10 deletions(-)
> >
> > How about killing this utility completely and use mtdinfo from ubi-utils
> > instead? Yes, before creating mtdinfo I should have noticed flash_info,
> > but I did not. Did you look at mtdinfo?
>
> didnt even notice it :P
>
> if mtdinfo provides all the details that my new flash_info does, then
> i dont care about punting it. be nice to merge my fixes before
> deleting it though, otherwise i feel like i wasted quite a bit of time
> for nothing ;).
I think it provides everything except of region information, which
flash_info provides :)
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 1/4] flash_info: convert to common.h
2011-06-07 4:42 ` Artem Bityutskiy
@ 2011-06-07 4:45 ` Artem Bityutskiy
2011-06-07 4:51 ` Mike Frysinger
0 siblings, 1 reply; 16+ messages in thread
From: Artem Bityutskiy @ 2011-06-07 4:45 UTC (permalink / raw)
To: Mike Frysinger; +Cc: linux-mtd
On Tue, 2011-06-07 at 07:42 +0300, Artem Bityutskiy wrote:
> On Tue, 2011-06-07 at 00:41 -0400, Mike Frysinger wrote:
> > On Tue, Jun 7, 2011 at 00:31, Artem Bityutskiy wrote:
> > > On Mon, 2011-06-06 at 14:22 -0400, Mike Frysinger wrote:
> > >> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> > >> ---
> > >> flash_info.c | 27 +++++++++++++++++----------
> > >> 1 files changed, 17 insertions(+), 10 deletions(-)
> > >
> > > How about killing this utility completely and use mtdinfo from ubi-utils
> > > instead? Yes, before creating mtdinfo I should have noticed flash_info,
> > > but I did not. Did you look at mtdinfo?
> >
> > didnt even notice it :P
> >
> > if mtdinfo provides all the details that my new flash_info does, then
> > i dont care about punting it. be nice to merge my fixes before
> > deleting it though, otherwise i feel like i wasted quite a bit of time
> > for nothing ;).
>
> I think it provides everything except of region information, which
> flash_info provides :)
And it does not show a map of sectors. May be we can add this to mtdinfo
instead?
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 1/4] flash_info: convert to common.h
2011-06-07 4:45 ` Artem Bityutskiy
@ 2011-06-07 4:51 ` Mike Frysinger
2011-06-07 5:01 ` Artem Bityutskiy
0 siblings, 1 reply; 16+ messages in thread
From: Mike Frysinger @ 2011-06-07 4:51 UTC (permalink / raw)
To: dedekind1; +Cc: linux-mtd
On Tue, Jun 7, 2011 at 00:45, Artem Bityutskiy wrote:
> On Tue, 2011-06-07 at 07:42 +0300, Artem Bityutskiy wrote:
>> On Tue, 2011-06-07 at 00:41 -0400, Mike Frysinger wrote:
>> > On Tue, Jun 7, 2011 at 00:31, Artem Bityutskiy wrote:
>> > > On Mon, 2011-06-06 at 14:22 -0400, Mike Frysinger wrote:
>> > >> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
>> > >> ---
>> > >> flash_info.c | 27 +++++++++++++++++----------
>> > >> 1 files changed, 17 insertions(+), 10 deletions(-)
>> > >
>> > > How about killing this utility completely and use mtdinfo from ubi-utils
>> > > instead? Yes, before creating mtdinfo I should have noticed flash_info,
>> > > but I did not. Did you look at mtdinfo?
>> >
>> > didnt even notice it :P
>> >
>> > if mtdinfo provides all the details that my new flash_info does, then
>> > i dont care about punting it. be nice to merge my fixes before
>> > deleting it though, otherwise i feel like i wasted quite a bit of time
>> > for nothing ;).
>>
>> I think it provides everything except of region information, which
>> flash_info provides :)
>
> And it does not show a map of sectors. May be we can add this to mtdinfo
> instead?
if you merge the patches i posted here, i'll see about extending
mtdinfo to include the new functionality and then i'll post another
patch to punt flash_info ;).
-mike
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 4/4] flash_info: display MEMGETINFO and MEMISLOCKED
2011-06-06 18:22 ` [PATCH 4/4] flash_info: display MEMGETINFO and MEMISLOCKED Mike Frysinger
@ 2011-06-07 5:01 ` Artem Bityutskiy
2011-06-07 5:05 ` Artem Bityutskiy
2011-06-07 5:14 ` Mike Frysinger
0 siblings, 2 replies; 16+ messages in thread
From: Artem Bityutskiy @ 2011-06-07 5:01 UTC (permalink / raw)
To: Mike Frysinger; +Cc: linux-mtd
On Mon, 2011-06-06 at 14:22 -0400, Mike Frysinger wrote:
> I found the existing flash_info output to be a little lacking, so
> add decoders for MEMGETINFO and MEMISLOCKED.
>
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> ---
> flash_info.c | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++------
> 1 files changed, 87 insertions(+), 11 deletions(-)
Pushed patches 1-3.
WRT this patch - I think the sector map should be a separate option,
because it outputs too much for a default option.
> + for (i = 0; i < reginfo->numblocks; ++i) {
> + einfo.start = reginfo->offset + i * reginfo->erasesize;
> + printf(" %*i: %08x ", width, i, einfo.start);
> + if (ioctl(fd, MEMISLOCKED, &einfo))
> + printf("RO ");
> + else
> + printf(" ");
MEMISLOCKED is quite new ioctl, so you should check for ENOTTY. E.g.,
with my stock Fedora 14 + nandsim I see all sectors as RO, which is
obviously not true.
Otherwise the patch looks very good.
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 1/4] flash_info: convert to common.h
2011-06-07 4:51 ` Mike Frysinger
@ 2011-06-07 5:01 ` Artem Bityutskiy
0 siblings, 0 replies; 16+ messages in thread
From: Artem Bityutskiy @ 2011-06-07 5:01 UTC (permalink / raw)
To: Mike Frysinger; +Cc: linux-mtd
On Tue, 2011-06-07 at 00:51 -0400, Mike Frysinger wrote:
> On Tue, Jun 7, 2011 at 00:45, Artem Bityutskiy wrote:
> > On Tue, 2011-06-07 at 07:42 +0300, Artem Bityutskiy wrote:
> >> On Tue, 2011-06-07 at 00:41 -0400, Mike Frysinger wrote:
> >> > On Tue, Jun 7, 2011 at 00:31, Artem Bityutskiy wrote:
> >> > > On Mon, 2011-06-06 at 14:22 -0400, Mike Frysinger wrote:
> >> > >> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> >> > >> ---
> >> > >> flash_info.c | 27 +++++++++++++++++----------
> >> > >> 1 files changed, 17 insertions(+), 10 deletions(-)
> >> > >
> >> > > How about killing this utility completely and use mtdinfo from ubi-utils
> >> > > instead? Yes, before creating mtdinfo I should have noticed flash_info,
> >> > > but I did not. Did you look at mtdinfo?
> >> >
> >> > didnt even notice it :P
> >> >
> >> > if mtdinfo provides all the details that my new flash_info does, then
> >> > i dont care about punting it. be nice to merge my fixes before
> >> > deleting it though, otherwise i feel like i wasted quite a bit of time
> >> > for nothing ;).
> >>
> >> I think it provides everything except of region information, which
> >> flash_info provides :)
> >
> > And it does not show a map of sectors. May be we can add this to mtdinfo
> > instead?
>
> if you merge the patches i posted here, i'll see about extending
> mtdinfo to include the new functionality and then i'll post another
> patch to punt flash_info ;).
Sure, thanks, I've sent you some feed-back for the last patch, though.
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 4/4] flash_info: display MEMGETINFO and MEMISLOCKED
2011-06-07 5:01 ` Artem Bityutskiy
@ 2011-06-07 5:05 ` Artem Bityutskiy
2011-06-07 5:14 ` Mike Frysinger
1 sibling, 0 replies; 16+ messages in thread
From: Artem Bityutskiy @ 2011-06-07 5:05 UTC (permalink / raw)
To: Mike Frysinger; +Cc: linux-mtd
On Tue, 2011-06-07 at 08:01 +0300, Artem Bityutskiy wrote:
> On Mon, 2011-06-06 at 14:22 -0400, Mike Frysinger wrote:
> > I found the existing flash_info output to be a little lacking, so
> > add decoders for MEMGETINFO and MEMISLOCKED.
> >
> > Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> > ---
> > flash_info.c | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++------
> > 1 files changed, 87 insertions(+), 11 deletions(-)
>
> Pushed patches 1-3.
>
> WRT this patch - I think the sector map should be a separate option,
> because it outputs too much for a default option.
Hmm, actually, for this utility it is probably ok this way.
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 4/4] flash_info: display MEMGETINFO and MEMISLOCKED
2011-06-07 5:14 ` Mike Frysinger
@ 2011-06-07 5:11 ` Artem Bityutskiy
2011-06-07 5:18 ` Artem Bityutskiy
1 sibling, 0 replies; 16+ messages in thread
From: Artem Bityutskiy @ 2011-06-07 5:11 UTC (permalink / raw)
To: Mike Frysinger; +Cc: linux-mtd
On Tue, 2011-06-07 at 01:14 -0400, Mike Frysinger wrote:
...
> i'm adding regioninfo(-r)/sectormap(-s) as options to mtdinfo so users
> get the extended info only when they ask for it
...
> i'll take care of this as i implement regioninfo/islocked in libmtd
Many thanks!
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 4/4] flash_info: display MEMGETINFO and MEMISLOCKED
2011-06-07 5:01 ` Artem Bityutskiy
2011-06-07 5:05 ` Artem Bityutskiy
@ 2011-06-07 5:14 ` Mike Frysinger
2011-06-07 5:11 ` Artem Bityutskiy
2011-06-07 5:18 ` Artem Bityutskiy
1 sibling, 2 replies; 16+ messages in thread
From: Mike Frysinger @ 2011-06-07 5:14 UTC (permalink / raw)
To: dedekind1; +Cc: linux-mtd
On Tue, Jun 7, 2011 at 01:01, Artem Bityutskiy wrote:
> On Mon, 2011-06-06 at 14:22 -0400, Mike Frysinger wrote:
>> I found the existing flash_info output to be a little lacking, so
>> add decoders for MEMGETINFO and MEMISLOCKED.
>>
>> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
>> ---
>> flash_info.c | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++------
>> 1 files changed, 87 insertions(+), 11 deletions(-)
>
> Pushed patches 1-3.
>
> WRT this patch - I think the sector map should be a separate option,
> because it outputs too much for a default option.
i'm adding regioninfo(-r)/sectormap(-s) as options to mtdinfo so users
get the extended info only when they ask for it
>> + for (i = 0; i < reginfo->numblocks; ++i) {
>> + einfo.start = reginfo->offset + i * reginfo->erasesize;
>> + printf(" %*i: %08x ", width, i, einfo.start);
>> + if (ioctl(fd, MEMISLOCKED, &einfo))
>> + printf("RO ");
>> + else
>> + printf(" ");
>
>
> MEMISLOCKED is quite new ioctl, so you should check for ENOTTY. E.g.,
> with my stock Fedora 14 + nandsim I see all sectors as RO, which is
> obviously not true.
i'll take care of this as i implement regioninfo/islocked in libmtd
-mike
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 4/4] flash_info: display MEMGETINFO and MEMISLOCKED
2011-06-07 5:14 ` Mike Frysinger
2011-06-07 5:11 ` Artem Bityutskiy
@ 2011-06-07 5:18 ` Artem Bityutskiy
1 sibling, 0 replies; 16+ messages in thread
From: Artem Bityutskiy @ 2011-06-07 5:18 UTC (permalink / raw)
To: Mike Frysinger; +Cc: linux-mtd
On Tue, 2011-06-07 at 01:14 -0400, Mike Frysinger wrote:
> On Tue, Jun 7, 2011 at 01:01, Artem Bityutskiy wrote:
> > On Mon, 2011-06-06 at 14:22 -0400, Mike Frysinger wrote:
> >> I found the existing flash_info output to be a little lacking, so
> >> add decoders for MEMGETINFO and MEMISLOCKED.
> >>
> >> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> >> ---
> >> flash_info.c | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++------
> >> 1 files changed, 87 insertions(+), 11 deletions(-)
> >
> > Pushed patches 1-3.
> >
> > WRT this patch - I think the sector map should be a separate option,
> > because it outputs too much for a default option.
>
> i'm adding regioninfo(-r)/sectormap(-s) as options to mtdinfo so users
> get the extended info only when they ask for it
Region info is probably not worth a separate option - I do not believe
there are flashes with more than 2-3 of them.
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2011-06-07 5:22 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-06 18:22 [PATCH 1/4] flash_info: convert to common.h Mike Frysinger
2011-06-06 18:22 ` [PATCH 2/4] flash_info: allow people to get info on multiple devices Mike Frysinger
2011-06-06 18:22 ` [PATCH 3/4] include/mtd: sync with kernel Mike Frysinger
2011-06-06 18:47 ` Brian Norris
2011-06-06 18:22 ` [PATCH 4/4] flash_info: display MEMGETINFO and MEMISLOCKED Mike Frysinger
2011-06-07 5:01 ` Artem Bityutskiy
2011-06-07 5:05 ` Artem Bityutskiy
2011-06-07 5:14 ` Mike Frysinger
2011-06-07 5:11 ` Artem Bityutskiy
2011-06-07 5:18 ` Artem Bityutskiy
2011-06-07 4:31 ` [PATCH 1/4] flash_info: convert to common.h Artem Bityutskiy
2011-06-07 4:41 ` Mike Frysinger
2011-06-07 4:42 ` Artem Bityutskiy
2011-06-07 4:45 ` Artem Bityutskiy
2011-06-07 4:51 ` Mike Frysinger
2011-06-07 5:01 ` Artem Bityutskiy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox