aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac2
-rw-r--r--misc-utils/serve_image.c2
-rw-r--r--tests/mtd-tests/flash_speed.c6
-rw-r--r--tests/ubifs_tools-tests/Makemodule.am5
-rw-r--r--ubi-utils/ubirsvol.c9
-rw-r--r--ubifs-utils/Makemodule.am4
-rw-r--r--ubifs-utils/common/atomic.h6
-rw-r--r--ubifs-utils/common/defs.h5
-rw-r--r--ubifs-utils/common/devtable.c1
-rw-r--r--ubifs-utils/fsck.ubifs/extract_files.c2
-rw-r--r--ubifs-utils/libubifs/journal.c1
-rw-r--r--ubifs-utils/libubifs/ubifs.h1
12 files changed, 32 insertions, 12 deletions
diff --git a/configure.ac b/configure.ac
index b160c03..2a79ba8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
AC_PREREQ([2.60])
-m4_define([RELEASE], 2.2.1)
+m4_define([RELEASE], 2.3.0)
AC_INIT([mtd-utils], [RELEASE], [linux-mtd@lists.infradead.org], mtd-utils)
diff --git a/misc-utils/serve_image.c b/misc-utils/serve_image.c
index 6c8c8fb..ec2090f 100644
--- a/misc-utils/serve_image.c
+++ b/misc-utils/serve_image.c
@@ -1,5 +1,5 @@
#define PROGRAM_NAME "serve_image"
-#define _POSIX_C_SOURCE 200112L
+#define _POSIX_C_SOURCE 200809L
#include <time.h>
#include <errno.h>
diff --git a/tests/mtd-tests/flash_speed.c b/tests/mtd-tests/flash_speed.c
index 11f396c..3319452 100644
--- a/tests/mtd-tests/flash_speed.c
+++ b/tests/mtd-tests/flash_speed.c
@@ -190,7 +190,7 @@ static int read_eraseblock(int ebnum)
{
int err = mtd_read(&mtd, fd, ebnum, 0, iobuf, mtd.eb_size);
if (err)
- fprintf(stderr, "Error writing block %d!\n", ebnum);
+ fprintf(stderr, "Error reading block %d!\n", ebnum);
return err;
}
@@ -490,7 +490,7 @@ int main(int argc, char **argv)
}
/* Multi-block erase all eraseblocks */
- if (!skip) {
+ if (flags & DESTRUCTIVE && !skip) {
for (k = 1; k < 7; ++k) {
blocks = 1 << k;
printf("Testing %dx multi-block erase speed\n", blocks);
@@ -518,7 +518,7 @@ int main(int argc, char **argv)
/* Write a page and immediately after try to read another page. Report
* the latency difference when performed on different banks (NOR only).
*/
- if (speb >= 0 && mtd.subpage_size == 1) {
+ if (flags & DESTRUCTIVE && speb >= 0 && mtd.subpage_size == 1) {
long rww_duration_w, rww_latency_end;
long rww_duration_rnw, rww_duration_r_end;
bool rww_r_end_first;
diff --git a/tests/ubifs_tools-tests/Makemodule.am b/tests/ubifs_tools-tests/Makemodule.am
index 1715757..5fe4f83 100644
--- a/tests/ubifs_tools-tests/Makemodule.am
+++ b/tests/ubifs_tools-tests/Makemodule.am
@@ -10,7 +10,7 @@ test_SCRIPTS += \
tests/ubifs_tools-tests/fsck_tests/fsck_bad_image.sh \
tests/ubifs_tools-tests/mkfs_tests/build_fs_from_dir.sh
-test_DATA += \
+TEST_IMAGE_FILES = \
tests/ubifs_tools-tests/images/good.gz \
tests/ubifs_tools-tests/images/sb_fanout.gz \
tests/ubifs_tools-tests/images/sb_fmt_version.gz \
@@ -64,3 +64,6 @@ test_DATA += \
tests/ubifs_tools-tests/images/dir_lost_not_recover.gz \
tests/ubifs_tools-tests/images/root_dir.gz \
tests/ubifs_tools-tests/images/empty_tnc.gz
+
+test_DATA += $(TEST_IMAGE_FILES)
+EXTRA_DIST += $(TEST_IMAGE_FILES)
diff --git a/ubi-utils/ubirsvol.c b/ubi-utils/ubirsvol.c
index 73d2f68..55f6794 100644
--- a/ubi-utils/ubirsvol.c
+++ b/ubi-utils/ubirsvol.c
@@ -57,8 +57,10 @@ static const char optionsstr[] =
"-N, --name=<volume name> volume name to resize\n"
"-s, --size=<bytes> volume size volume size in bytes, kilobytes (KiB)\n"
" or megabytes (MiB)\n"
+" zero size means use all available free bytes\n"
"-S, --lebs=<LEBs count> alternative way to give volume size in logical\n"
" eraseblocks\n"
+" zero size means use all available free LEBs\n"
"-h, -?, --help print help message\n"
"-V, --version print program version";
@@ -114,13 +116,13 @@ static int parse_opt(int argc, char * const argv[])
switch (key) {
case 's':
args.bytes = util_get_bytes(optarg);
- if (args.bytes <= 0)
+ if (args.bytes < 0)
return errmsg("bad volume size: \"%s\"", optarg);
break;
case 'S':
args.lebs = simple_strtoull(optarg, &error);
- if (error || args.lebs <= 0)
+ if (error || args.lebs < 0)
return errmsg("bad LEB count: \"%s\"", optarg);
break;
@@ -233,6 +235,9 @@ int main(int argc, char * const argv[])
if (args.lebs != -1)
args.bytes = (long long)vol_info.leb_size * args.lebs;
+ if (args.lebs == 0 || args.bytes == 0)
+ args.bytes = vol_info.rsvd_bytes + dev_info.avail_bytes;
+
err = ubi_rsvol(libubi, args.node, args.vol_id, args.bytes);
if (err) {
sys_errmsg("cannot UBI resize volume");
diff --git a/ubifs-utils/Makemodule.am b/ubifs-utils/Makemodule.am
index 21ba059..f84569a 100644
--- a/ubifs-utils/Makemodule.am
+++ b/ubifs-utils/Makemodule.am
@@ -72,7 +72,7 @@ mkfs_ubifs_SOURCES = \
ubifs-utils/mkfs.ubifs/mkfs.ubifs.c
mkfs_ubifs_LDADD = libmtd.a libubi.a $(ZLIB_LIBS) $(LZO_LIBS) $(ZSTD_LIBS) $(UUID_LIBS) $(LIBSELINUX_LIBS) $(OPENSSL_LIBS) \
- $(DUMP_STACK_LD) $(ASAN_LIBS) -lm -lpthread
+ $(DUMP_STACK_LD) $(ASAN_LIBS) -lm -lpthread libmissing.a
mkfs_ubifs_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_CFLAGS) $(LZO_CFLAGS) $(ZSTD_CFLAGS) $(UUID_CFLAGS) $(LIBSELINUX_CFLAGS) \
-I$(top_srcdir)/ubi-utils/include -I$(top_srcdir)/ubifs-utils/common -I $(top_srcdir)/ubifs-utils/libubifs
@@ -90,7 +90,7 @@ fsck_ubifs_SOURCES = \
ubifs-utils/fsck.ubifs/handle_disconnected.c
fsck_ubifs_LDADD = libmtd.a libubi.a $(ZLIB_LIBS) $(LZO_LIBS) $(ZSTD_LIBS) $(UUID_LIBS) $(LIBSELINUX_LIBS) $(OPENSSL_LIBS) \
- $(DUMP_STACK_LD) $(ASAN_LIBS) -lm -lpthread
+ $(DUMP_STACK_LD) $(ASAN_LIBS) -lm -lpthread libmissing.a
fsck_ubifs_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_CFLAGS) $(LZO_CFLAGS) $(ZSTD_CFLAGS) $(UUID_CFLAGS) $(LIBSELINUX_CFLAGS) \
-I$(top_srcdir)/ubi-utils/include -I$(top_srcdir)/ubifs-utils/common -I $(top_srcdir)/ubifs-utils/libubifs \
-I$(top_srcdir)/ubifs-utils/fsck.ubifs
diff --git a/ubifs-utils/common/atomic.h b/ubifs-utils/common/atomic.h
index f287d43..95754b2 100644
--- a/ubifs-utils/common/atomic.h
+++ b/ubifs-utils/common/atomic.h
@@ -2,8 +2,12 @@
#ifndef __ATOMIC_H__
#define __ATOMIC_H__
+#define GCC_VERSION (__GNUC__ * 10000 \
+ + __GNUC_MINOR__ * 100 \
+ + __GNUC_PATCHLEVEL__)
+
/* Check GCC version, just to be safe */
-#if !defined(__GNUC__) || (__GNUC__ < 4) || (__GNUC_MINOR__ < 1)
+#if GCC_VERSION < 40100
# error atomic.h works only with GCC newer than version 4.1
#endif /* GNUC >= 4.1 */
diff --git a/ubifs-utils/common/defs.h b/ubifs-utils/common/defs.h
index 7ff1771..d5edbf6 100644
--- a/ubifs-utils/common/defs.h
+++ b/ubifs-utils/common/defs.h
@@ -13,8 +13,11 @@
#include <errno.h>
#include <time.h>
#include <assert.h>
+#if HAVE_EXECINFO_H
#include <execinfo.h>
-
+#else
+#include "libmissing.h"
+#endif
#include "ubifs.h"
/* common.h requires the PROGRAM_NAME macro */
diff --git a/ubifs-utils/common/devtable.c b/ubifs-utils/common/devtable.c
index 7347f09..2e581ff 100644
--- a/ubifs-utils/common/devtable.c
+++ b/ubifs-utils/common/devtable.c
@@ -392,6 +392,7 @@ int parse_devtable(const char *tbl_file)
out_close:
fclose(f);
+ free(line);
free_devtable_info();
return -1;
}
diff --git a/ubifs-utils/fsck.ubifs/extract_files.c b/ubifs-utils/fsck.ubifs/extract_files.c
index c83d377..000ef5d 100644
--- a/ubifs-utils/fsck.ubifs/extract_files.c
+++ b/ubifs-utils/fsck.ubifs/extract_files.c
@@ -10,6 +10,8 @@
#include <getopt.h>
#include <sys/stat.h>
+#include <linux/limits.h>
+
#include "linux_err.h"
#include "bitops.h"
#include "kmem.h"
diff --git a/ubifs-utils/libubifs/journal.c b/ubifs-utils/libubifs/journal.c
index e78ea14..45d82fd 100644
--- a/ubifs-utils/libubifs/journal.c
+++ b/ubifs-utils/libubifs/journal.c
@@ -46,6 +46,7 @@
* all the nodes.
*/
+#include <sys/stat.h>
#include "bitops.h"
#include "kmem.h"
#include "ubifs.h"
diff --git a/ubifs-utils/libubifs/ubifs.h b/ubifs-utils/libubifs/ubifs.h
index 0908a22..1c7bc7b 100644
--- a/ubifs-utils/libubifs/ubifs.h
+++ b/ubifs-utils/libubifs/ubifs.h
@@ -11,6 +11,7 @@
#ifndef __UBIFS_H__
#define __UBIFS_H__
+#include <fcntl.h>
#include <string.h>
#include "linux_types.h"