summaryrefslogtreecommitdiffstats
path: root/fcp
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 /fcp
parentaa8354ef7ee6606fe32453e3eedce9af8038230a (diff)
downloadffs-76ce4aadee1a7a890001affed54a0fb1110b1793.tar.gz
ffs-76ce4aadee1a7a890001affed54a0fb1110b1793.zip
Support to compile in 64bit for Ubuntu Little Endian
Diffstat (limited to 'fcp')
-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
10 files changed, 100 insertions, 100 deletions
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 *);
OpenPOWER on IntegriCloud