]> www.infradead.org Git - mtd-utils.git/commitdiff
ubi-utils: fixes and cleanups
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Sat, 22 Dec 2007 15:32:19 +0000 (17:32 +0200)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Sat, 22 Dec 2007 15:50:12 +0000 (17:50 +0200)
This patch fixes a libubi bug and does some random minor cleanups.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
ubi-utils/src/common.c
ubi-utils/src/libubi.c
ubi-utils/src/ubimkvol.c
ubi-utils/src/ubinfo.c
ubi-utils/src/ubirmvol.c

index 761d47df164923a127068c775e52634a8acbade8..7ed1ade0b71b2bd6dc8c5d7946122f7117634525 100644 (file)
@@ -18,6 +18,8 @@
 
 /*
  * This file contains various common stuff used by UBI utilities.
+ *
+ * Author: Artem Bityutskiy
  */
 
 #include <stdio.h>
index ecc12b452c4a197d780dc8ff4a7fe589c8b731a2..a9c4a99235f8b766070b2340706b7ccf13bfbf8f 100644 (file)
@@ -412,7 +412,7 @@ static int vol_node2nums(struct libubi *lib, const char *node, int *dev_num,
 
        if (minor == 0) {
                errmsg("\"%s\" is not a volume character device", node);
-               errno = -EINVAL;
+               errno = EINVAL;
                return -1;
        }
 
@@ -479,7 +479,7 @@ static int dev_node2num(struct libubi *lib, const char *node, int *dev_num)
 
        if (minor != 0) {
                errmsg("\"%s\" is not an UBI character device", node);
-               errno = -EINVAL;
+               errno = EINVAL;
                return -1;
        }
 
index 488dd172b7ece4cca075d574f04cd2914a594a7f..c2868e2fdcf8a0739b81599685990e10e4bedeb7 100644 (file)
@@ -19,7 +19,7 @@
 /*
  * An utility to create UBI volumes.
  *
- * Authors: Artem B. Bityutskiy <dedekind@infradead.org>
+ * Authors: Artem Bityutskiy <dedekind@infradead.org>
  *          Frank Haverkamp <haver@vnet.ibm.com>
  */
 
@@ -43,7 +43,7 @@ struct args {
        long long bytes;
        int lebs;
        int alignment;
-       char *name;
+       const char *name;
        int nlen;
        char node[MAX_NODE_LEN + 2];
        int maxavs;
@@ -101,10 +101,9 @@ static const struct option long_options[] = {
 
 static int parse_opt(int argc, char * const argv[], struct args *args)
 {
-       char *endp;
-
        while (1) {
                int key;
+               char *endp;
 
                key = getopt_long(argc, argv, "a:n:N:s:S:t:hVm", long_options, NULL);
                if (key == -1)
@@ -280,7 +279,7 @@ int main(int argc, char * const argv[])
 
        err = ubi_get_dev_info(libubi, myargs.node, &dev_info);
        if (err) {
-               errmsg("cannot get information about UBI device number %s",
+               errmsg("cannot get information about UBI device \"%s\"",
                       myargs.node);
                perror("ubi_get_dev_info");
                goto out_libubi;
index 358f208c36db431c92c9bfa8b6c36a1ecde24161..6451bda3a3cca9fae80c55f079cbc9171302e851 100644 (file)
  * You should have received a copy of the GNU General Public License along with
  * this program; if not, write to the Free Software Foundation, Inc., 51
  * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author: Artem Bityutskiy
  */
 
 /*
  * An utility to get UBI information.
+ *
+ * Author: Artem Bityutskiy
  */
+
 #include <stdio.h>
 #include <stdint.h>
 #include <getopt.h>
@@ -50,7 +51,7 @@ static struct args myargs = {
 };
 
 static const char *doc = "Version " PROGRAM_VERSION "\n"
-       PROGRAM_NAME " - a tool to UBI information.";
+       PROGRAM_NAME " - a tool to print UBI information.";
 
 static const char *optionsstr =
 "-d, --devn=<UBI device number>  UBI device number to get information about\n"
@@ -84,10 +85,9 @@ static const struct option long_options[] = {
 
 static int parse_opt(int argc, char * const argv[], struct args *args)
 {
-       char *endp;
-
        while (1) {
                int key;
+               char *endp;
 
                key = getopt_long(argc, argv, "an:d:hV", long_options, NULL);
                if (key == -1)
index e9a1b41eaad59a2787d240351205e08811cbbfc5..10ce617de54313e8feafac96c8b7e5250b2ead9b 100644 (file)
@@ -19,7 +19,7 @@
 /*
  * An utility to remove UBI volumes.
  *
- * Authors: Artem B. Bityutskiy <dedekind@infradead.org>
+ * Authors: Artem Bityutskiy <dedekind@infradead.org>
  *          Frank Haverkamp <haver@vnet.ibm.com>
  */
 
@@ -68,10 +68,9 @@ static const struct option long_options[] = {
 
 static int parse_opt(int argc, char * const argv[], struct args *args)
 {
-       char *endp;
-
        while (1) {
                int key;
+               char *endp;
 
                key = getopt_long(argc, argv, "n:hV", long_options, NULL);
                if (key == -1)