diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2017-01-25 04:13:59 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-01-25 04:14:00 +0000 |
commit | de893939ec7b77427681244dddbd20f54eb96171 (patch) | |
tree | 5b304d4fbe068fc12cff8e381743a6b187de97bd | |
parent | e6fb950818d144d5866bc0eec989b40cfc30bbc5 (diff) | |
parent | bdd06dec245b204ade230ae8d1d03923305c4a04 (diff) | |
download | extras-de893939ec7b77427681244dddbd20f54eb96171.tar.gz |
Merge "Allow passing flash block sizes to libext4_utils"
-rw-r--r-- | ext4_utils/include/ext4_utils/make_ext4fs.h | 4 | ||||
-rw-r--r-- | ext4_utils/make_ext4fs.c | 27 |
2 files changed, 31 insertions, 0 deletions
diff --git a/ext4_utils/include/ext4_utils/make_ext4fs.h b/ext4_utils/include/ext4_utils/make_ext4fs.h index 4498e628..c558b87f 100644 --- a/ext4_utils/include/ext4_utils/make_ext4fs.h +++ b/ext4_utils/include/ext4_utils/make_ext4fs.h @@ -25,6 +25,10 @@ struct selabel_handle; int make_ext4fs(const char *filename, long long len, const char *mountpoint, struct selabel_handle *sehnd); +int make_ext4fs_directory_align(const char *filename, long long len, + const char *mountpoint, struct selabel_handle *sehnd, + const char *directory, unsigned eraseblk, + unsigned logicalblk); int make_ext4fs_directory(const char *filename, long long len, const char *mountpoint, struct selabel_handle *sehnd, const char *directory); diff --git a/ext4_utils/make_ext4fs.c b/ext4_utils/make_ext4fs.c index b59000d1..ec093f8d 100644 --- a/ext4_utils/make_ext4fs.c +++ b/ext4_utils/make_ext4fs.c @@ -447,6 +447,33 @@ int make_ext4fs(const char *filename, long long len, return make_ext4fs_directory(filename, len, mountpoint, sehnd, NULL); } +int make_ext4fs_directory_align(const char *filename, long long len, + const char *mountpoint, struct selabel_handle *sehnd, + const char *directory, unsigned eraseblk, + unsigned logicalblk) +{ + int fd; + int status; + + reset_ext4fs_info(); + info.len = len; + info.flash_erase_block_size = eraseblk; + info.flash_logical_block_size = logicalblk; + + fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644); + if (fd < 0) { + error_errno("open"); + return EXIT_FAILURE; + } + + status = make_ext4fs_internal(fd, directory, NULL, mountpoint, NULL, + 0, 0, 0, 1, 0, + sehnd, 0, -1, NULL, NULL, NULL); + close(fd); + + return status; +} + int make_ext4fs_directory(const char *filename, long long len, const char *mountpoint, struct selabel_handle *sehnd, const char *directory) |