aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Abgrall <jpa@google.com>2014-06-13 13:25:20 -0700
committerJaegeuk Kim <jaegeuk@kernel.org>2014-06-14 14:22:02 +0900
commite91da2f664a765a5bd2bde7d47efe7c8b957ebb9 (patch)
treea0bfb355007155b348f5b434d2e81bdbdfc7f90f
parent09f8f56066efd3a9fadb4c731f7184980383f9f9 (diff)
downloadandroid_external_f2fs-tools-e91da2f664a765a5bd2bde7d47efe7c8b957ebb9.tar.gz
android_external_f2fs-tools-e91da2f664a765a5bd2bde7d47efe7c8b957ebb9.tar.bz2
android_external_f2fs-tools-e91da2f664a765a5bd2bde7d47efe7c8b957ebb9.zip
libf2fs: move the finalize_device() into the io lib.
This is required so that libf2fs.c can be used against any kind of device (E.g. an in-memory sparse file) just by linking against something that provides the libf2fs_io.c functions. libf2fs is currently libf2fs.c + libf2fs_io.c Signed-off-by: JP Abgrall <jpa@google.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r--lib/libf2fs.c12
-rw-r--r--lib/libf2fs_io.c13
2 files changed, 13 insertions, 12 deletions
diff --git a/lib/libf2fs.c b/lib/libf2fs.c
index 8d6c670..6168c5c 100644
--- a/lib/libf2fs.c
+++ b/lib/libf2fs.c
@@ -493,15 +493,3 @@ int f2fs_get_device_info(struct f2fs_configuration *c)
return 0;
}
-void f2fs_finalize_device(struct f2fs_configuration *c)
-{
- /*
- * We should call fsync() to flush out all the dirty pages
- * in the block device page cache.
- */
- if (fsync(c->fd) < 0)
- MSG(0, "\tError: Could not conduct fsync!!!\n");
-
- if (close(c->fd) < 0)
- MSG(0, "\tError: Failed to close device file!!!\n");
-}
diff --git a/lib/libf2fs_io.c b/lib/libf2fs_io.c
index 508ccce..5d9b68d 100644
--- a/lib/libf2fs_io.c
+++ b/lib/libf2fs_io.c
@@ -67,3 +67,16 @@ int dev_read_blocks(void *buf, __u64 addr, __u32 nr_blks)
{
return dev_read(buf, addr * F2FS_BLKSIZE, nr_blks * F2FS_BLKSIZE);
}
+
+void f2fs_finalize_device(struct f2fs_configuration *c)
+{
+ /*
+ * We should call fsync() to flush out all the dirty pages
+ * in the block device page cache.
+ */
+ if (fsync(c->fd) < 0)
+ MSG(0, "\tError: Could not conduct fsync!!!\n");
+
+ if (close(c->fd) < 0)
+ MSG(0, "\tError: Failed to close device file!!!\n");
+}