summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdriana Kobylak <anoo@us.ibm.com>2015-02-18 16:14:28 -0600
committerAdriana Kobylak <anoo@us.ibm.com>2015-02-18 16:14:28 -0600
commit76ce4aadee1a7a890001affed54a0fb1110b1793 (patch)
tree14a358904909e8fe0f631d414333c26de81e5042
parentaa8354ef7ee6606fe32453e3eedce9af8038230a (diff)
downloadffs-76ce4aadee1a7a890001affed54a0fb1110b1793.zip
ffs-76ce4aadee1a7a890001affed54a0fb1110b1793.tar.gz
Support to compile in 64bit for Ubuntu Little Endian
-rw-r--r--clib/Rules.cunit.mk2
-rw-r--r--clib/Rules.mk8
-rw-r--r--clib/Rules.test.mk2
-rw-r--r--clib/compare.h2
-rw-r--r--clib/hash.h8
-rw-r--r--clib/misc.h45
-rw-r--r--clib/slab.h18
-rw-r--r--clib/src/array.c2
-rw-r--r--clib/src/crc32_main.c2
-rw-r--r--clib/src/ecc.c20
-rw-r--r--clib/src/list.c10
-rw-r--r--clib/src/memory_leak_detection.c40
-rw-r--r--clib/src/slab.c14
-rw-r--r--clib/src/table.c4
-rw-r--r--clib/src/tree.c6
-rw-r--r--clib/src/value.c8
-rw-r--r--clib/src/vector.c44
-rw-r--r--clib/src/vector_iter.c2
-rw-r--r--clib/table.h2
-rw-r--r--clib/tree.h2
-rw-r--r--clib/vector.h42
-rw-r--r--clib/vector_iter.h2
-rw-r--r--ecc/Rules.mk4
-rw-r--r--ecc/src/main.c2
-rw-r--r--fcp/Rules.mk4
-rw-r--r--fcp/src/cmd_copy.c54
-rw-r--r--fcp/src/cmd_erase.c14
-rw-r--r--fcp/src/cmd_list.c6
-rw-r--r--fcp/src/cmd_read.c12
-rw-r--r--fcp/src/cmd_trunc.c12
-rw-r--r--fcp/src/cmd_user.c14
-rw-r--r--fcp/src/cmd_write.c14
-rw-r--r--fcp/src/misc.c66
-rw-r--r--fcp/src/misc.h4
-rw-r--r--ffs/Rules.mk8
-rw-r--r--ffs/Rules.test.mk2
-rw-r--r--ffs/libffs.h2
-rw-r--r--ffs/src/libffs.c26
-rw-r--r--fpart/Rules.mk4
-rw-r--r--fpart/Rules.test.mk2
-rw-r--r--fpart/src/cmd_add.c6
-rw-r--r--fpart/src/cmd_create.c10
-rw-r--r--fpart/src/cmd_delete.c2
-rw-r--r--fpart/src/cmd_erase.c12
-rw-r--r--fpart/src/cmd_list.c6
-rw-r--r--fpart/src/cmd_trunc.c6
-rw-r--r--fpart/src/cmd_user.c6
-rw-r--r--fpart/src/command.c6
-rw-r--r--fpart/src/main.h4
49 files changed, 314 insertions, 279 deletions
diff --git a/clib/Rules.cunit.mk b/clib/Rules.cunit.mk
index c848f1e..9fe4338 100644
--- a/clib/Rules.cunit.mk
+++ b/clib/Rules.cunit.mk
@@ -22,7 +22,7 @@
# permissions and limitations under the License.
#
# IBM_PROLOG_END_TAG
-CFLAGS += -m32 -std=gnu99 -D__USE_GNU -I$(DEPTH)/apps
+CFLAGS += -std=gnu99 -D__USE_GNU -I$(DEPTH)/apps
LDFLAGS = -rdynamic -L$(DEPTH)/apps/clib/$(ARCH_DEP_DIR)
TARGETS=clib
diff --git a/clib/Rules.mk b/clib/Rules.mk
index 17a84fa..342fd0f 100644
--- a/clib/Rules.mk
+++ b/clib/Rules.mk
@@ -22,10 +22,10 @@
# permissions and limitations under the License.
#
# IBM_PROLOG_END_TAG
-CFLAGS += -m32 -D_GNU_SOURCE -std=gnu99 -fshort-enums -D_FILE_OFFSET_BITS=64
-CFLAGS += -iquote$(DEPTH)
+CFLAGS += -D_GNU_SOURCE -std=gnu99 -fshort-enums -D_FILE_OFFSET_BITS=64
+CFLAGS += -iquote$(DEPTH) -fPIC
-LDFLAGS=-L. -m32
+LDFLAGS=-L.
# array.o array_iter.o dispatch.o watch.o signal.o heap.o
@@ -48,7 +48,7 @@ vpath %.h ..
all: $(TARGETS)
libclib.so: $(OBJS)
- $(CC) $(LDFLAGS) -fPIC -shared -Wl,-soname,$@ -o $@ $^ -lpthread \
+ $(CC) $(LDFLAGS) -shared -Wl,-soname,$@ -o $@ $^ -lpthread \
-lrt
libclib.a: $(OBJS)
diff --git a/clib/Rules.test.mk b/clib/Rules.test.mk
index 8d91d84..bcb1fb1 100644
--- a/clib/Rules.test.mk
+++ b/clib/Rules.test.mk
@@ -22,7 +22,7 @@
# permissions and limitations under the License.
#
# IBM_PROLOG_END_TAG
-CFLAGS += -m32 -std=gnu99 -D__USE_GNU -I$(DEPTH)/apps
+CFLAGS += -std=gnu99 -D__USE_GNU -I$(DEPTH)/apps
LDFLAGS = -rdynamic -L$(DEPTH)/apps/clib/$(ARCH_DEP_DIR)
TARGETS=exception \
diff --git a/clib/compare.h b/clib/compare.h
index 296983e..438d5ac 100644
--- a/clib/compare.h
+++ b/clib/compare.h
@@ -43,7 +43,7 @@ typedef int (*compare_f) (const void *, const void *);
*/
static inline int default_compare(const void *v1, const void *v2)
{
- const int i1 = (const int)v1, i2 = (const int)v2;
+ const int i1 = (const long)v1, i2 = (const long)v2;
return i1 - i2;
}
diff --git a/clib/hash.h b/clib/hash.h
index 52eb22f..29fd9ec 100644
--- a/clib/hash.h
+++ b/clib/hash.h
@@ -26,7 +26,7 @@
/*
* File: hash.h
* Author: Shaun Wetzstein <shaun@us.ibm.com>
- * Descr: Various int32 hash functions
+ * Descr: Various int64 hash functions
* Note:
* Date: 10/03/10
*/
@@ -38,13 +38,13 @@
/* ======================================================================= */
-static inline int32_t int32_hash1(int32_t);
+static inline int64_t int64_hash1(int64_t);
-typedef uint32_t(*hash_t) (char *, uint32_t);
+typedef uint64_t(*hash_t) (char *, uint64_t);
/* ======================================================================= */
-static inline int32_t int32_hash1(int32_t key)
+static inline int64_t int64_hash1(int64_t key)
{
key = ~key + (key << 15);
key = key ^ (key >> 12);
diff --git a/clib/misc.h b/clib/misc.h
index ddec6d0..edb5da5 100644
--- a/clib/misc.h
+++ b/clib/misc.h
@@ -49,6 +49,51 @@
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+#ifndef be16toh
+#include <byteswap.h>
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define be16toh(x) __bswap_16(x)
+#define htobe16(x) __bswap_16(x)
+#define le16toh(x) (x)
+#define htole16(x) (x)
+#else
+#define be16toh(x) (x)
+#define htobe16(x) (x)
+#define le16toh(x) __bswap_16(x)
+#define htole16(x) __bswap_16(x)
+#endif
+#endif
+
+#ifndef be32toh
+#include <byteswap.h>
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define be32toh(x) __bswap_32(x)
+#define htobe32(x) __bswap_32(x)
+#define le32toh(x) (x)
+#define htole32(x) (x)
+#else
+#define be32toh(x) (x)
+#define htobe32(x) (x)
+#define le32toh(x) __bswap_32(x)
+#define htole32(x) __bswap_32(x)
+#endif
+#endif
+
+#ifndef be64toh
+#include <byteswap.h>
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define be64toh(x) __bswap_64(x)
+#define htobe64(x) __bswap_64(x)
+#define le64toh(x) (x)
+#define htole64(x) (x)
+#else
+#define be64toh(x) (x)
+#define htobe64(x) (x)
+#define le64toh(x) __bswap_64(x)
+#define htole64(x) __bswap_64(x)
+#endif
+#endif
+
#ifndef gettid
#define gettid() ({ \
pid_t __tid = (pid_t)syscall(SYS_gettid); \
diff --git a/clib/slab.h b/clib/slab.h
index bbd5991..40151a4 100644
--- a/clib/slab.h
+++ b/clib/slab.h
@@ -89,13 +89,13 @@ struct slab_header {
ident_t id; //!< identification
char name[SLAB_NAME_SIZE]; //!< slab name
- size_t page_size; //!< page size
- size_t align_size; //!< page alignment size
- size_t page_count; //!< page count
+ uint32_t page_size; //!< page size
+ uint32_t align_size; //!< page alignment size
+ uint32_t page_count; //!< page count
- size_t alloc_size; //!< allocation size
- size_t data_size; //!< data size
- size_t bitmap_size; //!< bitmap size
+ uint32_t alloc_size; //!< allocation size
+ uint32_t data_size; //!< data size
+ uint32_t bitmap_size; //!< bitmap size
};
typedef struct slab_header slab_header_t;
@@ -122,11 +122,11 @@ typedef struct slab slab_t; //!< Alias for the @em slab class
*/
/*! @cond */
#define slab_init(...) STRCAT(slab_init, NARGS(__VA_ARGS__))(__VA_ARGS__)
-extern int slab_init3(slab_t * self, const char *name, size_t alloc_size)
+extern int slab_init3(slab_t * self, const char *name, uint32_t alloc_size)
__nonnull((1, 2));
-extern int slab_init4(slab_t * self, const char *name, size_t alloc_size,
+extern int slab_init4(slab_t * self, const char *name, uint32_t alloc_size,
size_t page_size) __nonnull((1, 2));
-extern int slab_init5(slab_t * self, const char *name, size_t alloc_size,
+extern int slab_init5(slab_t * self, const char *name, uint32_t alloc_size,
size_t page_size, size_t align_size) __nonnull((1, 2));
/*! @endcond */
diff --git a/clib/src/array.c b/clib/src/array.c
index 19659cb..4a0581a 100644
--- a/clib/src/array.c
+++ b/clib/src/array.c
@@ -99,7 +99,7 @@ const char *__array_msg[] = {
#define __index_to_page_hashed(i,s) \
({ \
- typeof(i) _h = int32_hash1(__index_to_page((i),(s))); \
+ typeof(i) _h = int64_hash1(__index_to_page((i),(s))); \
_h; \
})
diff --git a/clib/src/crc32_main.c b/clib/src/crc32_main.c
index d848eab..889d096 100644
--- a/clib/src/crc32_main.c
+++ b/clib/src/crc32_main.c
@@ -65,7 +65,7 @@ int main(int argc, const char *argv[])
void *in_buf = mmap(NULL, filesize, PROT_READ, MAP_PRIVATE, fd, 0);
if (in_buf == MAP_FAILED) {
/* FIXME could still try to use read().... */
- printf("mmap %d failed: %s\n", filesize, strerror(errno));
+ printf("mmap %d failed: %s\n", (uint32_t)filesize, strerror(errno));
return 1;
}
diff --git a/clib/src/ecc.c b/clib/src/ecc.c
index a161668..c9a5f38 100644
--- a/clib/src/ecc.c
+++ b/clib/src/ecc.c
@@ -50,17 +50,7 @@
#include "ecc.h"
#include "builtin.h"
#include "attribute.h"
-
-#ifndef be64toh
-#include <byteswap.h>
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define be64toh(x) __bswap_64(x)
-#define htobe64(x) __bswap_64(x)
-#else
-#define be64toh(x) (x)
-#define htobe64(x) (x)
-#endif
-#endif
+#include "misc.h"
/*
* This is an alternative way to calculate the ECC byte taken
@@ -185,11 +175,11 @@ static void __ecc_dump(FILE * __out, uint32_t __addr,
fprintf(__out,
"[%.8s_%.8s %.*s%.2s%.*s %.8s_%.8s %.*s%.2s%.*s] ",
- hex + 0, hex + 8, (c1 != e1) ? strlen(ansi_red) : 0,
- ansi_red, hex + 16, (c1 != e1) ? strlen(ansi_norm) : 0,
+ hex + 0, hex + 8, (c1 != e1) ? (uint32_t)strlen(ansi_red) : 0,
+ ansi_red, hex + 16, (c1 != e1) ? (uint32_t)strlen(ansi_norm) : 0,
ansi_norm, hex + 18, hex + 26,
- (c2 != e2) ? strlen(ansi_red) : 0, ansi_red, hex + 34,
- (c2 != e2) ? strlen(ansi_norm) : 0, ansi_norm);
+ (c2 != e2) ? (uint32_t)strlen(ansi_red) : 0, ansi_red, hex + 34,
+ (c2 != e2) ? (uint32_t)strlen(ansi_norm) : 0, ansi_norm);
fprintf(__out, "[%.8s %.8s]\n", ascii + 0, ascii + 9);
}
diff --git a/clib/src/list.c b/clib/src/list.c
index 03f6a20..5c33a48 100644
--- a/clib/src/list.c
+++ b/clib/src/list.c
@@ -40,14 +40,14 @@ void list_dump(list_t * self, FILE * out)
fprintf(out,
"===================================================================\n");
- fprintf(out, "head: %8x node: %8x\n", (uint32_t) self,
- (uint32_t) & self->node);
+ fprintf(out, "head: %8lx node: %8lx\n", (ulong) self,
+ (ulong) & self->node);
list_node_t *node = &self->node;
do {
- fprintf(out, " node: %8x - prev: %8x - next: %8x\n",
- (uint32_t) node, (uint32_t) node->prev,
- (uint32_t) node->next);
+ fprintf(out, " node: %8lx - prev: %8lx - next: %8lx\n",
+ (ulong) node, (ulong) node->prev,
+ (ulong) node->next);
node = node->next;
} while (node != &self->node);
diff --git a/clib/src/memory_leak_detection.c b/clib/src/memory_leak_detection.c
index 2705ef1..07c6bd3 100644
--- a/clib/src/memory_leak_detection.c
+++ b/clib/src/memory_leak_detection.c
@@ -148,7 +148,7 @@ static int Check_Leak_List(const void *p)
/* Check the ending sentinel. */
Ending_Sentinel =
- (Sentinel_t *) ((unsigned int)Current_Item +
+ (Sentinel_t *) ((unsigned long)Current_Item +
sizeof(Memory_Leak_Data_t) +
Current_Item->User_Size);
if (*Ending_Sentinel == SENTINEL_VALUE) {
@@ -165,7 +165,7 @@ static int Check_Leak_List(const void *p)
Data_Start =
(unsigned
long)((unsigned
- int)
+ long)
Current_Item
+
sizeof
@@ -216,7 +216,7 @@ static int Check_Leak_List(const void *p)
" Size: %d\n"
" Allocated in module %s, function %s, at line %d\n",
Current_Item,
- (void *)((unsigned int)
+ (void *)((unsigned long)
Current_Item +
sizeof
(Memory_Leak_Data_t)),
@@ -235,7 +235,7 @@ static int Check_Leak_List(const void *p)
" Address: %p\n" " Size: %d\n"
" Allocated in module %s, function %s, at line %d\n",
Current_Item,
- (void *)((unsigned int)Current_Item +
+ (void *)((unsigned long)Current_Item +
sizeof(Memory_Leak_Data_t)),
Current_Item->User_Size,
Current_Item->Module_Name,
@@ -261,7 +261,7 @@ static int Check_Leak_List(const void *p)
Current_Item->Signature,
Current_Item->Signature, LEAK_SIGNATURE,
LEAK_SIGNATURE,
- (void *)((unsigned int)Current_Item +
+ (void *)((unsigned long)Current_Item +
sizeof(Memory_Leak_Data_t)),
Current_Item->User_Size,
Current_Item->User_Size,
@@ -428,7 +428,7 @@ static void Remove_Memory_Allocation_From_Chain(Memory_Leak_Data_t *
/* Calculate the address of the ending sentinel so that we can access it. */
Ending_Sentinel =
- (Sentinel_t *) ((unsigned int)Memory_Leak_Data +
+ (Sentinel_t *) ((unsigned long)Memory_Leak_Data +
sizeof(Memory_Leak_Data_t) +
Memory_Leak_Data->User_Size);
@@ -506,7 +506,7 @@ void Print_Leak_List(void)
/* Check the ending sentinel. */
Ending_Sentinel =
- (Sentinel_t *) ((unsigned int)Current_Item +
+ (Sentinel_t *) ((unsigned long)Current_Item +
sizeof(Memory_Leak_Data_t) +
Current_Item->User_Size);
if (*Ending_Sentinel == SENTINEL_VALUE) {
@@ -526,7 +526,7 @@ void Print_Leak_List(void)
" Allocated in module %s, function %s, at line %d\n\n",
Current_Item->Mem_Address,
Current_Item,
- (void *)((unsigned int)Current_Item +
+ (void *)((unsigned long)Current_Item +
sizeof(Memory_Leak_Data_t)),
Current_Item->Alignment,
Current_Item->User_Size,
@@ -543,7 +543,7 @@ void Print_Leak_List(void)
" Alignment: %u\n" " Size: %d\n"
" Allocated in module %s, function %s, at line %d\n\n",
Current_Item->Mem_Address, Current_Item,
- (void *)((unsigned int)Current_Item +
+ (void *)((unsigned long)Current_Item +
sizeof(Memory_Leak_Data_t)),
Current_Item->Alignment,
Current_Item->User_Size,
@@ -569,7 +569,7 @@ void Print_Leak_List(void)
Current_Item->Signature,
Current_Item->Signature, LEAK_SIGNATURE,
LEAK_SIGNATURE,
- (void *)((unsigned int)Current_Item +
+ (void *)((unsigned long)Current_Item +
sizeof(Memory_Leak_Data_t)),
Current_Item->Alignment,
Current_Item->User_Size,
@@ -677,7 +677,7 @@ int MEMORY_func(size_t sz,
if (sz == 0) {
Error = EINVAL;
fprintf(stderr,
- "MALLOC: request is invalid - size[%u] in module %s, function %s at line %d\n",
+ "MALLOC: request is invalid - size[%lu] in module %s, function %s at line %d\n",
sz, mod_name, func, line);
print_backtrace();
}
@@ -702,7 +702,7 @@ int MEMORY_func(size_t sz,
if (Error) {
fprintf(stderr,
- "MEMORY_func: request for aligned memory uses invalid alignment! size[%u], alignment [%u] in module %s, function %s at line %d\n",
+ "MEMORY_func: request for aligned memory uses invalid alignment! size[%lu], alignment [%u] in module %s, function %s at line %d\n",
sz, Alignment, mod_name, func, line);
}
@@ -711,7 +711,7 @@ int MEMORY_func(size_t sz,
if (Memory_Location == NULL) {
Error = EINVAL;
fprintf(stderr,
- "MEMORY_func: Location to place address of allocated memory is NULL! size[%u], alignment [%u] in module %s, function %s at line %d\n",
+ "MEMORY_func: Location to place address of allocated memory is NULL! size[%lu], alignment [%u] in module %s, function %s at line %d\n",
sz, Alignment, mod_name, func, line);
} else
*Memory_Location = NULL;
@@ -748,13 +748,13 @@ int MEMORY_func(size_t sz,
Memory_Leak_Data = (Memory_Leak_Data_t *) ptr;
} else {
Proposed_User_Address =
- (unsigned int)ptr +
+ (unsigned long)ptr +
sizeof(Memory_Leak_Data_t);
Shift_Amount =
Alignment -
(Proposed_User_Address % Alignment);
Memory_Leak_Data =
- (Memory_Leak_Data_t *) ((unsigned int)ptr +
+ (Memory_Leak_Data_t *) ((unsigned long)ptr +
Shift_Amount);
}
@@ -764,12 +764,12 @@ int MEMORY_func(size_t sz,
/* Create the address to return to the caller. This address should be the first byte after
our memory leak data. */
ptr =
- (void *)((unsigned int)Memory_Leak_Data +
+ (void *)((unsigned long)Memory_Leak_Data +
sizeof(Memory_Leak_Data_t));
/* Calculate the address of the trailing sentinel. */
Ending_Sentinel =
- (Sentinel_t *) ((unsigned int)ptr + sz);
+ (Sentinel_t *) ((unsigned long)ptr + sz);
/* Initialize our memory leak data. */
Memory_Leak_Data->Signature = LEAK_SIGNATURE;
@@ -920,7 +920,7 @@ void FREE_func(const void *p, const char *mod_name, const char *func,
* prevent wrap around when we subtract sizeof(Memory_Leak_Data_t) to get the starting address of
* the memory leak data associated with p.
*/
- if ((p == NULL) || ((unsigned int)p <= sizeof(Memory_Leak_Data_t))) {
+ if ((p == NULL) || ((unsigned long)p <= sizeof(Memory_Leak_Data_t))) {
fprintf(stderr,
"FREE: request has invalid user address [%p]. Request came from module %s, function %s, line %d\n",
p, mod_name, func, line);
@@ -942,7 +942,7 @@ void FREE_func(const void *p, const char *mod_name, const char *func,
if (!Check_Leak_List(p)) {
/* Get access to the memory leak data. */
Memory_Leak_Data =
- (Memory_Leak_Data_t *) ((unsigned int)p -
+ (Memory_Leak_Data_t *) ((unsigned long)p -
sizeof(Memory_Leak_Data_t));
USER3_PRINT_LINE
@@ -1178,7 +1178,7 @@ void *Realloc_func(void *p, size_t size, const char *mod_name, const char *func,
/* Get access to the memory leak data. */
Memory_Leak_Data =
(Memory_Leak_Data_t
- *) ((unsigned int)p -
+ *) ((unsigned long)p -
sizeof
(Memory_Leak_Data_t));
diff --git a/clib/src/slab.c b/clib/src/slab.c
index 1e5e5a8..9ee4353 100644
--- a/clib/src/slab.c
+++ b/clib/src/slab.c
@@ -63,7 +63,7 @@ typedef struct slab_node slab_node_t;
struct slab_node {
uint8_t magic[4];
- size_t free;
+ uint32_t free;
tree_node_t node;
uint32_t bitmap[];
@@ -98,7 +98,7 @@ static slab_node_t *__slab_grow(slab_t * self)
node->free = SLAB_ALLOC_COUNT(self);
- tree_node_init(&node->node, (const void *)int32_hash1((int32_t) node));
+ tree_node_init(&node->node, (const void *)int64_hash1((int64_t) node));
splay_insert(&self->tree, &node->node);
self->hdr.page_count++;
@@ -108,21 +108,21 @@ static slab_node_t *__slab_grow(slab_t * self)
/* ======================================================================= */
-int slab_init3(slab_t * self, const char *name, size_t alloc_size)
+int slab_init3(slab_t * self, const char *name, uint32_t alloc_size)
{
size_t page_size = max(sysconf(_SC_PAGESIZE),
__round_pow2(alloc_size * SLAB_PAGE_DIVISOR));
return slab_init5(self, name, alloc_size, page_size, page_size);
}
-int slab_init4(slab_t * self, const char *name, size_t alloc_size,
+int slab_init4(slab_t * self, const char *name, uint32_t alloc_size,
size_t page_size)
{
size_t align_size = (size_t) sysconf(_SC_PAGESIZE);
return slab_init5(self, name, alloc_size, page_size, align_size);
}
-int slab_init5(slab_t * self, const char *name, size_t alloc_size,
+int slab_init5(slab_t * self, const char *name, uint32_t alloc_size,
size_t page_size, size_t align_size)
{
assert(self != NULL);
@@ -144,7 +144,7 @@ int slab_init5(slab_t * self, const char *name, size_t alloc_size,
return -1;
}
- size_t __page_size = (size_t) sysconf(_SC_PAGESIZE);
+ uint32_t __page_size = (uint32_t) sysconf(_SC_PAGESIZE);
align_size = __round_pow2(align_size);
if (align_size % __page_size) {
@@ -286,7 +286,7 @@ int slab_free(slab_t * self, void *ptr)
assert(node != NULL);
if (unlikely(SLAB_NODE_MAGIC_CHECK(node->magic))) {
- int32_t hash = int32_hash1((int32_t) node);
+ int64_t hash = int64_hash1((int64_t) node);
if (splay_find(&self->tree, (const void *)hash) == NULL) {
UNEXPECTED("'%s' invalid slab_node pointer, %p",
self->hdr.name, ptr);
diff --git a/clib/src/table.c b/clib/src/table.c
index ee848cb..82a35aa 100644
--- a/clib/src/table.c
+++ b/clib/src/table.c
@@ -49,7 +49,7 @@
#define TABLE_PAGE_DIVISOR 32
/* ======================================================================= */
-int table_init(table_t * self, const char *name, size_t col_nr)
+int table_init(table_t * self, const char *name, uint32_t col_nr)
{
assert(self != NULL);
assert(name != NULL);
@@ -635,7 +635,7 @@ void table_dump(table_t * self, FILE * out)
}
fprintf(out,
- "table: [ size: %d cols: %d rows: %d name: '%s']\n",
+ "table: [ size: %ld cols: %ld rows: %ld name: '%s']\n",
sizeof(value_t), table_columns(self), table_rows(self),
self->hdr.name);
diff --git a/clib/src/tree.c b/clib/src/tree.c
index cb86ee3..5cd4c08 100644
--- a/clib/src/tree.c
+++ b/clib/src/tree.c
@@ -385,7 +385,7 @@ void tree_dump(tree_t * self, FILE * out)
int __tree_node_dump(tree_node_t * node) {
if (node != NULL)
return fprintf(out, "node[%p] left[%p] right[%p] "
- "parent[%p] -- key[%d]\n",
+ "parent[%p] -- key[%ld]\n",
node, node->left, node->right,
node->parent, (intptr_t) node->key);
else
@@ -414,7 +414,7 @@ void tree_node_dump(tree_node_t * node, FILE * out)
}
fprintf(out, "node:[%p] left[%p] right[%p] parent[%p] "
- "key[%d]\n", root, root->left, root->right,
+ "key[%ld]\n", root, root->left, root->right,
root->parent, (intptr_t) node->key);
level++;
@@ -591,7 +591,7 @@ int splay_remove(tree_t * self, tree_node_t * node)
}
#else
if (self->root->left != NULL && self->root->right != NULL) {
- if (parity(int32_hash1((int32_t) self->root))) {
+ if (parity(int64_hash1((int64_t) self->root))) {
x = splay(self->root->left, node->key,
self->compare);
x->right = self->root->right;
diff --git a/clib/src/value.c b/clib/src/value.c
index cadf8fd..899221e 100644
--- a/clib/src/value.c
+++ b/clib/src/value.c
@@ -74,7 +74,7 @@ void value_dump(const value_t * self, FILE * out)
break;
case VT_I64:
fprintf(out, "value: [ data: %lld size: %d type: %s ] %p\n",
- self->i64, self->size, type_name[self->type], self);
+ (long long)self->i64, self->size, type_name[self->type], self);
break;
case VT_U8:
fprintf(out, "value: [ data: %ud size: %d type: %s ] %p\n",
@@ -90,7 +90,7 @@ void value_dump(const value_t * self, FILE * out)
break;
case VT_U64:
fprintf(out, "value: [ data: %lld size: %d type: %s ] %p\n",
- self->u64, self->size, type_name[self->type], self);
+ (long long)self->u64, self->size, type_name[self->type], self);
break;
case VT_REAL32:
fprintf(out, "value: [ data: %f size: %d type: %s ] %p\n",
@@ -112,7 +112,7 @@ void value_dump(const value_t * self, FILE * out)
break;
case VT_STR_OFF:
fprintf(out, "value: [ data: %llu size: %d type: %s ] %p\n",
- self->u64, self->size, type_name[self->type], self);
+ (long long)self->u64, self->size, type_name[self->type], self);
break;
case VT_STR_CONST:
fprintf(out, "value: [ data: '%s' size: %d type: %s ] %p\n",
@@ -133,7 +133,7 @@ void value_dump(const value_t * self, FILE * out)
break;
case VT_BLOB_OFF:
fprintf(out, "value: [ data: %llu size: %d type: %s ] %p\n",
- self->u64, self->size, type_name[self->type], self);
+ (long long)self->u64, self->size, type_name[self->type], self);
break;
case VT_BLOB_FILE:
fprintf(out, "value: [ data: '%s' size: %d type: %s ] %p\n",
diff --git a/clib/src/vector.c b/clib/src/vector.c
index c4f44cc..73aa5c4 100644
--- a/clib/src/vector.c
+++ b/clib/src/vector.c
@@ -83,21 +83,21 @@ struct vector_node {
#define __index_to_page_hashed(i,s) \
({ \
- typeof(i) _h = int32_hash1(__index_to_page((i),(s))); \
+ typeof(i) _h = int64_hash1(__index_to_page((i),(s))); \
_h; \
})
/*! @endcond */
/* ======================================================================= */
-static vector_node_t *__vector_find_page(vector_t * self, size_t idx)
+static vector_node_t *__vector_find_page(vector_t * self, uint64_t idx)
{
const void *hash;
hash = (const void *)__index_to_page_hashed(idx, self->hdr.elem_num);
tree_node_t *node = tree_find(&self->tree, hash);
if (unlikely(node == NULL)) {
- UNEXPECTED("'%d' index out of range", idx);
+ UNEXPECTED("'%ld' index out of range", idx);
return NULL;
}
@@ -140,9 +140,9 @@ static vector_node_t *__vector_grow(vector_t * self)
node->magic[2] = VECTOR_NODE_MAGIC[2];
node->magic[3] = VECTOR_NODE_MAGIC[3];
- node->address = (uint32_t) node;
+ node->address = (ulong) node;
- size_t hash = __index_to_page_hashed(vector_capacity(self),
+ uint64_t hash = __index_to_page_hashed(vector_capacity(self),
self->hdr.elem_num);
tree_node_init(&node->node, (const void *)hash);
@@ -162,15 +162,15 @@ static int __vector_compare(const int i1, const int i2)
/* ======================================================================= */
-int vector_init3(vector_t * self, const char *name, size_t elem_size)
+int vector_init3(vector_t * self, const char *name, uint32_t elem_size)
{
- size_t page_size = max(sysconf(_SC_PAGESIZE),
+ uint32_t page_size = max(sysconf(_SC_PAGESIZE),
__round_pow2(elem_size * VECTOR_PAGE_DIVISOR));
return vector_init4(self, name, elem_size, page_size);
}
-int vector_init4(vector_t * self, const char *name, size_t elem_size,
- size_t page_size)
+int vector_init4(vector_t * self, const char *name, uint32_t elem_size,
+ uint32_t page_size)
{
assert(self != NULL);
@@ -251,7 +251,7 @@ int vector_delete(vector_t * self)
return 0;
}
-const void *vector_at(vector_t * self, size_t idx)
+const void *vector_at(vector_t * self, uint32_t idx)
{
assert(self != NULL);
assert(!MAGIC_CHECK(self->hdr.id, VECTOR_MAGIC));
@@ -261,12 +261,12 @@ const void *vector_at(vector_t * self, size_t idx)
return node->data + (self->hdr.elem_size * (idx % self->hdr.elem_num));
}
-int vector_get3(vector_t * self, size_t idx, void *ptr)
+int vector_get3(vector_t * self, uint32_t idx, void *ptr)
{
return vector_get4(self, idx, ptr, 1);
}
-int vector_get4(vector_t * self, size_t idx, void *ptr, size_t count)
+int vector_get4(vector_t * self, uint32_t idx, void *ptr, uint32_t count)
{
assert(self != NULL);
assert(!MAGIC_CHECK(self->hdr.id, VECTOR_MAGIC));
@@ -283,7 +283,7 @@ int vector_get4(vector_t * self, size_t idx, void *ptr, size_t count)
return 0;
}
-static inline int __vector_put(vector_t * self, size_t idx, const void *ptr)
+static inline int __vector_put(vector_t * self, uint32_t idx, const void *ptr)
{
assert(self != NULL);
assert(!MAGIC_CHECK(self->hdr.id, VECTOR_MAGIC));
@@ -303,12 +303,12 @@ static inline int __vector_put(vector_t * self, size_t idx, const void *ptr)
return 0;
}
-int vector_put3(vector_t * self, size_t idx, const void *ptr)
+int vector_put3(vector_t * self, uint32_t idx, const void *ptr)
{
return vector_put4(self, idx, ptr, 1);
}
-int vector_put4(vector_t * self, size_t idx, const void *ptr, size_t count)
+int vector_put4(vector_t * self, uint32_t idx, const void *ptr, uint32_t count)
{
assert(self != NULL);
assert(!MAGIC_CHECK(self->hdr.id, VECTOR_MAGIC));
@@ -327,13 +327,13 @@ int vector_put4(vector_t * self, size_t idx, const void *ptr, size_t count)
return 0;
}
-size_t vector_size1(vector_t * self)
+uint32_t vector_size1(vector_t * self)
{
assert(self != NULL);
return self->hdr.size;
}
-int vector_size2(vector_t * self, size_t size)
+int vector_size2(vector_t * self, uint32_t size)
{
assert(self != NULL);
assert(!MAGIC_CHECK(self->hdr.id, VECTOR_MAGIC));
@@ -355,21 +355,21 @@ int vector_size2(vector_t * self, size_t size)
return self->hdr.size = size;
}
-size_t vector_pages(vector_t * self)
+uint32_t vector_pages(vector_t * self)
{
assert(self != NULL);
assert(!MAGIC_CHECK(self->hdr.id, VECTOR_MAGIC));
return self->hdr.page_count;
}
-size_t vector_capacity(vector_t * self)
+uint32_t vector_capacity(vector_t * self)
{
assert(self != NULL);
assert(!MAGIC_CHECK(self->hdr.id, VECTOR_MAGIC));
return self->hdr.page_count * self->hdr.elem_num;
}
-size_t vector_elem_size(vector_t * self)
+uint32_t vector_elem_size(vector_t * self)
{
assert(self != NULL);
assert(!MAGIC_CHECK(self->hdr.id, VECTOR_MAGIC));
@@ -557,7 +557,7 @@ ssize_t vector_load(vector_t * self, FILE * in)
return -1;
}
- node->address = (uint32_t) node;
+ node->address = (ulong) node;
tree_node_init(&node->node, node->node.key);
splay_insert(&self->tree, &node->node);
@@ -626,7 +626,7 @@ int vector_receive(vector_t * self, mqueue_t * mq)
assert(!VECTOR_NODE_MAGIC_CHECK(node->magic));
- node->address = (uint32_t) node;
+ node->address = (ulong) node;
tree_node_init(&node->node, node->node.key);
splay_insert(&self->tree, &node->node);
diff --git a/clib/src/vector_iter.c b/clib/src/vector_iter.c
index c7d0c50..f3db641 100644
--- a/clib/src/vector_iter.c
+++ b/clib/src/vector_iter.c
@@ -173,7 +173,7 @@ int vector_iter_pos2(vector_iter_t * self, size_t pos)
assert(self != NULL);
if (vector_size(self->vector) <= pos) {
- UNEXPECTED("'%d' index out-of-range", pos);
+ UNEXPECTED("'%ld' index out-of-range", pos);
return -1;
}
diff --git a/clib/table.h b/clib/table.h
index 36e4bd4..ceed6d1 100644
--- a/clib/table.h
+++ b/clib/table.h
@@ -130,7 +130,7 @@ typedef struct table table_t; //!< Alias for the @em table class
* @param col_nr [in] Number of columns
* @return None
*/
-extern int table_init(table_t *, const char *, size_t)
+extern int table_init(table_t *, const char *, uint32_t)
/*! @cond */
__nonnull((1, 2)) /*! @endcond */ ;
diff --git a/clib/tree.h b/clib/tree.h
index 82b1a30..f6736f8 100644
--- a/clib/tree.h
+++ b/clib/tree.h
@@ -108,7 +108,7 @@ struct tree {
tree_node_t *max; //!< reference to the node with largest 'key' in the tree
compare_f compare; //!< Reference to the function used to distinguish tree_nodes
- size_t size; //!< Cache of the number of tree_node's contained in the @em tree
+ uint32_t size; //!< Cache of the number of tree_node's contained in the @em tree
};
typedef struct tree tree_t; //!< Alias for the @em tree class
diff --git a/clib/vector.h b/clib/vector.h
index 9b9260d..1d39b4f 100644
--- a/clib/vector.h
+++ b/clib/vector.h
@@ -97,13 +97,13 @@ struct vector_header {
ident_t id; //!< identification
char name[VECTOR_NAME_SIZE]; //!< vector name
- size_t page_size; //!< data page size (in bytes)
- size_t page_count; //!< number of data pages allocated (currently)
+ uint32_t page_size; //!< data page size (in bytes)
+ uint32_t page_count; //!< number of data pages allocated (currently)
- size_t elem_size; //!< element size (in bytes)
- size_t elem_num; //!< element count (per page)
+ uint32_t elem_size; //!< element size (in bytes)
+ uint32_t elem_num; //!< element count (per page)
- size_t size; //!< number of initialized elements
+ uint32_t size; //!< number of initialized elements
};
typedef struct vector_header vector_header_t; //!< Alias for the @em vector_header class
@@ -120,7 +120,7 @@ typedef struct vector vector_t; //!< Alias for the @em vector class
/* ======================================================================= */
/*!
- * @fn void vector_init(vector_t * self, const char * name, size_t elem_size [, size_t page_size])
+ * @fn void vector_init(vector_t * self, const char * name, uint32_t elem_size [, uint32_t page_size])
* @brief Constructs an @em vector container object
* @details For example,
* @code
@@ -139,10 +139,10 @@ typedef struct vector vector_t; //!< Alias for the @em vector class
*/
/*! @cond */
#define vector_init(...) STRCAT(vector_init, NARGS(__VA_ARGS__))(__VA_ARGS__)
-extern int vector_init3(vector_t *, const char *, size_t)
+extern int vector_init3(vector_t *, const char *, uint32_t)
/*! @cond */
__nonnull((1)) /*! @endcond */ ;
-extern int vector_init4(vector_t *, const char *, size_t, size_t)
+extern int vector_init4(vector_t *, const char *, uint32_t, uint32_t)
/*! @cond */
__nonnull((1)) /*! @endcond */ ;
/*! @endcond */
@@ -184,12 +184,12 @@ __nonnull((1)) /*! @endcond */ ;
* @throws UNEXPECTED if @em self pointer is NULL
* @throws UNEXPECTED if vector element at @em idx is uninitialized
*/
-extern const void *vector_at(vector_t *, size_t)
+extern const void *vector_at(vector_t *, uint32_t)
/*! @cond */
__nonnull((1)) /*! @endcond */ ;
/*!
- * @fn void vector_get(vector_t * self, size_t idx, const void * ptr, size_t count=1)
+ * @fn void vector_get(vector_t * self, uint32_t idx, const void * ptr, uint32_t count=1)
* @brief Copy content from the @em vector
* @details Copies @em elem_num element(s) starting at position @em elem_off in the source @em vector to destination pointer @em ptr
* @note If the fourth parameter is omitted, it defaults to 1
@@ -212,16 +212,16 @@ __nonnull((1)) /*! @endcond */ ;
*/
/*! @cond */
#define vector_get(...) STRCAT(vector_get, NARGS(__VA_ARGS__))(__VA_ARGS__)
-extern int vector_get3(vector_t *, size_t, void *)
+extern int vector_get3(vector_t *, uint32_t, void *)
/*! @cond */
__nonnull((1, 3)) /*! @endcond */ ;
-extern int vector_get4(vector_t *, size_t, void *, size_t)
+extern int vector_get4(vector_t *, uint32_t, void *, uint32_t)
/*! @cond */
__nonnull((1, 3)) /*! @endcond */ ;
/*! @endcond */
/*!
- * @fn void vector_put(vector_t * self, size_t idx, const void * ptr, size_t count=1)
+ * @fn void vector_put(vector_t * self, uint32_t idx, const void * ptr, uint32_t count=1)
* @brief Assign new content to the @em vector
* @details Copies @em elem_num element(s) from source pointer @em ptr to the destination @em vector starting at position @em elem_off
* @note If the fourth parameter is omitted, it defaults to 1
@@ -244,16 +244,16 @@ __nonnull((1, 3)) /*! @endcond */ ;
*/
/*! @cond */
#define vector_put(...) STRCAT(vector_put, NARGS(__VA_ARGS__))(__VA_ARGS__)
-extern int vector_put3(vector_t *, size_t, const void *)
+extern int vector_put3(vector_t *, uint32_t, const void *)
/*! @cond */
__nonnull((1, 3)) /*! @endcond */ ;
-extern int vector_put4(vector_t *, size_t, const void *, size_t)
+extern int vector_put4(vector_t *, uint32_t, const void *, uint32_t)
/*! @cond */
__nonnull((1, 3)) /*! @endcond */ ;
/*! @endcond */
/*!
- * @fn size_t vector_size(vector_t * self, size_t size = 1)
+ * @fn uint32_t vector_size(vector_t * self, uint32_t size = 1)
* @brief Return or set the size of the @em vector
* @details Return or set the number of allocated elements in the @em vector
* @details For example,
@@ -272,10 +272,10 @@ __nonnull((1, 3)) /*! @endcond */ ;
*/
/*! @cond */
#define vector_size(...) STRCAT(vector_size, NARGS(__VA_ARGS__))(__VA_ARGS__)
-extern size_t vector_size1(vector_t *)
+extern uint32_t vector_size1(vector_t *)
/*! @cond */
__nonnull((1)) /*! @endcond */ ;
-extern int vector_size2(vector_t *, size_t)
+extern int vector_size2(vector_t *, uint32_t)
/*! @cond */
__nonnull((1)) /*! @endcond */ ;
/*! @endcond */
@@ -297,7 +297,7 @@ __nonnull((1)) /*! @endcond */ ;
* @return The number of pages that conform the vector's content
* @throws UNEXPECTED if @em self pointer is NULL
*/
-extern size_t vector_pages(vector_t *)
+extern uint32_t vector_pages(vector_t *)
/*! @cond */
__nonnull((1)) /*! @endcond */ ;
@@ -318,11 +318,11 @@ __nonnull((1)) /*! @endcond */ ;
* @return The number of total elements that conform the vector's content
* @throws UNEXPECTED if @em self pointer is NULL
*/
-extern size_t vector_capacity(vector_t *)
+extern uint32_t vector_capacity(vector_t *)
/*! @cond */
__nonnull((1)) /*! @endcond */ ;
-extern size_t vector_elem_size(vector_t *)
+extern uint32_t vector_elem_size(vector_t *)
/*! @cond */
__nonnull((1)) /*! @endcond */ ;
diff --git a/clib/vector_iter.h b/clib/vector_iter.h
index 5dc14bf..764a7fc 100644
--- a/clib/vector_iter.h
+++ b/clib/vector_iter.h
@@ -64,7 +64,7 @@ typedef struct vector_iter vector_iter_t; //!< Alias for the @em vector_iter cla
*/
struct vector_iter {
vector_t *vector; //!< Reference to the target vector object
- size_t idx; //!< Current position of the iterator
+ uint32_t idx; //!< Current position of the iterator
uint32_t flags; //!< Iterator configuration flags
};
diff --git a/ecc/Rules.mk b/ecc/Rules.mk
index c815cf1..ed3c46d 100644
--- a/ecc/Rules.mk
+++ b/ecc/Rules.mk
@@ -22,8 +22,8 @@
# permissions and limitations under the License.
#
# IBM_PROLOG_END_TAG
-CFLAGS += -m32 -D_GNU_SOURCE -std=gnu99 -D_FILE_OFFSET_BITS=64 -I$(DEPTH)/.. -iquote..
-LDFLAGS += -L. -L$(DEPTH)/../clib/x86 -m32
+CFLAGS += -D_GNU_SOURCE -std=gnu99 -D_FILE_OFFSET_BITS=64 -I$(DEPTH)/.. -iquote..
+LDFLAGS += -L. -L$(DEPTH)/../clib/x86
OBJS=main.o
diff --git a/ecc/src/main.c b/ecc/src/main.c
index 7199919..53dbf47 100644
--- a/ecc/src/main.c
+++ b/ecc/src/main.c
@@ -247,7 +247,7 @@ static int validate_args(args_t * args)
args->file = strdup(args->path);
assert(args->file != NULL);
sprintf((char *)args->file, "%*s",
- strlen(args->path) - strlen(ECC_EXT),
+ (uint32_t)(strlen(args->path) - strlen(ECC_EXT)),
args->path);
fprintf(stderr, "%s: --output <file> missing, writing "
diff --git a/fcp/Rules.mk b/fcp/Rules.mk
index ee8d95b..d5fcd12 100644
--- a/fcp/Rules.mk
+++ b/fcp/Rules.mk
@@ -22,10 +22,10 @@
# permissions and limitations under the License.
#
# IBM_PROLOG_END_TAG
-CFLAGS += -m32 -D_GNU_SOURCE -std=gnu99 -D_FILE_OFFSET_BITS=64
+CFLAGS += -D_GNU_SOURCE -std=gnu99 -D_FILE_OFFSET_BITS=64
CFLAGS += -I$(DEPTH)/.. -iquote..
-LDFLAGS += -L. -m32
+LDFLAGS += -L.
NAME=fcp
diff --git a/fcp/src/cmd_copy.c b/fcp/src/cmd_copy.c
index b2642bd..6a0d8f6 100644
--- a/fcp/src/cmd_copy.c
+++ b/fcp/src/cmd_copy.c
@@ -62,7 +62,7 @@ static int validate_files(ffs_t * src, ffs_t * dst)
assert(src != NULL);
assert(dst != NULL);
- size_t s, d;
+ uint32_t s, d;
if (__ffs_info(src, FFS_INFO_BLOCK_SIZE, &s) < 0)
return -1;
@@ -131,28 +131,28 @@ static int __copy_entry(args_t * args,
if (dst_entry->type == FFS_TYPE_LOGICAL) {
if (args->verbose == f_VERBOSE)
fprintf(stderr, "%8llx: %s: logical partition (skip)\n",
- dst_ffs->offset, full_dst_name);
+ (long long)dst_ffs->offset, full_dst_name);
return 0;
}
if (src_entry->type == FFS_TYPE_LOGICAL) {
if (args->verbose == f_VERBOSE)
fprintf(stderr, "%8llx: %s: logical partition (skip)\n",
- src_ffs->offset, full_src_name);
+ (long long)src_ffs->offset, full_src_name);
return 0;
}
if (dst_entry->type == FFS_TYPE_PARTITION) {
if (args->verbose == f_VERBOSE)
fprintf(stderr, "%8llx: %s: partition table (skip)\n",
- dst_ffs->offset, full_dst_name);
+ (long long)dst_ffs->offset, full_dst_name);
return 0;
}
if (src_entry->type == FFS_TYPE_PARTITION) {
if (args->verbose == f_VERBOSE)
fprintf(stderr, "%8llx: %s: partition table (skip)\n",
- src_ffs->offset, full_src_name);
+ (long long)src_ffs->offset, full_src_name);
return 0;
}
@@ -160,14 +160,14 @@ static int __copy_entry(args_t * args,
if (dst_entry->flags & FFS_FLAGS_PROTECTED) {
if (args->verbose == f_VERBOSE)
fprintf(stderr, "%8llx: %s: protected "
- "partition (skip)\n", dst_ffs->offset,
+ "partition (skip)\n", (long long)dst_ffs->offset,
full_dst_name);
return 0;
}
if (src_entry->flags & FFS_FLAGS_PROTECTED) {
if (args->verbose == f_VERBOSE)
fprintf(stderr, "%8llx: %s: protected "
- "partition (skip)\n", src_ffs->offset,
+ "partition (skip)\n", (long long)src_ffs->offset,
full_src_name);
return 0;
}
@@ -175,14 +175,14 @@ static int __copy_entry(args_t * args,
if (src_entry->size != dst_entry->size) {
UNEXPECTED("%8llx: %s: source partition '%s' size mismatch "
- "'%x', use --force to overwrite\n", dst_ffs->offset,
+ "'%x', use --force to overwrite\n", (long long)dst_ffs->offset,
full_dst_name, full_src_name, dst_entry->size);
return -1;
}
if (src_entry->type != dst_entry->type) {
UNEXPECTED("%8llx: %s: source partition '%s' type mismatch "
- "'%x', use --force to overwrite\n", dst_ffs->offset,
+ "'%x', use --force to overwrite\n", (long long)dst_ffs->offset,
full_dst_name, full_src_name, dst_entry->size);
return -1;
}
@@ -194,7 +194,7 @@ static int __copy_entry(args_t * args,
}
if (args->verbose == f_VERBOSE)
fprintf(stderr, "%8llx: %s: trunc size '%x' (done)\n",
- dst_ffs->offset, full_dst_name, src_entry->actual);
+ (long long)dst_ffs->offset, full_dst_name, src_entry->actual);
uint32_t src_val, dst_val;
for (uint32_t i=0; i<FFS_USER_WORDS; i++) {
@@ -213,13 +213,13 @@ static int __copy_entry(args_t * args,
if (args->verbose == f_VERBOSE)
if (args->verbose == f_VERBOSE)
fprintf(stderr, "%8llx: %s: copy user[] from '%s' "
- "(done)\n", dst_ffs->offset, full_dst_name,
+ "(done)\n", (long long)dst_ffs->offset, full_dst_name,
src_ffs->path);
if (entry_list_exists(done_list, src_entry) == 1) {
if (args->verbose == f_VERBOSE)
fprintf(stderr, "%8llx: %s: copy from '%s' (skip)\n",
- dst_ffs->offset, full_dst_name, src_ffs->path);
+ (long long)dst_ffs->offset, full_dst_name, src_ffs->path);
return 0;
}
@@ -231,7 +231,7 @@ static int __copy_entry(args_t * args,
if (args->verbose == f_VERBOSE)
fprintf(stderr, "%8llx: %s: copy from '%s' (done)\n",
- dst_ffs->offset, full_dst_name, src_ffs->path);
+ (long long)dst_ffs->offset, full_dst_name, src_ffs->path);
return 0;
}
@@ -256,14 +256,14 @@ static int __compare_entry(args_t * args,
if (dst_entry->type == FFS_TYPE_LOGICAL) {
if (args->verbose == f_VERBOSE)
fprintf(stderr, "%8llx: %s: logical partition (skip)\n",
- dst_ffs->offset, full_dst_name);
+ (long long)dst_ffs->offset, full_dst_name);
return 0;
}
if (src_entry->type == FFS_TYPE_LOGICAL) {
if (args->verbose == f_VERBOSE)
fprintf(stderr, "%8llx: %s: logical partition (skip)\n",
- src_ffs->offset, full_src_name);
+ (long long)src_ffs->offset, full_src_name);
return 0;
}
@@ -271,14 +271,14 @@ static int __compare_entry(args_t * args,
if (dst_entry->flags & FFS_FLAGS_PROTECTED) {
if (args->verbose == f_VERBOSE)
fprintf(stderr, "%8llx: %s: protected "
- "partition (skip)\n", dst_ffs->offset,
+ "partition (skip)\n", (long long)dst_ffs->offset,
full_dst_name);
return 0;
}
if (src_entry->flags & FFS_FLAGS_PROTECTED) {
if (args->verbose == f_VERBOSE)
fprintf(stderr, "%8llx: %s: protected "
- "partition (skip)\n", src_ffs->offset,
+ "partition (skip)\n", (long long)src_ffs->offset,
full_src_name);
return 0;
}
@@ -286,14 +286,14 @@ static int __compare_entry(args_t * args,
if (src_entry->size != dst_entry->size) {
UNEXPECTED("%8llx: %s: source partition '%s' size mismatch "
- "'%x', use --force to overwrite\n", dst_ffs->offset,
+ "'%x', use --force to overwrite\n", (long long)dst_ffs->offset,
full_dst_name, full_src_name, dst_entry->size);
return -1;
}
if (src_entry->type != dst_entry->type) {
UNEXPECTED("%8llx: %s: source partition '%s' type mismatch "
- "'%x', use --force to overwrite\n", dst_ffs->offset,
+ "'%x', use --force to overwrite\n", (long long)dst_ffs->offset,
full_dst_name, full_src_name, dst_entry->size);
return -1;
}
@@ -301,7 +301,7 @@ static int __compare_entry(args_t * args,
if (entry_list_exists(done_list, src_entry) == 1) {
if (args->verbose == f_VERBOSE)
fprintf(stderr, "%8llx: %s: compare from '%s' (skip)\n",
- dst_ffs->offset, full_dst_name, src_ffs->path);
+ (long long)dst_ffs->offset, full_dst_name, src_ffs->path);
return 0;
}
@@ -314,7 +314,7 @@ static int __compare_entry(args_t * args,
if (args->verbose == f_VERBOSE)
fprintf(stderr, "%8llx: %s: compare from '%s' (done)\n",
- dst_ffs->offset, full_dst_name, src_ffs->path);
+ (long long)dst_ffs->offset, full_dst_name, src_ffs->path);
return 0;
}
@@ -324,7 +324,7 @@ static int __force_part(ffs_t * src, FILE * dst)
assert(src != NULL);
assert(dst != NULL);
- size_t block_size;
+ uint32_t block_size;
if (__ffs_info(src, FFS_INFO_BLOCK_SIZE, &block_size) < 0)
return -1;
@@ -404,7 +404,7 @@ static int __copy_compare(args_t * args, off_t offset, entry_list_t * done_list)
if (args->verbose == f_VERBOSE)
fprintf(stderr, "%8llx: partition table '%s' => '%s' "
- "(done)\n", offset, src_target, dst_target);
+ "(done)\n", (long long)offset, src_target, dst_target);
}
if (check_file(dst_target, dst_file, offset) < 0)
@@ -422,12 +422,12 @@ static int __copy_compare(args_t * args, off_t offset, entry_list_t * done_list)
if (src_ffs->count <= 0) // fix me
return 0;
- size_t block_size;
+ uint32_t block_size;
if (__ffs_info(src_ffs, FFS_INFO_BLOCK_SIZE, &block_size) < 0)
return -1;
if (args->buffer != NULL) {
- size_t buffer;
+ uint32_t buffer;
if (parse_size(args->buffer, &buffer) < 0)
return -1;
if (__ffs_buffer(src_ffs, buffer) < 0)
@@ -447,14 +447,14 @@ static int __copy_compare(args_t * args, off_t offset, entry_list_t * done_list)
} else if ((src_name != NULL) && (dst_name != NULL)) {
if (__ffs_entry_find(src_ffs, src_name, &src_parent) == false) {
UNEXPECTED("%8llx: partition entry '%s' not found in "
- "'%s'\n", src_ffs->offset, src_name,
+ "'%s'\n", (long long)src_ffs->offset, src_name,
src_target);
return -1;
}
if (__ffs_entry_find(dst_ffs, dst_name, &dst_parent) == false) {
UNEXPECTED("%8llx: partition entry '%s' not found in "
- "'%s'\n", dst_ffs->offset, dst_name,
+ "'%s'\n", (long long)dst_ffs->offset, dst_name,
dst_target);
return -1;
}
diff --git a/fcp/src/cmd_erase.c b/fcp/src/cmd_erase.c
index 3a958b2..c1a7f2f 100644
--- a/fcp/src/cmd_erase.c
+++ b/fcp/src/cmd_erase.c
@@ -65,7 +65,7 @@ static int __erase(args_t * args, off_t offset, entry_list_t * done_list)
char * target = args->dst_target;
char * name = args->dst_name;
- size_t fill;
+ uint32_t fill;
if (args->opt_nr == 1) {
fill = 0xFF;
} else if (args->opt_nr == 2) {
@@ -88,12 +88,12 @@ static int __erase(args_t * args, off_t offset, entry_list_t * done_list)
if (ffs->count <= 0)
return 0;
- size_t block_size;
+ uint32_t block_size;
if (__ffs_info(ffs, FFS_INFO_BLOCK_SIZE, &block_size) < 0)
return -1;
if (args->buffer != NULL) {
- size_t buffer;
+ uint32_t buffer;
if (parse_size(args->buffer, &buffer) < 0)
return -1;
if (__ffs_buffer(ffs, buffer) < 0)
@@ -136,7 +136,7 @@ static int __erase(args_t * args, off_t offset, entry_list_t * done_list)
if (entry->flags & FFS_FLAGS_PROTECTED) {
if (args->verbose == f_VERBOSE)
fprintf(stderr, "%8llx: %s: protected "
- "(skip)\n", offset, full_name);
+ "(skip)\n", (long long)offset, full_name);
continue;
}
}
@@ -147,12 +147,12 @@ static int __erase(args_t * args, off_t offset, entry_list_t * done_list)
}
if (args->verbose == f_VERBOSE)
fprintf(stderr, "%8llx: %s: trunc size '%x' (done)\n",
- offset, full_name, 0);
+ (long long)offset, full_name, 0);
if (entry_list_exists(done_list, entry) == 1) {
if (args->verbose == f_VERBOSE)
fprintf(stderr, "%8llx: %s: erase partition "
- "(skip)\n", offset, full_name);
+ "(skip)\n", (long long)offset, full_name);
continue;
}
@@ -164,7 +164,7 @@ static int __erase(args_t * args, off_t offset, entry_list_t * done_list)
if (args->verbose == f_VERBOSE)
fprintf(stderr, "%8llx: %s: erase partition (done)\n",
- offset, full_name);
+ (long long)offset, full_name);
}
return 0;
diff --git a/fcp/src/cmd_list.c b/fcp/src/cmd_list.c
index 3dc8492..a781441 100644
--- a/fcp/src/cmd_list.c
+++ b/fcp/src/cmd_list.c
@@ -78,7 +78,7 @@ static int list(args_t * args, off_t offset)
return 0;
fprintf(stdout, "========================[ PARTITION TABLE"
- " 0x%llx ]=======================\n", ffs->offset);
+ " 0x%llx ]=======================\n", (long long)ffs->offset);
fprintf(stdout, "vers:%04x size:%04x * blk:%06x blk(s):"
"%06x * entsz:%06x ent(s):%06x\n",
ffs->hdr->version, ffs->hdr->size, ffs->hdr->block_size,
@@ -105,8 +105,8 @@ static int list(args_t * args, off_t offset)
sizeof full_name) < 0)
return -1;
- size_t offset = entry->base * ffs->hdr->block_size;
- size_t size = entry->size * ffs->hdr->block_size;
+ uint32_t offset = entry->base * ffs->hdr->block_size;
+ uint32_t size = entry->size * ffs->hdr->block_size;
char type;
if (entry->type == FFS_TYPE_LOGICAL)
diff --git a/fcp/src/cmd_read.c b/fcp/src/cmd_read.c
index 2dc9b9b..b7c8666 100644
--- a/fcp/src/cmd_read.c
+++ b/fcp/src/cmd_read.c
@@ -80,12 +80,12 @@ static int __read(args_t * args, off_t offset, entry_list_t * done_list)
if (ffs->count <= 0)
return 0;
- size_t block_size;
+ uint32_t block_size;
if (__ffs_info(ffs, FFS_INFO_BLOCK_SIZE, &block_size) < 0)
return -1;
if (args->buffer != NULL) {
- size_t buffer;
+ uint32_t buffer;
if (parse_size(args->buffer, &buffer) < 0)
return -1;
if (__ffs_buffer(ffs, buffer) < 0)
@@ -101,7 +101,7 @@ static int __read(args_t * args, off_t offset, entry_list_t * done_list)
if (entry.actual == 0) {
if (args->verbose == f_VERBOSE)
fprintf(stderr, "%8llx: %s: is empty (skip)\n",
- offset, name);
+ (long long)offset, name);
return 0;
}
@@ -113,14 +113,14 @@ static int __read(args_t * args, off_t offset, entry_list_t * done_list)
if (entry.type == FFS_TYPE_LOGICAL) {
if (args->verbose == f_VERBOSE)
fprintf(stderr, "%8llx: %s: logical (skip)\n",
- offset, name);
+ (long long)offset, name);
return 0;
}
if (entry_list_exists(done_list, &entry) == 1) {
if (args->verbose == f_VERBOSE)
fprintf(stderr, "%8llx: %s: write to '%s' (skip)\n",
- offset, full_name, out_path);
+ (long long)offset, full_name, out_path);
return 0;
}
@@ -148,7 +148,7 @@ static int __read(args_t * args, off_t offset, entry_list_t * done_list)
if (args->verbose == f_VERBOSE)
fprintf(stderr, "%8llx: %s: write to '%s' (done)\n",
- offset, full_name, out_path);
+ (long long)offset, full_name, out_path);
}
return 0;
diff --git a/fcp/src/cmd_trunc.c b/fcp/src/cmd_trunc.c
index cf71d57..75a98f4 100644
--- a/fcp/src/cmd_trunc.c
+++ b/fcp/src/cmd_trunc.c
@@ -77,12 +77,12 @@ static int __trunc(args_t * args, off_t offset)
if (ffs->count <= 0)
return 0;
- size_t block_size;
+ uint32_t block_size;
if (__ffs_info(ffs, FFS_INFO_BLOCK_SIZE, &block_size) < 0)
return -1;
if (args->buffer != NULL) {
- size_t buffer;
+ uint32_t buffer;
if (parse_size(args->buffer, &buffer) < 0)
return -1;
if (__ffs_buffer(ffs, buffer) < 0)
@@ -103,7 +103,7 @@ static int __trunc(args_t * args, off_t offset)
if (entry.type == FFS_TYPE_LOGICAL) {
if (args->verbose == f_VERBOSE)
fprintf(stderr, "%8llx: %s: logical (skip)\n",
- offset, full_name);
+ (long long)offset, full_name);
return 0;
}
@@ -111,11 +111,11 @@ static int __trunc(args_t * args, off_t offset)
entry.flags && FFS_FLAGS_PROTECTED) {
if (args->verbose == f_VERBOSE)
fprintf(stderr, "%8llx: %s: protected (skip)\n",
- offset, full_name);
+ (long long)offset, full_name);
return 0;
}
- size_t size = 0;
+ uint32_t size = 0;
if (args->opt_nr == 1) {
size = entry.size * block_size;
} else if (args->opt_nr == 2) {
@@ -130,7 +130,7 @@ static int __trunc(args_t * args, off_t offset)
if (args->verbose == f_VERBOSE)
fprintf(stderr, "%8llx: %s: truncate '%x' (done)\n",
- offset, full_name, size);
+ (long long)offset, full_name, size);
return 0;
}
diff --git a/fcp/src/cmd_user.c b/fcp/src/cmd_user.c
index a214b80..139c48b 100644
--- a/fcp/src/cmd_user.c
+++ b/fcp/src/cmd_user.c
@@ -79,12 +79,12 @@ static int __user(args_t * args, off_t offset)
if (ffs->count <= 0)
return 0;
- size_t block_size;
+ uint32_t block_size;
if (__ffs_info(ffs, FFS_INFO_BLOCK_SIZE, &block_size) < 0)
return -1;
if (args->buffer != NULL) {
- size_t buffer;
+ uint32_t buffer;
if (parse_size(args->buffer, &buffer) < 0)
return -1;
if (__ffs_buffer(ffs, buffer) < 0)
@@ -106,7 +106,7 @@ static int __user(args_t * args, off_t offset)
entry.flags && FFS_FLAGS_PROTECTED) {
if (args->verbose == f_VERBOSE)
fprintf(stderr, "%8llx: %s: protected (skip)\n",
- offset, full_name);
+ (long long)offset, full_name);
return 0;
}
@@ -120,7 +120,7 @@ static int __user(args_t * args, off_t offset)
return -1;
fprintf(stdout, "%8llx: %s: [%02d] = %08x\n",
- offset, full_name, word, value);
+ (long long)offset, full_name, word, value);
}
fprintf(stdout, "\n");
} else {
@@ -136,7 +136,7 @@ static int __user(args_t * args, off_t offset)
if (__value != NULL)
*__value = '\0';
- size_t word = 0;
+ uint32_t word = 0;
if (parse_number(args->opt[i], &word) < 0)
return -1;
@@ -153,7 +153,7 @@ static int __user(args_t * args, off_t offset)
if (args->verbose == f_VERBOSE)
fprintf(stderr, "%8llx: %s: [%02d] = "
- "%08x\n", offset, full_name,
+ "%08x\n", (long long)offset, full_name,
word, value);
} else { // read
if (__ffs_entry_user_get(ffs, full_name,
@@ -162,7 +162,7 @@ static int __user(args_t * args, off_t offset)
if (isatty(fileno(stdout)))
fprintf(stdout, "%8llx: %s: [%02d] = "
- "%08x\n", offset, full_name,
+ "%08x\n", (long long)offset, full_name,
word, value);
else
fprintf(stdout, "%x", value);
diff --git a/fcp/src/cmd_write.c b/fcp/src/cmd_write.c
index cb6938f..ec3d6db 100644
--- a/fcp/src/cmd_write.c
+++ b/fcp/src/cmd_write.c
@@ -82,12 +82,12 @@ static int __write(args_t * args, off_t offset, entry_list_t * done_list)
if (ffs->count <= 0)
return 0;
- size_t block_size;
+ uint32_t block_size;
if (__ffs_info(ffs, FFS_INFO_BLOCK_SIZE, &block_size) < 0)
return -1;
if (args->buffer != NULL) {
- size_t buffer;
+ uint32_t buffer;
if (parse_size(args->buffer, &buffer) < 0)
return -1;
if (__ffs_buffer(ffs, buffer) < 0)
@@ -108,7 +108,7 @@ static int __write(args_t * args, off_t offset, entry_list_t * done_list)
if (entry.type == FFS_TYPE_LOGICAL) {
if (args->verbose == f_VERBOSE)
fprintf(stderr, "%8llx: %s: logical (skip)\n",
- offset, full_name);
+ (long long)offset, full_name);
return 0;
}
@@ -116,7 +116,7 @@ static int __write(args_t * args, off_t offset, entry_list_t * done_list)
entry.flags & FFS_FLAGS_PROTECTED) {
if (args->verbose == f_VERBOSE)
fprintf(stderr, "%8llx: %s: protected (skip)\n",
- offset, full_name);
+ (long long)offset, full_name);
return 0;
}
@@ -135,13 +135,13 @@ static int __write(args_t * args, off_t offset, entry_list_t * done_list)
if (args->verbose == f_VERBOSE)
fprintf(stderr, "%8llx: %s: trunc size '%llx' (done)\n",
- offset, full_name, st.st_size);
+ (long long)offset, full_name, (long long)st.st_size);
}
if (entry_list_exists(done_list, &entry) == 1) {
if (args->verbose == f_VERBOSE)
fprintf(stderr, "%8llx: %s: read from '%s' (skip)\n",
- offset, full_name, in_path);
+ (long long)offset, full_name, in_path);
return 0;
}
@@ -163,7 +163,7 @@ static int __write(args_t * args, off_t offset, entry_list_t * done_list)
if (args->verbose == f_VERBOSE)
fprintf(stderr, "%8llx: %s: read from '%s' (done)\n",
- offset, full_name, in_path);
+ (long long)offset, full_name, in_path);
}
return 0;
diff --git a/fcp/src/misc.c b/fcp/src/misc.c
index 8710ffc..f0dbe45 100644
--- a/fcp/src/misc.c
+++ b/fcp/src/misc.c
@@ -130,7 +130,7 @@ int parse_offset(const char *str, off_t *offset)
return 0;
}
-int parse_size(const char *str, size_t *size)
+int parse_size(const char *str, uint32_t *size)
{
assert(size != NULL);
@@ -167,7 +167,7 @@ int parse_size(const char *str, size_t *size)
return 0;
}
-int parse_number(const char *str, size_t *num)
+int parse_number(const char *str, uint32_t *num)
{
assert(num != NULL);
@@ -208,7 +208,7 @@ int parse_path(const char * path, char ** type, char ** target, char ** name)
return -1;
}
} else if (delim1 == delim2) { // <target>:<name>
- if (asprintf(target, "%.*s", delim1 - path, path) < 0) {
+ if (asprintf(target, "%.*s", (uint32_t)(delim1 - path), path) < 0) {
ERRNO(errno);
return -1;
}
@@ -224,12 +224,12 @@ int parse_path(const char * path, char ** type, char ** target, char ** name)
*name = NULL;
}
} else if (delim1 != delim2) { // <type>:<target>:<name>
- if (asprintf(type, "%.*s", delim1 - path, path) < 0) {
+ if (asprintf(type, "%.*s", (uint32_t)(delim1 - path), path) < 0) {
ERRNO(errno);
return -1;
}
delim1++;
- if (asprintf(target, "%.*s", delim2 - delim1, delim1) < 0) {
+ if (asprintf(target, "%.*s", (uint32_t)(delim2 - delim1), delim1) < 0) {
ERRNO(errno);
return -1;
}
@@ -283,15 +283,15 @@ int check_file(const char * path, FILE * file, off_t offset) {
return 0;
case FFS_CHECK_HEADER_MAGIC:
UNEXPECTED("'%s' no partition table found at offset '%llx'\n",
- path, offset);
+ path, (long long)offset);
return -1;
case FFS_CHECK_HEADER_CHECKSUM:
UNEXPECTED("'%s' partition table at offset '%llx', is "
- "corrupted\n", path, offset);
+ "corrupted\n", path, (long long)offset);
return -1;
case FFS_CHECK_ENTRY_CHECKSUM:
UNEXPECTED("'%s' partition table at offset '%llx', has "
- "corrupted entries\n", path, offset);
+ "corrupted entries\n", path, (long long)offset);
return -1;
default:
return -1;
@@ -501,7 +501,7 @@ FILE *__fopen(const char * type, const char * target, const char * mode,
assert(mode != NULL);
FILE *file = NULL;
- size_t port = 0;
+ uint32_t port = 0;
if (type == NULL)
type = TYPE_FILE;
@@ -548,11 +548,11 @@ int fcp_read_entry(ffs_t * src, const char * name, FILE * out)
assert(src != NULL);
assert(name != NULL);
- size_t block_size;
+ uint32_t block_size;
if (__ffs_info(src, FFS_INFO_BLOCK_SIZE, &block_size) < 0)
return -1;
- size_t buffer_count;
+ uint32_t buffer_count;
if (__ffs_info(src, FFS_INFO_BUFFER_COUNT, &buffer_count) < 0)
return -1;
@@ -574,8 +574,8 @@ int fcp_read_entry(ffs_t * src, const char * name, FILE * out)
if (__ffs_info(src, FFS_INFO_OFFSET, &poffset) < 0)
return -1;
- size_t total = 0;
- size_t size = entry.actual;
+ uint32_t total = 0;
+ uint32_t size = entry.actual;
off_t offset = 0;
if (isatty(fileno(stderr))) {
@@ -618,11 +618,11 @@ int fcp_write_entry(ffs_t * dst, const char * name, FILE * in)
assert(dst != NULL);
assert(name != NULL);
- size_t block_size;
+ uint32_t block_size;
if (__ffs_info(dst, FFS_INFO_BLOCK_SIZE, &block_size) < 0)
return -1;
- size_t buffer_count;
+ uint32_t buffer_count;
if (__ffs_info(dst, FFS_INFO_BUFFER_COUNT, &buffer_count) < 0)
return -1;
@@ -644,8 +644,8 @@ int fcp_write_entry(ffs_t * dst, const char * name, FILE * in)
if (__ffs_info(dst, FFS_INFO_OFFSET, &poffset) < 0)
return -1;
- size_t total = 0;
- size_t size = entry.actual;
+ uint32_t total = 0;
+ uint32_t size = entry.actual;
off_t offset = 0;
if (isatty(fileno(stderr))) {
@@ -694,11 +694,11 @@ int fcp_erase_entry(ffs_t * dst, const char * name, char fill)
assert(dst != NULL);
assert(name != NULL);
- size_t block_size;
+ uint32_t block_size;
if (__ffs_info(dst, FFS_INFO_BLOCK_SIZE, &block_size) < 0)
return -1;
- size_t buffer_count;
+ uint32_t buffer_count;
if (__ffs_info(dst, FFS_INFO_BUFFER_COUNT, &buffer_count) < 0)
return -1;
@@ -722,8 +722,8 @@ int fcp_erase_entry(ffs_t * dst, const char * name, char fill)
if (__ffs_info(dst, FFS_INFO_OFFSET, &poffset) < 0)
return -1;
- size_t total = 0;
- size_t size = entry.size * block_size;
+ uint32_t total = 0;
+ uint32_t size = entry.size * block_size;
off_t offset = 0;
if (isatty(fileno(stderr))) {
@@ -771,11 +771,11 @@ int fcp_copy_entry(ffs_t * src, const char * src_name,
assert(dst != NULL);
assert(dst_name != NULL);
- size_t block_size;
+ uint32_t block_size;
if (__ffs_info(src, FFS_INFO_BLOCK_SIZE, &block_size) < 0)
return -1;
- size_t buffer_count;
+ uint32_t buffer_count;
if (__ffs_info(dst, FFS_INFO_BUFFER_COUNT, &buffer_count) < 0)
return -1;
@@ -800,13 +800,13 @@ int fcp_copy_entry(ffs_t * src, const char * src_name,
return -1;
}
- size_t total = 0;
- size_t size = src_entry.actual;
+ uint32_t total = 0;
+ uint32_t size = src_entry.actual;
off_t offset = 0;
if (isatty(fileno(stderr))) {
fprintf(stderr, "%8llx: %s: copy partition %8x/%8x",
- src->offset, dst_name, src_entry.actual, total);
+ (long long)src->offset, dst_name, src_entry.actual, total);
}
while (0 < size) {
@@ -829,7 +829,7 @@ int fcp_copy_entry(ffs_t * src, const char * src_name,
if (isatty(fileno(stderr))) {
fprintf(stderr, "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
- fprintf(stderr, "%8x/%8x", src_entry.actual, total);
+ fprintf(stderr, "%8x/%8x", (uint32_t)src_entry.actual, total);
}
}
@@ -848,11 +848,11 @@ int fcp_compare_entry(ffs_t * src, const char * src_name,
assert(dst != NULL);
assert(dst_name != NULL);
- size_t block_size;
+ uint32_t block_size;
if (__ffs_info(src, FFS_INFO_BLOCK_SIZE, &block_size) < 0)
return -1;
- size_t buffer_count;
+ uint32_t buffer_count;
if (__ffs_info(dst, FFS_INFO_BUFFER_COUNT, &buffer_count) < 0)
return -1;
@@ -883,13 +883,13 @@ int fcp_compare_entry(ffs_t * src, const char * src_name,
return -1;
}
- size_t total = 0;
- size_t size = src_entry.actual;
+ uint32_t total = 0;
+ uint32_t size = src_entry.actual;
off_t offset = 0;
if (isatty(fileno(stderr))) {
fprintf(stderr, "%8llx: %s: compare partition %8x/%8x",
- src->offset, dst_name, src_entry.actual, total);
+ (long long)src->offset, dst_name, src_entry.actual, total);
}
while (0 < size) {
@@ -913,7 +913,7 @@ int fcp_compare_entry(ffs_t * src, const char * src_name,
if (memcmp(src_ptr, dst_ptr, cmp_sz) != 0) {
UNEXPECTED("MISCOMPARE! '%s' != '%s' at "
"offset '%llx'\n", src_name,
- dst_name, offset + cnt);
+ dst_name, (long long)offset + cnt);
if (isatty(fileno(stderr)))
fprintf(stderr, " <== [ERROR]\n");
diff --git a/fcp/src/misc.h b/fcp/src/misc.h
index 30b1cbe..a73bc8c 100644
--- a/fcp/src/misc.h
+++ b/fcp/src/misc.h
@@ -65,8 +65,8 @@ extern ffs_entry_t * entry_list_find(entry_list_t *, const char *);
extern int entry_list_dump(entry_list_t *, FILE *);
extern int parse_offset(const char *, off_t *);
-extern int parse_size(const char *, size_t *);
-extern int parse_number(const char *, size_t *);
+extern int parse_size(const char *, uint32_t *);
+extern int parse_number(const char *, uint32_t *);
extern int parse_path(const char *, char **, char **, char **);
extern int dump_errors(const char *, FILE *);
diff --git a/ffs/Rules.mk b/ffs/Rules.mk
index 2998d6e..c014ffa 100644
--- a/ffs/Rules.mk
+++ b/ffs/Rules.mk
@@ -22,10 +22,10 @@
# permissions and limitations under the License.
#
# IBM_PROLOG_END_TAG
-CFLAGS += -m32 -D_GNU_SOURCE -std=gnu99 -D_FILE_OFFSET_BITS=64
-CFLAGS += -I$(DEPTH)/.. -I$(DEPTH)/boot/fsp2_ipl -iquote..
+CFLAGS += -D_GNU_SOURCE -std=gnu99 -D_FILE_OFFSET_BITS=64
+CFLAGS += -I$(DEPTH)/.. -I$(DEPTH)/boot/fsp2_ipl -iquote.. -fPIC
-LDFLAGS += -L. -m32
+LDFLAGS += -L.
NAME=libffs
@@ -41,7 +41,7 @@ vpath %.h ..
all: $(TARGETS)
$(NAME).so: $(OBJS)
- $(CC) $(LDFLAGS) -fPIC -shared -Wl,-soname,$@ -o $@ $^
+ $(CC) $(LDFLAGS) -shared -Wl,-soname,$@ -o $@ $^
$(NAME).a: $(OBJS)
$(AR) -r $@ $^
diff --git a/ffs/Rules.test.mk b/ffs/Rules.test.mk
index 7082c3b..cedeb3e 100644
--- a/ffs/Rules.test.mk
+++ b/ffs/Rules.test.mk
@@ -22,7 +22,7 @@
# permissions and limitations under the License.
#
# IBM_PROLOG_END_TAG
-CFLAGS += -m32 -D_GNU_SOURCE -std=gnu99 -D_FILE_OFFSET_BITS=64 -I$(DEPTH)/apps -iquote..
+CFLAGS += -D_GNU_SOURCE -std=gnu99 -D_FILE_OFFSET_BITS=64 -I$(DEPTH)/apps -iquote..
LDFLAGS += -L. -L$(DEPTH)/apps/clib/$(ARCH_DEP_DIR)
OBJS=test_libffs.o
diff --git a/ffs/libffs.h b/ffs/libffs.h
index 799cdb4..d74e365 100644
--- a/ffs/libffs.h
+++ b/ffs/libffs.h
@@ -138,7 +138,7 @@ extern int __ffs_entry_name(ffs_t *, ffs_entry_t *, char *, size_t)
/*! @cond */ __nonnull ((1,2,3)) /*! @endcond */ ;
extern int __ffs_entry_add(ffs_t *, const char *, off_t,
- size_t, ffs_type_t, uint32_t)
+ uint32_t, ffs_type_t, uint32_t)
/*! @cond */ __nonnull ((1,2)) /*! @endcond */ ;
extern int __ffs_entry_delete(ffs_t *, const char *)
diff --git a/ffs/src/libffs.c b/ffs/src/libffs.c
index 2d15e3e..e8f1933 100644
--- a/ffs/src/libffs.c
+++ b/ffs/src/libffs.c
@@ -458,7 +458,7 @@ ffs_t *__ffs_fcreate(FILE *file, off_t offset, uint32_t block_size,
}
if (offset & (block_size - 1)) {
UNEXPECTED("'%lld' invalid offset (must be 'block size' "
- "aligned)", offset);
+ "aligned)", (long long)offset);
return NULL;
}
@@ -810,8 +810,8 @@ int __ffs_list_entries(ffs_t * self, const char * name, bool user, FILE * out)
int print_entry(ffs_entry_t * entry)
{
- size_t offset = entry->base * self->hdr->block_size;
- size_t size = entry->size * self->hdr->block_size;
+ uint32_t offset = entry->base * self->hdr->block_size;
+ uint32_t size = entry->size * self->hdr->block_size;
if (__ffs_entry_name(self, entry, full_name,
sizeof full_name) < 0)
@@ -848,7 +848,7 @@ int __ffs_list_entries(ffs_t * self, const char * name, bool user, FILE * out)
}
fprintf(out, "========================[ PARTITION TABLE 0x%llx "
- "]=======================\n", self->offset);
+ "]=======================\n", (long long)self->offset);
fprintf(out, "vers:%04x size:%04x * blk:%06x blk(s):%06x * "
"entsz:%06x ent(s):%06x\n",
self->hdr->version, self->hdr->size,
@@ -942,7 +942,7 @@ int __ffs_entry_name(ffs_t *self, ffs_entry_t *entry, char *name, size_t size)
return __entry_name(entry, name, size);
}
-int __ffs_entry_add(ffs_t * self, const char *path, off_t offset, size_t size,
+int __ffs_entry_add(ffs_t * self, const char *path, off_t offset, uint32_t size,
ffs_type_t type, uint32_t flags)
{
assert(self != NULL);
@@ -963,7 +963,7 @@ int __ffs_entry_add(ffs_t * self, const char *path, off_t offset, size_t size,
if (overlap != NULL) {
UNEXPECTED("'%s' at offset %lld and size %d overlaps "
"'%s' at offset %d and size %d",
- path, offset, size, overlap->name,
+ path, (long long)offset, size, overlap->name,
overlap->base * hdr->block_size,
overlap->size * hdr->block_size);
return -1;
@@ -1034,7 +1034,7 @@ int __ffs_entry_delete(ffs_t * self, const char *path)
ffs_entry_t entry;
if (__ffs_entry_find(self, path, &entry) == false) {
UNEXPECTED("entry '%s' not found in table at offset '%llx'",
- path, self->offset);
+ path, (long long)self->offset);
return -1;
}
@@ -1097,7 +1097,7 @@ int __ffs_entry_user_get(ffs_t *self, const char *path, uint32_t word,
ffs_entry_t *entry = __find_entry(self->hdr, path);
if (entry == NULL) {
UNEXPECTED("entry '%s' not found in partition table at "
- "offset '%llx'", path, self->offset);
+ "offset '%llx'", path, (long long)self->offset);
return -1;
}
@@ -1121,7 +1121,7 @@ int __ffs_entry_user_put(ffs_t *self, const char *path, uint32_t word,
ffs_entry_t *entry = __find_entry(self->hdr, path);
if (entry == NULL) {
UNEXPECTED("entry '%s' not found in partition table at "
- "offset '%llx'", path, self->offset);
+ "offset '%llx'", path, (long long)self->offset);
return -1;
}
@@ -1139,7 +1139,7 @@ ssize_t __ffs_entry_hexdump(ffs_t * self, const char *path, FILE * out)
ffs_entry_t entry;
if (__ffs_entry_find(self, path, &entry) == false) {
UNEXPECTED("entry '%s' not found in table at offset '%llx'",
- path, self->offset);
+ path, (long long)self->offset);
return -1;
}
@@ -1186,7 +1186,7 @@ ssize_t __ffs_entry_truncate(ffs_t * self, const char *path, size_t size)
ffs_entry_t * entry = __find_entry(self->hdr, path);
if (entry == NULL) {
UNEXPECTED("entry '%s' not found in partition table at "
- "offset '%llx'", path, self->offset);
+ "offset '%llx'", path, (long long)self->offset);
return -1;
}
@@ -1215,7 +1215,7 @@ ssize_t __ffs_entry_read(ffs_t * self, const char *path, void *buf,
ffs_entry_t entry;
if (__ffs_entry_find(self, path, &entry) == false) {
UNEXPECTED("entry '%s' not found in partition table at "
- "offset '%llx'", path, self->offset);
+ "offset '%llx'", path, (long long)self->offset);
return -1;
}
@@ -1271,7 +1271,7 @@ ssize_t __ffs_entry_write(ffs_t * self, const char *path, const void *buf,
ffs_entry_t *entry = __find_entry(self->hdr, path);
if (entry == NULL) {
UNEXPECTED("entry '%s' not found in partition table at "
- "offset '%llx'", path, self->offset);
+ "offset '%llx'", path, (long long)self->offset);
return -1;
}
diff --git a/fpart/Rules.mk b/fpart/Rules.mk
index 0eff083..11a26fa 100644
--- a/fpart/Rules.mk
+++ b/fpart/Rules.mk
@@ -22,10 +22,10 @@
# permissions and limitations under the License.
#
# IBM_PROLOG_END_TAG
-CFLAGS += -m32 -D_GNU_SOURCE -std=gnu99 -D_FILE_OFFSET_BITS=64
+CFLAGS += -D_GNU_SOURCE -std=gnu99 -D_FILE_OFFSET_BITS=64
CFLAGS += -I$(DEPTH)/.. -iquote..
-LDFLAGS += -L. -m32
+LDFLAGS += -L.
NAME=fpart
diff --git a/fpart/Rules.test.mk b/fpart/Rules.test.mk
index 11af900..2b93477 100644
--- a/fpart/Rules.test.mk
+++ b/fpart/Rules.test.mk
@@ -22,7 +22,7 @@
# permissions and limitations under the License.
#
# IBM_PROLOG_END_TAG
-CFLAGS += -m32 -D_GNU_SOURCE -std=gnu99 -D_FILE_OFFSET_BITS=64 -I$(DEPTH)/apps -iquote..
+CFLAGS += -D_GNU_SOURCE -std=gnu99 -D_FILE_OFFSET_BITS=64 -I$(DEPTH)/apps -iquote..
LDFLAGS += -L. -L$(DEPTH)/apps/clib/$(ARCH_DEP_DIR)
OBJS=test_libffs.o
diff --git a/fpart/src/cmd_add.c b/fpart/src/cmd_add.c
index 31ef662..2d8d578 100644
--- a/fpart/src/cmd_add.c
+++ b/fpart/src/cmd_add.c
@@ -67,7 +67,7 @@ int command_add(args_t * args)
int rc = 0;
off_t offset = 0;
- size_t size = 0;
+ uint32_t size = 0;
uint32_t flags = 0;
rc = parse_offset(args->offset, &offset);
@@ -97,8 +97,8 @@ int command_add(args_t * args)
if (args->verbose == f_VERBOSE)
printf("%llx: %s: add partition at offset '%llx' size "
- "'%x' type '%d' flags '%x'\n", poffset,
- args->name, offset, size, type, flags);
+ "'%x' type '%d' flags '%x'\n", (long long)poffset,
+ args->name, (long long)offset, size, type, flags);
return rc;
}
diff --git a/fpart/src/cmd_create.c b/fpart/src/cmd_create.c
index a94e450..6bebc99 100644
--- a/fpart/src/cmd_create.c
+++ b/fpart/src/cmd_create.c
@@ -60,9 +60,9 @@ int command_create(args_t * args)
{
assert(args != NULL);
- size_t block = 0;
- size_t size = 0;
- size_t pad = 0xff;
+ uint32_t block = 0;
+ uint32_t size = 0;
+ uint32_t pad = 0xff;
if (parse_size(args->block, &block) < 0)
return -1;
@@ -87,7 +87,7 @@ int command_create(args_t * args)
if (args->force != f_FORCE && st.st_size != size) {
UNEXPECTED("--size '%d' differs from actual "
"size '%lld', use --force to "
- "override", size, st.st_size);
+ "override", size, (long long)st.st_size);
return -1;
}
}
@@ -98,7 +98,7 @@ int command_create(args_t * args)
int create(args_t * args, off_t poffset)
{
if (args->verbose == f_VERBOSE)
- printf("%llx: create partition table\n", poffset);
+ printf("%llx: create partition table\n", (long long)poffset);
const char * target = args->target;
int debug = args->debug;
diff --git a/fpart/src/cmd_delete.c b/fpart/src/cmd_delete.c
index cc55247..16e13e5 100644
--- a/fpart/src/cmd_delete.c
+++ b/fpart/src/cmd_delete.c
@@ -74,7 +74,7 @@ int command_delete(args_t * args)
return -1;
if (args->verbose == f_VERBOSE)
- printf("%llx: %s: delete\n", poffset, args->name);
+ printf("%llx: %s: delete\n", (long long)poffset, args->name);
return 0;
}
diff --git a/fpart/src/cmd_erase.c b/fpart/src/cmd_erase.c
index e250cec..931283c 100644
--- a/fpart/src/cmd_erase.c
+++ b/fpart/src/cmd_erase.c
@@ -65,7 +65,7 @@ int command_erase(args_t * args)
if (strrchr(name, '$') == NULL)
strcat(name, "$");
- size_t pad = 0xff;
+ uint32_t pad = 0xff;
if (args->pad != NULL)
if (parse_size(args->pad, &pad) < 0)
return -1;
@@ -97,7 +97,7 @@ int command_erase(args_t * args)
args->force != f_FORCE) {
if (args->verbose == f_VERBOSE)
printf("%llx: %s: protected, skipping erase\n",
- __poffset, full_name);
+ (long long)__poffset, full_name);
return 0;
}
@@ -105,7 +105,7 @@ int command_erase(args_t * args)
return -1;
if (args->verbose == f_VERBOSE)
- printf("%llx: %s: truncate size '%x'\n", __poffset,
+ printf("%llx: %s: truncate size '%x'\n", (long long)__poffset,
full_name, 0);
for (uint32_t i=0; i<FFS_USER_WORDS; i++)
@@ -113,14 +113,14 @@ int command_erase(args_t * args)
return -1;
if (args->verbose == f_VERBOSE)
- printf("%llx: %s: user[] zero\n", __poffset, full_name);
+ printf("%llx: %s: user[] zero\n", (long long)__poffset, full_name);
list_iter_init(&it, &list, LI_FLAG_FWD);
list_for_each(&it, node, node) {
if (node->entry.base == entry->base) {
if (args->verbose == f_VERBOSE)
printf("%llx: %s: skipping fill with "
- "'%x'\n", __poffset, full_name,
+ "'%x'\n", (long long)__poffset, full_name,
(uint8_t)pad);
return 0;
}
@@ -165,7 +165,7 @@ int command_erase(args_t * args)
return -1;
if (args->verbose == f_VERBOSE)
- printf("%llx: %s: filled with '%x'\n", __poffset,
+ printf("%llx: %s: filled with '%x'\n", (long long)__poffset,
full_name, (uint8_t)pad);
return 0;
diff --git a/fpart/src/cmd_list.c b/fpart/src/cmd_list.c
index 7e4401f..19eee56 100644
--- a/fpart/src/cmd_list.c
+++ b/fpart/src/cmd_list.c
@@ -75,8 +75,8 @@ int command_list(args_t * args)
int __list_entry(ffs_entry_t * entry)
{
- size_t offset = entry->base * __ffs->hdr->block_size;
- size_t size = entry->size * __ffs->hdr->block_size;
+ uint32_t offset = entry->base * __ffs->hdr->block_size;
+ uint32_t size = entry->size * __ffs->hdr->block_size;
if (__ffs_entry_name(__ffs, entry, full_name,
sizeof full_name) < 0)
@@ -135,7 +135,7 @@ int command_list(args_t * args)
if (0 < ffs->count) {
printf("========================[ PARTITION TABLE"
" 0x%llx ]=======================\n",
- ffs->offset);
+ (long long)ffs->offset);
printf("vers:%04x size:%04x * blk:%06x blk(s):"
"%06x * entsz:%06x ent(s):%06x\n",
ffs->hdr->version,
diff --git a/fpart/src/cmd_trunc.c b/fpart/src/cmd_trunc.c
index fce2de0..ac5c5ee 100644
--- a/fpart/src/cmd_trunc.c
+++ b/fpart/src/cmd_trunc.c
@@ -84,11 +84,11 @@ int command_trunc(args_t * args)
if (entry->flags & FFS_FLAGS_PROTECTED &&
args->force != f_FORCE) {
printf("%llx: %s: protected, skipping truncate\n",
- __poffset, full_name);
+ (long long)__poffset, full_name);
return 0;
}
- size_t size = entry->size * __ffs->hdr->block_size;
+ uint32_t size = entry->size * __ffs->hdr->block_size;
if (args->size != NULL)
if (parse_size(args->size, &size) < 0)
return -1;
@@ -97,7 +97,7 @@ int command_trunc(args_t * args)
return -1;
if (args->verbose == f_VERBOSE)
- printf("%llx: %s: truncate size '%x'\n", __poffset,
+ printf("%llx: %s: truncate size '%x'\n", (long long)__poffset,
full_name, size);
return 0;
diff --git a/fpart/src/cmd_user.c b/fpart/src/cmd_user.c
index b86311a..af61cf0 100644
--- a/fpart/src/cmd_user.c
+++ b/fpart/src/cmd_user.c
@@ -96,7 +96,7 @@ int command_user(args_t * args)
if (entry->flags & FFS_FLAGS_PROTECTED &&
args->force != f_FORCE) {
printf("%llx: %s: protected, skipping user[%d]\n",
- __poffset, full_name, user);
+ (long long)__poffset, full_name, user);
return 0;
}
@@ -111,14 +111,14 @@ int command_user(args_t * args)
return -1;
if (args->verbose == f_VERBOSE)
- printf("%llx: %s: user[%d] = '%x'\n", __poffset,
+ printf("%llx: %s: user[%d] = '%x'\n", (long long)__poffset,
args->name, user, value);
} else {
if (__ffs_entry_user_get(__ffs, args->name,
user, &value) < 0)
return -1;
- printf("%llx: %s: user[%d] = '%x'\n", __poffset,
+ printf("%llx: %s: user[%d] = '%x'\n", (long long)__poffset,
args->name, user, value);
}
diff --git a/fpart/src/command.c b/fpart/src/command.c
index 78b33a0..3f25abb 100644
--- a/fpart/src/command.c
+++ b/fpart/src/command.c
@@ -99,7 +99,7 @@ int parse_offset(const char *str, off_t *offset)
return 0;
}
-int parse_size(const char *str, size_t *size)
+int parse_size(const char *str, uint32_t *size)
{
assert(size != NULL);
@@ -136,7 +136,7 @@ int parse_size(const char *str, size_t *size)
return 0;
}
-int parse_number(const char *str, size_t *num)
+int parse_number(const char *str, uint32_t *num)
{
assert(num != NULL);
@@ -240,7 +240,7 @@ FILE *fopen_generic(const char *path, const char *mode, int debug)
assert(mode != NULL);
FILE *file = NULL;
- size_t port = 0;
+ uint32_t port = 0;
if (strncasecmp(path, "aa:", 3) == 0) {
if (parse_number(path + 3, &port) == 0)
diff --git a/fpart/src/main.h b/fpart/src/main.h
index 31fadcd..35160c6 100644
--- a/fpart/src/main.h
+++ b/fpart/src/main.h
@@ -110,8 +110,8 @@ extern args_t args;
extern size_t page_size;
extern int parse_offset(const char *, off_t *);
-extern int parse_size(const char *, size_t *);
-extern int parse_number(const char *, size_t *);
+extern int parse_size(const char *, uint32_t *);
+extern int parse_number(const char *, uint32_t *);
extern bool check_extension(const char *, const char *);
extern int create_regular_file(const char *, size_t, char);
OpenPOWER on IntegriCloud