• Home
  • History
  • Annotate
  • Raw
  • Download

Lines Matching refs:s

31   struct sparse_file* s = reinterpret_cast<sparse_file*>(calloc(sizeof(struct sparse_file), 1));  in sparse_file_new()  local
32 if (!s) { in sparse_file_new()
36 s->backed_block_list = backed_block_list_new(block_size); in sparse_file_new()
37 if (!s->backed_block_list) { in sparse_file_new()
38 free(s); in sparse_file_new()
42 s->block_size = block_size; in sparse_file_new()
43 s->len = len; in sparse_file_new()
45 return s; in sparse_file_new()
48 void sparse_file_destroy(struct sparse_file* s) { in sparse_file_destroy() argument
49 backed_block_list_destroy(s->backed_block_list); in sparse_file_destroy()
50 free(s); in sparse_file_destroy()
53 int sparse_file_add_data(struct sparse_file* s, void* data, uint64_t len, unsigned int block) { in sparse_file_add_data() argument
54 return backed_block_add_data(s->backed_block_list, data, len, block); in sparse_file_add_data()
57 int sparse_file_add_fill(struct sparse_file* s, uint32_t fill_val, uint64_t len, in sparse_file_add_fill() argument
59 return backed_block_add_fill(s->backed_block_list, fill_val, len, block); in sparse_file_add_fill()
62 int sparse_file_add_file(struct sparse_file* s, const char* filename, int64_t file_offset, in sparse_file_add_file() argument
64 return backed_block_add_file(s->backed_block_list, filename, file_offset, len, block); in sparse_file_add_file()
67 int sparse_file_add_fd(struct sparse_file* s, int fd, int64_t file_offset, uint64_t len, in sparse_file_add_fd() argument
69 return backed_block_add_fd(s->backed_block_list, fd, file_offset, len, block); in sparse_file_add_fd()
71 unsigned int sparse_count_chunks(struct sparse_file* s) { in sparse_count_chunks() argument
76 for (bb = backed_block_iter_new(s->backed_block_list); bb; bb = backed_block_iter_next(bb)) { in sparse_count_chunks()
82 last_block = backed_block_block(bb) + DIV_ROUND_UP(backed_block_len(bb), s->block_size); in sparse_count_chunks()
84 if (last_block < DIV_ROUND_UP(s->len, s->block_size)) { in sparse_count_chunks()
114 static int write_all_blocks(struct sparse_file* s, struct output_file* out) { in write_all_blocks() argument
120 for (bb = backed_block_iter_new(s->backed_block_list); bb; bb = backed_block_iter_next(bb)) { in write_all_blocks()
123 write_skip_chunk(out, (int64_t)blocks * s->block_size); in write_all_blocks()
127 last_block = backed_block_block(bb) + DIV_ROUND_UP(backed_block_len(bb), s->block_size); in write_all_blocks()
130 pad = s->len - (int64_t)last_block * s->block_size; in write_all_blocks()
145 int sparse_file_write(struct sparse_file* s, int fd, bool gz, bool sparse, bool crc) { in sparse_file_write() argument
151 for (bb = backed_block_iter_new(s->backed_block_list); bb; bb = backed_block_iter_next(bb)) { in sparse_file_write()
152 ret = backed_block_split(s->backed_block_list, bb, MAX_BACKED_BLOCK_SIZE); in sparse_file_write()
156 chunks = sparse_count_chunks(s); in sparse_file_write()
157 out = output_file_open_fd(fd, s->block_size, s->len, gz, sparse, chunks, crc); in sparse_file_write()
161 ret = write_all_blocks(s, out); in sparse_file_write()
168 int sparse_file_callback(struct sparse_file* s, bool sparse, bool crc, in sparse_file_callback() argument
174 chunks = sparse_count_chunks(s); in sparse_file_callback()
175 out = output_file_open_callback(write, priv, s->block_size, s->len, false, sparse, chunks, crc); in sparse_file_callback()
179 ret = write_all_blocks(s, out); in sparse_file_callback()
199 int sparse_file_foreach_chunk(struct sparse_file* s, bool sparse, bool crc, in sparse_file_foreach_chunk() argument
212 chunks = sparse_count_chunks(s); in sparse_file_foreach_chunk()
213 out = output_file_open_callback(foreach_chunk_write, &chk, s->block_size, s->len, false, sparse, in sparse_file_foreach_chunk()
218 for (bb = backed_block_iter_new(s->backed_block_list); bb; bb = backed_block_iter_next(bb)) { in sparse_file_foreach_chunk()
220 chk.nr_blocks = (backed_block_len(bb) - 1) / s->block_size + 1; in sparse_file_foreach_chunk()
236 int64_t sparse_file_len(struct sparse_file* s, bool sparse, bool crc) { in sparse_file_len() argument
238 int chunks = sparse_count_chunks(s); in sparse_file_len()
242 out = output_file_open_callback(out_counter_write, &count, s->block_size, s->len, false, sparse, in sparse_file_len()
248 ret = write_all_blocks(s, out); in sparse_file_len()
259 unsigned int sparse_file_block_size(struct sparse_file* s) { in sparse_file_block_size() argument
260 return s->block_size; in sparse_file_block_size()
328 struct sparse_file* s; in sparse_file_resparse() local
338 s = sparse_file_new(in_s->block_size, in_s->len); in sparse_file_resparse()
340 bb = move_chunks_up_to_len(in_s, s, max_len); in sparse_file_resparse()
343 out_s[c] = s; in sparse_file_resparse()
345 backed_block_list_move(s->backed_block_list, tmp->backed_block_list, nullptr, nullptr); in sparse_file_resparse()
346 sparse_file_destroy(s); in sparse_file_resparse()
358 void sparse_file_verbose(struct sparse_file* s) { in sparse_file_verbose() argument
359 s->verbose = true; in sparse_file_verbose()