]> www.infradead.org Git - mtd-utils.git/commitdiff
mkfs.ubifs: start using common code
authorArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Mon, 20 Oct 2014 10:47:09 +0000 (13:47 +0300)
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Mon, 20 Oct 2014 10:47:09 +0000 (13:47 +0300)
Several commonly used macros are now defined in 'common.h', let's start using
them in mkfs.ubifs, instead of duplicating them.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
mkfs.ubifs/defs.h
mkfs.ubifs/mkfs.ubifs.c
mkfs.ubifs/mkfs.ubifs.h

index 06cf9e5619a40beff1d9b9b5359667066e1b5a6f..1fa3316cc554dece8e76340ba04b64eb7c429fc4 100644 (file)
 #define le32_to_cpu(x) (t32((x)))
 #define le64_to_cpu(x) (t64((x)))
 
-#define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1)
-#define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask))
-
-#define min_t(t,x,y) ({ \
-       typeof((x)) _x = (x); \
-       typeof((y)) _y = (y); \
-       (_x < _y) ? _x : _y; \
-})
-
-#define max_t(t,x,y) ({ \
-       typeof((x)) _x = (x); \
-       typeof((y)) _y = (y); \
-       (_x > _y) ? _x : _y; \
-})
-
 #define unlikely(x) (x)
 
 #define ubifs_assert(x) ({})
index 200c8a5007e4bddc9dedd67536588635a8a36cf1..ca17e2bca3ac5a0fc43a1ef386a33afd025e1534 100644 (file)
@@ -21,7 +21,6 @@
  */
 
 #define _XOPEN_SOURCE 500 /* For realpath() */
-#define PROGRAM_NAME "mkfs.ubifs"
 
 #include "mkfs.ubifs.h"
 #include <crc32.h>
index 6030c481e64083a1a824f09afacc5818faeaef02..3edb79d8d9d654b3437ab1ce0207f0e4a6e6d817 100644 (file)
 #include <uuid/uuid.h>
 #include <sys/file.h>
 
+/* common.h requires the PROGRAM_NAME macro */
+#define PROGRAM_NAME "mkfs.ubifs"
+#include "common.h"
+
 #include "libubi.h"
 #include "defs.h"
 #include "crc16.h"