aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2016-01-13 11:51:33 -0800
committerGreg Wallace <greg@gregtwallace.com>2016-01-19 22:02:21 -0500
commitbf12354581c7d1209db1c5cbcc58976039a217f8 (patch)
tree96cf5f68cf100dbaa43b4492170630bd5c379a13
parent54dabbe65c4c73172d02127402967fd2b9abf8ab (diff)
downloadandroid_external_f2fs-tools-bf12354581c7d1209db1c5cbcc58976039a217f8.tar.gz
android_external_f2fs-tools-bf12354581c7d1209db1c5cbcc58976039a217f8.tar.bz2
android_external_f2fs-tools-bf12354581c7d1209db1c5cbcc58976039a217f8.zip
f2fs-tools: avoid failure and warnings for android build
This patch fixes to resolve build failure and warnings when compiling it under AOSP. Change-Id: I26f65615203183ad4d4c54c28fc152042707251b Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r--fsck/fsck.c8
-rw-r--r--fsck/mount.c2
-rw-r--r--lib/libf2fs.c13
-rw-r--r--mkfs/f2fs_format.c4
4 files changed, 17 insertions, 10 deletions
diff --git a/fsck/fsck.c b/fsck/fsck.c
index 3e67ffc..e7dd02f 100644
--- a/fsck/fsck.c
+++ b/fsck/fsck.c
@@ -21,7 +21,7 @@ static inline int f2fs_set_main_bitmap(struct f2fs_sb_info *sbi, u32 blk,
int fix = 0;
se = get_seg_entry(sbi, GET_SEGNO(sbi, blk));
- if (se->type < 0 || se->type >= NO_CHECK_TYPE)
+ if (se->type >= NO_CHECK_TYPE)
fix = 1;
else if (IS_DATASEG(se->type) != IS_DATASEG(type))
fix = 1;
@@ -945,7 +945,6 @@ static int __chk_dentries(struct f2fs_sb_info *sbi, struct child_info *child,
int dentries = 0;
u32 blk_cnt;
u8 *name;
- u32 ino;
u16 name_len;;
int ret = 0;
int fixed = 0;
@@ -953,6 +952,8 @@ static int __chk_dentries(struct f2fs_sb_info *sbi, struct child_info *child,
/* readahead inode blocks */
for (i = 0; i < max; i++) {
+ u32 ino;
+
if (test_bit_le(i, bitmap) == 0)
continue;
@@ -992,7 +993,8 @@ static int __chk_dentries(struct f2fs_sb_info *sbi, struct child_info *child,
ftype = dentry[i].file_type;
if ((ftype <= F2FS_FT_UNKNOWN || ftype > F2FS_FT_LAST_FILE_TYPE)) {
- ASSERT_MSG("Bad dentry 0x%x with unexpected ftype 0x%x", ino, ftype);
+ ASSERT_MSG("Bad dentry 0x%x with unexpected ftype 0x%x",
+ le32_to_cpu(dentry[i].ino), ftype);
if (config.fix_on) {
FIX_MSG("Clear bad dentry 0x%x with bad ftype 0x%x",
i, ftype);
diff --git a/fsck/mount.c b/fsck/mount.c
index 7533926..b01230f 100644
--- a/fsck/mount.c
+++ b/fsck/mount.c
@@ -1410,7 +1410,7 @@ int find_next_free_block(struct f2fs_sb_info *sbi, u64 *to, int left, int type)
}
if (se->valid_blocks == 0 && !(segno % sbi->segs_per_sec)) {
struct seg_entry *se2;
- int i;
+ unsigned int i;
for (i = 0; i < sbi->segs_per_sec; i++) {
se2 = get_seg_entry(sbi, segno + i);
diff --git a/lib/libf2fs.c b/lib/libf2fs.c
index 8158514..57de047 100644
--- a/lib/libf2fs.c
+++ b/lib/libf2fs.c
@@ -96,7 +96,7 @@ int utf8_to_utf16(u_int16_t *output, const char *input, size_t outsize,
u_int16_t *outp = output;
wchar_t wc;
- while (inp - input < insize && *inp) {
+ while ((size_t)(inp - input) < insize && *inp) {
inp = utf8_to_wchar(inp, &wc, insize - (inp - input));
if (inp == NULL) {
DBG(0, "illegal UTF-8 sequence\n");
@@ -182,7 +182,7 @@ int utf16_to_utf8(char *output, const u_int16_t *input, size_t outsize,
char *outp = output;
wchar_t wc;
- while (inp - input < insize && le16_to_cpu(*inp)) {
+ while ((size_t)(inp - input) < insize && le16_to_cpu(*inp)) {
inp = utf16_to_wchar(inp, &wc, insize - (inp - input));
if (inp == NULL) {
DBG(0, "illegal UTF-16 sequence\n");
@@ -506,8 +506,7 @@ void f2fs_init_configuration(struct f2fs_configuration *c)
c->ro = 0;
}
-static int is_mounted(struct f2fs_configuration *c,
- const char *mpt, const char *device)
+static int is_mounted(const char *mpt, const char *device)
{
#ifdef __linux__
FILE *file = NULL;
@@ -519,8 +518,10 @@ static int is_mounted(struct f2fs_configuration *c,
while ((mnt = getmntent(file)) != NULL) {
if (!strcmp(device, mnt->mnt_fsname)) {
+#ifdef MNTOPT_RO
if (hasmntopt(mnt, MNTOPT_RO))
config.ro = 1;
+#endif
break;
}
}
@@ -538,7 +539,7 @@ int f2fs_dev_is_umounted(struct f2fs_configuration *c)
int ret = 0;
#ifdef __linux__
- ret = is_mounted(c, MOUNTED, c->device_name);
+ ret = is_mounted(MOUNTED, c->device_name);
if (ret) {
MSG(0, "Info: Mounted device!\n");
return -1;
@@ -549,7 +550,7 @@ int f2fs_dev_is_umounted(struct f2fs_configuration *c)
* if failed due to /etc/mtab file not present
* try with /proc/mounts.
*/
- ret = is_mounted(c, "/proc/mounts", c->device_name);
+ ret = is_mounted("/proc/mounts", c->device_name);
if (ret) {
MSG(0, "Info: Mounted device!\n");
return -1;
diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c
index fd61757..2c81ecc 100644
--- a/mkfs/f2fs_format.c
+++ b/mkfs/f2fs_format.c
@@ -697,6 +697,7 @@ static int f2fs_write_super_block(void)
return 0;
}
+#ifndef WITH_ANDROID
static int discard_obsolete_dnode(struct f2fs_node *raw_node, u_int64_t offset)
{
do {
@@ -722,6 +723,7 @@ static int discard_obsolete_dnode(struct f2fs_node *raw_node, u_int64_t offset)
return 0;
}
+#endif
static int f2fs_write_root_inode(void)
{
@@ -789,10 +791,12 @@ static int f2fs_write_root_inode(void)
main_area_node_seg_blk_offset += config.cur_seg[CURSEG_WARM_NODE] *
config.blks_per_seg;
+#ifndef WITH_ANDROID
if (discard_obsolete_dnode(raw_node, main_area_node_seg_blk_offset)) {
free(raw_node);
return -1;
}
+#endif
free(raw_node);
return 0;