summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2010-07-17 10:04:56 +0300
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2010-07-17 10:04:56 +0300
commit5db0545e2858da5f79d6461544f94c88f6bf7af9 (patch)
tree7e2441edff0cd44e1a0396f7e4cb801ecb3ae5f5
parent7d3f89c62f5032713e6614f1004fcbba379ebbaa (diff)
libs: remove ubiutils-specific stuff from common.h
Now include/common.h contains things that really everyone can use. And all the stuff specific to ubi-utils is in ubi-utils/include/ubiutils-common.h Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
-rw-r--r--include/common.h16
-rw-r--r--ubi-utils/Makefile10
-rw-r--r--ubi-utils/include/ubiutils-common.h36
-rw-r--r--ubi-utils/src/mtdinfo.c1
-rw-r--r--ubi-utils/src/ubiattach.c1
-rw-r--r--ubi-utils/src/ubiformat.c1
-rw-r--r--ubi-utils/src/ubimkvol.c1
-rw-r--r--ubi-utils/src/ubinfo.c1
-rw-r--r--ubi-utils/src/ubinize.c1
-rw-r--r--ubi-utils/src/ubirsvol.c1
-rw-r--r--ubi-utils/src/ubiutils-common.c (renamed from ubi-utils/src/common.c)0
11 files changed, 56 insertions, 13 deletions
diff --git a/include/common.h b/include/common.h
index d14cb48..03e6f7c 100644
--- a/include/common.h
+++ b/include/common.h
@@ -16,14 +16,19 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#ifndef __UBI_UTILS_COMMON_H__
-#define __UBI_UTILS_COMMON_H__
+#ifndef __MTD_UTILS_COMMON_H__
+#define __MTD_UTILS_COMMON_H__
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <errno.h>
+/*
+ * Note, the user is supposed to define its PROGRAM_NAME before including this
+ * header.
+ */
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -75,13 +80,8 @@ static inline int is_power_of_2(unsigned long long n)
return (n != 0 && ((n & (n - 1)) == 0));
}
-long long ubiutils_get_bytes(const char *str);
-void ubiutils_print_bytes(long long bytes, int bracket);
-void ubiutils_print_text(FILE *stream, const char *txt, int len);
-int ubiutils_srand(void);
-
#ifdef __cplusplus
}
#endif
-#endif /* !__UBI_UTILS_COMMON_H__ */
+#endif /* !__MTD_UTILS_COMMON_H__ */
diff --git a/ubi-utils/Makefile b/ubi-utils/Makefile
index 327d2d7..bfebee5 100644
--- a/ubi-utils/Makefile
+++ b/ubi-utils/Makefile
@@ -18,9 +18,9 @@ LDLIBS = -L$(BUILDDIR)/../lib -lmtd
include ../common.mk
-# And the below is the rule to get final executable from its .o and common.o
+# And the below is the rule to get final executable from its .o and ubiutils-common.o
$(TARGETS): $(addprefix $(BUILDDIR)/,\
- libubi.a common.o)
+ libubi.a ubiutils-common.o)
# $(CC) $(CFLAGS) $(filter %.o, $^) -L. -lubi -o $@
$(BUILDDIR)/ubicrc32: $(addprefix $(BUILDDIR)/,\
@@ -28,15 +28,15 @@ $(BUILDDIR)/ubicrc32: $(addprefix $(BUILDDIR)/,\
# $(CC) $(CFLAGS) -o $@ $^
$(BUILDDIR)/ubinize: $(addprefix $(BUILDDIR)/,\
- ubinize.o common.o libiniparser.a libubigen.a)
+ ubinize.o ubiutils-common.o libiniparser.a libubigen.a)
# $(CC) $(CFLAGS) $(filter %.o, $^) -L. -liniparser -lubigen -o $@
$(BUILDDIR)/mtdinfo: $(addprefix $(BUILDDIR)/,\
- libubigen.a common.o)
+ libubigen.a ubiutils-common.o)
# $(CC) $(CFLAGS) $(filter %.o, $^) -L. -lmtd -lubigen -o $@
$(BUILDDIR)/ubiformat: $(addprefix $(BUILDDIR)/,\
- ubiformat.o common.o libscan.a libubi.a libubigen.a)
+ ubiformat.o ubiutils-common.o libscan.a libubi.a libubigen.a)
# $(CC) $(CFLAGS) $(filter %.o, $^) -L. -lmtd -lscan -lubi -lubigen -o $@
$(BUILDDIR)/libubi.a: $(BUILDDIR)/libubi.o
diff --git a/ubi-utils/include/ubiutils-common.h b/ubi-utils/include/ubiutils-common.h
new file mode 100644
index 0000000..762e21f
--- /dev/null
+++ b/ubi-utils/include/ubiutils-common.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) Artem Bityutskiy, 2007, 2008
+ *
+ * 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
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef __UBI_UTILS_COMMON_H__
+#define __UBI_UTILS_COMMON_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+long long ubiutils_get_bytes(const char *str);
+void ubiutils_print_bytes(long long bytes, int bracket);
+void ubiutils_print_text(FILE *stream, const char *txt, int len);
+int ubiutils_srand(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !__UBI_UTILS_COMMON_H__ */
+
diff --git a/ubi-utils/src/mtdinfo.c b/ubi-utils/src/mtdinfo.c
index 11f309e..b39ed5f 100644
--- a/ubi-utils/src/mtdinfo.c
+++ b/ubi-utils/src/mtdinfo.c
@@ -31,6 +31,7 @@
#include <libubigen.h>
#include <libmtd.h>
#include "common.h"
+#include "ubiutils-common.h"
#define PROGRAM_VERSION "1.0"
#define PROGRAM_NAME "mtdinfo"
diff --git a/ubi-utils/src/ubiattach.c b/ubi-utils/src/ubiattach.c
index 210624b..b1c8d74 100644
--- a/ubi-utils/src/ubiattach.c
+++ b/ubi-utils/src/ubiattach.c
@@ -29,6 +29,7 @@
#include <libubi.h>
#include "common.h"
+#include "ubiutils-common.h"
#define PROGRAM_VERSION "1.0"
#define PROGRAM_NAME "ubiattach"
diff --git a/ubi-utils/src/ubiformat.c b/ubi-utils/src/ubiformat.c
index f0a87c4..6052a35 100644
--- a/ubi-utils/src/ubiformat.c
+++ b/ubi-utils/src/ubiformat.c
@@ -43,6 +43,7 @@
#include <mtd_swab.h>
#include <crc32.h>
#include "common.h"
+#include "ubiutils-common.h"
#define PROGRAM_VERSION "1.5"
#define PROGRAM_NAME "ubiformat"
diff --git a/ubi-utils/src/ubimkvol.c b/ubi-utils/src/ubimkvol.c
index c1b577d..c867c44 100644
--- a/ubi-utils/src/ubimkvol.c
+++ b/ubi-utils/src/ubimkvol.c
@@ -31,6 +31,7 @@
#include <libubi.h>
#include "common.h"
+#include "ubiutils-common.h"
#define PROGRAM_VERSION "1.1"
#define PROGRAM_NAME "ubimkvol"
diff --git a/ubi-utils/src/ubinfo.c b/ubi-utils/src/ubinfo.c
index 8f84382..cecab43 100644
--- a/ubi-utils/src/ubinfo.c
+++ b/ubi-utils/src/ubinfo.c
@@ -29,6 +29,7 @@
#include <libubi.h>
#include "common.h"
+#include "ubiutils-common.h"
#define PROGRAM_VERSION "1.1"
#define PROGRAM_NAME "ubinfo"
diff --git a/ubi-utils/src/ubinize.c b/ubi-utils/src/ubinize.c
index ab5b0b8..2ff4e29 100644
--- a/ubi-utils/src/ubinize.c
+++ b/ubi-utils/src/ubinize.c
@@ -34,6 +34,7 @@
#include <libubigen.h>
#include <libiniparser.h>
#include "common.h"
+#include "ubiutils-common.h"
#define PROGRAM_VERSION "1.2"
#define PROGRAM_NAME "ubinize"
diff --git a/ubi-utils/src/ubirsvol.c b/ubi-utils/src/ubirsvol.c
index a32a956..683e606 100644
--- a/ubi-utils/src/ubirsvol.c
+++ b/ubi-utils/src/ubirsvol.c
@@ -31,6 +31,7 @@
#include <libubi.h>
#include "common.h"
+#include "ubiutils-common.h"
#define PROGRAM_VERSION "1.1"
#define PROGRAM_NAME "ubirsvol"
diff --git a/ubi-utils/src/common.c b/ubi-utils/src/ubiutils-common.c
index da5156d..da5156d 100644
--- a/ubi-utils/src/common.c
+++ b/ubi-utils/src/ubiutils-common.c