]> www.infradead.org Git - mtd-utils.git/commitdiff
libs: remove ubiutils-specific stuff from common.h
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Sat, 17 Jul 2010 07:04:56 +0000 (10:04 +0300)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Sat, 17 Jul 2010 07:04:56 +0000 (10:04 +0300)
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>
include/common.h
ubi-utils/Makefile
ubi-utils/include/ubiutils-common.h [new file with mode: 0644]
ubi-utils/src/mtdinfo.c
ubi-utils/src/ubiattach.c
ubi-utils/src/ubiformat.c
ubi-utils/src/ubimkvol.c
ubi-utils/src/ubinfo.c
ubi-utils/src/ubinize.c
ubi-utils/src/ubirsvol.c
ubi-utils/src/ubiutils-common.c [moved from ubi-utils/src/common.c with 100% similarity]

index d14cb4831001db75db415aafcc9956aad9908703..03e6f7c5a65a9757aa0f3fb849d83209bd62526a 100644 (file)
  * 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__ */
index 327d2d739454eb169bd9290bf9a04d095074bfb8..bfebee5d57a017e7e8b8bb1cd9ef938afdfe423d 100644 (file)
@@ -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 (file)
index 0000000..762e21f
--- /dev/null
@@ -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__ */
+
index 11f309e32b5e267af13590500b99f10b4e4b54dd..b39ed5f7ca59cd1f08c3c7f8640a78ab08a2999a 100644 (file)
@@ -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"
index 210624b487fd106dd585955a5dfa7c55f1e87ffb..b1c8d74194b394a9bb74d2a7f5670ff71de226e1 100644 (file)
@@ -29,6 +29,7 @@
 
 #include <libubi.h>
 #include "common.h"
+#include "ubiutils-common.h"
 
 #define PROGRAM_VERSION "1.0"
 #define PROGRAM_NAME    "ubiattach"
index f0a87c43eaaf05322f22f823295bdf8dac246bdc..6052a356c8090d66b32bda50fef987ee3ce2af2a 100644 (file)
@@ -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"
index c1b577d0a193f68fa0a33c0bbd1df38e0460e8ef..c867c441a852305c9f0a983ea9f2cbd4b7bccc3b 100644 (file)
@@ -31,6 +31,7 @@
 
 #include <libubi.h>
 #include "common.h"
+#include "ubiutils-common.h"
 
 #define PROGRAM_VERSION "1.1"
 #define PROGRAM_NAME    "ubimkvol"
index 8f8438249d6fc087f68f9f5c1bc7bdb964b775cb..cecab43fccffa8b46383e22a1ad334326a469de8 100644 (file)
@@ -29,6 +29,7 @@
 
 #include <libubi.h>
 #include "common.h"
+#include "ubiutils-common.h"
 
 #define PROGRAM_VERSION "1.1"
 #define PROGRAM_NAME    "ubinfo"
index ab5b0b8e66f6fe759677e50d5ff37d74037b1d5b..2ff4e29c42159fe3bd46724bff3f1130f0704566 100644 (file)
@@ -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"
index a32a9560f7bf498430e9b7ff9bf8396947e033cc..683e606e82c5801abc2768f4d3a5cac643512966 100644 (file)
@@ -31,6 +31,7 @@
 
 #include <libubi.h>
 #include "common.h"
+#include "ubiutils-common.h"
 
 #define PROGRAM_VERSION "1.1"
 #define PROGRAM_NAME    "ubirsvol"