Lines Matching refs:file_buffer
302 struct file_buffer *file_buffer, int blocks, unsigned short checksum,
1309 static struct file_buffer *get_fragment(struct fragment *fragment) in get_fragment()
1312 struct file_buffer *buffer, *compressed_buffer; in get_fragment()
1432 struct file_buffer *frag_buffer; in get_fragment_checksum()
1487 struct file_buffer *write_buffer; in unlock_fragments()
1515 void add_pending_fragment(struct file_buffer *write_buffer, int c_byte, in add_pending_fragment()
1525 void write_fragment(struct file_buffer *fragment) in write_fragment()
1539 struct file_buffer *allocate_fragment() in allocate_fragment()
1541 struct file_buffer *fragment = cache_get(fragment_buffer, fragments); in allocate_fragment()
1573 struct fragment *get_and_fill_fragment(struct file_buffer *file_buffer, in get_and_fill_fragment() argument
1577 struct file_buffer **fragment; in get_and_fill_fragment()
1579 if(file_buffer == NULL || file_buffer->size == 0) in get_and_fill_fragment()
1584 if((*fragment) && (*fragment)->size + file_buffer->size > block_size) { in get_and_fill_fragment()
1598 ffrg->size = file_buffer->size; in get_and_fill_fragment()
1599 memcpy((*fragment)->data + (*fragment)->size, file_buffer->data, in get_and_fill_fragment()
1600 file_buffer->size); in get_and_fill_fragment()
1601 (*fragment)->size += file_buffer->size; in get_and_fill_fragment()
1730 struct file_buffer *write_buffer; in get_checksum_disk()
1767 unsigned short get_checksum_mem_buffer(struct file_buffer *file_buffer) in get_checksum_mem_buffer() argument
1769 if(file_buffer == NULL) in get_checksum_mem_buffer()
1772 return get_checksum(file_buffer->data, file_buffer->size, 0); in get_checksum_mem_buffer()
1871 struct fragment *frag_duplicate(struct file_buffer *file_buffer, char *dont_put) in frag_duplicate() argument
1874 struct file_buffer *buffer; in frag_duplicate()
1875 struct file_info *dupl_start = file_buffer->dupl_start; in frag_duplicate()
1876 long long file_size = file_buffer->file_size; in frag_duplicate()
1877 unsigned short checksum = file_buffer->checksum; in frag_duplicate()
1880 if(file_buffer->duplicate) { in frag_duplicate()
1896 res = memcmp(file_buffer->data, buffer->data + in frag_duplicate()
1918 struct file_buffer *file_buffer, int blocks, unsigned short checksum, in duplicate() argument
1922 int frag_bytes = file_buffer ? file_buffer->size : 0; in duplicate()
1923 unsigned short fragment_checksum = file_buffer ? in duplicate()
1924 file_buffer->checksum : 0; in duplicate()
1958 struct file_buffer *target_buffer = NULL; in duplicate()
1959 struct file_buffer *dup_buffer = NULL; in duplicate()
2005 struct file_buffer *frag_buffer = in duplicate()
2009 memcmp(file_buffer->data, in duplicate()
2056 void put_file_buffer(struct file_buffer *file_buffer) in put_file_buffer() argument
2064 if(file_buffer->error) { in put_file_buffer()
2065 file_buffer->fragment = 0; in put_file_buffer()
2066 seq_queue_put(to_main, file_buffer); in put_file_buffer()
2067 } else if (file_buffer->file_size == 0) in put_file_buffer()
2068 seq_queue_put(to_main, file_buffer); in put_file_buffer()
2069 else if(file_buffer->fragment) in put_file_buffer()
2070 queue_put(to_process_frag, file_buffer); in put_file_buffer()
2072 queue_put(to_deflate, file_buffer); in put_file_buffer()
2081 struct file_buffer *prev_buffer = NULL, *file_buffer; in reader_read_process() local
2086 file_buffer = cache_get_nohash(reader_buffer); in reader_read_process()
2087 file_buffer->sequence = seq ++; in reader_read_process()
2092 file_buffer = cache_get_nohash(reader_buffer); in reader_read_process()
2093 file_buffer->sequence = seq ++; in reader_read_process()
2094 file_buffer->noD = inode->noD; in reader_read_process()
2096 byte = read_bytes(file, file_buffer->data, block_size); in reader_read_process()
2100 file_buffer->size = byte; in reader_read_process()
2101 file_buffer->file_size = -1; in reader_read_process()
2102 file_buffer->error = FALSE; in reader_read_process()
2103 file_buffer->fragment = FALSE; in reader_read_process()
2120 prev_buffer = file_buffer; in reader_read_process()
2136 prev_buffer = file_buffer; in reader_read_process()
2138 cache_block_put(file_buffer); in reader_read_process()
2151 cache_block_put(file_buffer); in reader_read_process()
2153 file_buffer = prev_buffer; in reader_read_process()
2155 file_buffer->error = TRUE; in reader_read_process()
2156 put_file_buffer(file_buffer); in reader_read_process()
2163 struct file_buffer *file_buffer; in reader_read_file() local
2179 file_buffer = cache_get_nohash(reader_buffer); in reader_read_file()
2180 file_buffer->sequence = seq ++; in reader_read_file()
2185 file_buffer = cache_get_nohash(reader_buffer); in reader_read_file()
2186 file_buffer->file_size = read_size; in reader_read_file()
2187 file_buffer->sequence = seq ++; in reader_read_file()
2188 file_buffer->noD = inode->noD; in reader_read_file()
2189 file_buffer->error = FALSE; in reader_read_file()
2200 file_buffer->size = read_bytes(file, file_buffer->data, in reader_read_file()
2202 if(file_buffer->size == -1) in reader_read_file()
2205 bytes += file_buffer->size; in reader_read_file()
2209 if(file_buffer->size < block_size) in reader_read_file()
2212 file_buffer->fragment = FALSE; in reader_read_file()
2213 put_file_buffer(file_buffer); in reader_read_file()
2238 file_buffer->fragment = is_fragment(inode); in reader_read_file()
2239 put_file_buffer(file_buffer); in reader_read_file()
2256 file_buffer->error = 2; in reader_read_file()
2257 put_file_buffer(file_buffer); in reader_read_file()
2263 file_buffer->error = TRUE; in reader_read_file()
2264 put_file_buffer(file_buffer); in reader_read_file()
2315 struct file_buffer *file_buffer = queue_get(to_writer); in writer() local
2318 if(file_buffer == NULL) { in writer()
2323 off = file_buffer->block; in writer()
2336 if(write_bytes(fd, file_buffer->data, in writer()
2337 file_buffer->size) == -1) in writer()
2343 cache_block_put(file_buffer); in writer()
2348 int all_zero(struct file_buffer *file_buffer) in all_zero() argument
2351 long entries = file_buffer->size / sizeof(long); in all_zero()
2352 long *p = (long *) file_buffer->data; in all_zero()
2357 for(i = file_buffer->size & ~(sizeof(long) - 1); in all_zero()
2358 i < file_buffer->size && file_buffer->data[i] == 0; in all_zero()
2361 return i == file_buffer->size; in all_zero()
2370 struct file_buffer *write_buffer = cache_get_nohash(bwriter_buffer); in deflator()
2379 struct file_buffer *file_buffer = queue_get(to_deflate); in deflator() local
2381 if(sparse_files && all_zero(file_buffer)) { in deflator()
2382 file_buffer->c_byte = 0; in deflator()
2383 seq_queue_put(to_main, file_buffer); in deflator()
2386 write_buffer->data, file_buffer->data, in deflator()
2387 file_buffer->size, block_size, in deflator()
2388 file_buffer->noD, 1); in deflator()
2389 write_buffer->sequence = file_buffer->sequence; in deflator()
2390 write_buffer->file_size = file_buffer->file_size; in deflator()
2391 write_buffer->block = file_buffer->block; in deflator()
2396 cache_block_put(file_buffer); in deflator()
2417 struct file_buffer *file_buffer = queue_get(to_frag); in frag_deflator() local
2418 struct file_buffer *write_buffer = in frag_deflator()
2419 cache_get(fwriter_buffer, file_buffer->block); in frag_deflator()
2421 c_byte = mangle2(stream, write_buffer->data, file_buffer->data, in frag_deflator()
2422 file_buffer->size, block_size, noF, 1); in frag_deflator()
2427 fragment_table[file_buffer->block].size = c_byte; in frag_deflator()
2428 fragment_table[file_buffer->block].start_block = bytes; in frag_deflator()
2435 "compressed size %d\n", file_buffer->block, in frag_deflator()
2436 file_buffer->size, compressed_size); in frag_deflator()
2439 file_buffer->block); in frag_deflator()
2442 cache_block_put(file_buffer); in frag_deflator()
2449 struct file_buffer *get_file_buffer() in get_file_buffer()
2451 struct file_buffer *file_buffer = seq_queue_get(to_main); in get_file_buffer() local
2453 return file_buffer; in get_file_buffer()
2458 struct file_buffer *file_buffer, int *duplicate_file) in write_file_empty() argument
2462 cache_block_put(file_buffer); in write_file_empty()
2469 struct file_buffer *file_buffer, int *duplicate_file) in write_file_frag() argument
2471 int size = file_buffer->file_size; in write_file_frag()
2473 unsigned short checksum = file_buffer->checksum; in write_file_frag()
2476 fragment = frag_duplicate(file_buffer, &dont_put); in write_file_frag()
2479 fragment = get_and_fill_fragment(file_buffer, dir_ent); in write_file_frag()
2486 free(file_buffer); in write_file_frag()
2488 cache_block_put(file_buffer); in write_file_frag()
2504 struct file_buffer *read_buffer, int *duplicate_file) in write_file_process()
2511 struct file_buffer *fragment_buffer = NULL; in write_file_process()
2594 struct file_buffer *read_buffer, int *duplicate_file) in write_file_blocks_dup()
2603 struct file_buffer **buffer_list; in write_file_blocks_dup()
2606 struct file_buffer *fragment_buffer = NULL; in write_file_blocks_dup()
2613 buffer_list = malloc(blocks * sizeof(struct file_buffer *)); in write_file_blocks_dup()
2736 struct file_buffer *read_buffer, int *dup) in write_file_blocks()
2745 struct file_buffer *fragment_buffer = NULL; in write_file_blocks()
2844 struct file_buffer *read_buffer; in write_file()
5169 struct file_buffer **fragment = NULL; in main()