All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/10] more mtd-utils cleanup
@ 2011-06-27 18:27 Brian Norris
  2011-06-27 18:27 ` [PATCH 01/10] mtd-tests: checkfs: fix size_t related warning Brian Norris
                   ` (10 more replies)
  0 siblings, 11 replies; 21+ messages in thread
From: Brian Norris @ 2011-06-27 18:27 UTC (permalink / raw)
  To: Artem Bityutskiy; +Cc: Brian Norris, linux-mtd, Mike Frysinger

This series fixes several mtd-utils issues and takes care of a few things
on the feature-removal schedule.

I think patch 9 ("mtdinfo: kill -m option") could use some review, as I
am not the one who formed the original feature removal request.

Thanks,
Brian

Brian Norris (10):
  mtd-tests: checkfs: fix size_t related warning
  mtd-tests: io_paral: build error, "variable length strings"
  mtd-utils: remove whitespace at end of lines
  mtd-utils: update .gitignore files
  mkfs.ubifs: use common.h
  mtd-utils: add common version printing function
  mtd-utils: switch more utils to unified versioning
  mtd-utils: kill flash_info
  mtdinfo: kill -m option
  nanddump: remove unused variable

 .gitignore                               |    5 ++
 Makefile                                 |    2 +-
 device_table.txt                         |    6 +-
 feature-removal-schedule.txt             |   14 ------
 flash_info.c                             |   67 ------------------------------
 include/common.h                         |    6 +++
 include/linux/jffs2.h                    |    2 +-
 jffs2dump.c                              |    2 +-
 lib/libfec.c                             |   14 +++---
 mcast_image.h                            |    4 +-
 mkfs.jffs2.1                             |    6 +-
 mkfs.jffs2.c                             |    6 +-
 mkfs.ubifs/hashtable/hashtable.c         |   14 +++---
 mkfs.ubifs/hashtable/hashtable.h         |   30 +++++++-------
 mkfs.ubifs/hashtable/hashtable_itr.c     |   12 +++---
 mkfs.ubifs/hashtable/hashtable_itr.h     |   12 +++---
 mkfs.ubifs/hashtable/hashtable_private.h |   12 +++---
 mkfs.ubifs/mkfs.ubifs.c                  |   12 ++----
 nanddump.c                               |    3 +-
 nandtest.c                               |   16 ++++----
 rbtree.c                                 |    6 +-
 rbtree.h                                 |    4 +-
 recv_image.c                             |   24 +++++-----
 serve_image.c                            |   30 +++++++-------
 tests/checkfs/.gitignore                 |    2 +
 tests/checkfs/README                     |   26 ++++++------
 tests/checkfs/checkfs.c                  |    2 +-
 tests/fs-tests/integrity/.gitignore      |    1 +
 tests/fs-tests/simple/.gitignore         |    5 ++
 tests/fs-tests/stress/atoms/.gitignore   |   10 ++++
 tests/fs-tests/utils/.gitignore          |    2 +
 tests/jittertest/.gitignore              |    2 +
 tests/jittertest/README                  |   18 ++++----
 tests/jittertest/filljffs2.sh            |    2 +-
 tests/ubi-tests/io_paral.c               |    2 +-
 ubi-utils/dictionary.c                   |    6 +-
 ubi-utils/libiniparser.c                 |    8 ++--
 ubi-utils/mtdinfo.c                      |   30 ++++----------
 ubi-utils/ubiattach.c                    |    5 +-
 ubi-utils/ubicrc32.c                     |    5 +-
 ubi-utils/ubidetach.c                    |    5 +-
 ubi-utils/ubiformat.c                    |    5 +-
 ubi-utils/ubimkvol.c                     |    5 +-
 ubi-utils/ubinfo.c                       |    5 +-
 ubi-utils/ubinize.c                      |    5 +-
 ubi-utils/ubirename.c                    |    1 -
 ubi-utils/ubirmvol.c                     |    5 +-
 ubi-utils/ubirsvol.c                     |    5 +-
 ubi-utils/ubiupdatevol.c                 |    5 +-
 49 files changed, 199 insertions(+), 277 deletions(-)
 delete mode 100644 flash_info.c
 create mode 100644 tests/checkfs/.gitignore
 create mode 100644 tests/fs-tests/integrity/.gitignore
 create mode 100644 tests/fs-tests/simple/.gitignore
 create mode 100644 tests/fs-tests/stress/atoms/.gitignore
 create mode 100644 tests/fs-tests/utils/.gitignore
 create mode 100644 tests/jittertest/.gitignore

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 01/10] mtd-tests: checkfs: fix size_t related warning
  2011-06-27 18:27 [PATCH 00/10] more mtd-utils cleanup Brian Norris
@ 2011-06-27 18:27 ` Brian Norris
  2011-06-27 18:27 ` [PATCH 02/10] mtd-tests: io_paral: build error, "variable length strings" Brian Norris
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Brian Norris @ 2011-06-27 18:27 UTC (permalink / raw)
  To: Artem Bityutskiy; +Cc: Brian Norris, linux-mtd, Mike Frysinger

Depending on your compiler, size_t may or may not be long unsigned int.
Use printf's %zu format to clarify.

Warning message:

   checkfs.c:524:28: warning: format '%lu' expects type
   'long unsigned int', but argument 2 has type 'unsigned int'

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
 tests/checkfs/checkfs.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tests/checkfs/checkfs.c b/tests/checkfs/checkfs.c
index 8e74da8..0e67626 100644
--- a/tests/checkfs/checkfs.c
+++ b/tests/checkfs/checkfs.c
@@ -520,7 +520,7 @@ void processCmdLine(int argc, char **argv)
                 FileSizeMax = (float)atoi(argv[++cnt]);
                 if(FileSizeMax > (MAX_INTS_ALLOW*sizeof(int)))
                 {
-                    printf("Max file size allowed is %lu.\n",
+                    printf("Max file size allowed is %zu.\n",
                            MAX_INTS_ALLOW*sizeof(int));
                     exit(0);
                 }
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 02/10] mtd-tests: io_paral: build error, "variable length strings"
  2011-06-27 18:27 [PATCH 00/10] more mtd-utils cleanup Brian Norris
  2011-06-27 18:27 ` [PATCH 01/10] mtd-tests: checkfs: fix size_t related warning Brian Norris
@ 2011-06-27 18:27 ` Brian Norris
  2011-06-29 13:22   ` Josh Boyer
  2011-06-27 18:27 ` [PATCH 03/10] mtd-utils: remove whitespace at end of lines Brian Norris
                   ` (8 subsequent siblings)
  10 siblings, 1 reply; 21+ messages in thread
From: Brian Norris @ 2011-06-27 18:27 UTC (permalink / raw)
  To: Artem Bityutskiy; +Cc: Brian Norris, linux-mtd, Mike Frysinger

Some compilers will complain about use of strlen() within a static array
size declaration. For this type of string, "sizeof() - 1" is equivalent
and prevents the build error.

Error:

   io_paral.c:48:13: error: variably modified 'vol_nodes' at file scope

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
 tests/ubi-tests/io_paral.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tests/ubi-tests/io_paral.c b/tests/ubi-tests/io_paral.c
index 9754a0d..1d9a97c 100644
--- a/tests/ubi-tests/io_paral.c
+++ b/tests/ubi-tests/io_paral.c
@@ -45,7 +45,7 @@ static int vol_size;
 
 static struct ubi_mkvol_request reqests[THREADS_NUM + 1];
 static char vol_name[THREADS_NUM + 1][100];
-static char vol_nodes[THREADS_NUM + 1][strlen(UBI_VOLUME_PATTERN) + 100];
+static char vol_nodes[THREADS_NUM + 1][sizeof(UBI_VOLUME_PATTERN) + 99];
 static unsigned char *wbufs[THREADS_NUM + 1];
 static unsigned char *rbufs[THREADS_NUM + 1];
 
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 03/10] mtd-utils: remove whitespace at end of lines
  2011-06-27 18:27 [PATCH 00/10] more mtd-utils cleanup Brian Norris
  2011-06-27 18:27 ` [PATCH 01/10] mtd-tests: checkfs: fix size_t related warning Brian Norris
  2011-06-27 18:27 ` [PATCH 02/10] mtd-tests: io_paral: build error, "variable length strings" Brian Norris
@ 2011-06-27 18:27 ` Brian Norris
  2011-06-27 18:27 ` [PATCH 04/10] mtd-utils: update .gitignore files Brian Norris
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Brian Norris @ 2011-06-27 18:27 UTC (permalink / raw)
  To: Artem Bityutskiy; +Cc: Brian Norris, linux-mtd, Mike Frysinger

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
 device_table.txt                         |    6 +++---
 include/linux/jffs2.h                    |    2 +-
 lib/libfec.c                             |   14 +++++++-------
 mcast_image.h                            |    4 ++--
 mkfs.jffs2.1                             |    6 +++---
 mkfs.jffs2.c                             |    6 +++---
 mkfs.ubifs/hashtable/hashtable.c         |   14 +++++++-------
 mkfs.ubifs/hashtable/hashtable.h         |   30 +++++++++++++++---------------
 mkfs.ubifs/hashtable/hashtable_itr.c     |   12 ++++++------
 mkfs.ubifs/hashtable/hashtable_itr.h     |   12 ++++++------
 mkfs.ubifs/hashtable/hashtable_private.h |   12 ++++++------
 nandtest.c                               |   16 ++++++++--------
 rbtree.c                                 |    6 +++---
 rbtree.h                                 |    4 ++--
 recv_image.c                             |   24 ++++++++++++------------
 serve_image.c                            |   30 +++++++++++++++---------------
 tests/checkfs/README                     |   26 +++++++++++++-------------
 tests/jittertest/README                  |   18 +++++++++---------
 tests/jittertest/filljffs2.sh            |    2 +-
 ubi-utils/dictionary.c                   |    6 +++---
 ubi-utils/libiniparser.c                 |    8 ++++----
 21 files changed, 129 insertions(+), 129 deletions(-)

diff --git a/device_table.txt b/device_table.txt
index 74fdc56..194fed6 100644
--- a/device_table.txt
+++ b/device_table.txt
@@ -5,10 +5,10 @@
 #   /sbin/foobar	f	2755	0	0	-	-	-	-	-
 # and (assuming the file /sbin/foobar exists) it will be made setuid
 # root (regardless of what its permissions are on the host filesystem.
-# 
+#
 # Device table entries take the form of:
 # <name>		<type>	<mode>	<uid>	<gid>	<major>	<minor>	<start>	<inc>	<count>
-# where name is the file name,  type can be one of: 
+# where name is the file name,  type can be one of:
 #	f	A regular file
 #	d	Directory
 #	c	Character special device file
@@ -19,7 +19,7 @@
 # file.
 
 # When building a target filesystem, it is desirable to not have to
-# become root and then run 'mknod' a thousand times.  Using a device 
+# become root and then run 'mknod' a thousand times.  Using a device
 # table you can create device nodes and directories "on the fly".
 # Furthermore, you can use a single table entry to create a many device
 # minors.  For example, if I wanted to create /dev/hda and /dev/hda[0-15]
diff --git a/include/linux/jffs2.h b/include/linux/jffs2.h
index c2f684a..7306f86 100644
--- a/include/linux/jffs2.h
+++ b/include/linux/jffs2.h
@@ -15,7 +15,7 @@
 #ifndef __LINUX_JFFS2_H__
 #define __LINUX_JFFS2_H__
 
-/* You must include something which defines the C99 uintXX_t types. 
+/* You must include something which defines the C99 uintXX_t types.
    We don't do it from here because this file is used in too many
    different environments. */
 
diff --git a/lib/libfec.c b/lib/libfec.c
index c89a180..ff5a127 100644
--- a/lib/libfec.c
+++ b/lib/libfec.c
@@ -79,7 +79,7 @@ typedef unsigned short u_short ;
 	  if (t1 < t) t = 256000000 + t1 - t ; \
 	  else t = t1 - t ; \
 	  if (t == 0) t = 1 ;}
-	
+
 u_long ticks[10];	/* vars for timekeeping */
 #else
 #define DEB(x)
@@ -200,7 +200,7 @@ static inline gf
 gf_mul(x,y)
 {
     if ( (x) == 0 || (y)==0 ) return 0;
-     
+
     return gf_exp[gf_log[x] + gf_log[y] ] ;
 }
 #define init_mul_table()
@@ -315,7 +315,7 @@ generate_gf(void)
  * unrolled 16 times, a good value for 486 and pentium-class machines.
  * The case c=0 is also optimized, whereas c=1 is not. These
  * calls are unfrequent in my typical apps so I did not bother.
- * 
+ *
  * Note that gcc on
  */
 #define addmul(dst, src, c, sz) \
@@ -452,7 +452,7 @@ invert_mat(gf *src, int k)
 			}
 		    } else if (ipiv[ix] > 1) {
 			fprintf(stderr, "singular matrix\n");
-			goto fail ; 
+			goto fail ;
 		    }
 		}
 	    }
@@ -562,7 +562,7 @@ invert_vdm(gf *src, int k)
     b = NEW_GF_MATRIX(1, k);
 
     p = NEW_GF_MATRIX(1, k);
-   
+
     for ( j=1, i = 0 ; i < k ; i++, j+=k ) {
 	c[i] = 0 ;
 	p[i] = src[j] ;    /* p[i] */
@@ -807,7 +807,7 @@ build_decode_matrix(struct fec_parms *code, int index[])
 	} else
 #endif
 	if (index[i] < code->n )
-	    memcpy(p,  &(code->enc_matrix[index[i]*k]), k*sizeof(gf) ); 
+	    memcpy(p,  &(code->enc_matrix[index[i]*k]), k*sizeof(gf) );
 	else {
 	    fprintf(stderr, "decode: invalid index %d (max %d)\n",
 		index[i], code->n - 1 );
@@ -838,7 +838,7 @@ build_decode_matrix(struct fec_parms *code, int index[])
 int
 fec_decode(struct fec_parms *code, gf *pkt[], int index[], int sz)
 {
-    gf *m_dec ; 
+    gf *m_dec ;
     gf **new_pkt ;
     int row, col , k = code->k ;
 
diff --git a/mcast_image.h b/mcast_image.h
index 07b6e31..8e94ffa 100644
--- a/mcast_image.h
+++ b/mcast_image.h
@@ -24,7 +24,7 @@ struct image_pkt {
 struct fec_parms;
 
 /* k - number of actual data packets
- * n - total number of packets including data and redundant packets 
+ * n - total number of packets including data and redundant packets
  *   (actual packet size isn't relevant here) */
 struct fec_parms *fec_new(int k, int n);
 void fec_free(struct fec_parms *p);
@@ -45,7 +45,7 @@ void fec_encode_linear(struct fec_parms *code, unsigned char *src,
 /* data  - array of (k) pointers to data packets, in arbitrary order (see i)
  * i     - indices of (data) packets
  * sz    - data packet size
- * 
+ *
  * Will never fail as long as you give it (k) individual data packets.
  * Will re-order the (data) pointers but not the indices -- data packets
  * are ordered on return.
diff --git a/mkfs.jffs2.1 b/mkfs.jffs2.1
index 1eefeda..9b0acc3 100644
--- a/mkfs.jffs2.1
+++ b/mkfs.jffs2.1
@@ -104,7 +104,7 @@ or the present directory, if the
 .B -r
 option is not specified.
 
-Each block of the files to be placed into the file system image 
+Each block of the files to be placed into the file system image
 are compressed using one of the avaiable compressors depending
 on the selected compression mode.
 
@@ -196,8 +196,8 @@ Enables xattr, stuff only SELinux Labels into jffs2 image file.
 Enable xattr, stuff only POSIX ACL entries into jffs2 image file.
 .TP
 .B -m, --compression-mode=MODE
-Set the default compression mode. The default mode is 
-.B priority 
+Set the default compression mode. The default mode is
+.B priority
 which tries the compressors in a predefinied order and chooses the first
 successful one. The alternatives are:
 .B none
diff --git a/mkfs.jffs2.c b/mkfs.jffs2.c
index 7abaf50..ad88ac6 100644
--- a/mkfs.jffs2.c
+++ b/mkfs.jffs2.c
@@ -123,11 +123,11 @@ uint32_t find_hardlink(struct filesystem_entry *e)
 		f = rb_entry(parent, struct filesystem_entry, hardlink_rb);
 
 		if ((f->sb.st_dev < e->sb.st_dev) ||
-		    (f->sb.st_dev == e->sb.st_dev && 
+		    (f->sb.st_dev == e->sb.st_dev &&
 		     f->sb.st_ino < e->sb.st_ino))
 			n = &parent->rb_left;
 		else if ((f->sb.st_dev > e->sb.st_dev) ||
-			 (f->sb.st_dev == e->sb.st_dev && 
+			 (f->sb.st_dev == e->sb.st_dev &&
 			  f->sb.st_ino > e->sb.st_ino)) {
 			n = &parent->rb_right;
 		} else
@@ -264,7 +264,7 @@ static struct filesystem_entry *add_host_filesystem_entry(const char *name,
 	tmp = xstrdup(name);
 	entry->path = xstrdup(dirname(tmp));
 	free(tmp);
-	
+
 	entry->sb.st_ino = sb.st_ino;
 	entry->sb.st_dev = sb.st_dev;
 	entry->sb.st_nlink = sb.st_nlink;
diff --git a/mkfs.ubifs/hashtable/hashtable.c b/mkfs.ubifs/hashtable/hashtable.c
index 8aa273c..c1f99ed 100644
--- a/mkfs.ubifs/hashtable/hashtable.c
+++ b/mkfs.ubifs/hashtable/hashtable.c
@@ -100,7 +100,7 @@ hashtable_expand(struct hashtable *h)
         h->table = newtable;
     }
     /* Plan B: realloc instead */
-    else 
+    else
     {
         newtable = (struct entry **)
                    realloc(h->table, newsize * sizeof(struct entry *));
@@ -246,23 +246,23 @@ hashtable_destroy(struct hashtable *h, int free_values)
 /*
  * Copyright (c) 2002, Christopher Clark
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  * * Redistributions in binary form must reproduce the above copyright
  * notice, this list of conditions and the following disclaimer in the
  * documentation and/or other materials provided with the distribution.
- * 
+ *
  * * Neither the name of the original author; nor the names of any contributors
  * may be used to endorse or promote products derived from this software
  * without specific prior written permission.
- * 
- * 
+ *
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
diff --git a/mkfs.ubifs/hashtable/hashtable.h b/mkfs.ubifs/hashtable/hashtable.h
index b90781a..c0b0acd 100644
--- a/mkfs.ubifs/hashtable/hashtable.h
+++ b/mkfs.ubifs/hashtable/hashtable.h
@@ -19,7 +19,7 @@ struct hashtable;
  *      v = (struct some_value *)   malloc(sizeof(struct some_value));
  *
  *      (initialise k and v to suitable values)
- * 
+ *
  *      if (! hashtable_insert(h,k,v) )
  *      {     exit(-1);               }
  *
@@ -33,7 +33,7 @@ struct hashtable;
 
 /* Macros may be used to define type-safe(r) hashtable access functions, with
  * methods specialized to take known key and value types as parameters.
- * 
+ *
  * Example:
  *
  * Insert this at the start of your file:
@@ -63,7 +63,7 @@ struct hashtable;
 
 /*****************************************************************************
  * create_hashtable
-   
+
  * @name                    create_hashtable
  * @param   minsize         minimum initial size of hashtable
  * @param   hashfunction    function for hashing keys
@@ -78,7 +78,7 @@ create_hashtable(unsigned int minsize,
 
 /*****************************************************************************
  * hashtable_insert
-   
+
  * @name        hashtable_insert
  * @param   h   the hashtable to insert into
  * @param   k   the key - hashtable claims ownership and will free on removal
@@ -95,7 +95,7 @@ create_hashtable(unsigned int minsize,
  * If in doubt, remove before insert.
  */
 
-int 
+int
 hashtable_insert(struct hashtable *h, void *k, void *v);
 
 #define DEFINE_HASHTABLE_INSERT(fnname, keytype, valuetype) \
@@ -106,7 +106,7 @@ int fnname (struct hashtable *h, keytype *k, valuetype *v) \
 
 /*****************************************************************************
  * hashtable_search
-   
+
  * @name        hashtable_search
  * @param   h   the hashtable to search
  * @param   k   the key to search for  - does not claim ownership
@@ -124,7 +124,7 @@ valuetype * fnname (struct hashtable *h, keytype *k) \
 
 /*****************************************************************************
  * hashtable_remove
-   
+
  * @name        hashtable_remove
  * @param   h   the hashtable to remove the item from
  * @param   k   the key to search for  - does not claim ownership
@@ -143,7 +143,7 @@ valuetype * fnname (struct hashtable *h, keytype *k) \
 
 /*****************************************************************************
  * hashtable_count
-   
+
  * @name        hashtable_count
  * @param   h   the hashtable
  * @return      the number of items stored in the hashtable
@@ -154,7 +154,7 @@ hashtable_count(struct hashtable *h);
 
 /*****************************************************************************
  * hashtable_destroy
-   
+
  * @name        hashtable_destroy
  * @param   h   the hashtable
  * @param       free_values     whether to call 'free' on the remaining values
@@ -168,23 +168,23 @@ hashtable_destroy(struct hashtable *h, int free_values);
 /*
  * Copyright (c) 2002, Christopher Clark
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  * * Redistributions in binary form must reproduce the above copyright
  * notice, this list of conditions and the following disclaimer in the
  * documentation and/or other materials provided with the distribution.
- * 
+ *
  * * Neither the name of the original author; nor the names of any contributors
  * may be used to endorse or promote products derived from this software
  * without specific prior written permission.
- * 
- * 
+ *
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
diff --git a/mkfs.ubifs/hashtable/hashtable_itr.c b/mkfs.ubifs/hashtable/hashtable_itr.c
index 5dced84..24f4dde 100644
--- a/mkfs.ubifs/hashtable/hashtable_itr.c
+++ b/mkfs.ubifs/hashtable/hashtable_itr.c
@@ -157,23 +157,23 @@ hashtable_iterator_search(struct hashtable_itr *itr,
 /*
  * Copyright (c) 2002, 2004, Christopher Clark
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  * * Redistributions in binary form must reproduce the above copyright
  * notice, this list of conditions and the following disclaimer in the
  * documentation and/or other materials provided with the distribution.
- * 
+ *
  * * Neither the name of the original author; nor the names of any contributors
  * may be used to endorse or promote products derived from this software
  * without specific prior written permission.
- * 
- * 
+ *
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
diff --git a/mkfs.ubifs/hashtable/hashtable_itr.h b/mkfs.ubifs/hashtable/hashtable_itr.h
index eea699a..87a97eb 100644
--- a/mkfs.ubifs/hashtable/hashtable_itr.h
+++ b/mkfs.ubifs/hashtable/hashtable_itr.h
@@ -81,23 +81,23 @@ int fnname (struct hashtable_itr *i, struct hashtable *h, keytype *k) \
 /*
  * Copyright (c) 2002, 2004, Christopher Clark
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  * * Redistributions in binary form must reproduce the above copyright
  * notice, this list of conditions and the following disclaimer in the
  * documentation and/or other materials provided with the distribution.
- * 
+ *
  * * Neither the name of the original author; nor the names of any contributors
  * may be used to endorse or promote products derived from this software
  * without specific prior written permission.
- * 
- * 
+ *
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
diff --git a/mkfs.ubifs/hashtable/hashtable_private.h b/mkfs.ubifs/hashtable/hashtable_private.h
index 3e95f60..3a558e6 100644
--- a/mkfs.ubifs/hashtable/hashtable_private.h
+++ b/mkfs.ubifs/hashtable/hashtable_private.h
@@ -54,23 +54,23 @@ indexFor(unsigned int tablelength, unsigned int hashvalue)
 /*
  * Copyright (c) 2002, Christopher Clark
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  * * Redistributions in binary form must reproduce the above copyright
  * notice, this list of conditions and the following disclaimer in the
  * documentation and/or other materials provided with the distribution.
- * 
+ *
  * * Neither the name of the original author; nor the names of any contributors
  * may be used to endorse or promote products derived from this software
  * without specific prior written permission.
- * 
- * 
+ *
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
diff --git a/nandtest.c b/nandtest.c
index 93f01ca..d03dc11 100644
--- a/nandtest.c
+++ b/nandtest.c
@@ -79,7 +79,7 @@ int erase_and_write(loff_t ofs, unsigned char *data, unsigned char *rbuf)
 
 	printf("\r%08x: reading...", (unsigned)ofs);
 	fflush(stdout);
-	
+
 	len = pread(fd, rbuf, meminfo.erasesize, ofs);
 	if (len < meminfo.erasesize) {
 		printf("\n");
@@ -89,7 +89,7 @@ int erase_and_write(loff_t ofs, unsigned char *data, unsigned char *rbuf)
 			perror("read");
 		exit(1);
 	}
-		
+
 	if (ioctl(fd, ECCGETSTATS, &newstats)) {
 		printf("\n");
 		perror("ECCGETSTATS");
@@ -184,7 +184,7 @@ int main(int argc, char **argv)
 		case 'l':
 			length = strtol(optarg, NULL, 0);
 			break;
-			
+
 		}
 	}
 	if (argc - optind != 1)
@@ -195,7 +195,7 @@ int main(int argc, char **argv)
 		perror("open");
 		exit(1);
 	}
-	
+
 	if (ioctl(fd, MEMGETINFO, &meminfo)) {
 		perror("MEMGETINFO");
 		close(fd);
@@ -206,20 +206,20 @@ int main(int argc, char **argv)
 		length = meminfo.size;
 
 	if (offset % meminfo.erasesize) {
-		fprintf(stderr, "Offset %x not multiple of erase size %x\n", 
+		fprintf(stderr, "Offset %x not multiple of erase size %x\n",
 			offset, meminfo.erasesize);
 		exit(1);
 	}
 	if (length % meminfo.erasesize) {
-		fprintf(stderr, "Length %x not multiple of erase size %x\n", 
+		fprintf(stderr, "Length %x not multiple of erase size %x\n",
 			length, meminfo.erasesize);
 		exit(1);
 	}
 	if (length + offset > meminfo.size) {
-		fprintf(stderr, "Length %x + offset %x exceeds device size %x\n", 
+		fprintf(stderr, "Length %x + offset %x exceeds device size %x\n",
 			length, offset, meminfo.size);
 		exit(1);
-	}		
+	}
 
 	wbuf = malloc(meminfo.erasesize * 3);
 	if (!wbuf) {
diff --git a/rbtree.c b/rbtree.c
index dd50134..329e098 100644
--- a/rbtree.c
+++ b/rbtree.c
@@ -2,7 +2,7 @@
   Red Black Trees
   (C) 1999  Andrea Arcangeli <andrea@suse.de>
   (C) 2002  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
@@ -324,7 +324,7 @@ struct rb_node *rb_next(struct rb_node *node)
 	/* If we have a right-hand child, go down and then left as far
 	   as we can. */
 	if (node->rb_right) {
-		node = node->rb_right; 
+		node = node->rb_right;
 		while (node->rb_left)
 			node=node->rb_left;
 		return node;
@@ -352,7 +352,7 @@ struct rb_node *rb_prev(struct rb_node *node)
 	/* If we have a left-hand child, go down and then right as far
 	   as we can. */
 	if (node->rb_left) {
-		node = node->rb_left; 
+		node = node->rb_left;
 		while (node->rb_right)
 			node=node->rb_right;
 		return node;
diff --git a/rbtree.h b/rbtree.h
index e64dc9a..0d77b65 100644
--- a/rbtree.h
+++ b/rbtree.h
@@ -1,7 +1,7 @@
 /*
   Red Black Trees
   (C) 1999  Andrea Arcangeli <andrea@suse.de>
-  
+
   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
@@ -156,7 +156,7 @@ extern struct rb_node *rb_first(struct rb_root *);
 extern struct rb_node *rb_last(struct rb_root *);
 
 /* Fast replacement of a single node without remove/rebalance/add/rebalance */
-extern void rb_replace_node(struct rb_node *victim, struct rb_node *new, 
+extern void rb_replace_node(struct rb_node *victim, struct rb_node *new,
 			    struct rb_root *root);
 
 static inline void rb_link_node(struct rb_node * node, struct rb_node * parent,
diff --git a/recv_image.c b/recv_image.c
index a3c3fd5..26a8361 100644
--- a/recv_image.c
+++ b/recv_image.c
@@ -111,7 +111,7 @@ int main(int argc, char **argv)
 	memset(&hints, 0, sizeof(hints));
 	hints.ai_flags = AI_ADDRCONFIG;
 	hints.ai_socktype = SOCK_DGRAM;
-	
+
 	ret = getaddrinfo(argv[1], argv[2], &hints, &ai);
 	if (ret) {
 		fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(ret));
@@ -131,18 +131,18 @@ int main(int argc, char **argv)
 			rq.imr_multiaddr = ((struct sockaddr_in *)runp->ai_addr)->sin_addr;
 			rq.imr_interface.s_addr = INADDR_ANY;
 			if (setsockopt(sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, &rq, sizeof(rq))) {
-				perror("IP_ADD_MEMBERSHIP"); 
+				perror("IP_ADD_MEMBERSHIP");
 				close(sock);
 				continue;
 			}
-			
+
 		} else if (runp->ai_family == AF_INET6 &&
 			   ((struct sockaddr_in6 *)runp->ai_addr)->sin6_addr.s6_addr[0] == 0xff) {
 			struct ipv6_mreq rq;
 			rq.ipv6mr_multiaddr =  ((struct sockaddr_in6 *)runp->ai_addr)->sin6_addr;
 			rq.ipv6mr_interface = 0;
 			if (setsockopt(sock, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, &rq, sizeof(rq))) {
-				perror("IPV6_ADD_MEMBERSHIP"); 
+				perror("IPV6_ADD_MEMBERSHIP");
 				close(sock);
 				continue;
 			}
@@ -254,7 +254,7 @@ int main(int argc, char **argv)
 			continue;
 		}
 	pkt_again:
-		eraseblocks[block_nr].pkt_indices[eraseblocks[block_nr].nr_pkts++] = 
+		eraseblocks[block_nr].pkt_indices[eraseblocks[block_nr].nr_pkts++] =
 			ntohs(thispkt.hdr.pkt_nr);
 		total_pkts++;
 		if (!(total_pkts % 50) || total_pkts == pkts_per_block * nr_blocks) {
@@ -290,7 +290,7 @@ int main(int argc, char **argv)
 			       thispkt.data, fits);
 			wrotelen = pwrite(flfd, eraseblocks[block_nr].wbuf, WBUF_SIZE,
 					  eraseblocks[block_nr].flash_offset);
-			
+
 			if (wrotelen < WBUF_SIZE || (block_nr == 5 && eraseblocks[block_nr].nr_pkts == 5 && !faked)) {
 				faked = 1;
 				if (wrotelen < 0)
@@ -308,7 +308,7 @@ int main(int argc, char **argv)
 						~(meminfo.erasesize - 1);
 					erase.length = meminfo.erasesize;
 
-					printf("Will erase at %08x len %08x (bad write was at %08x)\n", 
+					printf("Will erase at %08x len %08x (bad write was at %08x)\n",
 					       erase.start, erase.length, eraseblocks[block_nr].flash_offset);
 					if (ioctl(flfd, MEMERASE, &erase)) {
 						perror("MEMERASE");
@@ -342,7 +342,7 @@ int main(int argc, char **argv)
 			memcpy(eraseblocks[block_nr].wbuf, &thispkt.data[fits], PKT_SIZE - fits);
 			eraseblocks[block_nr].wbuf_ofs = PKT_SIZE - fits;
 		}
-		
+
 		if (eraseblocks[block_nr].nr_pkts == pkts_per_block) {
 			eraseblocks[block_nr].crc = ntohl(thispkt.hdr.block_crc);
 
@@ -388,7 +388,7 @@ int main(int argc, char **argv)
 		gettimeofday(&now, NULL);
 		fec_time += (now.tv_usec - start.tv_usec) / 1000;
 		fec_time += (now.tv_sec - start.tv_sec) * 1000;
-		
+
 		for (i=0; i < pkts_per_block; i++)
 			memcpy(&decode_buf[i*PKT_SIZE], src_pkts[i], PKT_SIZE);
 
@@ -396,7 +396,7 @@ int main(int argc, char **argv)
 		gettimeofday(&start, NULL);
 		if (mtd_crc32(-1, decode_buf, meminfo.erasesize) != eraseblocks[block_nr].crc) {
 			printf("\nCRC mismatch for block #%d: want %08x got %08x\n",
-			       block_nr, eraseblocks[block_nr].crc, 
+			       block_nr, eraseblocks[block_nr].crc,
 			       mtd_crc32(-1, decode_buf, meminfo.erasesize));
 			exit(1);
 		}
@@ -410,7 +410,7 @@ int main(int argc, char **argv)
 
 			erase.start = eraseblocks[block_nr].flash_offset;
 			erase.length = meminfo.erasesize;
-			
+
 			printf("\rErasing block at %08x...", erase.start);
 
 			if (ioctl(flfd, MEMERASE, &erase)) {
@@ -430,7 +430,7 @@ int main(int argc, char **argv)
 		if (rwlen < meminfo.erasesize) {
 			if (rwlen < 0) {
 				perror("\ndecoded data write");
-			} else 
+			} else
 				fprintf(stderr, "\nshort write of decoded data\n");
 
 			if (!file_mode) {
diff --git a/serve_image.c b/serve_image.c
index f7f6315..38549a1 100644
--- a/serve_image.c
+++ b/serve_image.c
@@ -2,13 +2,13 @@
 #define _POSIX_C_SOURCE 199309
 
 #include <time.h>
-#include <errno.h>  	
-#include <error.h> 	
-#include <netdb.h> 	
-#include <stdio.h> 	
-#include <stdlib.h> 	
+#include <errno.h>
+#include <error.h>
+#include <netdb.h>
+#include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
-#include <unistd.h> 	
+#include <unistd.h>
 #include <fcntl.h>
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -83,7 +83,7 @@ int main(int argc, char **argv)
 		fprintf(stderr, "Failed to allocate last-block buffer\n");
 		exit(1);
 	}
-	
+
 	fec = fec_new(pkts_per_block, total_pkts_per_block);
 	if (!fec) {
 		fprintf(stderr, "Error initialising FEC\n");
@@ -93,7 +93,7 @@ int main(int argc, char **argv)
 	memset(&hints, 0, sizeof(hints));
 	hints.ai_flags = AI_ADDRCONFIG;
 	hints.ai_socktype = SOCK_DGRAM;
-	
+
 	ret = getaddrinfo(argv[1], argv[2], &hints, &ai);
 	if (ret) {
 		fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(ret));
@@ -167,9 +167,9 @@ int main(int argc, char **argv)
 		fflush(stdout);
 		block_crcs[block_nr] = mtd_crc32(-1, image + (block_nr * erasesize), erasesize);
 	}
-		
+
 	printf("\nImage size %ld KiB (0x%08lx). %d blocks at %d pkts/block\n"
-	       "Estimated transmit time per cycle: %ds\n", 
+	       "Estimated transmit time per cycle: %ds\n",
 	       (long)st.st_size / 1024, (long) st.st_size,
 	       nr_blocks, pkts_per_block,
 	       nr_blocks * pkts_per_block * pkt_delay / 1000000);
@@ -202,11 +202,11 @@ int main(int argc, char **argv)
 			   the first $pkts_per_block are cheap enough though
 			   because they're just copies. So alternate between
 			   simple and complex stuff, so that we don't start
-			   to choke and fail to keep up with the expected 
+			   to choke and fail to keep up with the expected
 			   bitrate in the second half of the sequence */
 			if (block_nr & 1)
 				actualpkt = pkt_nr;
-			else 
+			else
 				actualpkt = total_pkts_per_block - 1 - pkt_nr;
 
 			blockptr = image + (erasesize * block_nr);
@@ -246,7 +246,7 @@ int main(int argc, char **argv)
 #endif
 			gettimeofday(&now, NULL);
 #if 1
-			tosleep = nextpkt.tv_usec - now.tv_usec + 
+			tosleep = nextpkt.tv_usec - now.tv_usec +
 				(1000000 * (nextpkt.tv_sec - now.tv_sec));
 
 			/* We need hrtimers for this to actually work */
@@ -276,7 +276,7 @@ int main(int argc, char **argv)
 			   Adjust our expected timings accordingly. If
 			   we're only a little way behind, don't slip yet */
 			if (now.tv_usec > (now.tv_usec + (5 * pkt_delay) +
-					   1000000 * (nextpkt.tv_sec - now.tv_sec))) { 
+					1000000 * (nextpkt.tv_sec - now.tv_sec))) {
 				nextpkt = now;
 			}
 
@@ -291,7 +291,7 @@ int main(int argc, char **argv)
 				writeerrors = 0;
 
 
-			
+
 		}
 	}
 	munmap(image, st.st_size);
diff --git a/tests/checkfs/README b/tests/checkfs/README
index d9966a5..6b72487 100644
--- a/tests/checkfs/README
+++ b/tests/checkfs/README
@@ -11,11 +11,11 @@ This is the README file for the "checkfs" power fail test program.
 By: Vipin Malik
 
 NOTE: This program requires an external "power cycling box"
-connected to one of the com ports of the system under test. 
-This power cycling box should wait for a random amount of time 
-after it receives a "ok to power me down" message over the 
+connected to one of the com ports of the system under test.
+This power cycling box should wait for a random amount of time
+after it receives a "ok to power me down" message over the
 serial port, and then yank power to the system under test.
-(The box that I rigged up tested with waits anywhere from 
+(The box that I rigged up tested with waits anywhere from
 0 to ~40 seconds).
 
 
@@ -75,7 +75,7 @@ some "sister" files on the root fs even though "checkfs" would
 run fine through all its own check files.
 
 (I found this out when one of the clobbered sister file happened
-to be /bin/bash. The system refused to run rc.local thus 
+to be /bin/bash. The system refused to run rc.local thus
 preventing my "checkfs" program from being launched :)
 
 "checkfs":
@@ -98,8 +98,8 @@ Each file has a random number of bytes in it (set by using the
 first "int" in it (note: 0 length files are not allowed). Each file
 is then filled with random data and a 16 bit CRC appended at the end.
 
-When "checkfs" is run, it runs through all files (with predetermined 
-file names)- one at a time- and checks for the number of "int's" 
+When "checkfs" is run, it runs through all files (with predetermined
+file names)- one at a time- and checks for the number of "int's"
 in it as well as the ending CRC.
 
 The program exits if the numbers of files that are corrupt are greater
@@ -116,10 +116,10 @@ the data reliability of "other" files present of the fs, use -e 1.
 "other" files are defined as sister files on the fs, not being written to
 by the "checkfs" test program.
 
-As mentioned, in this case you would set -e 1, or allow at most 1 file 
-to be corrupt each time after a power fail. This would be the file 
-that was probably being written to when power failed (and CRC was not 
-updated to reflect the  new data being written). You would check file 
+As mentioned, in this case you would set -e 1, or allow at most 1 file
+to be corrupt each time after a power fail. This would be the file
+that was probably being written to when power failed (and CRC was not
+updated to reflect the  new data being written). You would check file
 systems like ext2 etc. with such a configuration.
 (As you have no hope that these file systems provide for either your
 new data or old data to be present in the file if power failed during
@@ -137,13 +137,13 @@ In other words, JFFS2 will partially update a file on FLASH even before
 the write() command has completed, thus leaving part old data part new
 data in your file if power failed in the middle of a write().
 
-This is bad functionality if you are updating a binary structure or a 
+This is bad functionality if you are updating a binary structure or a
 CRC protected file (as in our case).
 
 
 If All Files Check Out OK:
 
-On the startup scan, if there are less errors than specified by the "-e flag" 
+On the startup scan, if there are less errors than specified by the "-e flag"
 a "ok to power me down message" is sent via the specified com port.
 
 The actual format of this message will depend on the format expected
diff --git a/tests/jittertest/README b/tests/jittertest/README
index f411a2c..b97a8b7 100644
--- a/tests/jittertest/README
+++ b/tests/jittertest/README
@@ -11,7 +11,7 @@ a real time task under Linux with background
 JFFS file system activity.
 
 The jitter is measured in milli seconds (ms) from
-the expected time of arrival of a signal from a 
+the expected time of arrival of a signal from a
 periodic timer (set by the task) to when the
 task actually gets the signal.
 
@@ -20,7 +20,7 @@ This jitter is then stored in a file specified
 
 The data  may also be sent out to the console by
 writing to /dev/console (See help options. This is
-highly desirable specially if you have redirected 
+highly desirable specially if you have redirected
 your console to the serial port and are storing it
 as a minicom log on another computer for later analysis
 using some tools provided here).
@@ -82,7 +82,7 @@ supports it).
   In this test you would generate some background
 write/erase type activity that would generate
 chip erases. Since this program is reading from
-the same file system, you contrast the latencies 
+the same file system, you contrast the latencies
 with those obtained with writes going to the same
 fs.
 
@@ -90,7 +90,7 @@ fs.
 file system:
 
   Here you would test for latencies experienced by
-a program if it were writing (and optionally also 
+a program if it were writing (and optionally also
 reading) from a JFFS fs.
 
 
@@ -99,7 +99,7 @@ reading) from a JFFS fs.
 Grabing a kernel profile:
 
 This program can also conditionally grab a kernel profile.
-Specify --grab_kprofile on the cmd line as well as 
+Specify --grab_kprofile on the cmd line as well as
 a "threshold" parameter (see help options by -?).
 
 Any jitter greater than this "threshold" will cause the
@@ -119,10 +119,10 @@ when you boot the kernel if you want to use this functionality.
 
 Signalling the JFFS[2] GC task:
 
-You can also force this program to send a SIGSTOP/SIGCONT to the 
+You can also force this program to send a SIGSTOP/SIGCONT to the
 JFFS (or JFFS2) gc task by specifing --siggc <pid> on the cmd line.
 
-This will let you investigate the effect of forcing the gc task to 
+This will let you investigate the effect of forcing the gc task to
 wake up and do its thing when you are not writing to the fs and to
 force it to sleep when you want to write to the fs.
 
@@ -130,7 +130,7 @@ These are just various tools to investigate the possibility of
 achieving minimal read/write latency when using JFFS[2].
 
 You need to manually do a "ps aux" and look up the PID of the gc
-thread and provide it to the program. 
+thread and provide it to the program.
 
 
 
@@ -156,7 +156,7 @@ console log or printk data).
 
 You can then run this saved console log through this program and it
 will output a very nice text file with the %fill in one col and
-corrosponding jitter values in the second. gnuplot then does a 
+corrosponding jitter values in the second. gnuplot then does a
 beautifull plot of this resulting file showing you graphically the
 jitters encountered at different fill % of your JFFS[2] fs.
 
diff --git a/tests/jittertest/filljffs2.sh b/tests/jittertest/filljffs2.sh
index 10651f4..d8c2a83 100644
--- a/tests/jittertest/filljffs2.sh
+++ b/tests/jittertest/filljffs2.sh
@@ -8,7 +8,7 @@
 while [ $(( 1 )) -gt $(( 0 )) ]
 do
    cp $1 $2
-   rm $2 
+   rm $2
    df |grep mtd > /dev/console
    echo "sleeping $3"
    sleep $3
diff --git a/ubi-utils/dictionary.c b/ubi-utils/dictionary.c
index b7c9ebf..f4b7468 100644
--- a/ubi-utils/dictionary.c
+++ b/ubi-utils/dictionary.c
@@ -44,7 +44,7 @@
 static void * mem_double(void * ptr, int size)
 {
     void * newptr ;
- 
+
     newptr = calloc(2*size, 1);
     if (newptr==NULL) {
         return NULL ;
@@ -230,7 +230,7 @@ int dictionary_set(dictionary * d, char * key, char * val)
 	unsigned	hash ;
 
 	if (d==NULL || key==NULL) return -1 ;
-	
+
 	/* Compute hash for this key */
 	hash = dictionary_hash(key) ;
 	/* Find if value is already in dictionary */
@@ -374,7 +374,7 @@ int main(int argc, char *argv[])
 	/* Allocate dictionary */
 	printf("allocating...\n");
 	d = dictionary_new(0);
-	
+
 	/* Set values in dictionary */
 	printf("setting %d values...\n", NVALS);
 	for (i=0 ; i<NVALS ; i++) {
diff --git a/ubi-utils/libiniparser.c b/ubi-utils/libiniparser.c
index 3bea51e..898f57f 100644
--- a/ubi-utils/libiniparser.c
+++ b/ubi-utils/libiniparser.c
@@ -82,9 +82,9 @@ static char * strstrip(char * s)
 {
     static char l[ASCIILINESZ+1];
 	char * last ;
-	
+
     if (s==NULL) return NULL ;
-    
+
 	while (isspace((int)*s) && *s) s++;
 	memset(l, 0, ASCIILINESZ+1);
 	strcpy(l, s);
@@ -457,7 +457,7 @@ static line_status iniparser_line(
     char * section,
     char * key,
     char * value)
-{   
+{
     line_status sta ;
     char        line[ASCIILINESZ+1];
     int         len ;
@@ -471,7 +471,7 @@ static line_status iniparser_line(
         sta = LINE_EMPTY ;
     } else if (line[0]=='#') {
         /* Comment line */
-        sta = LINE_COMMENT ; 
+        sta = LINE_COMMENT ;
     } else if (line[0]=='[' && line[len-1]==']') {
         /* Section name */
         sscanf(line, "[%[^]]", section);
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 04/10] mtd-utils: update .gitignore files
  2011-06-27 18:27 [PATCH 00/10] more mtd-utils cleanup Brian Norris
                   ` (2 preceding siblings ...)
  2011-06-27 18:27 ` [PATCH 03/10] mtd-utils: remove whitespace at end of lines Brian Norris
@ 2011-06-27 18:27 ` Brian Norris
  2011-06-27 18:27 ` [PATCH 05/10] mkfs.ubifs: use common.h Brian Norris
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Brian Norris @ 2011-06-27 18:27 UTC (permalink / raw)
  To: Artem Bityutskiy; +Cc: Brian Norris, linux-mtd, Mike Frysinger

First, the top-level Makefile should not tell git to ignore sub-level
.gitignore files.

Second, add simple .gitignores to ignore the executables generated under
the various `tests' subdirectories.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
 .gitignore                             |    5 +++++
 tests/checkfs/.gitignore               |    2 ++
 tests/fs-tests/integrity/.gitignore    |    1 +
 tests/fs-tests/simple/.gitignore       |    5 +++++
 tests/fs-tests/stress/atoms/.gitignore |   10 ++++++++++
 tests/fs-tests/utils/.gitignore        |    2 ++
 tests/jittertest/.gitignore            |    2 ++
 7 files changed, 27 insertions(+), 0 deletions(-)
 create mode 100644 tests/checkfs/.gitignore
 create mode 100644 tests/fs-tests/integrity/.gitignore
 create mode 100644 tests/fs-tests/simple/.gitignore
 create mode 100644 tests/fs-tests/stress/atoms/.gitignore
 create mode 100644 tests/fs-tests/utils/.gitignore
 create mode 100644 tests/jittertest/.gitignore

diff --git a/.gitignore b/.gitignore
index 86aee63..3a56d0d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -48,6 +48,11 @@
 #
 
 #
+# git files that we don't want to ignore even it they are dot-files
+#
+!.gitignore
+
+#
 # Generated include files
 #
 /include/version.h
diff --git a/tests/checkfs/.gitignore b/tests/checkfs/.gitignore
new file mode 100644
index 0000000..52e7b5d
--- /dev/null
+++ b/tests/checkfs/.gitignore
@@ -0,0 +1,2 @@
+/checkfs
+/makefiles
diff --git a/tests/fs-tests/integrity/.gitignore b/tests/fs-tests/integrity/.gitignore
new file mode 100644
index 0000000..2ea8e69
--- /dev/null
+++ b/tests/fs-tests/integrity/.gitignore
@@ -0,0 +1 @@
+/integck
diff --git a/tests/fs-tests/simple/.gitignore b/tests/fs-tests/simple/.gitignore
new file mode 100644
index 0000000..f3ccde4
--- /dev/null
+++ b/tests/fs-tests/simple/.gitignore
@@ -0,0 +1,5 @@
+/ftrunc
+/orph
+/perf
+/test_1
+/test_2
diff --git a/tests/fs-tests/stress/atoms/.gitignore b/tests/fs-tests/stress/atoms/.gitignore
new file mode 100644
index 0000000..67dede0
--- /dev/null
+++ b/tests/fs-tests/stress/atoms/.gitignore
@@ -0,0 +1,10 @@
+/fwrite00
+/gcd_hupper
+/pdfrun
+/rmdir00
+/rndrm00
+/rndrm99
+/rndwrite00
+/stress_1
+/stress_2
+/stress_3
diff --git a/tests/fs-tests/utils/.gitignore b/tests/fs-tests/utils/.gitignore
new file mode 100644
index 0000000..f3cdf5f
--- /dev/null
+++ b/tests/fs-tests/utils/.gitignore
@@ -0,0 +1,2 @@
+/free_space
+/fstest_monitor
diff --git a/tests/jittertest/.gitignore b/tests/jittertest/.gitignore
new file mode 100644
index 0000000..05d4e9e
--- /dev/null
+++ b/tests/jittertest/.gitignore
@@ -0,0 +1,2 @@
+/JitterTest
+/plotJittervsFill
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 05/10] mkfs.ubifs: use common.h
  2011-06-27 18:27 [PATCH 00/10] more mtd-utils cleanup Brian Norris
                   ` (3 preceding siblings ...)
  2011-06-27 18:27 ` [PATCH 04/10] mtd-utils: update .gitignore files Brian Norris
@ 2011-06-27 18:27 ` Brian Norris
  2011-06-27 18:27 ` [PATCH 06/10] mtd-utils: add common version printing function Brian Norris
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Brian Norris @ 2011-06-27 18:27 UTC (permalink / raw)
  To: Artem Bityutskiy; +Cc: Brian Norris, linux-mtd, Mike Frysinger

To use more unified versioning and to re-use other existing code,
switch to common.h.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
 mkfs.ubifs/mkfs.ubifs.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/mkfs.ubifs/mkfs.ubifs.c b/mkfs.ubifs/mkfs.ubifs.c
index ac3c8d3..c718818 100644
--- a/mkfs.ubifs/mkfs.ubifs.c
+++ b/mkfs.ubifs/mkfs.ubifs.c
@@ -20,8 +20,11 @@
  *          Zoltan Sogor
  */
 
+#define PROGRAM_NAME "mkfs.ubifs"
+
 #include "mkfs.ubifs.h"
 #include <crc32.h>
+#include "common.h"
 
 #define PROGRAM_VERSION "1.5"
 
@@ -390,11 +393,6 @@ static long long add_space_overhead(long long size)
         return size / divisor;
 }
 
-static inline int is_power_of_2(unsigned long long n)
-{
-                return (n != 0 && ((n & (n - 1)) == 0));
-}
-
 static int validate_options(void)
 {
 	int tmp;
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 06/10] mtd-utils: add common version printing function
  2011-06-27 18:27 [PATCH 00/10] more mtd-utils cleanup Brian Norris
                   ` (4 preceding siblings ...)
  2011-06-27 18:27 ` [PATCH 05/10] mkfs.ubifs: use common.h Brian Norris
@ 2011-06-27 18:27 ` Brian Norris
  2011-06-27 19:51   ` Mike Frysinger
  2011-06-27 18:27 ` [PATCH 07/10] mtd-utils: switch more utils to unified versioning Brian Norris
                   ` (4 subsequent siblings)
  10 siblings, 1 reply; 21+ messages in thread
From: Brian Norris @ 2011-06-27 18:27 UTC (permalink / raw)
  To: Artem Bityutskiy; +Cc: Brian Norris, linux-mtd, Mike Frysinger

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
 include/common.h |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/include/common.h b/include/common.h
index 65ec086..b285bc0 100644
--- a/include/common.h
+++ b/include/common.h
@@ -129,6 +129,12 @@ simple_strtoX(strtoll, long long int)
 simple_strtoX(strtoul, unsigned long int)
 simple_strtoX(strtoull, unsigned long long int)
 
+/* Simple version-printing for utils */
+#define common_print_version() \
+do { \
+	fprintf(stderr, PROGRAM_NAME " " VERSION "\n"); \
+} while (0)
+
 #include "xalloc.h"
 
 #ifdef __cplusplus
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 07/10] mtd-utils: switch more utils to unified versioning
  2011-06-27 18:27 [PATCH 00/10] more mtd-utils cleanup Brian Norris
                   ` (5 preceding siblings ...)
  2011-06-27 18:27 ` [PATCH 06/10] mtd-utils: add common version printing function Brian Norris
@ 2011-06-27 18:27 ` Brian Norris
  2011-06-27 18:27 ` [PATCH 08/10] mtd-utils: kill flash_info Brian Norris
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Brian Norris @ 2011-06-27 18:27 UTC (permalink / raw)
  To: Artem Bityutskiy; +Cc: Brian Norris, linux-mtd, Mike Frysinger

More utilities now use the common VERSION system.

For utils that printed a very simple message, we use the new
common_print_version() "function."

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
 jffs2dump.c              |    2 +-
 mkfs.ubifs/mkfs.ubifs.c  |    4 +---
 ubi-utils/mtdinfo.c      |    5 ++---
 ubi-utils/ubiattach.c    |    5 ++---
 ubi-utils/ubicrc32.c     |    5 ++---
 ubi-utils/ubidetach.c    |    5 ++---
 ubi-utils/ubiformat.c    |    5 ++---
 ubi-utils/ubimkvol.c     |    5 ++---
 ubi-utils/ubinfo.c       |    5 ++---
 ubi-utils/ubinize.c      |    5 ++---
 ubi-utils/ubirename.c    |    1 -
 ubi-utils/ubirmvol.c     |    5 ++---
 ubi-utils/ubirsvol.c     |    5 ++---
 ubi-utils/ubiupdatevol.c |    5 ++---
 14 files changed, 24 insertions(+), 38 deletions(-)

diff --git a/jffs2dump.c b/jffs2dump.c
index d093afc..9e13e98 100644
--- a/jffs2dump.c
+++ b/jffs2dump.c
@@ -15,7 +15,6 @@
  */
 
 #define PROGRAM_NAME "jffs2dump"
-#define VERSION "$Revision: 1.10 $"
 
 #include <errno.h>
 #include <stdint.h>
@@ -36,6 +35,7 @@
 #include <getopt.h>
 #include <crc32.h>
 #include "summary.h"
+#include "common.h"
 
 #define PAD(x) (((x)+3)&~3)
 
diff --git a/mkfs.ubifs/mkfs.ubifs.c b/mkfs.ubifs/mkfs.ubifs.c
index c718818..733a3bb 100644
--- a/mkfs.ubifs/mkfs.ubifs.c
+++ b/mkfs.ubifs/mkfs.ubifs.c
@@ -26,8 +26,6 @@
 #include <crc32.h>
 #include "common.h"
 
-#define PROGRAM_VERSION "1.5"
-
 /* Size (prime number) of hash table for link counting */
 #define HASH_TABLE_SIZE 10099
 
@@ -606,7 +604,7 @@ static int get_options(int argc, char**argv)
 			verbose = 1;
 			break;
 		case 'V':
-			printf("Version " PROGRAM_VERSION "\n");
+			common_print_version();
 			exit(0);
 		case 'g':
 			debug_level = strtol(optarg, &endp, 0);
diff --git a/ubi-utils/mtdinfo.c b/ubi-utils/mtdinfo.c
index bfd7e6d..ab00ce0 100644
--- a/ubi-utils/mtdinfo.c
+++ b/ubi-utils/mtdinfo.c
@@ -21,7 +21,6 @@
  * Author: Artem Bityutskiy
  */
 
-#define PROGRAM_VERSION "1.1"
 #define PROGRAM_NAME    "mtdinfo"
 
 #include <stdint.h>
@@ -53,7 +52,7 @@ static struct args args = {
 	.node = NULL,
 };
 
-static const char doc[] = PROGRAM_NAME " version " PROGRAM_VERSION
+static const char doc[] = PROGRAM_NAME " version " VERSION
 			 " - a tool to print MTD information.";
 
 static const char optionsstr[] =
@@ -125,7 +124,7 @@ static int parse_opt(int argc, char * const argv[])
 			exit(EXIT_SUCCESS);
 
 		case 'V':
-			printf("%s\n", PROGRAM_VERSION);
+			common_print_version();
 			exit(EXIT_SUCCESS);
 
 		case ':':
diff --git a/ubi-utils/ubiattach.c b/ubi-utils/ubiattach.c
index 4f18e99..27e7c09 100644
--- a/ubi-utils/ubiattach.c
+++ b/ubi-utils/ubiattach.c
@@ -21,7 +21,6 @@
  * Author: Artem Bityutskiy
  */
 
-#define PROGRAM_VERSION "1.1"
 #define PROGRAM_NAME    "ubiattach"
 
 #include <stdio.h>
@@ -53,7 +52,7 @@ static struct args args = {
 	.dev = NULL,
 };
 
-static const char doc[] = PROGRAM_NAME " version " PROGRAM_VERSION
+static const char doc[] = PROGRAM_NAME " version " VERSION
 			 " - a tool to attach MTD device to UBI.";
 
 static const char optionsstr[] =
@@ -129,7 +128,7 @@ static int parse_opt(int argc, char * const argv[])
 			exit(EXIT_SUCCESS);
 
 		case 'V':
-			fprintf(stderr, "%s\n", PROGRAM_VERSION);
+			common_print_version();
 			exit(EXIT_SUCCESS);
 
 		case ':':
diff --git a/ubi-utils/ubicrc32.c b/ubi-utils/ubicrc32.c
index 73ec595..0ea255d 100644
--- a/ubi-utils/ubicrc32.c
+++ b/ubi-utils/ubicrc32.c
@@ -22,7 +22,6 @@
  * Author: Oliver Lohmann
  */
 
-#define PROGRAM_VERSION "1.0"
 #define PROGRAM_NAME    "ubicrc32"
 
 #include <stdio.h>
@@ -37,7 +36,7 @@
 
 #define BUFSIZE 4096
 
-static const char doc[] = PROGRAM_NAME " version " PROGRAM_VERSION
+static const char doc[] = PROGRAM_NAME " version " VERSION
 			 " - a tool to calculate CRC32 with UBI start value (0xFFFFFFFF)";
 
 static const char optionsstr[] =
@@ -70,7 +69,7 @@ static int parse_opt(int argc, char * const argv[])
 			exit(EXIT_SUCCESS);
 
 		case 'V':
-			fprintf(stderr, "%s\n", PROGRAM_VERSION);
+			common_print_version();
 			exit(EXIT_SUCCESS);
 
 		case ':':
diff --git a/ubi-utils/ubidetach.c b/ubi-utils/ubidetach.c
index 668f1bd..64b748e 100644
--- a/ubi-utils/ubidetach.c
+++ b/ubi-utils/ubidetach.c
@@ -21,7 +21,6 @@
  * Author: Artem Bityutskiy
  */
 
-#define PROGRAM_VERSION "1.1"
 #define PROGRAM_NAME    "ubidetach"
 
 #include <stdio.h>
@@ -50,7 +49,7 @@ static struct args args = {
 	.dev = NULL,
 };
 
-static const char doc[] = PROGRAM_NAME " version " PROGRAM_VERSION
+static const char doc[] = PROGRAM_NAME " version " VERSION
 " - tool to remove UBI devices (detach MTD devices from UBI)";
 
 static const char optionsstr[] =
@@ -113,7 +112,7 @@ static int parse_opt(int argc, char * const argv[])
 			exit(EXIT_SUCCESS);
 
 		case 'V':
-			fprintf(stderr, "%s\n", PROGRAM_VERSION);
+			common_print_version();
 			exit(EXIT_SUCCESS);
 
 		case ':':
diff --git a/ubi-utils/ubiformat.c b/ubi-utils/ubiformat.c
index c4b944a..bfa1730 100644
--- a/ubi-utils/ubiformat.c
+++ b/ubi-utils/ubiformat.c
@@ -29,7 +29,6 @@
  */
 #define MAX_CONSECUTIVE_BAD_BLOCKS 4
 
-#define PROGRAM_VERSION "1.5"
 #define PROGRAM_NAME    "ubiformat"
 
 #include <sys/stat.h>
@@ -72,7 +71,7 @@ static struct args args =
 	.ubi_ver   = 1,
 };
 
-static const char doc[] = PROGRAM_NAME " version " PROGRAM_VERSION
+static const char doc[] = PROGRAM_NAME " version " VERSION
 		" - a tool to format MTD devices and flash UBI images";
 
 static const char optionsstr[] =
@@ -206,7 +205,7 @@ static int parse_opt(int argc, char * const argv[])
 			break;
 
 		case 'V':
-			fprintf(stderr, "%s\n", PROGRAM_VERSION);
+			common_print_version();
 			exit(EXIT_SUCCESS);
 
 		case 'h':
diff --git a/ubi-utils/ubimkvol.c b/ubi-utils/ubimkvol.c
index 25065e3..7c2a234 100644
--- a/ubi-utils/ubimkvol.c
+++ b/ubi-utils/ubimkvol.c
@@ -23,7 +23,6 @@
  *          Frank Haverkamp <haver@vnet.ibm.com>
  */
 
-#define PROGRAM_VERSION "1.1"
 #define PROGRAM_NAME    "ubimkvol"
 
 #include <stdio.h>
@@ -56,7 +55,7 @@ static struct args args = {
 	.vol_id = UBI_VOL_NUM_AUTO,
 };
 
-static const char doc[] = PROGRAM_NAME " version " PROGRAM_VERSION
+static const char doc[] = PROGRAM_NAME " version " VERSION
 			 " - a tool to create UBI volumes.";
 
 static const char optionsstr[] =
@@ -173,7 +172,7 @@ static int parse_opt(int argc, char * const argv[])
 			exit(EXIT_SUCCESS);
 
 		case 'V':
-			fprintf(stderr, "%s\n", PROGRAM_VERSION);
+			common_print_version();
 			exit(EXIT_SUCCESS);
 
 		case 'm':
diff --git a/ubi-utils/ubinfo.c b/ubi-utils/ubinfo.c
index 8e14e6e..7aa4aa4 100644
--- a/ubi-utils/ubinfo.c
+++ b/ubi-utils/ubinfo.c
@@ -21,7 +21,6 @@
  * Author: Artem Bityutskiy
  */
 
-#define PROGRAM_VERSION "1.1"
 #define PROGRAM_NAME    "ubinfo"
 
 #include <stdint.h>
@@ -51,7 +50,7 @@ static struct args args = {
 	.vol_name = NULL,
 };
 
-static const char doc[] = PROGRAM_NAME " version " PROGRAM_VERSION
+static const char doc[] = PROGRAM_NAME " version " VERSION
 			 " - a tool to print UBI information.";
 
 static const char optionsstr[] =
@@ -124,7 +123,7 @@ static int parse_opt(int argc, char * const argv[])
 			exit(EXIT_SUCCESS);
 
 		case 'V':
-			fprintf(stderr, "%s\n", PROGRAM_VERSION);
+			common_print_version();
 			exit(EXIT_SUCCESS);
 
 		case ':':
diff --git a/ubi-utils/ubinize.c b/ubi-utils/ubinize.c
index 3085b66..453494d 100644
--- a/ubi-utils/ubinize.c
+++ b/ubi-utils/ubinize.c
@@ -24,7 +24,6 @@
  *          Oliver Lohmann
  */
 
-#define PROGRAM_VERSION "1.2"
 #define PROGRAM_NAME    "ubinize"
 
 #include <sys/stat.h>
@@ -39,7 +38,7 @@
 #include "common.h"
 #include "ubiutils-common.h"
 
-static const char doc[] = PROGRAM_NAME " version " PROGRAM_VERSION
+static const char doc[] = PROGRAM_NAME " version " VERSION
 " - a tool to generate UBI images. An UBI image may contain one or more UBI "
 "volumes which have to be defined in the input configuration ini-file. The "
 "ini file defines all the UBI volumes - their characteristics and the and the "
@@ -234,7 +233,7 @@ static int parse_opt(int argc, char * const argv[])
 			exit(EXIT_SUCCESS);
 
 		case 'V':
-			fprintf(stderr, "%s\n", PROGRAM_VERSION);
+			common_print_version();
 			exit(EXIT_SUCCESS);
 
 		default:
diff --git a/ubi-utils/ubirename.c b/ubi-utils/ubirename.c
index 070e32e..288475b 100644
--- a/ubi-utils/ubirename.c
+++ b/ubi-utils/ubirename.c
@@ -21,7 +21,6 @@
  * Author: Richard Titmuss
  */
 
-#define PROGRAM_VERSION "1.0"
 #define PROGRAM_NAME    "ubirename"
 
 #include <stdio.h>
diff --git a/ubi-utils/ubirmvol.c b/ubi-utils/ubirmvol.c
index 5725d90..464f05d 100644
--- a/ubi-utils/ubirmvol.c
+++ b/ubi-utils/ubirmvol.c
@@ -23,7 +23,6 @@
  *          Frank Haverkamp <haver@vnet.ibm.com>
  */
 
-#define PROGRAM_VERSION "1.1"
 #define PROGRAM_NAME    "ubirmvol"
 
 #include <stdio.h>
@@ -46,7 +45,7 @@ static struct args args = {
 	.vol_id = -1,
 };
 
-static const char doc[] = PROGRAM_NAME " version " PROGRAM_VERSION
+static const char doc[] = PROGRAM_NAME " version " VERSION
 				 " - a tool to remove UBI volumes.";
 
 static const char optionsstr[] =
@@ -117,7 +116,7 @@ static int parse_opt(int argc, char * const argv[])
 			exit(EXIT_SUCCESS);
 
 		case 'V':
-			fprintf(stderr, "%s\n", PROGRAM_VERSION);
+			common_print_version();
 			exit(EXIT_SUCCESS);
 
 		case ':':
diff --git a/ubi-utils/ubirsvol.c b/ubi-utils/ubirsvol.c
index 65f579c..c469060 100644
--- a/ubi-utils/ubirsvol.c
+++ b/ubi-utils/ubirsvol.c
@@ -23,7 +23,6 @@
  *          Frank Haverkamp <haver@vnet.ibm.com>
  */
 
-#define PROGRAM_VERSION "1.1"
 #define PROGRAM_NAME    "ubirsvol"
 
 #include <stdio.h>
@@ -51,7 +50,7 @@ static struct args args = {
 	.lebs = -1,
 };
 
-static const char doc[] = PROGRAM_NAME " version " PROGRAM_VERSION
+static const char doc[] = PROGRAM_NAME " version " VERSION
 				 " - a tool to resize UBI volumes.";
 
 static const char optionsstr[] =
@@ -146,7 +145,7 @@ static int parse_opt(int argc, char * const argv[])
 			exit(EXIT_SUCCESS);
 
 		case 'V':
-			fprintf(stderr, "%s\n", PROGRAM_VERSION);
+			common_print_version();
 			exit(EXIT_SUCCESS);
 
 		case ':':
diff --git a/ubi-utils/ubiupdatevol.c b/ubi-utils/ubiupdatevol.c
index 24f38fe..7fedb3c 100644
--- a/ubi-utils/ubiupdatevol.c
+++ b/ubi-utils/ubiupdatevol.c
@@ -24,7 +24,6 @@
  *          Artem Bityutskiy
  */
 
-#define PROGRAM_VERSION "1.2"
 #define PROGRAM_NAME    "ubiupdatevol"
 
 #include <fcntl.h>
@@ -52,7 +51,7 @@ struct args {
 
 static struct args args;
 
-static const char doc[] = PROGRAM_NAME " version " PROGRAM_VERSION
+static const char doc[] = PROGRAM_NAME " version " VERSION
 			 " - a tool to write data to UBI volumes.";
 
 static const char optionsstr[] =
@@ -103,7 +102,7 @@ static int parse_opt(int argc, char * const argv[])
 			exit(EXIT_SUCCESS);
 
 		case 'V':
-			fprintf(stderr, "%s\n", PROGRAM_VERSION);
+			common_print_version();
 			exit(EXIT_SUCCESS);
 
 		case ':':
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 08/10] mtd-utils: kill flash_info
  2011-06-27 18:27 [PATCH 00/10] more mtd-utils cleanup Brian Norris
                   ` (6 preceding siblings ...)
  2011-06-27 18:27 ` [PATCH 07/10] mtd-utils: switch more utils to unified versioning Brian Norris
@ 2011-06-27 18:27 ` Brian Norris
  2011-06-27 18:27 ` [PATCH 09/10] mtdinfo: kill -m option Brian Norris
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Brian Norris @ 2011-06-27 18:27 UTC (permalink / raw)
  To: Artem Bityutskiy; +Cc: Brian Norris, linux-mtd, Mike Frysinger

According to "feature-removal-schedule," we kill flash_info in favor of
mtdinfo.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
 Makefile                     |    2 +-
 feature-removal-schedule.txt |    6 ----
 flash_info.c                 |   67 ------------------------------------------
 3 files changed, 1 insertions(+), 74 deletions(-)
 delete mode 100644 flash_info.c

diff --git a/Makefile b/Makefile
index 8f871c6..afbe201 100644
--- a/Makefile
+++ b/Makefile
@@ -18,7 +18,7 @@ TESTS = tests
 
 MTD_BINS = \
 	ftl_format flash_erase nanddump doc_loadbios \
-	ftl_check mkfs.jffs2 flash_lock flash_unlock flash_info \
+	ftl_check mkfs.jffs2 flash_lock flash_unlock \
 	flash_otp_info flash_otp_dump mtd_debug flashcp nandwrite nandtest \
 	jffs2dump \
 	nftldump nftl_format docfdisk \
diff --git a/feature-removal-schedule.txt b/feature-removal-schedule.txt
index a5980f7..0920203 100644
--- a/feature-removal-schedule.txt
+++ b/feature-removal-schedule.txt
@@ -34,9 +34,3 @@ the -m option. For now, we just have a warning, but the option will be
 removed in release 1.4.6.
 
 ---------------------------
-3. flash_info utility
-
-This is duplicating behavior with the mtdinfo utility.  Now the util
-warns when people use it, but it'll be removed in release 1.4.6.
-
----------------------------
diff --git a/flash_info.c b/flash_info.c
deleted file mode 100644
index d9a4492..0000000
--- a/flash_info.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * flash_info.c -- print info about a MTD device
- */
-
-#define PROGRAM_NAME "flash_info"
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <time.h>
-#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> [devices]\n",
-		PROGRAM_NAME);
-	exit(status);
-}
-
-int main(int argc, char *argv[])
-{
-	int fd, i, regcount;
-
-	warnmsg("this utility is deprecated in favor of `mtdinfo` and will be removed in mtd-utils-1.4.6");
-
-	if (argc < 2)
-		usage(1);
-	if (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help"))
-		usage(0);
-
-	for (i = 1; i < argc; ++i) {
-		const char *dev = argv[i];
-		int r;
-		region_info_t reginfo;
-
-		/* 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, &regcount))
-			continue;
-
-		printf("%s: %d erase regions\n", dev, regcount);
-		for (r = 0; r < regcount; ++r) {
-			reginfo.regionindex = r;
-			if (ioctl(fd, MEMGETREGIONINFO, &reginfo) == 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);
-			}
-		}
-	}
-
-	return 0;
-}
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 09/10] mtdinfo: kill -m option
  2011-06-27 18:27 [PATCH 00/10] more mtd-utils cleanup Brian Norris
                   ` (7 preceding siblings ...)
  2011-06-27 18:27 ` [PATCH 08/10] mtd-utils: kill flash_info Brian Norris
@ 2011-06-27 18:27 ` Brian Norris
  2011-06-29  6:02   ` Artem Bityutskiy
  2011-06-27 18:27 ` [PATCH 10/10] nanddump: remove unused variable Brian Norris
  2011-06-27 19:52 ` [PATCH 00/10] more mtd-utils cleanup Mike Frysinger
  10 siblings, 1 reply; 21+ messages in thread
From: Brian Norris @ 2011-06-27 18:27 UTC (permalink / raw)
  To: Artem Bityutskiy; +Cc: Brian Norris, linux-mtd, Mike Frysinger

According to feature-removal-schedule, we shouldn't use `-m', since
it relies on a specific device-naming pattern.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
 feature-removal-schedule.txt |    8 --------
 ubi-utils/mtdinfo.c          |   25 ++++++-------------------
 2 files changed, 6 insertions(+), 27 deletions(-)

diff --git a/feature-removal-schedule.txt b/feature-removal-schedule.txt
index 0920203..69a8155 100644
--- a/feature-removal-schedule.txt
+++ b/feature-removal-schedule.txt
@@ -26,11 +26,3 @@ to stop using them.
 The further step is to remove both of them.
 
 ---------------------------
-2. Kill -m parameter of mtdinfo
-
-We cannot assume that mtd device names follow the "/dev/mtd%d" pattern,
-because it is up to udev rules to name the devices. So we are removing
-the -m option. For now, we just have a warning, but the option will be
-removed in release 1.4.6.
-
----------------------------
diff --git a/ubi-utils/mtdinfo.c b/ubi-utils/mtdinfo.c
index ab00ce0..dd5da53 100644
--- a/ubi-utils/mtdinfo.c
+++ b/ubi-utils/mtdinfo.c
@@ -56,8 +56,6 @@ static const char doc[] = PROGRAM_NAME " version " VERSION
 			 " - a tool to print MTD information.";
 
 static const char optionsstr[] =
-"-m, --mtdn=<MTD device number>  MTD device number to get information about\n"
-"                                (deprecated option, will be removed, do not use)\n"
 "-u, --ubi-info                  print what would UBI layout be if it was put\n"
 "                                on this MTD device\n"
 "-M, --map                       print eraseblock map\n"
@@ -66,20 +64,16 @@ static const char optionsstr[] =
 "-V, --version                   print program version";
 
 static const char usage[] =
-"Usage 1: " PROGRAM_NAME " [-m <MTD device number>] [-u] [-M] [-h] [-V] [--mtdn <MTD device number>]\n"
-"\t\t[--ubi-info] [--help] [--version]\n"
-"Usage 2: " PROGRAM_NAME " <MTD device node file name> [-u] [-M] [-h] [-V] [--ubi-info] [--help]\n"
+"Usage: " PROGRAM_NAME " <MTD device node file name> [-u] [-M] [-h] [-V] [--ubi-info] [--help]\n"
 "\t\t[--version]\n"
 "Example 1: " PROGRAM_NAME " - (no arguments) print general MTD information\n"
-"Example 2: " PROGRAM_NAME " -m 1 - print information about MTD device number 1\n"
-"Example 3: " PROGRAM_NAME " /dev/mtd0 - print information MTD device /dev/mtd0\n"
-"Example 4: " PROGRAM_NAME " /dev/mtd0 -u - print information MTD device /dev/mtd0\n"
+"Example 2: " PROGRAM_NAME " /dev/mtd0 - print information MTD device /dev/mtd0\n"
+"Example 3: " PROGRAM_NAME " /dev/mtd0 -u - print information MTD device /dev/mtd0\n"
 "\t\t\t\tand include UBI layout information\n"
-"Example 5: " PROGRAM_NAME " -a - print information about all MTD devices\n"
+"Example 4: " PROGRAM_NAME " -a - print information about all MTD devices\n"
 "\t\t\tand include UBI layout information\n";
 
 static const struct option long_options[] = {
-	{ .name = "mtdn",      .has_arg = 1, .flag = NULL, .val = 'm' },
 	{ .name = "ubi-info",  .has_arg = 0, .flag = NULL, .val = 'u' },
 	{ .name = "map",       .has_arg = 0, .flag = NULL, .val = 'M' },
 	{ .name = "all",       .has_arg = 0, .flag = NULL, .val = 'a' },
@@ -91,9 +85,9 @@ static const struct option long_options[] = {
 static int parse_opt(int argc, char * const argv[])
 {
 	while (1) {
-		int key, error = 0;
+		int key;
 
-		key = getopt_long(argc, argv, "am:uMhV", long_options, NULL);
+		key = getopt_long(argc, argv, "auMhV", long_options, NULL);
 		if (key == -1)
 			break;
 
@@ -106,13 +100,6 @@ static int parse_opt(int argc, char * const argv[])
 			args.ubinfo = 1;
 			break;
 
-		case 'm':
-			args.mtdn = simple_strtoul(optarg, &error);
-			if (error || args.mtdn < 0)
-				return errmsg("bad MTD device number: \"%s\"", optarg);
-			warnmsg("-m/--mtdn is depecated, will be removed in mtd-utils-1.4.6");
-			break;
-
 		case 'M':
 			args.map = 1;
 			break;
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 10/10] nanddump: remove unused variable
  2011-06-27 18:27 [PATCH 00/10] more mtd-utils cleanup Brian Norris
                   ` (8 preceding siblings ...)
  2011-06-27 18:27 ` [PATCH 09/10] mtdinfo: kill -m option Brian Norris
@ 2011-06-27 18:27 ` Brian Norris
  2011-06-27 19:52 ` [PATCH 00/10] more mtd-utils cleanup Mike Frysinger
  10 siblings, 0 replies; 21+ messages in thread
From: Brian Norris @ 2011-06-27 18:27 UTC (permalink / raw)
  To: Artem Bityutskiy; +Cc: Brian Norris, linux-mtd, Mike Frysinger

The "bb_default" bool was temporarily being used to straighten out
potential issues with the changing --bb=METHOD options and to warn
users properly. Now, it's unnecessary.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
 nanddump.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/nanddump.c b/nanddump.c
index 27b0f7a..0b931db 100644
--- a/nanddump.c
+++ b/nanddump.c
@@ -102,7 +102,7 @@ static enum {
 static void process_options(int argc, char * const argv[])
 {
 	int error = 0;
-	bool bb_default = true, oob_default = true;
+	bool oob_default = true;
 
 	for (;;) {
 		int option_index = 0;
@@ -149,7 +149,6 @@ static void process_options(int argc, char * const argv[])
 							bb_method = skipbad;
 						else
 							error++;
-						bb_default = false;
 						break;
 					case 3: /* --omitoob */
 						if (oob_default) {
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH 06/10] mtd-utils: add common version printing function
  2011-06-27 18:27 ` [PATCH 06/10] mtd-utils: add common version printing function Brian Norris
@ 2011-06-27 19:51   ` Mike Frysinger
  2011-06-27 20:15     ` Brian Norris
  0 siblings, 1 reply; 21+ messages in thread
From: Mike Frysinger @ 2011-06-27 19:51 UTC (permalink / raw)
  To: Brian Norris; +Cc: linux-mtd, Artem Bityutskiy

On Mon, Jun 27, 2011 at 14:27, Brian Norris wrote:
> +/* Simple version-printing for utils */
> +#define common_print_version() \
> +do { \
> +       fprintf(stderr, PROGRAM_NAME " " VERSION "\n"); \
> +} while (0)

this shouldnt go to stderr

if the string is const, then it could just be puts().  but i wonder if
it shouldnt instead use printf("%s %s\n", PROGRAM_NAME, VERSION) so
that the string that represents PROGRAM_NAME isn't duplicated in the
.rodata section.
-mike

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 00/10] more mtd-utils cleanup
  2011-06-27 18:27 [PATCH 00/10] more mtd-utils cleanup Brian Norris
                   ` (9 preceding siblings ...)
  2011-06-27 18:27 ` [PATCH 10/10] nanddump: remove unused variable Brian Norris
@ 2011-06-27 19:52 ` Mike Frysinger
  2011-06-27 20:30   ` Brian Norris
  10 siblings, 1 reply; 21+ messages in thread
From: Mike Frysinger @ 2011-06-27 19:52 UTC (permalink / raw)
  To: Brian Norris; +Cc: linux-mtd, Artem Bityutskiy

except for the one i commented on, the rest look fine to me
Acked-by: Mike Frysinger <vapier@gentoo.org>
-mike

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 06/10] mtd-utils: add common version printing function
  2011-06-27 19:51   ` Mike Frysinger
@ 2011-06-27 20:15     ` Brian Norris
  2011-06-27 20:20       ` Mike Frysinger
  0 siblings, 1 reply; 21+ messages in thread
From: Brian Norris @ 2011-06-27 20:15 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: linux-mtd, Artem Bityutskiy

On Mon, Jun 27, 2011 at 12:51 PM, Mike Frysinger <vapier.adi@gmail.com> wrote:
> On Mon, Jun 27, 2011 at 14:27, Brian Norris wrote:
>> +/* Simple version-printing for utils */
>> +#define common_print_version() \
>> +do { \
>> +       fprintf(stderr, PROGRAM_NAME " " VERSION "\n"); \
>> +} while (0)
>
> this shouldnt go to stderr

Yeah, I wasn't too sure on that one. There were several utils that
already used stderr, but that doesn't actually make much sense, I
guess.

> if the string is const, then it could just be puts().  but i wonder if
> it shouldnt instead use printf("%s %s\n", PROGRAM_NAME, VERSION) so
> that the string that represents PROGRAM_NAME isn't duplicated in the
> .rodata section.

I'm not sure I know what the exact technical difference would be
between the string concatenation version and the '%s' argument
version...

Brian

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 06/10] mtd-utils: add common version printing function
  2011-06-27 20:15     ` Brian Norris
@ 2011-06-27 20:20       ` Mike Frysinger
  0 siblings, 0 replies; 21+ messages in thread
From: Mike Frysinger @ 2011-06-27 20:20 UTC (permalink / raw)
  To: Brian Norris; +Cc: linux-mtd, Artem Bityutskiy

On Mon, Jun 27, 2011 at 16:15, Brian Norris wrote:
> On Mon, Jun 27, 2011 at 12:51 PM, Mike Frysinger wrote:
>> if the string is const, then it could just be puts().  but i wonder if
>> it shouldnt instead use printf("%s %s\n", PROGRAM_NAME, VERSION) so
>> that the string that represents PROGRAM_NAME isn't duplicated in the
>> .rodata section.
>
> I'm not sure I know what the exact technical difference would be
> between the string concatenation version and the '%s' argument
> version...

"%s %s\n" is one string in .rodata, and PROGRAM_NAME is another.  so
anytime the app uses PROGRAM_NAME (like in all the helpers in
common.h), they'll reuse that same PROGRAM_NAME string rather than
constantly duplicating it.

if however you use PROGRAM_NAME " " VERSION, you have a unique string
that is only used by the version code.

minor details, but all these duplicate const strings slowly add up ...
-mike

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 00/10] more mtd-utils cleanup
  2011-06-27 19:52 ` [PATCH 00/10] more mtd-utils cleanup Mike Frysinger
@ 2011-06-27 20:30   ` Brian Norris
  0 siblings, 0 replies; 21+ messages in thread
From: Brian Norris @ 2011-06-27 20:30 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: linux-mtd, Artem Bityutskiy

On Mon, Jun 27, 2011 at 12:52 PM, Mike Frysinger <vapier.adi@gmail.com> wrote:
> except for the one i commented on, the rest look fine to me
> Acked-by: Mike Frysinger <vapier@gentoo.org>
> -mike

Thanks. I'll send v2 soon if I don't get any more comments.

Brian

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 09/10] mtdinfo: kill -m option
  2011-06-27 18:27 ` [PATCH 09/10] mtdinfo: kill -m option Brian Norris
@ 2011-06-29  6:02   ` Artem Bityutskiy
  2011-06-29 16:09     ` [PATCH v2] mtdinfo: remove -m leftovers Brian Norris
  0 siblings, 1 reply; 21+ messages in thread
From: Artem Bityutskiy @ 2011-06-29  6:02 UTC (permalink / raw)
  To: Brian Norris; +Cc: linux-mtd, Mike Frysinger

On Mon, 2011-06-27 at 11:27 -0700, Brian Norris wrote:
> According to feature-removal-schedule, we shouldn't use `-m', since
> it relies on a specific device-naming pattern.
> 
> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
> ---
>  feature-removal-schedule.txt |    8 --------
>  ubi-utils/mtdinfo.c          |   25 ++++++-------------------
>  2 files changed, 6 insertions(+), 27 deletions(-)

Pushed the series, thanks! I would also like to add the following patch
on top of your series, is ok with you?

From: Artem Bityutskiy <dedekind1@gmail.com>
Date: Wed, 29 Jun 2011 08:56:39 +0300
Subject: [PATCH] mtdinfo: remove -m leftovers

We have removed the -m option, but did not remove args.mtdn which represents
the -m parameters. Kill args.mtdn as well.

Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
---
 ubi-utils/mtdinfo.c |   22 +++++++++-------------
 1 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/ubi-utils/mtdinfo.c b/ubi-utils/mtdinfo.c
index dd5da53..4631f37 100644
--- a/ubi-utils/mtdinfo.c
+++ b/ubi-utils/mtdinfo.c
@@ -128,10 +128,8 @@ static int parse_opt(int argc, char * const argv[])
 	else if (optind < argc)
 		return errmsg("more then one MTD device specified (use -h for help)");
 
-	if (args.all && (args.node || args.mtdn != -1)) {
-		args.mtdn = -1;
+	if (args.all && args.node)
 		args.node = NULL;
-	}
 
 	if (args.map && !args.node)
 		return errmsg("-M requires MTD device node name");
@@ -153,8 +151,7 @@ static int translate_dev(libmtd_t libmtd, const char *node)
 				  "device \"%s\"", node);
 	}
 
-	args.mtdn = mtd.mtd_num;
-	return 0;
+	return mtd.mtd_num;
 }
 
 static void print_ubi_info(const struct mtd_info *mtd_info,
@@ -406,20 +403,19 @@ int main(int argc, char * const argv[])
 		return sys_errmsg("cannot get MTD information");
 	}
 
-	if (args.node) {
+	if (!args.all) {
+		int mtdn;
+
 		/*
 		 * A character device was specified, translate this to MTD
 		 * device number.
 		 */
-		err = translate_dev(libmtd, args.node);
-		if (err)
+		mtdn = translate_dev(libmtd, args.node);
+		if (mtdn < 0)
 			goto out_libmtd;
-	}
-
-	if (args.mtdn == -1)
+		err = print_dev_info(libmtd, &mtd_info, mtdn);
+	} else
 		err = print_general_info(libmtd, &mtd_info, args.all);
-	else
-		err = print_dev_info(libmtd, &mtd_info, args.mtdn);
 	if (err)
 		goto out_libmtd;
 
-- 
1.7.5.4


-- 
Best Regards,
Artem Bityutskiy

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH 02/10] mtd-tests: io_paral: build error, "variable length strings"
  2011-06-27 18:27 ` [PATCH 02/10] mtd-tests: io_paral: build error, "variable length strings" Brian Norris
@ 2011-06-29 13:22   ` Josh Boyer
  2011-06-29 15:45     ` Brian Norris
  0 siblings, 1 reply; 21+ messages in thread
From: Josh Boyer @ 2011-06-29 13:22 UTC (permalink / raw)
  To: Brian Norris; +Cc: linux-mtd, Mike Frysinger, Artem Bityutskiy

On Mon, Jun 27, 2011 at 2:27 PM, Brian Norris
<computersforpeace@gmail.com> wrote:
> Some compilers will complain about use of strlen() within a static array
> size declaration. For this type of string, "sizeof() - 1" is equivalent
> and prevents the build error.
>
> Error:
>
>   io_paral.c:48:13: error: variably modified 'vol_nodes' at file scope

Out of curiosity, which compiler does that?  Newer versions of GCC, or
some other compiler altogether?

josh

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 02/10] mtd-tests: io_paral: build error, "variable length strings"
  2011-06-29 13:22   ` Josh Boyer
@ 2011-06-29 15:45     ` Brian Norris
  0 siblings, 0 replies; 21+ messages in thread
From: Brian Norris @ 2011-06-29 15:45 UTC (permalink / raw)
  To: Josh Boyer; +Cc: linux-mtd, Mike Frysinger, Artem Bityutskiy

On Wed, Jun 29, 2011 at 6:22 AM, Josh Boyer <jwboyer@gmail.com> wrote:
> On Mon, Jun 27, 2011 at 2:27 PM, Brian Norris
> <computersforpeace@gmail.com> wrote:
>> Some compilers will complain about use of strlen() within a static array
>> size declaration. For this type of string, "sizeof() - 1" is equivalent
>> and prevents the build error.
>>
>> Error:
>>
>>   io_paral.c:48:13: error: variably modified 'vol_nodes' at file scope
>
> Out of curiosity, which compiler does that?  Newer versions of GCC, or
> some other compiler altogether?

I think it's just newer versions of GCC. I found the error on MIPS GCC
on versions 4.5.2 and 4.5.3. It didn't occur on MIPS or x86_64 for
version 4.4.3.

Brian

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH v2] mtdinfo: remove -m leftovers
  2011-06-29  6:02   ` Artem Bityutskiy
@ 2011-06-29 16:09     ` Brian Norris
  2011-06-30  7:03       ` Artem Bityutskiy
  0 siblings, 1 reply; 21+ messages in thread
From: Brian Norris @ 2011-06-29 16:09 UTC (permalink / raw)
  To: Artem Bityutskiy
  Cc: Brian Norris, linux-mtd, Mike Frysinger, Artem Bityutskiy

From: Artem Bityutskiy <dedekind1@gmail.com>

Looks OK to me, except it seems you did everything but actually removing
the field in struct args :) So here's a quick v2 from me...

From: Artem Bityutskiy <dedekind1@gmail.com>
Date: Wed, 29 Jun 2011 08:56:39 +0300
Subject: [PATCH v2] mtdinfo: remove -m leftovers

We have removed the -m option, but did not remove args.mtdn which represents
the -m parameters. Kill args.mtdn as well.

Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
 ubi-utils/mtdinfo.c |   24 +++++++++---------------
 1 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/ubi-utils/mtdinfo.c b/ubi-utils/mtdinfo.c
index dd5da53..e72d69e 100644
--- a/ubi-utils/mtdinfo.c
+++ b/ubi-utils/mtdinfo.c
@@ -38,7 +38,6 @@
 
 /* The variables below are set by command line arguments */
 struct args {
-	int mtdn;
 	unsigned int all:1;
 	unsigned int ubinfo:1;
 	unsigned int map:1;
@@ -46,7 +45,6 @@ struct args {
 };
 
 static struct args args = {
-	.mtdn = -1,
 	.ubinfo = 0,
 	.all = 0,
 	.node = NULL,
@@ -128,10 +126,8 @@ static int parse_opt(int argc, char * const argv[])
 	else if (optind < argc)
 		return errmsg("more then one MTD device specified (use -h for help)");
 
-	if (args.all && (args.node || args.mtdn != -1)) {
-		args.mtdn = -1;
+	if (args.all && args.node)
 		args.node = NULL;
-	}
 
 	if (args.map && !args.node)
 		return errmsg("-M requires MTD device node name");
@@ -153,8 +149,7 @@ static int translate_dev(libmtd_t libmtd, const char *node)
 				  "device \"%s\"", node);
 	}
 
-	args.mtdn = mtd.mtd_num;
-	return 0;
+	return mtd.mtd_num;
 }
 
 static void print_ubi_info(const struct mtd_info *mtd_info,
@@ -406,20 +401,19 @@ int main(int argc, char * const argv[])
 		return sys_errmsg("cannot get MTD information");
 	}
 
-	if (args.node) {
+	if (!args.all) {
+		int mtdn;
+
 		/*
 		 * A character device was specified, translate this to MTD
 		 * device number.
 		 */
-		err = translate_dev(libmtd, args.node);
-		if (err)
+		mtdn = translate_dev(libmtd, args.node);
+		if (mtdn < 0)
 			goto out_libmtd;
-	}
-
-	if (args.mtdn == -1)
+		err = print_dev_info(libmtd, &mtd_info, mtdn);
+	} else
 		err = print_general_info(libmtd, &mtd_info, args.all);
-	else
-		err = print_dev_info(libmtd, &mtd_info, args.mtdn);
 	if (err)
 		goto out_libmtd;
 
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH v2] mtdinfo: remove -m leftovers
  2011-06-29 16:09     ` [PATCH v2] mtdinfo: remove -m leftovers Brian Norris
@ 2011-06-30  7:03       ` Artem Bityutskiy
  0 siblings, 0 replies; 21+ messages in thread
From: Artem Bityutskiy @ 2011-06-30  7:03 UTC (permalink / raw)
  To: Brian Norris; +Cc: linux-mtd, Mike Frysinger

On Wed, 2011-06-29 at 09:09 -0700, Brian Norris wrote:
> From: Artem Bityutskiy <dedekind1@gmail.com>
> 
> Looks OK to me, except it seems you did everything but actually removing
> the field in struct args :) So here's a quick v2 from me...
> 
> From: Artem Bityutskiy <dedekind1@gmail.com>
> Date: Wed, 29 Jun 2011 08:56:39 +0300
> Subject: [PATCH v2] mtdinfo: remove -m leftovers
> 
> We have removed the -m option, but did not remove args.mtdn which represents
> the -m parameters. Kill args.mtdn as well.
> 
> Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
> Signed-off-by: Brian Norris <computersforpeace@gmail.com>

Pushed, thanks you!

-- 
Best Regards,
Artem Bityutskiy

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2011-06-30  7:02 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-27 18:27 [PATCH 00/10] more mtd-utils cleanup Brian Norris
2011-06-27 18:27 ` [PATCH 01/10] mtd-tests: checkfs: fix size_t related warning Brian Norris
2011-06-27 18:27 ` [PATCH 02/10] mtd-tests: io_paral: build error, "variable length strings" Brian Norris
2011-06-29 13:22   ` Josh Boyer
2011-06-29 15:45     ` Brian Norris
2011-06-27 18:27 ` [PATCH 03/10] mtd-utils: remove whitespace at end of lines Brian Norris
2011-06-27 18:27 ` [PATCH 04/10] mtd-utils: update .gitignore files Brian Norris
2011-06-27 18:27 ` [PATCH 05/10] mkfs.ubifs: use common.h Brian Norris
2011-06-27 18:27 ` [PATCH 06/10] mtd-utils: add common version printing function Brian Norris
2011-06-27 19:51   ` Mike Frysinger
2011-06-27 20:15     ` Brian Norris
2011-06-27 20:20       ` Mike Frysinger
2011-06-27 18:27 ` [PATCH 07/10] mtd-utils: switch more utils to unified versioning Brian Norris
2011-06-27 18:27 ` [PATCH 08/10] mtd-utils: kill flash_info Brian Norris
2011-06-27 18:27 ` [PATCH 09/10] mtdinfo: kill -m option Brian Norris
2011-06-29  6:02   ` Artem Bityutskiy
2011-06-29 16:09     ` [PATCH v2] mtdinfo: remove -m leftovers Brian Norris
2011-06-30  7:03       ` Artem Bityutskiy
2011-06-27 18:27 ` [PATCH 10/10] nanddump: remove unused variable Brian Norris
2011-06-27 19:52 ` [PATCH 00/10] more mtd-utils cleanup Mike Frysinger
2011-06-27 20:30   ` Brian Norris

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.