Skip to content

Commit

Permalink
libsparse: rename symbols that conflict with libext4_utils
Browse files Browse the repository at this point in the history
Until ext4_utils switches to using libsparse, libext4_utils defines some
of the same symbols as libsparse.  Fastboot links statically against
both of them, and there is no easy way to make the symbols hidden, so
just rename them in libsparse.

Change-Id: Idc2cfe20efe3c3a7fb8233f453a89bbbeb0dcc8b
  • Loading branch information
colincross committed Jul 10, 2012
1 parent 317a09e commit b43828b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions libsparse/output_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ static struct sparse_file_ops normal_file_ops = {
.write_end_chunk = write_normal_end_chunk,
};

void close_output_file(struct output_file *out)
void output_file_close(struct output_file *out)
{
int ret;

Expand Down Expand Up @@ -638,7 +638,7 @@ static struct output_file *output_file_new_normal(void)
return &outn->out;
}

struct output_file *open_output_callback(int (*write)(void *, const void *, int),
struct output_file *output_file_open_callback(int (*write)(void *, const void *, int),
void *priv, unsigned int block_size, int64_t len, int gz, int sparse,
int chunks, int crc)
{
Expand All @@ -664,7 +664,7 @@ struct output_file *open_output_callback(int (*write)(void *, const void *, int)
return &outc->out;
}

struct output_file *open_output_fd(int fd, unsigned int block_size, int64_t len,
struct output_file *output_file_open_fd(int fd, unsigned int block_size, int64_t len,
int gz, int sparse, int chunks, int crc)
{
int ret;
Expand Down
6 changes: 3 additions & 3 deletions libsparse/output_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@

struct output_file;

struct output_file *open_output_fd(int fd, unsigned int block_size, int64_t len,
struct output_file *output_file_open_fd(int fd, unsigned int block_size, int64_t len,
int gz, int sparse, int chunks, int crc);
struct output_file *open_output_callback(int (*write)(void *, const void *, int),
struct output_file *output_file_open_callback(int (*write)(void *, const void *, int),
void *priv, unsigned int block_size, int64_t len, int gz, int sparse,
int chunks, int crc);
int write_data_chunk(struct output_file *out, unsigned int len, void *data);
Expand All @@ -34,7 +34,7 @@ int write_file_chunk(struct output_file *out, unsigned int len,
int write_fd_chunk(struct output_file *out, unsigned int len,
int fd, int64_t offset);
int write_skip_chunk(struct output_file *out, int64_t len);
void close_output_file(struct output_file *out);
void output_file_close(struct output_file *out);

int read_all(int fd, void *buf, size_t len);

Expand Down
16 changes: 8 additions & 8 deletions libsparse/sparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,14 @@ int sparse_file_write(struct sparse_file *s, int fd, bool gz, bool sparse,
struct output_file *out;

chunks = sparse_count_chunks(s);
out = open_output_fd(fd, s->block_size, s->len, gz, sparse, chunks, crc);
out = output_file_open_fd(fd, s->block_size, s->len, gz, sparse, chunks, crc);

if (!out)
return -ENOMEM;

ret = write_all_blocks(s, out);

close_output_file(out);
output_file_close(out);

return ret;
}
Expand All @@ -176,15 +176,15 @@ int sparse_file_callback(struct sparse_file *s, bool sparse, bool crc,
struct output_file *out;

chunks = sparse_count_chunks(s);
out = open_output_callback(write, priv, s->block_size, s->len, false,
out = output_file_open_callback(write, priv, s->block_size, s->len, false,
sparse, chunks, crc);

if (!out)
return -ENOMEM;

ret = write_all_blocks(s, out);

close_output_file(out);
output_file_close(out);

return ret;
}
Expand All @@ -203,15 +203,15 @@ int64_t sparse_file_len(struct sparse_file *s, bool sparse, bool crc)
int64_t count = 0;
struct output_file *out;

out = open_output_callback(out_counter_write, &count,
out = output_file_open_callback(out_counter_write, &count,
s->block_size, s->len, false, sparse, chunks, crc);
if (!out) {
return -1;
}

ret = write_all_blocks(s, out);

close_output_file(out);
output_file_close(out);

if (ret < 0) {
return -1;
Expand Down Expand Up @@ -239,7 +239,7 @@ static struct backed_block *move_chunks_up_to_len(struct sparse_file *from,
len -= overhead;

start = backed_block_iter_new(from->backed_block_list);
out_counter = open_output_callback(out_counter_write, &count,
out_counter = output_file_open_callback(out_counter_write, &count,
to->block_size, to->len, false, true, 0, false);
if (!out_counter) {
return NULL;
Expand Down Expand Up @@ -269,7 +269,7 @@ static struct backed_block *move_chunks_up_to_len(struct sparse_file *from,
backed_block_list_move(from->backed_block_list,
to->backed_block_list, start, last_bb);

close_output_file(out_counter);
output_file_close(out_counter);

return bb;
}
Expand Down

0 comments on commit b43828b

Please sign in to comment.