summaryrefslogtreecommitdiff
path: root/ext4_utils
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@google.com>2019-02-13 15:24:01 -0800
committerJaegeuk Kim <jaegeuk@google.com>2019-02-13 22:11:32 -0800
commit03fcd4502b367ed3c975ecbb076bdc8309887ece (patch)
tree16ad8e9b0dc8b8377f0e1ebcce26c6e446e5fabc /ext4_utils
parent4ad91e8078045a19a201ff2dc4ace69b2473ff84 (diff)
downloadextras-03fcd4502b367ed3c975ecbb076bdc8309887ece.tar.gz
ext4_utils: build by C++
With this patch, we can use many library functions. Bug: 122989894 Change-Id: I761a93d3f6460529a99086e33803e96f1a307079 Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Diffstat (limited to 'ext4_utils')
-rw-r--r--ext4_utils/Android.bp8
-rw-r--r--ext4_utils/blk_alloc_to_base_fs.cpp (renamed from ext4_utils/blk_alloc_to_base_fs.c)0
-rw-r--r--ext4_utils/ext4_sb.cpp (renamed from ext4_utils/ext4_sb.c)0
-rw-r--r--ext4_utils/ext4_utils.cpp (renamed from ext4_utils/ext4_utils.c)12
-rw-r--r--ext4_utils/wipe.cpp (renamed from ext4_utils/wipe.c)0
5 files changed, 10 insertions, 10 deletions
diff --git a/ext4_utils/Android.bp b/ext4_utils/Android.bp
index 92a24e50..f8bb310e 100644
--- a/ext4_utils/Android.bp
+++ b/ext4_utils/Android.bp
@@ -5,9 +5,9 @@ cc_library {
host_supported: true,
recovery_available: true,
srcs: [
- "ext4_utils.c",
- "wipe.c",
- "ext4_sb.c",
+ "ext4_utils.cpp",
+ "wipe.cpp",
+ "ext4_sb.cpp",
],
// Various instances of dereferencing a type-punned pointer in extent.c
cflags: [
@@ -80,7 +80,7 @@ prebuilt_etc {
cc_binary_host {
name: "blk_alloc_to_base_fs",
- srcs: ["blk_alloc_to_base_fs.c"],
+ srcs: ["blk_alloc_to_base_fs.cpp"],
shared_libs: ["libcutils"],
target: {
host: {
diff --git a/ext4_utils/blk_alloc_to_base_fs.c b/ext4_utils/blk_alloc_to_base_fs.cpp
index 664648d1..664648d1 100644
--- a/ext4_utils/blk_alloc_to_base_fs.c
+++ b/ext4_utils/blk_alloc_to_base_fs.cpp
diff --git a/ext4_utils/ext4_sb.c b/ext4_utils/ext4_sb.cpp
index 5c3e4f3f..5c3e4f3f 100644
--- a/ext4_utils/ext4_sb.c
+++ b/ext4_utils/ext4_sb.cpp
diff --git a/ext4_utils/ext4_utils.c b/ext4_utils/ext4_utils.cpp
index 04e2b6d9..7c411c89 100644
--- a/ext4_utils/ext4_utils.c
+++ b/ext4_utils/ext4_utils.cpp
@@ -140,7 +140,7 @@ void ext4_create_fs_aux_info()
/* A zero-filled superblock to be written firstly to the block
* device to mark the file-system as invalid
*/
- aux_info.sb_zero = calloc(1, info.block_size);
+ aux_info.sb_zero = (struct ext4_super_block *)calloc(1, info.block_size);
if (!aux_info.sb_zero)
critical_error_errno("calloc");
@@ -149,7 +149,7 @@ void ext4_create_fs_aux_info()
* block on a system with a block size > 1K. So, we need to
* deal with that here.
*/
- aux_info.sb_block = calloc(1, info.block_size);
+ aux_info.sb_block = (struct ext4_super_block *)calloc(1, info.block_size);
if (!aux_info.sb_block)
critical_error_errno("calloc");
@@ -159,12 +159,12 @@ void ext4_create_fs_aux_info()
aux_info.sb = aux_info.sb_block;
/* Alloc an array to hold the pointers to the backup superblocks */
- aux_info.backup_sb = calloc(aux_info.groups, sizeof(char *));
+ aux_info.backup_sb = (struct ext4_super_block **)calloc(aux_info.groups, sizeof(char *));
if (!aux_info.sb)
critical_error_errno("calloc");
- aux_info.bg_desc = calloc(info.block_size, aux_info.bg_desc_blocks);
+ aux_info.bg_desc = (struct ext2_group_desc *)calloc(info.block_size, aux_info.bg_desc_blocks);
if (!aux_info.bg_desc)
critical_error_errno("calloc");
aux_info.xattrs = NULL;
@@ -289,13 +289,13 @@ int read_ext(int fd, int verbose)
if (verbose) {
printf("Found filesystem with parameters:\n");
- printf(" Size: %"PRIu64"\n", info.len);
+ printf(" Size: %" PRIu64 "\n", info.len);
printf(" Block size: %d\n", info.block_size);
printf(" Blocks per group: %d\n", info.blocks_per_group);
printf(" Inodes per group: %d\n", info.inodes_per_group);
printf(" Inode size: %d\n", info.inode_size);
printf(" Label: %s\n", info.label);
- printf(" Blocks: %"PRIext4u64"\n", aux_info.len_blocks);
+ printf(" Blocks: %" PRIext4u64 "\n", aux_info.len_blocks);
printf(" Block groups: %d\n", aux_info.groups);
printf(" Reserved block group size: %d\n", info.bg_desc_reserve_blocks);
printf(" Used %d/%d inodes and %d/%d blocks\n",
diff --git a/ext4_utils/wipe.c b/ext4_utils/wipe.cpp
index 7bda71c1..7bda71c1 100644
--- a/ext4_utils/wipe.c
+++ b/ext4_utils/wipe.cpp