summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2013-01-23 15:25:29 -0800
committerColin Cross <ccross@android.com>2013-01-23 15:43:52 -0800
commit03ad99cff5743b9e0ce462f53dd2f0fcb17b169b (patch)
tree6b8609fe394c26fcd3c0dd3a3bf0efb477cdd73b
parent00724b61779e04ff586dad4c9634572712b8ef70 (diff)
downloadextras-03ad99cff5743b9e0ce462f53dd2f0fcb17b169b.tar.gz
ext4_utils: export make_ext4fs_sparse_fd
Export a function to create a sparse image, writing the output to an fd. Useful for utilities that need to format a partition. Change-Id: I3737c65c69b7df0a0bd25885ee70aaadef8a4ad5
-rw-r--r--ext4_utils/make_ext4fs.c9
-rw-r--r--ext4_utils/make_ext4fs.h2
2 files changed, 11 insertions, 0 deletions
diff --git a/ext4_utils/make_ext4fs.c b/ext4_utils/make_ext4fs.c
index 64fcc84b..57179125 100644
--- a/ext4_utils/make_ext4fs.c
+++ b/ext4_utils/make_ext4fs.c
@@ -353,6 +353,15 @@ void reset_ext4fs_info() {
}
}
+int make_ext4fs_sparse_fd(int fd, s64 len,
+ const char *mountpoint, struct selabel_handle *sehnd)
+{
+ reset_ext4fs_info();
+ info.len = len;
+
+ return make_ext4fs_internal(fd, NULL, mountpoint, NULL, 0, 1, 0, 0, 0, sehnd);
+}
+
int make_ext4fs(const char *filename, s64 len,
const char *mountpoint, struct selabel_handle *sehnd)
{
diff --git a/ext4_utils/make_ext4fs.h b/ext4_utils/make_ext4fs.h
index e80e6367..d75ea02a 100644
--- a/ext4_utils/make_ext4fs.h
+++ b/ext4_utils/make_ext4fs.h
@@ -38,6 +38,8 @@ typedef void (*fs_config_func_t)(const char *path, int dir, unsigned *uid, unsig
void reset_ext4fs_info();
int make_ext4fs(const char *filename, s64 len,
const char *mountpoint, struct selabel_handle *sehnd);
+int make_ext4fs_sparse_fd(int fd, s64 len,
+ const char *mountpoint, struct selabel_handle *sehnd);
int make_ext4fs_internal(int fd, const char *directory,
const char *mountpoint, fs_config_func_t fs_config_func, int gzip,
int sparse, int crc, int wipe, int init_itabs,