aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-12-22 17:32:19 +0200
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-12-22 17:50:12 +0200
commit8a8e8101d50ed702d6c45959c8b3f71fdb1e811f (patch)
treecc206cf63d285be98e8dc88f51c911ccbadda7ac
parentc036f9958b3719a949999ca4fe9866ba56b3f713 (diff)
ubi-utils: fixes and cleanups
This patch fixes a libubi bug and does some random minor cleanups. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
-rw-r--r--ubi-utils/src/common.c2
-rw-r--r--ubi-utils/src/libubi.c4
-rw-r--r--ubi-utils/src/ubimkvol.c9
-rw-r--r--ubi-utils/src/ubinfo.c10
-rw-r--r--ubi-utils/src/ubirmvol.c5
5 files changed, 15 insertions, 15 deletions
diff --git a/ubi-utils/src/common.c b/ubi-utils/src/common.c
index 761d47d..7ed1ade 100644
--- a/ubi-utils/src/common.c
+++ b/ubi-utils/src/common.c
@@ -18,6 +18,8 @@
/*
* This file contains various common stuff used by UBI utilities.
+ *
+ * Author: Artem Bityutskiy
*/
#include <stdio.h>
diff --git a/ubi-utils/src/libubi.c b/ubi-utils/src/libubi.c
index ecc12b4..a9c4a99 100644
--- a/ubi-utils/src/libubi.c
+++ b/ubi-utils/src/libubi.c
@@ -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;
}
diff --git a/ubi-utils/src/ubimkvol.c b/ubi-utils/src/ubimkvol.c
index 488dd17..c2868e2 100644
--- a/ubi-utils/src/ubimkvol.c
+++ b/ubi-utils/src/ubimkvol.c
@@ -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;
diff --git a/ubi-utils/src/ubinfo.c b/ubi-utils/src/ubinfo.c
index 358f208..6451bda 100644
--- a/ubi-utils/src/ubinfo.c
+++ b/ubi-utils/src/ubinfo.c
@@ -13,13 +13,14 @@
* 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)
diff --git a/ubi-utils/src/ubirmvol.c b/ubi-utils/src/ubirmvol.c
index e9a1b41..10ce617 100644
--- a/ubi-utils/src/ubirmvol.c
+++ b/ubi-utils/src/ubirmvol.c
@@ -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)