aboutsummaryrefslogtreecommitdiffstats
path: root/mkfs
diff options
context:
space:
mode:
authorSteve Kondik <steve@cyngn.com>2016-01-21 18:29:05 -0800
committerSteve Kondik <steve@cyngn.com>2016-08-24 11:43:29 -0700
commita8bc4cc0fc23c5f90a44e81f68d01fe053adcec0 (patch)
treee2e0a8c7637d860859d30f3502b69259be63347c /mkfs
parent67762ca3f0614752574a47f55aae1c36c05a3140 (diff)
downloadandroid_external_f2fs-tools-a8bc4cc0fc23c5f90a44e81f68d01fe053adcec0.tar.gz
android_external_f2fs-tools-a8bc4cc0fc23c5f90a44e81f68d01fe053adcec0.tar.bz2
android_external_f2fs-tools-a8bc4cc0fc23c5f90a44e81f68d01fe053adcec0.zip
f2fs-utils: Fix Android host utils
* __ANDROID__ isn't defined for host utils. * Additionally, use the old behavior as the fallback. Change-Id: Ic0247358fb19595a70f9dd455914bd8f3f9710e2
Diffstat (limited to 'mkfs')
-rw-r--r--mkfs/f2fs_format.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c
index 2a1c7d7..322b938 100644
--- a/mkfs/f2fs_format.c
+++ b/mkfs/f2fs_format.c
@@ -697,7 +697,7 @@ static int f2fs_write_super_block(void)
return 0;
}
-#ifndef __ANDROID__
+#if !defined(__ANDROID__) && !defined(ANDROID_HOST)
static int discard_obsolete_dnode(struct f2fs_node *raw_node, u_int64_t offset)
{
do {
@@ -786,16 +786,29 @@ static int f2fs_write_root_inode(void)
return -1;
}
+#if defined(__ANDROID__) || defined(ANDROID_HOST)
+ memset(raw_node, 0xff, sizeof(struct f2fs_node));
+#endif
+
/* avoid power-off-recovery based on roll-forward policy */
main_area_node_seg_blk_offset = get_sb(main_blkaddr);
main_area_node_seg_blk_offset += config.cur_seg[CURSEG_WARM_NODE] *
config.blks_per_seg;
-#ifndef __ANDROID__
+#if !defined(__ANDROID__) && !defined(ANDROID_HOST)
if (discard_obsolete_dnode(raw_node, main_area_node_seg_blk_offset)) {
free(raw_node);
return -1;
}
+#else
+ main_area_node_seg_blk_offset *= blk_size_bytes;
+
+ DBG(1, "\tWriting root inode (warm node), at offset 0x%08"PRIx64"\n", main_area_node_seg_blk_offset);
+ if (dev_write(raw_node, main_area_node_seg_blk_offset, F2FS_BLKSIZE)) {
+ MSG(1, "\tError: While writing the raw_node to disk!!!\n");
+ free(raw_node);
+ return -1;
+ }
#endif
free(raw_node);