summaryrefslogtreecommitdiff
path: root/ext4_utils
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2010-06-20 23:22:12 -0700
committerColin Cross <ccross@android.com>2010-06-20 23:22:12 -0700
commit8aef66d2125af8de7672a12895276802fcc1948f (patch)
treef7a5c954b1c2377c4a141780f9d135e9281bad82 /ext4_utils
parent7a8bee7653c393d8da0e28668cb51d3ccab793e8 (diff)
downloadextras-8aef66d2125af8de7672a12895276802fcc1948f.tar.gz
Fix whitespace
Change-Id: I37da6c38cd33ae22a0578ed8e91650e35972bf6a
Diffstat (limited to 'ext4_utils')
-rw-r--r--ext4_utils/allocate.c94
-rw-r--r--ext4_utils/allocate.h2
-rw-r--r--ext4_utils/backed_block.c4
-rw-r--r--ext4_utils/backed_block.h6
-rw-r--r--ext4_utils/contents.c6
-rw-r--r--ext4_utils/contents.h2
-rw-r--r--ext4_utils/extent.c24
-rw-r--r--ext4_utils/extent.h4
-rw-r--r--ext4_utils/indirect.c144
-rw-r--r--ext4_utils/indirect.h2
-rw-r--r--ext4_utils/make_ext4fs.c38
-rw-r--r--ext4_utils/uuid.c2
12 files changed, 164 insertions, 164 deletions
diff --git a/ext4_utils/allocate.c b/ext4_utils/allocate.c
index a95aa262..61c1be10 100644
--- a/ext4_utils/allocate.c
+++ b/ext4_utils/allocate.c
@@ -24,10 +24,10 @@
#include "ext4.h"
struct region_list {
- struct region *first;
- struct region *last;
- struct region *iter;
- u32 partial_iter;
+ struct region *first;
+ struct region *last;
+ struct region *iter;
+ u32 partial_iter;
};
struct block_allocation {
@@ -36,11 +36,11 @@ struct block_allocation {
};
struct region {
- u32 block;
- u32 len;
- int bg;
- struct region *next;
- struct region *prev;
+ u32 block;
+ u32 len;
+ int bg;
+ struct region *next;
+ struct region *prev;
};
struct block_group_info {
@@ -61,16 +61,16 @@ struct block_group_info {
struct block_allocation *create_allocation()
{
- struct block_allocation *alloc = malloc(sizeof(struct block_allocation));
- alloc->list.first = NULL;
- alloc->list.last = NULL;
- alloc->oob_list.first = NULL;
- alloc->oob_list.last = NULL;
- alloc->list.iter = NULL;
- alloc->list.partial_iter = 0;
- alloc->oob_list.iter = NULL;
- alloc->oob_list.partial_iter = 0;
- return alloc;
+ struct block_allocation *alloc = malloc(sizeof(struct block_allocation));
+ alloc->list.first = NULL;
+ alloc->list.last = NULL;
+ alloc->oob_list.first = NULL;
+ alloc->oob_list.last = NULL;
+ alloc->list.iter = NULL;
+ alloc->list.partial_iter = 0;
+ alloc->oob_list.iter = NULL;
+ alloc->oob_list.partial_iter = 0;
+ return alloc;
}
static void region_list_remove(struct region_list *list, struct region *reg)
@@ -131,14 +131,14 @@ static void dump_region_lists(struct block_allocation *alloc) {
void append_region(struct block_allocation *alloc,
u32 block, u32 len, int bg_num)
{
- struct region *reg;
- reg = malloc(sizeof(struct region));
- reg->block = block;
- reg->len = len;
- reg->bg = bg_num;
- reg->next = NULL;
+ struct region *reg;
+ reg = malloc(sizeof(struct region));
+ reg->block = block;
+ reg->len = len;
+ reg->bg = bg_num;
+ reg->next = NULL;
- region_list_append(&alloc->list, reg);
+ region_list_append(&alloc->list, reg);
}
static void allocate_bg_inode_table(struct block_group_info *bg)
@@ -156,7 +156,7 @@ static void allocate_bg_inode_table(struct block_group_info *bg)
critical_error_errno("calloc");
queue_data_block(bg->inode_table, aux_info.inode_table_blocks
- * info.block_size, block);
+ * info.block_size, block);
}
static int bitmap_set_bit(u8 *bitmap, u32 bit)
@@ -330,13 +330,13 @@ static u32 ext4_allocate_blocks_from_block_group(u32 len, int bg_num)
static struct region *ext4_allocate_contiguous_blocks(u32 len)
{
unsigned int i;
- struct region *reg;
+ struct region *reg;
for (i = 0; i < aux_info.groups; i++) {
u32 block = ext4_allocate_blocks_from_block_group(len, i);
if (block != EXT4_ALLOCATE_FAILED) {
- reg = malloc(sizeof(struct region));
+ reg = malloc(sizeof(struct region));
reg->block = block;
reg->len = len;
reg->next = NULL;
@@ -366,7 +366,7 @@ u32 allocate_block()
static struct region *ext4_allocate_partial(u32 len)
{
unsigned int i;
- struct region *reg;
+ struct region *reg;
for (i = 0; i < aux_info.groups; i++) {
if (aux_info.bgs[i].data_blocks_used == 0) {
@@ -387,7 +387,7 @@ static struct region *ext4_allocate_partial(u32 len)
return NULL;
}
- reg = malloc(sizeof(struct region));
+ reg = malloc(sizeof(struct region));
reg->block = block;
reg->len = bg_len;
reg->next = NULL;
@@ -454,7 +454,7 @@ struct block_allocation *allocate_blocks(u32 len)
struct block_allocation *alloc = create_allocation();
alloc->list.first = reg;
- alloc->list.last = reg;
+ alloc->list.last = reg;
alloc->list.iter = alloc->list.first;
alloc->list.partial_iter = 0;
return alloc;
@@ -475,7 +475,7 @@ int block_allocation_num_regions(struct block_allocation *alloc)
int block_allocation_len(struct block_allocation *alloc)
{
unsigned int i;
- struct region *reg = alloc->list.first;
+ struct region *reg = alloc->list.first;
for (i = 0; reg != NULL; reg = reg->next)
i += reg->len;
@@ -486,10 +486,10 @@ int block_allocation_len(struct block_allocation *alloc)
/* Returns the block number of the block'th block in an allocation */
u32 get_block(struct block_allocation *alloc, u32 block)
{
- struct region *reg = alloc->list.iter;
- block += alloc->list.partial_iter;
+ struct region *reg = alloc->list.iter;
+ block += alloc->list.partial_iter;
- for (; reg; reg = reg->next) {
+ for (; reg; reg = reg->next) {
if (block < reg->len)
return reg->block + block;
block -= reg->len;
@@ -499,10 +499,10 @@ u32 get_block(struct block_allocation *alloc, u32 block)
u32 get_oob_block(struct block_allocation *alloc, u32 block)
{
- struct region *reg = alloc->oob_list.iter;
- block += alloc->oob_list.partial_iter;
+ struct region *reg = alloc->oob_list.iter;
+ block += alloc->oob_list.partial_iter;
- for (; reg; reg = reg->next) {
+ for (; reg; reg = reg->next) {
if (block < reg->len)
return reg->block + block;
block -= reg->len;
@@ -544,11 +544,11 @@ void rewind_alloc(struct block_allocation *alloc)
static struct region *do_split_allocation(struct block_allocation *alloc, u32 len)
{
- struct region *reg = alloc->list.iter;
- struct region *new;
- struct region *tmp;
+ struct region *reg = alloc->list.iter;
+ struct region *new;
+ struct region *tmp;
- while (reg && len >= reg->len) {
+ while (reg && len >= reg->len) {
len -= reg->len;
reg = reg->next;
}
@@ -569,7 +569,7 @@ static struct region *do_split_allocation(struct block_allocation *alloc, u32 le
reg->len = len;
tmp = alloc->list.iter;
- alloc->list.iter = new;
+ alloc->list.iter = new;
return tmp;
} else {
return reg;
@@ -594,7 +594,7 @@ static struct region *split_allocation(struct block_allocation *alloc, u32 len)
int reserve_oob_blocks(struct block_allocation *alloc, int blocks)
{
struct region *oob = split_allocation(alloc, blocks);
- struct region *next;
+ struct region *next;
if (oob == NULL)
return -1;
@@ -664,8 +664,8 @@ struct ext4_inode *get_inode(u32 inode)
inode %= info.inodes_per_group;
allocate_bg_inode_table(&aux_info.bgs[bg]);
- return (struct ext4_inode *)(aux_info.bgs[bg].inode_table + inode
- * info.inode_size);
+ return (struct ext4_inode *)(aux_info.bgs[bg].inode_table + inode *
+ info.inode_size);
}
/* Mark the first len inodes in a block group as used */
diff --git a/ext4_utils/allocate.h b/ext4_utils/allocate.h
index 23c690e1..f4bed412 100644
--- a/ext4_utils/allocate.h
+++ b/ext4_utils/allocate.h
@@ -46,6 +46,6 @@ int advance_oob_blocks(struct block_allocation *alloc, int blocks);
int last_region(struct block_allocation *alloc);
void rewind_alloc(struct block_allocation *alloc);
void append_region(struct block_allocation *alloc,
- u32 block, u32 len, int bg);
+ u32 block, u32 len, int bg);
struct block_allocation *create_allocation();
int append_oob_allocation(struct block_allocation *alloc, u32 len);
diff --git a/ext4_utils/backed_block.c b/ext4_utils/backed_block.c
index 6ec778a5..6fb4870d 100644
--- a/ext4_utils/backed_block.c
+++ b/ext4_utils/backed_block.c
@@ -84,7 +84,7 @@ void queue_data_block(u8 *data, u32 len, u32 block)
/* Queues a chunk of a file on disk to be written to the specified data blocks */
void queue_data_file(const char *filename, off_t offset, u32 len,
- u32 block)
+ u32 block)
{
struct data_block *db = malloc(sizeof(struct data_block));
if (db == NULL)
@@ -102,7 +102,7 @@ void queue_data_file(const char *filename, off_t offset, u32 len,
/* Iterates over the queued data blocks, calling data_func for each contiguous
data block, and file_func for each contiguous file block */
void for_each_data_block(data_block_callback_t data_func,
- data_block_file_callback_t file_func, struct output_file *out)
+ data_block_file_callback_t file_func, struct output_file *out)
{
struct data_block *db;
u32 last_block = 0;
diff --git a/ext4_utils/backed_block.h b/ext4_utils/backed_block.h
index 9bcfd446..5304f00e 100644
--- a/ext4_utils/backed_block.h
+++ b/ext4_utils/backed_block.h
@@ -23,16 +23,16 @@
#include "output_file.h"
typedef void (*data_block_callback_t)(struct output_file *out, u64 off,
- u8 *data, int len);
+ u8 *data, int len);
typedef void (*data_block_file_callback_t)(struct output_file *out, u64 off,
const char *file, off_t offset,
int len);
void queue_data_block(u8 *data, u32 len, u32 block);
void queue_data_file(const char *filename, off_t offset, u32 len,
- u32 block);
+ u32 block);
void for_each_data_block(data_block_callback_t data_func,
- data_block_file_callback_t file_func, struct output_file *out);
+ data_block_file_callback_t file_func, struct output_file *out);
void free_data_blocks();
#endif
diff --git a/ext4_utils/contents.c b/ext4_utils/contents.c
index eefb6c6f..501ff94a 100644
--- a/ext4_utils/contents.c
+++ b/ext4_utils/contents.c
@@ -32,8 +32,8 @@ static u32 dentry_size(u32 entries, struct dentry *dentries)
unsigned int i;
for (i = 0; i < entries; i++) {
- unsigned int dentry_len = 8 + 4
- * DIV_ROUND_UP(strlen(dentries[i].filename), 4);
+ unsigned int dentry_len = 8 + 4 *
+ DIV_ROUND_UP(strlen(dentries[i].filename), 4);
if (len % info.block_size + dentry_len > info.block_size)
len += info.block_size - (len % info.block_size);
len += dentry_len;
@@ -81,7 +81,7 @@ static struct ext4_dir_entry_2 *add_dentry(u8 *data, u32 *offset,
when the inode for the entry is allocated. Returns the inode number of the
new directory */
u32 make_directory(u32 dir_inode_num, u32 entries, struct dentry *dentries,
- u32 dirs)
+ u32 dirs)
{
struct ext4_inode *inode;
u32 blocks = DIV_ROUND_UP(dentry_size(entries, dentries), info.block_size);
diff --git a/ext4_utils/contents.h b/ext4_utils/contents.h
index b1ae8683..0e2a3b7d 100644
--- a/ext4_utils/contents.h
+++ b/ext4_utils/contents.h
@@ -31,7 +31,7 @@ struct dentry {
};
u32 make_directory(u32 dir_inode_num, u32 entries, struct dentry *dentries,
- u32 dirs);
+ u32 dirs);
u32 make_file(const char *filename, u64 len);
u32 make_link(const char *filename, const char *link);
int inode_set_permissions(u32 inode_num, u16 mode, u16 uid, u16 gid);
diff --git a/ext4_utils/extent.c b/ext4_utils/extent.c
index b1e7749f..1d2581d9 100644
--- a/ext4_utils/extent.c
+++ b/ext4_utils/extent.c
@@ -27,7 +27,7 @@
/* Creates data buffers for the first backing_len bytes of a block allocation
and queues them to be written */
static u8 *extent_create_backing(struct block_allocation *alloc,
- u64 backing_len)
+ u64 backing_len)
{
u8 *data = calloc(backing_len, 1);
if (!data)
@@ -53,7 +53,7 @@ static u8 *extent_create_backing(struct block_allocation *alloc,
/* Queues each chunk of a file to be written to contiguous data block
regions */
static void extent_create_backing_file(struct block_allocation *alloc,
- u64 backing_len, const char *filename)
+ u64 backing_len, const char *filename)
{
off_t offset = 0;
for (; alloc != NULL && backing_len > 0; get_next_region(alloc)) {
@@ -71,7 +71,7 @@ static void extent_create_backing_file(struct block_allocation *alloc,
}
static struct block_allocation *do_inode_allocate_extents(
- struct ext4_inode *inode, u64 len)
+ struct ext4_inode *inode, u64 len)
{
u32 block_len = DIV_ROUND_UP(len, info.block_size);
struct block_allocation *alloc = allocate_blocks(block_len + 1);
@@ -95,7 +95,7 @@ static struct block_allocation *do_inode_allocate_extents(
if (!extent_block) {
struct ext4_extent_header *hdr =
- (struct ext4_extent_header *)&inode->i_block[0];
+ (struct ext4_extent_header *)&inode->i_block[0];
hdr->eh_magic = EXT4_EXT_MAGIC;
hdr->eh_entries = allocation_len;
hdr->eh_max = 3;
@@ -105,7 +105,7 @@ static struct block_allocation *do_inode_allocate_extents(
extent = (struct ext4_extent *)&inode->i_block[3];
} else {
struct ext4_extent_header *hdr =
- (struct ext4_extent_header *)&inode->i_block[0];
+ (struct ext4_extent_header *)&inode->i_block[0];
hdr->eh_magic = EXT4_EXT_MAGIC;
hdr->eh_entries = 1;
hdr->eh_max = 3;
@@ -113,7 +113,7 @@ static struct block_allocation *do_inode_allocate_extents(
hdr->eh_depth = 1;
struct ext4_extent_idx *idx =
- (struct ext4_extent_idx *)&inode->i_block[3];
+ (struct ext4_extent_idx *)&inode->i_block[3];
idx->ei_block = 0;
idx->ei_leaf_lo = extent_block;
idx->ei_leaf_hi = 0;
@@ -135,13 +135,13 @@ static struct block_allocation *do_inode_allocate_extents(
hdr = (struct ext4_extent_header *)data;
hdr->eh_magic = EXT4_EXT_MAGIC;
hdr->eh_entries = allocation_len;
- hdr->eh_max = (info.block_size - sizeof(struct ext4_extent_header))
- / sizeof(struct ext4_extent);
+ hdr->eh_max = (info.block_size - sizeof(struct ext4_extent_header)) /
+ sizeof(struct ext4_extent);
hdr->eh_generation = 0;
hdr->eh_depth = 0;
- extent = (struct ext4_extent *)(data
- + sizeof(struct ext4_extent_header));
+ extent = (struct ext4_extent *)(data +
+ sizeof(struct ext4_extent_header));
}
for (; !last_region(alloc); extent++, get_next_region(alloc)) {
@@ -176,7 +176,7 @@ static struct block_allocation *do_inode_allocate_extents(
buffer, and connects them to an inode. Returns a pointer to the data
buffer. */
u8 *inode_allocate_data_extents(struct ext4_inode *inode, u64 len,
- u64 backing_len)
+ u64 backing_len)
{
struct block_allocation *alloc;
u8 *data = NULL;
@@ -201,7 +201,7 @@ u8 *inode_allocate_data_extents(struct ext4_inode *inode, u64 len,
/* Allocates enough blocks to hold len bytes, queues them to be written
from a file, and connects them to an inode. */
void inode_allocate_file_extents(struct ext4_inode *inode, u64 len,
- const char *filename)
+ const char *filename)
{
struct block_allocation *alloc;
diff --git a/ext4_utils/extent.h b/ext4_utils/extent.h
index 5456a86f..a1ddeb15 100644
--- a/ext4_utils/extent.h
+++ b/ext4_utils/extent.h
@@ -22,9 +22,9 @@
void inode_allocate_extents(struct ext4_inode *inode, u64 len);
void inode_allocate_file_extents(struct ext4_inode *inode, u64 len,
- const char *filename);
+ const char *filename);
u8 *inode_allocate_data_extents(struct ext4_inode *inode, u64 len,
- u64 backing_len);
+ u64 backing_len);
void free_extent_blocks();
#endif
diff --git a/ext4_utils/indirect.c b/ext4_utils/indirect.c
index cb876027..2d9d7104 100644
--- a/ext4_utils/indirect.c
+++ b/ext4_utils/indirect.c
@@ -56,9 +56,9 @@ static u8 *create_backing(struct block_allocation *alloc,
static void reserve_indirect_block(struct block_allocation *alloc, int len)
{
if (reserve_oob_blocks(alloc, 1)) {
- error("failed to reserve oob block");
- return;
- }
+ error("failed to reserve oob block");
+ return;
+ }
if (advance_blocks(alloc, len)) {
error("failed to advance %d blocks", len);
@@ -69,9 +69,9 @@ static void reserve_indirect_block(struct block_allocation *alloc, int len)
static void reserve_dindirect_block(struct block_allocation *alloc, int len)
{
if (reserve_oob_blocks(alloc, 1)) {
- error("failed to reserve oob block");
- return;
- }
+ error("failed to reserve oob block");
+ return;
+ }
while (len > 0) {
int ind_block_len = min((int)aux_info.blocks_per_ind, len);
@@ -86,9 +86,9 @@ static void reserve_dindirect_block(struct block_allocation *alloc, int len)
static void reserve_tindirect_block(struct block_allocation *alloc, int len)
{
if (reserve_oob_blocks(alloc, 1)) {
- error("failed to reserve oob block");
- return;
- }
+ error("failed to reserve oob block");
+ return;
+ }
while (len > 0) {
int dind_block_len = min((int)aux_info.blocks_per_dind, len);
@@ -115,9 +115,9 @@ static void fill_dindirect_block(u32 *dind_block, int len, struct block_allocati
for (i = 0; len > 0; i++) {
ind_block = get_oob_block(alloc, 0);
if (advance_oob_blocks(alloc, 1)) {
- error("failed to reserve oob block");
- return;
- }
+ error("failed to reserve oob block");
+ return;
+ }
dind_block[i] = ind_block;
@@ -144,11 +144,11 @@ static void fill_tindirect_block(u32 *tind_block, int len, struct block_allocati
for (i = 0; len > 0; i++) {
dind_block = get_oob_block(alloc, 0);
if (advance_oob_blocks(alloc, 1)) {
- error("failed to reserve oob block");
- return;
- }
+ error("failed to reserve oob block");
+ return;
+ }
- tind_block[i] = dind_block;
+ tind_block[i] = dind_block;
u32 *dind_block_data = calloc(info.block_size, 1);
queue_data_block((u8*)dind_block_data, info.block_size, dind_block);
@@ -156,7 +156,7 @@ static void fill_tindirect_block(u32 *tind_block, int len, struct block_allocati
fill_dindirect_block(dind_block_data, dind_block_len, alloc);
- len -= dind_block_len;
+ len -= dind_block_len;
}
}
@@ -172,13 +172,13 @@ static int inode_attach_direct_blocks(struct ext4_inode *inode,
inode->i_block[i] = get_block(alloc, i);
}
- if (advance_blocks(alloc, len)) {
- error("failed to advance %d blocks", len);
- return -1;
- }
+ if (advance_blocks(alloc, len)) {
+ error("failed to advance %d blocks", len);
+ return -1;
+ }
- *block_len -= len;
- return 0;
+ *block_len -= len;
+ return 0;
}
/* Given an allocation, attach as many blocks as possible to indirect blocks,
@@ -193,23 +193,23 @@ static int inode_attach_indirect_blocks(struct ext4_inode *inode,
int ind_block = get_oob_block(alloc, 0);
inode->i_block[EXT4_IND_BLOCK] = ind_block;
- if (advance_oob_blocks(alloc, 1)) {
- error("failed to advance oob block");
- return -1;
- }
+ if (advance_oob_blocks(alloc, 1)) {
+ error("failed to advance oob block");
+ return -1;
+ }
u32 *ind_block_data = calloc(info.block_size, 1);
queue_data_block((u8*)ind_block_data, info.block_size, ind_block);
fill_indirect_block(ind_block_data, len, alloc);
- if (advance_blocks(alloc, len)) {
- error("failed to advance %d blocks", len);
- return -1;
- }
+ if (advance_blocks(alloc, len)) {
+ error("failed to advance %d blocks", len);
+ return -1;
+ }
- *block_len -= len;
- return 0;
+ *block_len -= len;
+ return 0;
}
/* Given an allocation, attach as many blocks as possible to doubly indirect
@@ -224,22 +224,22 @@ static int inode_attach_dindirect_blocks(struct ext4_inode *inode,
int dind_block = get_oob_block(alloc, 0);
inode->i_block[EXT4_DIND_BLOCK] = dind_block;
- if (advance_oob_blocks(alloc, 1)) {
- error("failed to advance oob block");
- return -1;
- }
+ if (advance_oob_blocks(alloc, 1)) {
+ error("failed to advance oob block");
+ return -1;
+ }
u32 *dind_block_data = calloc(info.block_size, 1);
queue_data_block((u8*)dind_block_data, info.block_size, dind_block);
fill_dindirect_block(dind_block_data, len, alloc);
- if (advance_blocks(alloc, len)) {
- error("failed to advance %d blocks", len);
- return -1;
- }
+ if (advance_blocks(alloc, len)) {
+ error("failed to advance %d blocks", len);
+ return -1;
+ }
- *block_len -= len;
+ *block_len -= len;
return 0;
}
@@ -255,23 +255,23 @@ static int inode_attach_tindirect_blocks(struct ext4_inode *inode,
int tind_block = get_oob_block(alloc, 0);
inode->i_block[EXT4_TIND_BLOCK] = tind_block;
- if (advance_oob_blocks(alloc, 1)) {
- error("failed to advance oob block");
- return -1;
- }
+ if (advance_oob_blocks(alloc, 1)) {
+ error("failed to advance oob block");
+ return -1;
+ }
u32 *tind_block_data = calloc(info.block_size, 1);
queue_data_block((u8*)tind_block_data, info.block_size, tind_block);
fill_tindirect_block(tind_block_data, len, alloc);
- if (advance_blocks(alloc, len)) {
- error("failed to advance %d blocks", len);
- return -1;
- }
+ if (advance_blocks(alloc, len)) {
+ error("failed to advance %d blocks", len);
+ return -1;
+ }
- *block_len -= len;
- return 0;
+ *block_len -= len;
+ return 0;
}
static void reserve_all_indirect_blocks(struct block_allocation *alloc, u32 len)
@@ -350,30 +350,30 @@ static int do_inode_attach_indirect(struct ext4_inode *inode,
}
if (count > 0) {
- if (inode_attach_indirect_blocks(inode, alloc, &count)) {
- error("failed to attach indirect blocks to inode");
- return -1;
- }
+ if (inode_attach_indirect_blocks(inode, alloc, &count)) {
+ error("failed to attach indirect blocks to inode");
+ return -1;
+ }
+ }
+
+ if (count > 0) {
+ if (inode_attach_dindirect_blocks(inode, alloc, &count)) {
+ error("failed to attach dindirect blocks to inode");
+ return -1;
+ }
}
- if (count > 0) {
- if (inode_attach_dindirect_blocks(inode, alloc, &count)) {
- error("failed to attach dindirect blocks to inode");
- return -1;
- }
- }
-
- if (count > 0) {
- if (inode_attach_tindirect_blocks(inode, alloc, &count)) {
- error("failed to attach tindirect blocks to inode");
- return -1;
- }
- }
-
- if (count) {
+ if (count > 0) {
+ if (inode_attach_tindirect_blocks(inode, alloc, &count)) {
+ error("failed to attach tindirect blocks to inode");
+ return -1;
+ }
+ }
+
+ if (count) {
error("blocks left after triply-indirect allocation");
return -1;
- }
+ }
rewind_alloc(alloc);
diff --git a/ext4_utils/indirect.h b/ext4_utils/indirect.h
index e281b923..cee89790 100644
--- a/ext4_utils/indirect.h
+++ b/ext4_utils/indirect.h
@@ -21,7 +21,7 @@
void inode_allocate_indirect(struct ext4_inode *inode, unsigned long len);
u8 *inode_allocate_data_indirect(struct ext4_inode *inode, unsigned long len,
- unsigned long backing_len);
+ unsigned long backing_len);
void inode_attach_resize(struct ext4_inode *inode,
struct block_allocation *alloc);
void free_indirect_blocks();
diff --git a/ext4_utils/make_ext4fs.c b/ext4_utils/make_ext4fs.c
index 5b0a3aff..e69b11f9 100644
--- a/ext4_utils/make_ext4fs.c
+++ b/ext4_utils/make_ext4fs.c
@@ -94,20 +94,20 @@ static void ext4_create_fs_aux_info()
aux_info.first_data_block = (info.block_size > 1024) ? 0 : 1;
aux_info.len_blocks = info.len / info.block_size;
aux_info.inode_table_blocks = DIV_ROUND_UP(info.inodes_per_group * info.inode_size,
- info.block_size);
+ info.block_size);
aux_info.groups = DIV_ROUND_UP(aux_info.len_blocks - aux_info.first_data_block,
- info.blocks_per_group);
+ info.blocks_per_group);
aux_info.blocks_per_ind = info.block_size / sizeof(u32);
aux_info.blocks_per_dind = aux_info.blocks_per_ind * aux_info.blocks_per_ind;
aux_info.blocks_per_tind = aux_info.blocks_per_dind * aux_info.blocks_per_dind;
aux_info.bg_desc_blocks =
- DIV_ROUND_UP(aux_info.groups * sizeof(struct ext2_group_desc),
- info.block_size);
+ DIV_ROUND_UP(aux_info.groups * sizeof(struct ext2_group_desc),
+ info.block_size);
aux_info.bg_desc_reserve_blocks =
- DIV_ROUND_UP(aux_info.groups * 1024 * sizeof(struct ext2_group_desc),
- info.block_size) - aux_info.bg_desc_blocks;
+ DIV_ROUND_UP(aux_info.groups * 1024 * sizeof(struct ext2_group_desc),
+ info.block_size) - aux_info.bg_desc_blocks;
if (aux_info.bg_desc_reserve_blocks > aux_info.blocks_per_ind)
aux_info.bg_desc_reserve_blocks = aux_info.blocks_per_ind;
@@ -204,10 +204,10 @@ static void ext4_fill_in_sb()
sb->s_blocks_count_hi = aux_info.len_blocks >> 32;
sb->s_r_blocks_count_hi = 0;
sb->s_free_blocks_count_hi = 0;
- sb->s_min_extra_isize = sizeof(struct ext4_inode)
- - EXT4_GOOD_OLD_INODE_SIZE;
- sb->s_want_extra_isize = sizeof(struct ext4_inode)
- - EXT4_GOOD_OLD_INODE_SIZE;
+ sb->s_min_extra_isize = sizeof(struct ext4_inode) -
+ EXT4_GOOD_OLD_INODE_SIZE;
+ sb->s_want_extra_isize = sizeof(struct ext4_inode) -
+ EXT4_GOOD_OLD_INODE_SIZE;
sb->s_flags = 0;
sb->s_raid_stride = 0;
sb->s_mmp_interval = 0;
@@ -217,15 +217,15 @@ static void ext4_fill_in_sb()
sb->s_kbytes_written = 0;
for (i = 0; i < aux_info.groups; i++) {
- u64 group_start_block = aux_info.first_data_block + i
- * info.blocks_per_group;
+ u64 group_start_block = aux_info.first_data_block + i *
+ info.blocks_per_group;
u32 header_size = 0;
if (ext4_bg_has_super_block(i)) {
if (i != 0) {
queue_data_block((u8 *)sb, info.block_size, group_start_block);
queue_data_block((u8 *)aux_info.bg_desc,
- aux_info.bg_desc_blocks * info.block_size,
- group_start_block + 1);
+ aux_info.bg_desc_blocks * info.block_size,
+ group_start_block + 1);
}
header_size = 1 + aux_info.bg_desc_blocks + aux_info.bg_desc_reserve_blocks;
}
@@ -255,12 +255,12 @@ static void ext4_create_resize_inode()
for (i = 0; i < aux_info.groups; i++) {
if (ext4_bg_has_super_block(i)) {
u64 group_start_block = aux_info.first_data_block + i *
- info.blocks_per_group;
+ info.blocks_per_group;
u32 reserved_block_start = group_start_block + 1 +
- aux_info.bg_desc_blocks;
+ aux_info.bg_desc_blocks;
u32 reserved_block_len = aux_info.bg_desc_reserve_blocks;
append_region(reserve_inode_alloc, reserved_block_start,
- reserved_block_len, i);
+ reserved_block_len, i);
reserve_inode_len += reserved_block_len;
}
}
@@ -285,7 +285,7 @@ static void ext4_create_journal_inode()
u8 *journal_data = inode_allocate_data_extents(inode,
info.journal_blocks * info.block_size,
- info.block_size);
+ info.block_size);
if (!journal_data) {
error("failed to allocate extents for journal data");
return;
@@ -364,7 +364,7 @@ static u32 build_directory_structure(const char *full_path, const char *dir_path
u32 entry_inode;
u32 dirs = 0;
- entries = scandir(full_path, &namelist, filter_dot, alphasort);
+ entries = scandir(full_path, &namelist, filter_dot, (void*)alphasort);
if (entries < 0) {
error_errno("scandir");
return EXT4_ALLOCATE_FAILED;
diff --git a/ext4_utils/uuid.c b/ext4_utils/uuid.c
index c1bec2a5..ac9b518c 100644
--- a/ext4_utils/uuid.c
+++ b/ext4_utils/uuid.c
@@ -32,7 +32,7 @@ struct uuid {
};
static void sha1_hash(const char *namespace, const char *name,
- unsigned char sha1[SHA1_DIGEST_LENGTH])
+ unsigned char sha1[SHA1_DIGEST_LENGTH])
{
SHA1_CTX ctx;
SHA1Init(&ctx);