Re: [ptxdist] [PATCH 1/2] mtd-utils: Version bump. 2.1.6 -> 2.2.0

2024-04-05 Thread Michael Olbrich
On Tue, Apr 02, 2024 at 10:54:06PM +0200, Christian Melki wrote:
> Not overly exciting.
> https://lists.infradead.org/pipermail/linux-mtd/2024-March/104058.html
> 
> * Fix options that changed from endis to wwo.
> 
> * Forward patchset, applies cleanly.

You forgot to remove the patches for the old version.

Michael

> 
> Signed-off-by: Christian Melki 
> ---
>  ...rkbad-new-util-to-mark-blocks-as-bad.patch | 158 ++
>  patches/mtd-utils-2.2.0/autogen.sh|   1 +
>  patches/mtd-utils-2.2.0/series|   4 +
>  rules/mtd-utils.make  |   8 +-
>  4 files changed, 167 insertions(+), 4 deletions(-)
>  create mode 100644 
> patches/mtd-utils-2.2.0/0001-nandmarkbad-new-util-to-mark-blocks-as-bad.patch
>  create mode 12 patches/mtd-utils-2.2.0/autogen.sh
>  create mode 100644 patches/mtd-utils-2.2.0/series
> 
> diff --git 
> a/patches/mtd-utils-2.2.0/0001-nandmarkbad-new-util-to-mark-blocks-as-bad.patch
>  
> b/patches/mtd-utils-2.2.0/0001-nandmarkbad-new-util-to-mark-blocks-as-bad.patch
> new file mode 100644
> index 0..e6ff202a7
> --- /dev/null
> +++ 
> b/patches/mtd-utils-2.2.0/0001-nandmarkbad-new-util-to-mark-blocks-as-bad.patch
> @@ -0,0 +1,158 @@
> +From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= 
> +Date: Wed, 30 Aug 2017 13:31:46 +0200
> +Subject: [PATCH] nandmarkbad: new util to mark blocks as bad
> +
> +---
> + nand-utils/Makemodule.am |   5 +-
> + nand-utils/nandmarkbad.c | 119 
> +++
> + 2 files changed, 123 insertions(+), 1 deletion(-)
> + create mode 100644 nand-utils/nandmarkbad.c
> +
> +diff --git a/nand-utils/Makemodule.am b/nand-utils/Makemodule.am
> +index cee677783e7a..7fd1de5aa9ae 100644
> +--- a/nand-utils/Makemodule.am
>  b/nand-utils/Makemodule.am
> +@@ -7,6 +7,9 @@ nandwrite_LDADD = libmtd.a
> + nandtest_SOURCES = nand-utils/nandtest.c
> + nandtest_LDADD = libmtd.a
> + 
> ++nandmarkbad_SOURCES = nand-utils/nandmarkbad.c
> ++nandmarkbad_LDADD = libmtd.a
> ++
> + nftldump_SOURCES = nand-utils/nftldump.c include/mtd_swab.h
> + nftldump_SOURCES += include/mtd/nftl-user.h include/mtd/ftl-user.h
> + nftldump_LDADD = libmtd.a
> +@@ -23,7 +26,7 @@ NAND_SH = \
> + 
> + EXTRA_DIST += $(NAND_SH)
> + 
> +-sbin_PROGRAMS += nanddump nandwrite nandtest nftldump nftl_format 
> nandflipbits
> ++sbin_PROGRAMS += nanddump nandwrite nandtest nandmarkbad nftldump 
> nftl_format nandflipbits
> + 
> + if BUILD_TESTS
> + test_SCRIPTS += $(NAND_SH)
> +diff --git a/nand-utils/nandmarkbad.c b/nand-utils/nandmarkbad.c
> +new file mode 100644
> +index ..cf05698c3609
> +--- /dev/null
>  b/nand-utils/nandmarkbad.c
> +@@ -0,0 +1,119 @@
> ++#define PROGRAM_NAME "nandmarkbad"
> ++
> ++#include 
> ++#include 
> ++#include 
> ++#include 
> ++
> ++#include "common.h"
> ++#include 
> ++
> ++static void usage(int status)
> ++{
> ++fprintf(status ? stderr : stdout,
> ++"usage: %s [OPTIONS] \n\n"
> ++"  -b, --markbad=blocknoMark block bad\n"
> ++"  -h, --help   Display this help and exit\n"
> ++"  -V, --versionOutput version information and 
> exit\n"
> ++"  -y, --i-know-what-i-do   really do mark blocks as bad\n",
> ++PROGRAM_NAME);
> ++exit(status);
> ++}
> ++
> ++/*
> ++ * Main program
> ++ */
> ++int main(int argc, char **argv)
> ++{
> ++loff_t mark_bad[32];
> ++unsigned cnt_bad = 0;
> ++struct mtd_dev_info mtd;
> ++libmtd_t mtd_desc;
> ++int fd;
> ++int error = 0;
> ++int ret;
> ++unsigned int i;
> ++int iknowwhatido = 0;
> ++
> ++for (;;) {
> ++static const char short_options[] = "b:hVy";
> ++static const struct option long_options[] = {
> ++{ "help", no_argument, 0, 'h' },
> ++{ "markbad", required_argument, 0, 'b' },
> ++{ "version", no_argument, 0, 'V'},
> ++{ "i-know-what-i-do", no_argument, 0, 'y' },
> ++{0, 0, 0, 0},
> ++};
> ++int option_index = 0;
> ++int c = getopt_long(argc, argv, short_options, long_options,
> ++_index);
> ++if (c == EOF)
> ++break;
> ++
> ++switch (c) {
> ++case '?':
> ++usage(EXIT_FAILURE);
> ++break;
> ++
> ++case 'b':
> ++if (cnt_bad < ARRAY_SIZE(mark_bad)) {
> ++mark_bad[cnt_bad] =
> ++simple_strtoll(optarg, );
> ++++cnt_bad;
> ++} else {
> ++errmsg_die("Can't handle so many bad blocks\n");
> ++}
> ++
> ++break;
> ++
> ++case 'h':
> ++usage(EXIT_SUCCESS);
> ++

[ptxdist] [PATCH 1/2] mtd-utils: Version bump. 2.1.6 -> 2.2.0

2024-04-02 Thread Christian Melki
Not overly exciting.
https://lists.infradead.org/pipermail/linux-mtd/2024-March/104058.html

* Fix options that changed from endis to wwo.

* Forward patchset, applies cleanly.

Signed-off-by: Christian Melki 
---
 ...rkbad-new-util-to-mark-blocks-as-bad.patch | 158 ++
 patches/mtd-utils-2.2.0/autogen.sh|   1 +
 patches/mtd-utils-2.2.0/series|   4 +
 rules/mtd-utils.make  |   8 +-
 4 files changed, 167 insertions(+), 4 deletions(-)
 create mode 100644 
patches/mtd-utils-2.2.0/0001-nandmarkbad-new-util-to-mark-blocks-as-bad.patch
 create mode 12 patches/mtd-utils-2.2.0/autogen.sh
 create mode 100644 patches/mtd-utils-2.2.0/series

diff --git 
a/patches/mtd-utils-2.2.0/0001-nandmarkbad-new-util-to-mark-blocks-as-bad.patch 
b/patches/mtd-utils-2.2.0/0001-nandmarkbad-new-util-to-mark-blocks-as-bad.patch
new file mode 100644
index 0..e6ff202a7
--- /dev/null
+++ 
b/patches/mtd-utils-2.2.0/0001-nandmarkbad-new-util-to-mark-blocks-as-bad.patch
@@ -0,0 +1,158 @@
+From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= 
+Date: Wed, 30 Aug 2017 13:31:46 +0200
+Subject: [PATCH] nandmarkbad: new util to mark blocks as bad
+
+---
+ nand-utils/Makemodule.am |   5 +-
+ nand-utils/nandmarkbad.c | 119 +++
+ 2 files changed, 123 insertions(+), 1 deletion(-)
+ create mode 100644 nand-utils/nandmarkbad.c
+
+diff --git a/nand-utils/Makemodule.am b/nand-utils/Makemodule.am
+index cee677783e7a..7fd1de5aa9ae 100644
+--- a/nand-utils/Makemodule.am
 b/nand-utils/Makemodule.am
+@@ -7,6 +7,9 @@ nandwrite_LDADD = libmtd.a
+ nandtest_SOURCES = nand-utils/nandtest.c
+ nandtest_LDADD = libmtd.a
+ 
++nandmarkbad_SOURCES = nand-utils/nandmarkbad.c
++nandmarkbad_LDADD = libmtd.a
++
+ nftldump_SOURCES = nand-utils/nftldump.c include/mtd_swab.h
+ nftldump_SOURCES += include/mtd/nftl-user.h include/mtd/ftl-user.h
+ nftldump_LDADD = libmtd.a
+@@ -23,7 +26,7 @@ NAND_SH = \
+ 
+ EXTRA_DIST += $(NAND_SH)
+ 
+-sbin_PROGRAMS += nanddump nandwrite nandtest nftldump nftl_format nandflipbits
++sbin_PROGRAMS += nanddump nandwrite nandtest nandmarkbad nftldump nftl_format 
nandflipbits
+ 
+ if BUILD_TESTS
+ test_SCRIPTS += $(NAND_SH)
+diff --git a/nand-utils/nandmarkbad.c b/nand-utils/nandmarkbad.c
+new file mode 100644
+index ..cf05698c3609
+--- /dev/null
 b/nand-utils/nandmarkbad.c
+@@ -0,0 +1,119 @@
++#define PROGRAM_NAME "nandmarkbad"
++
++#include 
++#include 
++#include 
++#include 
++
++#include "common.h"
++#include 
++
++static void usage(int status)
++{
++  fprintf(status ? stderr : stdout,
++  "usage: %s [OPTIONS] \n\n"
++  "  -b, --markbad=blocknoMark block bad\n"
++  "  -h, --help   Display this help and exit\n"
++  "  -V, --versionOutput version information and 
exit\n"
++  "  -y, --i-know-what-i-do   really do mark blocks as bad\n",
++  PROGRAM_NAME);
++  exit(status);
++}
++
++/*
++ * Main program
++ */
++int main(int argc, char **argv)
++{
++  loff_t mark_bad[32];
++  unsigned cnt_bad = 0;
++  struct mtd_dev_info mtd;
++  libmtd_t mtd_desc;
++  int fd;
++  int error = 0;
++  int ret;
++  unsigned int i;
++  int iknowwhatido = 0;
++
++  for (;;) {
++  static const char short_options[] = "b:hVy";
++  static const struct option long_options[] = {
++  { "help", no_argument, 0, 'h' },
++  { "markbad", required_argument, 0, 'b' },
++  { "version", no_argument, 0, 'V'},
++  { "i-know-what-i-do", no_argument, 0, 'y' },
++  {0, 0, 0, 0},
++  };
++  int option_index = 0;
++  int c = getopt_long(argc, argv, short_options, long_options,
++  _index);
++  if (c == EOF)
++  break;
++
++  switch (c) {
++  case '?':
++  usage(EXIT_FAILURE);
++  break;
++
++  case 'b':
++  if (cnt_bad < ARRAY_SIZE(mark_bad)) {
++  mark_bad[cnt_bad] =
++  simple_strtoll(optarg, );
++  ++cnt_bad;
++  } else {
++  errmsg_die("Can't handle so many bad blocks\n");
++  }
++
++  break;
++
++  case 'h':
++  usage(EXIT_SUCCESS);
++  break;
++
++  case 'V':
++  common_print_version();
++  return EXIT_SUCCESS;
++
++  case 'y':
++  iknowwhatido = 1;
++  break;
++  }
++  }
++
++  argc -= optind;
++  argv += optind;
++
++  if