summaryrefslogtreecommitdiff
path: root/ext4_utils/make_ext4fs.c
diff options
context:
space:
mode:
authorPaul Crowley <paulcrowley@google.com>2015-11-27 09:05:39 +0000
committerPaul Crowley <paulcrowley@google.com>2015-11-27 09:05:39 +0000
commitd7a3fb4fc35fe729e5013474914746aeb8de35b7 (patch)
treee27e01dd82908608bfdfcd9c5d8bafdfc6d98fe9 /ext4_utils/make_ext4fs.c
parenta2d79fd17c37136b1c42c1f0db1e59494b04f4d2 (diff)
downloadextras-d7a3fb4fc35fe729e5013474914746aeb8de35b7.tar.gz
Add _directory function for fd-based ext4 filesystem creation
Allow an initializing directory to be specified in ext4 filesystem creation where the target is specified as as an fd, to match where it is given as a filename. Bug: 25898323 Change-Id: I945c9554b885ab9f903fd2985ad4b73399304321
Diffstat (limited to 'ext4_utils/make_ext4fs.c')
-rw-r--r--ext4_utils/make_ext4fs.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/ext4_utils/make_ext4fs.c b/ext4_utils/make_ext4fs.c
index 59d9c3e0..a9549a5f 100644
--- a/ext4_utils/make_ext4fs.c
+++ b/ext4_utils/make_ext4fs.c
@@ -401,10 +401,19 @@ void reset_ext4fs_info() {
int make_ext4fs_sparse_fd(int fd, long long len,
const char *mountpoint, struct selabel_handle *sehnd)
{
+ return make_ext4fs_sparse_fd_directory(fd, len, mountpoint, sehnd, NULL);
+}
+
+int make_ext4fs_sparse_fd_directory(int fd, long long len,
+ const char *mountpoint, struct selabel_handle *sehnd,
+ const char *directory)
+{
reset_ext4fs_info();
info.len = len;
- return make_ext4fs_internal(fd, NULL, NULL, mountpoint, NULL, 0, 1, 0, 0, 0, sehnd, 0, -1, NULL);
+ return make_ext4fs_internal(fd, directory, NULL, mountpoint, NULL,
+ 0, 1, 0, 0, 0,
+ sehnd, 0, -1, NULL);
}
int make_ext4fs(const char *filename, long long len,
@@ -415,7 +424,7 @@ int make_ext4fs(const char *filename, long long len,
int make_ext4fs_directory(const char *filename, long long len,
const char *mountpoint, struct selabel_handle *sehnd,
- const char *directory)
+ const char *directory)
{
int fd;
int status;
@@ -429,7 +438,9 @@ int make_ext4fs_directory(const char *filename, long long len,
return EXIT_FAILURE;
}
- status = make_ext4fs_internal(fd, directory, NULL, mountpoint, NULL, 0, 0, 0, 1, 0, sehnd, 0, -1, NULL);
+ status = make_ext4fs_internal(fd, directory, NULL, mountpoint, NULL,
+ 0, 0, 0, 1, 0,
+ sehnd, 0, -1, NULL);
close(fd);
return status;