summaryrefslogtreecommitdiff
path: root/ubi-utils/new-utils
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-04-17 15:53:35 +0300
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-04-17 15:53:35 +0300
commite6c387a96f6c3cae91e5bf1a6f7e6574cbe03b80 (patch)
treeef8c4f2e88c740ef1d597d54f33199c5ae2550e1 /ubi-utils/new-utils
parentbcc87aa2d908389534394caa8659fd613817584f (diff)
Teach libubi_open not to prirnt error message
... when it is expected that UBI is not necessarily present Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'ubi-utils/new-utils')
-rw-r--r--ubi-utils/new-utils/include/libubi.h7
-rw-r--r--ubi-utils/new-utils/src/libubi.c9
-rw-r--r--ubi-utils/new-utils/src/libubi_int.h2
-rw-r--r--ubi-utils/new-utils/src/libubigen.c4
-rw-r--r--ubi-utils/new-utils/src/ubiattach.c2
-rw-r--r--ubi-utils/new-utils/src/ubidetach.c2
-rw-r--r--ubi-utils/new-utils/src/ubimkvol.c2
-rw-r--r--ubi-utils/new-utils/src/ubinfo.c2
-rw-r--r--ubi-utils/new-utils/src/ubirmvol.c2
-rw-r--r--ubi-utils/new-utils/src/ubiupdatevol.c2
10 files changed, 19 insertions, 15 deletions
diff --git a/ubi-utils/new-utils/include/libubi.h b/ubi-utils/new-utils/include/libubi.h
index 7e0bfcd..3e8c55a 100644
--- a/ubi-utils/new-utils/include/libubi.h
+++ b/ubi-utils/new-utils/include/libubi.h
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * Author: Artem B. Bityutskiy
+ * Author: Artem Bityutskiy
*
* UBI (Unsorted Block Images) library.
*/
@@ -170,10 +170,13 @@ struct ubi_vol_info
/**
* libubi_open - open UBI library.
+ * @required: if non-zero, libubi will print an error messages if this UBI is
+ * not present in the system
+ *
* This function initializes and opens the UBI library and returns UBI library
* descriptor in case of success and %NULL in case of failure.
*/
-libubi_t libubi_open(void);
+libubi_t libubi_open(int required);
/**
* libubi_close - close UBI library.
diff --git a/ubi-utils/new-utils/src/libubi.c b/ubi-utils/new-utils/src/libubi.c
index b53f18c..f0cbc9e 100644
--- a/ubi-utils/new-utils/src/libubi.c
+++ b/ubi-utils/new-utils/src/libubi.c
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * Author: Artem B. Bityutskiy
+ * Author: Artem Bityutskiy
*
* UBI (Unsorted Block Images) library.
*/
@@ -501,7 +501,7 @@ static int mtd_num2ubi_dev(struct libubi *lib, int mtd_num, int *dev_num)
return -1;
}
-libubi_t libubi_open(void)
+libubi_t libubi_open(int required)
{
int fd, version;
struct libubi *lib;
@@ -530,8 +530,9 @@ libubi_t libubi_open(void)
/* Make sure UBI is present */
fd = open(lib->sysfs_ubi, O_RDONLY);
if (fd == -1) {
- errmsg("cannot open \"%s\", UBI does not seem to exist in system",
- lib->sysfs_ubi);
+ if (required)
+ errmsg("cannot open \"%s\", UBI does not seem to "
+ "exist in system", lib->sysfs_ubi);
goto out_error;
}
diff --git a/ubi-utils/new-utils/src/libubi_int.h b/ubi-utils/new-utils/src/libubi_int.h
index dab3e62..f52797a 100644
--- a/ubi-utils/new-utils/src/libubi_int.h
+++ b/ubi-utils/new-utils/src/libubi_int.h
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * Author: Artem B. Bityutskiy
+ * Author: Artem Bityutskiy
*
* UBI (Unsorted Block Images) library.
*/
diff --git a/ubi-utils/new-utils/src/libubigen.c b/ubi-utils/new-utils/src/libubigen.c
index 34e2c0b..bee6f77 100644
--- a/ubi-utils/new-utils/src/libubigen.c
+++ b/ubi-utils/new-utils/src/libubigen.c
@@ -111,8 +111,8 @@ struct ubi_vtbl_record *ubigen_create_empty_vtbl(const struct ubigen_info *ui)
* @vtbl.
*/
int ubigen_add_volume(const struct ubigen_info *ui,
- const struct ubigen_vol_info *vi,
- struct ubi_vtbl_record *vtbl)
+ const struct ubigen_vol_info *vi,
+ struct ubi_vtbl_record *vtbl)
{
struct ubi_vtbl_record *vtbl_rec = &vtbl[vi->id];
uint32_t tmp;
diff --git a/ubi-utils/new-utils/src/ubiattach.c b/ubi-utils/new-utils/src/ubiattach.c
index b3d768a..04a2f9c 100644
--- a/ubi-utils/new-utils/src/ubiattach.c
+++ b/ubi-utils/new-utils/src/ubiattach.c
@@ -153,7 +153,7 @@ int main(int argc, char * const argv[])
if (err)
return -1;
- libubi = libubi_open();
+ libubi = libubi_open(1);
if (libubi == NULL)
return sys_errmsg("cannot open libubi");
diff --git a/ubi-utils/new-utils/src/ubidetach.c b/ubi-utils/new-utils/src/ubidetach.c
index cd48368..50670d0 100644
--- a/ubi-utils/new-utils/src/ubidetach.c
+++ b/ubi-utils/new-utils/src/ubidetach.c
@@ -139,7 +139,7 @@ int main(int argc, char * const argv[])
if (err)
return -1;
- libubi = libubi_open();
+ libubi = libubi_open(1);
if (libubi == NULL)
return sys_errmsg("cannot open libubi");
diff --git a/ubi-utils/new-utils/src/ubimkvol.c b/ubi-utils/new-utils/src/ubimkvol.c
index b99582c..fd8c568 100644
--- a/ubi-utils/new-utils/src/ubimkvol.c
+++ b/ubi-utils/new-utils/src/ubimkvol.c
@@ -240,7 +240,7 @@ int main(int argc, char * const argv[])
if (err)
return err;
- libubi = libubi_open();
+ libubi = libubi_open(1);
if (!libubi)
return sys_errmsg("cannot open libubi");
diff --git a/ubi-utils/new-utils/src/ubinfo.c b/ubi-utils/new-utils/src/ubinfo.c
index 185caae..a71f087 100644
--- a/ubi-utils/new-utils/src/ubinfo.c
+++ b/ubi-utils/new-utils/src/ubinfo.c
@@ -366,7 +366,7 @@ int main(int argc, char * const argv[])
if (!args.node && args.devn != -1)
return errmsg("specify either device number or node file (use -h for help)");
- libubi = libubi_open();
+ libubi = libubi_open(1);
if (libubi == NULL)
return sys_errmsg("cannot open libubi");
diff --git a/ubi-utils/new-utils/src/ubirmvol.c b/ubi-utils/new-utils/src/ubirmvol.c
index 5822aa0..10be975 100644
--- a/ubi-utils/new-utils/src/ubirmvol.c
+++ b/ubi-utils/new-utils/src/ubirmvol.c
@@ -166,7 +166,7 @@ int main(int argc, char * const argv[])
if (err)
return -1;
- libubi = libubi_open();
+ libubi = libubi_open(1);
if (libubi == NULL)
return sys_errmsg("cannot open libubi");
diff --git a/ubi-utils/new-utils/src/ubiupdatevol.c b/ubi-utils/new-utils/src/ubiupdatevol.c
index 5c67fc9..7748de8 100644
--- a/ubi-utils/new-utils/src/ubiupdatevol.c
+++ b/ubi-utils/new-utils/src/ubiupdatevol.c
@@ -295,7 +295,7 @@ int main(int argc, char * const argv[])
if (!args.img && !args.truncate)
return errmsg("incorrect arguments, use -h for help");
- libubi = libubi_open();
+ libubi = libubi_open(1);
if (libubi == NULL) {
sys_errmsg("cannot open libubi");
goto out_libubi;