Lines 62-67
Link Here
|
62 |
int total_compressed = 0, total_uncompressed = 0; |
62 |
int total_compressed = 0, total_uncompressed = 0; |
63 |
|
63 |
|
64 |
int fd; |
64 |
int fd; |
|
|
65 |
unsigned char* read_buffer_base; |
65 |
|
66 |
|
66 |
/* superblock attributes */ |
67 |
/* superblock attributes */ |
67 |
int noI = 0, noD = 0, check_data = 0, block_size = SQUASHFS_FILE_SIZE, block_log; |
68 |
int noI = 0, noD = 0, check_data = 0, block_size = SQUASHFS_FILE_SIZE, block_log; |
Lines 853-862
Link Here
|
853 |
return start_bytes; |
854 |
return start_bytes; |
854 |
} |
855 |
} |
855 |
|
856 |
|
|
|
857 |
void setup_read_buffer(void* p) |
858 |
{ |
859 |
read_buffer_base = (unsigned char*) p; |
860 |
} |
856 |
|
861 |
|
857 |
unsigned char *read_from_buffer(unsigned int *start, unsigned int avail_bytes) |
862 |
unsigned char *read_from_buffer(unsigned int *start, unsigned int avail_bytes) |
858 |
{ |
863 |
{ |
859 |
unsigned char *v = (unsigned char *) *start; |
864 |
unsigned char *v = read_buffer_base + *start; |
860 |
*start += avail_bytes; |
865 |
*start += avail_bytes; |
861 |
return v; |
866 |
return v; |
862 |
} |
867 |
} |
Lines 923-929
Link Here
|
923 |
struct file_info *duplicate(unsigned char *(get_next_file_block)(unsigned int *, unsigned int), unsigned int file_start, int bytes, unsigned int **block_list, int *start, int blocks, struct fragment **fragment, char *frag_data, int frag_bytes) |
928 |
struct file_info *duplicate(unsigned char *(get_next_file_block)(unsigned int *, unsigned int), unsigned int file_start, int bytes, unsigned int **block_list, int *start, int blocks, struct fragment **fragment, char *frag_data, int frag_bytes) |
924 |
{ |
929 |
{ |
925 |
unsigned short checksum = get_checksum(get_next_file_block, file_start, bytes); |
930 |
unsigned short checksum = get_checksum(get_next_file_block, file_start, bytes); |
926 |
unsigned short fragment_checksum = get_checksum(read_from_buffer, (unsigned int) frag_data, frag_bytes); |
931 |
setup_read_buffer(frag_data); |
|
|
932 |
unsigned short fragment_checksum = get_checksum(read_from_buffer, 0, frag_bytes); |
927 |
struct file_info *dupl_ptr = bytes ? dupl[checksum] : frag_dups[fragment_checksum]; |
933 |
struct file_info *dupl_ptr = bytes ? dupl[checksum] : frag_dups[fragment_checksum]; |
928 |
|
934 |
|
929 |
|
935 |
|
Lines 1043-1049
Link Here
|
1043 |
|
1049 |
|
1044 |
close(file); |
1050 |
close(file); |
1045 |
if(whole_file) { |
1051 |
if(whole_file) { |
1046 |
if(duplicate_checking && (dupl_ptr = duplicate(read_from_buffer, (unsigned int) c_buffer, file_bytes, &block_listp, &start, blocks, &fragment, buff, frag_bytes)) == NULL) { |
1052 |
setup_read_buffer(c_buffer); |
|
|
1053 |
if(duplicate_checking && (dupl_ptr = duplicate(read_from_buffer, 0, file_bytes, &block_listp, &start, blocks, &fragment, buff, frag_bytes)) == NULL) { |
1047 |
*duplicate_file = TRUE; |
1054 |
*duplicate_file = TRUE; |
1048 |
goto wr_inode; |
1055 |
goto wr_inode; |
1049 |
} |
1056 |
} |