Removed development macro Libisofs_with_checksumS
and made the affected code unconditional.
This commit is contained in:
parent
9cf460a3b1
commit
3528493b92
@ -27,10 +27,7 @@
|
|||||||
#include "rockridge.h"
|
#include "rockridge.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "system_area.h"
|
#include "system_area.h"
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
#include "md5.h"
|
#include "md5.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -76,16 +73,12 @@ void ecma119_image_free(Ecma119Image *t)
|
|||||||
free(t->bootsrc);
|
free(t->bootsrc);
|
||||||
if (t->system_area_data != NULL)
|
if (t->system_area_data != NULL)
|
||||||
free(t->system_area_data);
|
free(t->system_area_data);
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
if (t->checksum_ctx != NULL) { /* dispose checksum context */
|
if (t->checksum_ctx != NULL) { /* dispose checksum context */
|
||||||
char md5[16];
|
char md5[16];
|
||||||
iso_md5_end(&(t->checksum_ctx), md5);
|
iso_md5_end(&(t->checksum_ctx), md5);
|
||||||
}
|
}
|
||||||
if (t->checksum_buffer != NULL)
|
if (t->checksum_buffer != NULL)
|
||||||
free(t->checksum_buffer);
|
free(t->checksum_buffer);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (t->writers != NULL)
|
if (t->writers != NULL)
|
||||||
free(t->writers);
|
free(t->writers);
|
||||||
free(t);
|
free(t);
|
||||||
@ -256,17 +249,11 @@ int ecma119_writer_compute_data_blocks(IsoImageWriter *writer)
|
|||||||
target->m_path_table_pos = target->curblock;
|
target->m_path_table_pos = target->curblock;
|
||||||
target->curblock += DIV_UP(path_table_size, BLOCK_SIZE);
|
target->curblock += DIV_UP(path_table_size, BLOCK_SIZE);
|
||||||
target->path_table_size = path_table_size;
|
target->path_table_size = path_table_size;
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
if (target->md5_session_checksum) {
|
if (target->md5_session_checksum) {
|
||||||
/* Account for tree checksum tag */
|
/* Account for tree checksum tag */
|
||||||
target->checksum_tree_tag_pos = target->curblock;
|
target->checksum_tree_tag_pos = target->curblock;
|
||||||
target->curblock++;
|
target->curblock++;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
return ISO_SUCCESS;
|
return ISO_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -737,16 +724,10 @@ int ecma119_writer_write_data(IsoImageWriter *writer)
|
|||||||
ret = write_path_tables(t);
|
ret = write_path_tables(t);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
if (t->md5_session_checksum) {
|
if (t->md5_session_checksum) {
|
||||||
/* Write tree checksum tag */
|
/* Write tree checksum tag */
|
||||||
ret = iso_md5_write_tag(t, 3);
|
ret = iso_md5_write_tag(t, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -934,8 +915,6 @@ void *write_function(void *arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
/* Write superblock checksum tag */
|
/* Write superblock checksum tag */
|
||||||
if (target->md5_session_checksum && target->checksum_ctx != NULL) {
|
if (target->md5_session_checksum && target->checksum_ctx != NULL) {
|
||||||
res = iso_md5_write_tag(target, 2);
|
res = iso_md5_write_tag(target, 2);
|
||||||
@ -943,9 +922,6 @@ void *write_function(void *arg)
|
|||||||
goto write_error;
|
goto write_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
|
|
||||||
/* write data for each writer */
|
/* write data for each writer */
|
||||||
for (i = 0; i < target->nwriters; ++i) {
|
for (i = 0; i < target->nwriters; ++i) {
|
||||||
writer = target->writers[i];
|
writer = target->writers[i];
|
||||||
@ -955,13 +931,9 @@ void *write_function(void *arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
/* Transplant checksum buffer from Ecma119Image to IsoImage */
|
/* Transplant checksum buffer from Ecma119Image to IsoImage */
|
||||||
transplant_checksum_buffer(target, 0);
|
transplant_checksum_buffer(target, 0);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
iso_ring_buffer_writer_close(target->buffer, 0);
|
iso_ring_buffer_writer_close(target->buffer, 0);
|
||||||
|
|
||||||
#ifdef Libisofs_with_pthread_exiT
|
#ifdef Libisofs_with_pthread_exiT
|
||||||
@ -981,15 +953,11 @@ void *write_function(void *arg)
|
|||||||
}
|
}
|
||||||
iso_ring_buffer_writer_close(target->buffer, 1);
|
iso_ring_buffer_writer_close(target->buffer, 1);
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
/* Transplant checksum buffer away from Ecma119Image */
|
/* Transplant checksum buffer away from Ecma119Image */
|
||||||
transplant_checksum_buffer(target, 0);
|
transplant_checksum_buffer(target, 0);
|
||||||
/* Invalidate the transplanted checksum buffer in IsoImage */
|
/* Invalidate the transplanted checksum buffer in IsoImage */
|
||||||
iso_image_free_checksums(target->image, 0);
|
iso_image_free_checksums(target->image, 0);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef Libisofs_with_pthread_exiT
|
#ifdef Libisofs_with_pthread_exiT
|
||||||
pthread_exit(NULL);
|
pthread_exit(NULL);
|
||||||
#else
|
#else
|
||||||
@ -999,9 +967,6 @@ void *write_function(void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
|
|
||||||
static
|
static
|
||||||
int checksum_prepare_image(IsoImage *src, int flag)
|
int checksum_prepare_image(IsoImage *src, int flag)
|
||||||
{
|
{
|
||||||
@ -1096,9 +1061,6 @@ int checksum_prepare_nodes(Ecma119Image *target, IsoNode *node, int flag)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
|
|
||||||
static
|
static
|
||||||
int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
||||||
{
|
{
|
||||||
@ -1222,8 +1184,6 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
|||||||
goto target_cleanup;
|
goto target_cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
target->md5_file_checksums = opts->md5_file_checksums;
|
target->md5_file_checksums = opts->md5_file_checksums;
|
||||||
target->md5_session_checksum = opts->md5_session_checksum;
|
target->md5_session_checksum = opts->md5_session_checksum;
|
||||||
strcpy(target->scdbackup_tag_parm, opts->scdbackup_tag_parm);
|
strcpy(target->scdbackup_tag_parm, opts->scdbackup_tag_parm);
|
||||||
@ -1241,8 +1201,6 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
|||||||
target->checksum_range_size = 0;
|
target->checksum_range_size = 0;
|
||||||
target->opts_overwrite = 0;
|
target->opts_overwrite = 0;
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 2. Based on those options, create needed writers: iso, joliet...
|
* 2. Based on those options, create needed writers: iso, joliet...
|
||||||
* Each writer inits its structures and stores needed info into
|
* Each writer inits its structures and stores needed info into
|
||||||
@ -1266,9 +1224,6 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
|||||||
nwriters++;
|
nwriters++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
if ((target->md5_file_checksums & 1) || target->md5_session_checksum) {
|
if ((target->md5_file_checksums & 1) || target->md5_session_checksum) {
|
||||||
nwriters++;
|
nwriters++;
|
||||||
image_checksums_mad = 1; /* from here on the loaded checksums are
|
image_checksums_mad = 1; /* from here on the loaded checksums are
|
||||||
@ -1285,9 +1240,6 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
|||||||
target->checksum_idx_counter = 0;
|
target->checksum_idx_counter = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
|
|
||||||
target->writers = malloc(nwriters * sizeof(void*));
|
target->writers = malloc(nwriters * sizeof(void*));
|
||||||
if (target->writers == NULL) {
|
if (target->writers == NULL) {
|
||||||
ret = ISO_OUT_OF_MEM;
|
ret = ISO_OUT_OF_MEM;
|
||||||
@ -1345,19 +1297,12 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
|||||||
goto target_cleanup;
|
goto target_cleanup;
|
||||||
}
|
}
|
||||||
file_src_writer_index = target->nwriters - 1;
|
file_src_writer_index = target->nwriters - 1;
|
||||||
|
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
if ((target->md5_file_checksums & 1) || target->md5_session_checksum) {
|
if ((target->md5_file_checksums & 1) || target->md5_session_checksum) {
|
||||||
ret = checksum_writer_create(target);
|
ret = checksum_writer_create(target);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto target_cleanup;
|
goto target_cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 3.
|
* 3.
|
||||||
* Call compute_data_blocks() in each Writer.
|
* Call compute_data_blocks() in each Writer.
|
||||||
@ -1456,8 +1401,6 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
|||||||
memcpy(vol->std_identifier, "CD001", 5);
|
memcpy(vol->std_identifier, "CD001", 5);
|
||||||
vol->vol_desc_version[0] = 1;
|
vol->vol_desc_version[0] = 1;
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
/* Write relocated superblock checksum tag */
|
/* Write relocated superblock checksum tag */
|
||||||
tag_pos = voldesc_size / BLOCK_SIZE + 16 + 1;
|
tag_pos = voldesc_size / BLOCK_SIZE + 16 + 1;
|
||||||
if (target->md5_session_checksum) {
|
if (target->md5_session_checksum) {
|
||||||
@ -1489,9 +1432,6 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
|||||||
if (ret > 0)
|
if (ret > 0)
|
||||||
opts->overwrite[i * 2048] = 0;
|
opts->overwrite[i * 2048] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1503,8 +1443,6 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
|||||||
|
|
||||||
|
|
||||||
/* 4. Create and start writing thread */
|
/* 4. Create and start writing thread */
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
if (target->md5_session_checksum) {
|
if (target->md5_session_checksum) {
|
||||||
/* After any fake writes are done: Initialize image checksum context */
|
/* After any fake writes are done: Initialize image checksum context */
|
||||||
if (target->checksum_ctx != NULL)
|
if (target->checksum_ctx != NULL)
|
||||||
@ -1518,8 +1456,6 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
|||||||
iso_image_free_checksums(target->image, 0);
|
iso_image_free_checksums(target->image, 0);
|
||||||
image_checksums_mad = 0;
|
image_checksums_mad = 0;
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
/* ensure the thread is created joinable */
|
/* ensure the thread is created joinable */
|
||||||
pthread_attr_init(&(target->th_attr));
|
pthread_attr_init(&(target->th_attr));
|
||||||
pthread_attr_setdetachstate(&(target->th_attr), PTHREAD_CREATE_JOINABLE);
|
pthread_attr_setdetachstate(&(target->th_attr), PTHREAD_CREATE_JOINABLE);
|
||||||
@ -1544,14 +1480,8 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
|||||||
return ISO_SUCCESS;
|
return ISO_SUCCESS;
|
||||||
|
|
||||||
target_cleanup: ;
|
target_cleanup: ;
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
if(image_checksums_mad) /* No checksums is better than mad checksums */
|
if(image_checksums_mad) /* No checksums is better than mad checksums */
|
||||||
iso_image_free_checksums(target->image, 0);
|
iso_image_free_checksums(target->image, 0);
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
ecma119_image_free(target);
|
ecma119_image_free(target);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -1691,17 +1621,11 @@ int iso_write(Ecma119Image *target, void *buf, size_t count)
|
|||||||
/* reader cancelled */
|
/* reader cancelled */
|
||||||
return ISO_CANCELED;
|
return ISO_CANCELED;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
if (target->checksum_ctx != NULL) {
|
if (target->checksum_ctx != NULL) {
|
||||||
/* Add to image checksum */
|
/* Add to image checksum */
|
||||||
target->checksum_counter += count;
|
target->checksum_counter += count;
|
||||||
iso_md5_compute(target->checksum_ctx, (char *) buf, (int) count);
|
iso_md5_compute(target->checksum_ctx, (char *) buf, (int) count);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
/* total size is 0 when writing the overwrite buffer */
|
/* total size is 0 when writing the overwrite buffer */
|
||||||
if (ret > 0 && (target->total_size != (off_t) 0)){
|
if (ret > 0 && (target->total_size != (off_t) 0)){
|
||||||
unsigned int kbw, kbt;
|
unsigned int kbw, kbt;
|
||||||
@ -1977,14 +1901,8 @@ int iso_write_opts_set_sort_files(IsoWriteOpts *opts, int sort)
|
|||||||
|
|
||||||
int iso_write_opts_set_record_md5(IsoWriteOpts *opts, int session, int files)
|
int iso_write_opts_set_record_md5(IsoWriteOpts *opts, int session, int files)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
opts->md5_session_checksum = session & 1;
|
opts->md5_session_checksum = session & 1;
|
||||||
opts->md5_file_checksums = files & 3;
|
opts->md5_file_checksums = files & 3;
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
return ISO_SUCCESS;
|
return ISO_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1992,9 +1910,6 @@ int iso_write_opts_set_scdbackup_tag(IsoWriteOpts *opts,
|
|||||||
char *name, char *timestamp,
|
char *name, char *timestamp,
|
||||||
char *tag_written)
|
char *tag_written)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
char eff_name[81], eff_time[19];
|
char eff_name[81], eff_time[19];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -2020,9 +1935,6 @@ int iso_write_opts_set_scdbackup_tag(IsoWriteOpts *opts,
|
|||||||
opts->scdbackup_tag_written = tag_written;
|
opts->scdbackup_tag_written = tag_written;
|
||||||
if (tag_written != NULL)
|
if (tag_written != NULL)
|
||||||
tag_written[0] = 0;
|
tag_written[0] = 0;
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
return ISO_SUCCESS;
|
return ISO_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,8 +152,6 @@ struct iso_write_opts {
|
|||||||
*/
|
*/
|
||||||
unsigned int dir_rec_mtime :1;
|
unsigned int dir_rec_mtime :1;
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compute MD5 checksum for the whole session and record it as index 0 of
|
* Compute MD5 checksum for the whole session and record it as index 0 of
|
||||||
* the checksum blocks after the data area of the session. The layout and
|
* the checksum blocks after the data area of the session. The layout and
|
||||||
@ -174,8 +172,6 @@ struct iso_write_opts {
|
|||||||
*/
|
*/
|
||||||
unsigned int md5_file_checksums :2;
|
unsigned int md5_file_checksums :2;
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
/** If files should be sorted based on their weight. */
|
/** If files should be sorted based on their weight. */
|
||||||
unsigned int sort_files :1;
|
unsigned int sort_files :1;
|
||||||
|
|
||||||
@ -373,13 +369,9 @@ struct ecma119_image
|
|||||||
/* Store in ECMA-119 timestamp mtime of source */
|
/* Store in ECMA-119 timestamp mtime of source */
|
||||||
unsigned int dir_rec_mtime :1;
|
unsigned int dir_rec_mtime :1;
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
unsigned int md5_session_checksum :1;
|
unsigned int md5_session_checksum :1;
|
||||||
unsigned int md5_file_checksums :2;
|
unsigned int md5_file_checksums :2;
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mode replace. If one of these flags is set, the correspodent values are
|
* Mode replace. If one of these flags is set, the correspodent values are
|
||||||
* replaced with values below.
|
* replaced with values below.
|
||||||
@ -498,8 +490,6 @@ struct ecma119_image
|
|||||||
/* tree of files sources */
|
/* tree of files sources */
|
||||||
IsoRBTree *files;
|
IsoRBTree *files;
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
unsigned int checksum_idx_counter;
|
unsigned int checksum_idx_counter;
|
||||||
void *checksum_ctx;
|
void *checksum_ctx;
|
||||||
off_t checksum_counter;
|
off_t checksum_counter;
|
||||||
@ -525,8 +515,6 @@ struct ecma119_image
|
|||||||
char scdbackup_tag_parm[100];
|
char scdbackup_tag_parm[100];
|
||||||
char *scdbackup_tag_written;
|
char *scdbackup_tag_written;
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
/* Buffer for communication between burn_source and writer thread */
|
/* Buffer for communication between burn_source and writer thread */
|
||||||
IsoRingBuffer *buffer;
|
IsoRingBuffer *buffer;
|
||||||
|
|
||||||
|
@ -14,10 +14,7 @@
|
|||||||
#include "messages.h"
|
#include "messages.h"
|
||||||
#include "image.h"
|
#include "image.h"
|
||||||
#include "stream.h"
|
#include "stream.h"
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
#include "md5.h"
|
#include "md5.h"
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -53,11 +50,8 @@ int iso_file_src_create(Ecma119Image *img, IsoFile *file, IsoFileSrc **src)
|
|||||||
unsigned int fs_id;
|
unsigned int fs_id;
|
||||||
dev_t dev_id;
|
dev_t dev_id;
|
||||||
ino_t ino_id;
|
ino_t ino_id;
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
int cret, no_md5= 0;
|
int cret, no_md5= 0;
|
||||||
void *xipt = NULL;
|
void *xipt = NULL;
|
||||||
#endif
|
|
||||||
|
|
||||||
if (img == NULL || file == NULL || src == NULL) {
|
if (img == NULL || file == NULL || src == NULL) {
|
||||||
return ISO_NULL_POINTER;
|
return ISO_NULL_POINTER;
|
||||||
@ -103,9 +97,6 @@ int iso_file_src_create(Ecma119Image *img, IsoFile *file, IsoFileSrc **src)
|
|||||||
/* insert the filesrc in the tree */
|
/* insert the filesrc in the tree */
|
||||||
ret = iso_rbtree_insert(img->files, fsrc, (void**)src);
|
ret = iso_rbtree_insert(img->files, fsrc, (void**)src);
|
||||||
if (ret <= 0) {
|
if (ret <= 0) {
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
if (ret == 0 && (*src)->checksum_index > 0) {
|
if (ret == 0 && (*src)->checksum_index > 0) {
|
||||||
/* Duplicate file source was mapped to previously registered source
|
/* Duplicate file source was mapped to previously registered source
|
||||||
*/
|
*/
|
||||||
@ -113,17 +104,12 @@ int iso_file_src_create(Ecma119Image *img, IsoFile *file, IsoFileSrc **src)
|
|||||||
if (cret < 0)
|
if (cret < 0)
|
||||||
ret = cret;
|
ret = cret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
free(fsrc->sections);
|
free(fsrc->sections);
|
||||||
free(fsrc);
|
free(fsrc);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
iso_stream_ref(fsrc->stream);
|
iso_stream_ref(fsrc->stream);
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
if ((img->md5_file_checksums & 1) &&
|
if ((img->md5_file_checksums & 1) &&
|
||||||
file->from_old_session && img->appendable) {
|
file->from_old_session && img->appendable) {
|
||||||
ret = iso_node_get_xinfo((IsoNode *) file, checksum_md5_xinfo_func,
|
ret = iso_node_get_xinfo((IsoNode *) file, checksum_md5_xinfo_func,
|
||||||
@ -149,8 +135,6 @@ int iso_file_src_create(Ecma119Image *img, IsoFile *file, IsoFileSrc **src)
|
|||||||
return cret;
|
return cret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
return ISO_SUCCESS;
|
return ISO_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -304,21 +288,16 @@ int filesrc_read(IsoFileSrc *file, char *buf, size_t count)
|
|||||||
return iso_stream_read_buffer(file->stream, buf, count, &got);
|
return iso_stream_read_buffer(file->stream, buf, count, &got);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
/* @return 1=ok, md5 is valid,
|
/* @return 1=ok, md5 is valid,
|
||||||
0= not ok, go on,
|
0= not ok, go on,
|
||||||
<0 fatal error, abort
|
<0 fatal error, abort
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static
|
static
|
||||||
int filesrc_make_md5(Ecma119Image *t, IsoFileSrc *file, char md5[16], int flag)
|
int filesrc_make_md5(Ecma119Image *t, IsoFileSrc *file, char md5[16], int flag)
|
||||||
{
|
{
|
||||||
return iso_stream_make_md5(file->stream, md5, 0);
|
return iso_stream_make_md5(file->stream, md5, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
static
|
static
|
||||||
int filesrc_writer_write_data(IsoImageWriter *writer)
|
int filesrc_writer_write_data(IsoImageWriter *writer)
|
||||||
{
|
{
|
||||||
@ -331,13 +310,9 @@ int filesrc_writer_write_data(IsoImageWriter *writer)
|
|||||||
char buffer[BLOCK_SIZE];
|
char buffer[BLOCK_SIZE];
|
||||||
off_t file_size;
|
off_t file_size;
|
||||||
uint32_t nblocks;
|
uint32_t nblocks;
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
void *ctx= NULL;
|
void *ctx= NULL;
|
||||||
char md5[16], pre_md5[16];
|
char md5[16], pre_md5[16];
|
||||||
int pre_md5_valid = 0;
|
int pre_md5_valid = 0;
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
if (writer == NULL) {
|
if (writer == NULL) {
|
||||||
return ISO_ASSERT_FAILURE;
|
return ISO_ASSERT_FAILURE;
|
||||||
@ -353,17 +328,11 @@ int filesrc_writer_write_data(IsoImageWriter *writer)
|
|||||||
was_error = 0;
|
was_error = 0;
|
||||||
file_size = iso_file_src_get_size(file);
|
file_size = iso_file_src_get_size(file);
|
||||||
nblocks = DIV_UP(file_size, BLOCK_SIZE);
|
nblocks = DIV_UP(file_size, BLOCK_SIZE);
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
pre_md5_valid = 0;
|
pre_md5_valid = 0;
|
||||||
if (file->checksum_index > 0 && (t->md5_file_checksums & 2)) {
|
if (file->checksum_index > 0 && (t->md5_file_checksums & 2)) {
|
||||||
/* Obtain an MD5 of content by a first read pass */
|
/* Obtain an MD5 of content by a first read pass */
|
||||||
pre_md5_valid = filesrc_make_md5(t, file, pre_md5, 0);
|
pre_md5_valid = filesrc_make_md5(t, file, pre_md5, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
res = filesrc_open(file);
|
res = filesrc_open(file);
|
||||||
iso_stream_get_file_name(file->stream, name);
|
iso_stream_get_file_name(file->stream, name);
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
@ -407,18 +376,12 @@ int filesrc_writer_write_data(IsoImageWriter *writer)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
if (file->checksum_index > 0) {
|
if (file->checksum_index > 0) {
|
||||||
/* initialize file checksum */
|
/* initialize file checksum */
|
||||||
res = iso_md5_start(&ctx);
|
res = iso_md5_start(&ctx);
|
||||||
if (res <= 0)
|
if (res <= 0)
|
||||||
file->checksum_index = 0;
|
file->checksum_index = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
/* write file contents to image */
|
/* write file contents to image */
|
||||||
for (b = 0; b < nblocks; ++b) {
|
for (b = 0; b < nblocks; ++b) {
|
||||||
int wres;
|
int wres;
|
||||||
@ -434,9 +397,6 @@ int filesrc_writer_write_data(IsoImageWriter *writer)
|
|||||||
ret = wres;
|
ret = wres;
|
||||||
goto ex;
|
goto ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
if (file->checksum_index > 0) {
|
if (file->checksum_index > 0) {
|
||||||
/* Add to file checksum */
|
/* Add to file checksum */
|
||||||
if (file_size - b * BLOCK_SIZE > BLOCK_SIZE)
|
if (file_size - b * BLOCK_SIZE > BLOCK_SIZE)
|
||||||
@ -447,9 +407,6 @@ int filesrc_writer_write_data(IsoImageWriter *writer)
|
|||||||
if (res <= 0)
|
if (res <= 0)
|
||||||
file->checksum_index = 0;
|
file->checksum_index = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
filesrc_close(file);
|
filesrc_close(file);
|
||||||
@ -484,9 +441,6 @@ int filesrc_writer_write_data(IsoImageWriter *writer)
|
|||||||
ret = res;
|
ret = res;
|
||||||
goto ex;
|
goto ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
if (file->checksum_index > 0) {
|
if (file->checksum_index > 0) {
|
||||||
/* Add to file checksum */
|
/* Add to file checksum */
|
||||||
if (file_size - b * BLOCK_SIZE > BLOCK_SIZE)
|
if (file_size - b * BLOCK_SIZE > BLOCK_SIZE)
|
||||||
@ -497,14 +451,8 @@ int filesrc_writer_write_data(IsoImageWriter *writer)
|
|||||||
if (res <= 0)
|
if (res <= 0)
|
||||||
file->checksum_index = 0;
|
file->checksum_index = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
if (file->checksum_index > 0 &&
|
if (file->checksum_index > 0 &&
|
||||||
file->checksum_index <= t->checksum_idx_counter) {
|
file->checksum_index <= t->checksum_idx_counter) {
|
||||||
/* Obtain checksum and dispose checksum context */
|
/* Obtain checksum and dispose checksum context */
|
||||||
@ -529,19 +477,12 @@ int filesrc_writer_write_data(IsoImageWriter *writer)
|
|||||||
/* Write md5 into checksum buffer at file->checksum_index */
|
/* Write md5 into checksum buffer at file->checksum_index */
|
||||||
memcpy(t->checksum_buffer + 16 * file->checksum_index, md5, 16);
|
memcpy(t->checksum_buffer + 16 * file->checksum_index, md5, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = ISO_SUCCESS;
|
ret = ISO_SUCCESS;
|
||||||
ex:;
|
ex:;
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
if (ctx != NULL) /* avoid any memory leak */
|
if (ctx != NULL) /* avoid any memory leak */
|
||||||
iso_md5_end(&ctx, md5);
|
iso_md5_end(&ctx, md5);
|
||||||
#endif
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,14 +18,8 @@
|
|||||||
struct Iso_File_Src
|
struct Iso_File_Src
|
||||||
{
|
{
|
||||||
unsigned int prev_img :1; /**< if the file comes from a previous image */
|
unsigned int prev_img :1; /**< if the file comes from a previous image */
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
unsigned int checksum_index :31;
|
unsigned int checksum_index :31;
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
|
|
||||||
/** File Sections of the file in the image */
|
/** File Sections of the file in the image */
|
||||||
struct iso_file_section *sections;
|
struct iso_file_section *sections;
|
||||||
int nsections;
|
int nsections;
|
||||||
|
@ -2439,9 +2439,6 @@ int iso_image_filesystem_new(IsoDataSource *src, struct iso_read_opts *opts,
|
|||||||
ifs->free = ifs_fs_free;
|
ifs->free = ifs_fs_free;
|
||||||
|
|
||||||
/* read Volume Descriptors and ensure it is a valid image */
|
/* read Volume Descriptors and ensure it is a valid image */
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
if (data->md5_load) {
|
if (data->md5_load) {
|
||||||
/* From opts->block on : check for superblock and tree tags */;
|
/* From opts->block on : check for superblock and tree tags */;
|
||||||
ret = iso_src_check_sb_tree(src, opts->block, 0);
|
ret = iso_src_check_sb_tree(src, opts->block, 0);
|
||||||
@ -2456,8 +2453,6 @@ int iso_image_filesystem_new(IsoDataSource *src, struct iso_read_opts *opts,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
/* 1. first, open the filesystem */
|
/* 1. first, open the filesystem */
|
||||||
ifs_fs_open(ifs);
|
ifs_fs_open(ifs);
|
||||||
|
|
||||||
@ -3128,8 +3123,6 @@ int iso_image_import(IsoImage *image, IsoDataSource *src,
|
|||||||
uint8_t *rpt;
|
uint8_t *rpt;
|
||||||
IsoFileSource *boot_src;
|
IsoFileSource *boot_src;
|
||||||
IsoNode *node;
|
IsoNode *node;
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
uint32_t old_checksum_start_lba;
|
uint32_t old_checksum_start_lba;
|
||||||
uint32_t old_checksum_end_lba;
|
uint32_t old_checksum_end_lba;
|
||||||
uint32_t old_checksum_idx_count;
|
uint32_t old_checksum_idx_count;
|
||||||
@ -3139,7 +3132,6 @@ int iso_image_import(IsoImage *image, IsoDataSource *src,
|
|||||||
size_t size;
|
size_t size;
|
||||||
void *ctx = NULL;
|
void *ctx = NULL;
|
||||||
char md5[16];
|
char md5[16];
|
||||||
#endif
|
|
||||||
|
|
||||||
if (image == NULL || src == NULL || opts == NULL) {
|
if (image == NULL || src == NULL || opts == NULL) {
|
||||||
return ISO_NULL_POINTER;
|
return ISO_NULL_POINTER;
|
||||||
@ -3181,14 +3173,11 @@ int iso_image_import(IsoImage *image, IsoDataSource *src,
|
|||||||
oldroot = image->root;
|
oldroot = image->root;
|
||||||
oldbootcat = image->bootcat; /* could be NULL */
|
oldbootcat = image->bootcat; /* could be NULL */
|
||||||
image->bootcat = NULL;
|
image->bootcat = NULL;
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
old_checksum_start_lba = image->checksum_start_lba;
|
old_checksum_start_lba = image->checksum_start_lba;
|
||||||
old_checksum_end_lba = image->checksum_end_lba;
|
old_checksum_end_lba = image->checksum_end_lba;
|
||||||
old_checksum_idx_count = image->checksum_idx_count;
|
old_checksum_idx_count = image->checksum_idx_count;
|
||||||
old_checksum_array = image->checksum_array;
|
old_checksum_array = image->checksum_array;
|
||||||
image->checksum_array = NULL;
|
image->checksum_array = NULL;
|
||||||
#endif
|
|
||||||
|
|
||||||
/* create new builder */
|
/* create new builder */
|
||||||
ret = iso_image_builder_new(blback, &image->builder);
|
ret = iso_image_builder_new(blback, &image->builder);
|
||||||
@ -3363,8 +3352,6 @@ int iso_image_import(IsoImage *image, IsoDataSource *src,
|
|||||||
(*features)->size = data->nblocks;
|
(*features)->size = data->nblocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
if (data->md5_load) {
|
if (data->md5_load) {
|
||||||
/* Read checksum array */
|
/* Read checksum array */
|
||||||
ret = iso_root_get_isofsca((IsoNode *) image->root,
|
ret = iso_root_get_isofsca((IsoNode *) image->root,
|
||||||
@ -3417,8 +3404,6 @@ int iso_image_import(IsoImage *image, IsoDataSource *src,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
ret = iso_image_eval_boot_info_table(image, opts, src, data->nblocks, 0);
|
ret = iso_image_eval_boot_info_table(image, opts, src, data->nblocks, 0);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto import_revert;
|
goto import_revert;
|
||||||
@ -3432,14 +3417,11 @@ int iso_image_import(IsoImage *image, IsoDataSource *src,
|
|||||||
el_torito_boot_catalog_free(image->bootcat);
|
el_torito_boot_catalog_free(image->bootcat);
|
||||||
image->root = oldroot;
|
image->root = oldroot;
|
||||||
image->bootcat = oldbootcat;
|
image->bootcat = oldbootcat;
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
old_checksum_start_lba = image->checksum_start_lba;
|
old_checksum_start_lba = image->checksum_start_lba;
|
||||||
old_checksum_end_lba = image->checksum_end_lba;
|
old_checksum_end_lba = image->checksum_end_lba;
|
||||||
old_checksum_idx_count = image->checksum_idx_count;
|
old_checksum_idx_count = image->checksum_idx_count;
|
||||||
image->checksum_array = old_checksum_array;
|
image->checksum_array = old_checksum_array;
|
||||||
old_checksum_array = NULL;
|
old_checksum_array = NULL;
|
||||||
#endif
|
|
||||||
|
|
||||||
import_cleanup:;
|
import_cleanup:;
|
||||||
|
|
||||||
@ -3450,14 +3432,10 @@ int iso_image_import(IsoImage *image, IsoDataSource *src,
|
|||||||
iso_file_source_unref(newroot);
|
iso_file_source_unref(newroot);
|
||||||
fs->close(fs);
|
fs->close(fs);
|
||||||
iso_filesystem_unref(fs);
|
iso_filesystem_unref(fs);
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
if (old_checksum_array != NULL)
|
if (old_checksum_array != NULL)
|
||||||
free(old_checksum_array);
|
free(old_checksum_array);
|
||||||
if (ctx != NULL)
|
if (ctx != NULL)
|
||||||
iso_md5_end(&ctx, md5);
|
iso_md5_end(&ctx, md5);
|
||||||
#endif
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,14 +81,10 @@ int iso_image_new(const char *name, IsoImage **image)
|
|||||||
img->inode_counter = 0;
|
img->inode_counter = 0;
|
||||||
img->used_inodes = NULL;
|
img->used_inodes = NULL;
|
||||||
img->used_inodes_start = 0;
|
img->used_inodes_start = 0;
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
img->checksum_start_lba = 0;
|
img->checksum_start_lba = 0;
|
||||||
img->checksum_end_lba = 0;
|
img->checksum_end_lba = 0;
|
||||||
img->checksum_idx_count = 0;
|
img->checksum_idx_count = 0;
|
||||||
img->checksum_array = NULL;
|
img->checksum_array = NULL;
|
||||||
#endif
|
|
||||||
|
|
||||||
*image = img;
|
*image = img;
|
||||||
return ISO_SUCCESS;
|
return ISO_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -145,17 +141,12 @@ void iso_image_unref(IsoImage *image)
|
|||||||
|
|
||||||
int iso_image_free_checksums(IsoImage *image, int flag)
|
int iso_image_free_checksums(IsoImage *image, int flag)
|
||||||
{
|
{
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
image->checksum_start_lba = 0;
|
image->checksum_start_lba = 0;
|
||||||
image->checksum_end_lba = 0;
|
image->checksum_end_lba = 0;
|
||||||
image->checksum_idx_count = 0;
|
image->checksum_idx_count = 0;
|
||||||
if (image->checksum_array != NULL)
|
if (image->checksum_array != NULL)
|
||||||
free(image->checksum_array);
|
free(image->checksum_array);
|
||||||
image->checksum_array = NULL;
|
image->checksum_array = NULL;
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -592,39 +583,23 @@ ex:;
|
|||||||
int iso_image_get_session_md5(IsoImage *image, uint32_t *start_lba,
|
int iso_image_get_session_md5(IsoImage *image, uint32_t *start_lba,
|
||||||
uint32_t *end_lba, char md5[16], int flag)
|
uint32_t *end_lba, char md5[16], int flag)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
if (image->checksum_array == NULL || image->checksum_idx_count < 1)
|
if (image->checksum_array == NULL || image->checksum_idx_count < 1)
|
||||||
return 0;
|
return 0;
|
||||||
*start_lba = image->checksum_start_lba;
|
*start_lba = image->checksum_start_lba;
|
||||||
*end_lba = image->checksum_end_lba;
|
*end_lba = image->checksum_end_lba;
|
||||||
memcpy(md5, image->checksum_array, 16);
|
memcpy(md5, image->checksum_array, 16);
|
||||||
return ISO_SUCCESS;
|
return ISO_SUCCESS;
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
#endif /* ! Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int iso_image_set_checksums(IsoImage *image, char *checksum_array,
|
int iso_image_set_checksums(IsoImage *image, char *checksum_array,
|
||||||
uint32_t start_lba, uint32_t end_lba,
|
uint32_t start_lba, uint32_t end_lba,
|
||||||
uint32_t idx_count, int flag)
|
uint32_t idx_count, int flag)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
iso_image_free_checksums(image, 0);
|
iso_image_free_checksums(image, 0);
|
||||||
image->checksum_array = checksum_array;
|
image->checksum_array = checksum_array;
|
||||||
image->checksum_start_lba = start_lba;
|
image->checksum_start_lba = start_lba;
|
||||||
image->checksum_end_lba = end_lba;
|
image->checksum_end_lba = end_lba;
|
||||||
image->checksum_idx_count = idx_count;
|
image->checksum_idx_count = idx_count;
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,8 +154,6 @@ struct Iso_Image
|
|||||||
uint8_t *used_inodes;
|
uint8_t *used_inodes;
|
||||||
ino_t used_inodes_start;
|
ino_t used_inodes_start;
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Array of MD5 checksums as announced by xattr "isofs.ca" of the
|
* Array of MD5 checksums as announced by xattr "isofs.ca" of the
|
||||||
* root node. Array element 0 contains an overall image checksum for the
|
* root node. Array element 0 contains an overall image checksum for the
|
||||||
@ -168,8 +166,6 @@ struct Iso_Image
|
|||||||
uint32_t checksum_idx_count;
|
uint32_t checksum_idx_count;
|
||||||
char *checksum_array;
|
char *checksum_array;
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -6160,13 +6160,7 @@ struct burn_source {
|
|||||||
|
|
||||||
/* ---------------------------- Improvements --------------------------- */
|
/* ---------------------------- Improvements --------------------------- */
|
||||||
|
|
||||||
|
/* currently none being tested */
|
||||||
/* Checksums : During image writing equip IsoFile objects with MD5 checksums
|
|
||||||
and compute an overall checksum of the session. Store them in
|
|
||||||
a separate checksum block area after the data area of the
|
|
||||||
session.
|
|
||||||
*/
|
|
||||||
#define Libisofs_with_checksumS yes
|
|
||||||
|
|
||||||
|
|
||||||
/* ---------------------------- Experiments ---------------------------- */
|
/* ---------------------------- Experiments ---------------------------- */
|
||||||
|
@ -430,8 +430,6 @@ int checksum_md5_xinfo_func(void *data, int flag)
|
|||||||
|
|
||||||
/* MD5 checksum image writer */
|
/* MD5 checksum image writer */
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@flag bit0= recursion
|
@flag bit0= recursion
|
||||||
bit1= session will be appended to an existing image
|
bit1= session will be appended to an existing image
|
||||||
@ -508,15 +506,10 @@ int checksum_copy_old_nodes(Ecma119Image *target, IsoNode *node, int flag)
|
|||||||
return ISO_SUCCESS;
|
return ISO_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
|
|
||||||
static
|
static
|
||||||
int checksum_writer_compute_data_blocks(IsoImageWriter *writer)
|
int checksum_writer_compute_data_blocks(IsoImageWriter *writer)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
size_t size;
|
size_t size;
|
||||||
Ecma119Image *t;
|
Ecma119Image *t;
|
||||||
int ret;
|
int ret;
|
||||||
@ -557,9 +550,6 @@ int checksum_writer_compute_data_blocks(IsoImageWriter *writer)
|
|||||||
t->checksum_idx_counter + 2, 16, "MD5", 0);
|
t->checksum_idx_counter + 2, 16, "MD5", 0);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
return ISO_SUCCESS;
|
return ISO_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -580,9 +570,6 @@ int checksum_writer_write_vol_desc(IsoImageWriter *writer)
|
|||||||
static
|
static
|
||||||
int checksum_writer_write_data(IsoImageWriter *writer)
|
int checksum_writer_write_data(IsoImageWriter *writer)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
int wres, res;
|
int wres, res;
|
||||||
size_t i, size;
|
size_t i, size;
|
||||||
Ecma119Image *t;
|
Ecma119Image *t;
|
||||||
@ -649,12 +636,6 @@ ex:;
|
|||||||
if (ctx != NULL)
|
if (ctx != NULL)
|
||||||
iso_md5_end(&ctx, md5);
|
iso_md5_end(&ctx, md5);
|
||||||
return(res);
|
return(res);
|
||||||
|
|
||||||
#else /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
return ISO_SUCCESS;
|
|
||||||
|
|
||||||
#endif /* ! Libisofs_with_checksumS */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -684,17 +665,11 @@ int checksum_writer_create(Ecma119Image *target)
|
|||||||
|
|
||||||
/* add this writer to image */
|
/* add this writer to image */
|
||||||
target->writers[target->nwriters++] = writer;
|
target->writers[target->nwriters++] = writer;
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
/* Account for superblock checksum tag */
|
/* Account for superblock checksum tag */
|
||||||
if (target->md5_session_checksum) {
|
if (target->md5_session_checksum) {
|
||||||
target->checksum_sb_tag_pos = target->curblock;
|
target->checksum_sb_tag_pos = target->curblock;
|
||||||
target->curblock++;
|
target->curblock++;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
return ISO_SUCCESS;
|
return ISO_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -702,9 +677,6 @@ int checksum_writer_create(Ecma119Image *target)
|
|||||||
static
|
static
|
||||||
int iso_md5_write_scdbackup_tag(Ecma119Image *t, char *tag_block, int flag)
|
int iso_md5_write_scdbackup_tag(Ecma119Image *t, char *tag_block, int flag)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
void *ctx = NULL;
|
void *ctx = NULL;
|
||||||
off_t pos = 0, line_start;
|
off_t pos = 0, line_start;
|
||||||
int record_len, block_len, res, i;
|
int record_len, block_len, res, i;
|
||||||
@ -753,12 +725,6 @@ ex:;
|
|||||||
if (ctx != NULL)
|
if (ctx != NULL)
|
||||||
iso_md5_end(&ctx, md5);
|
iso_md5_end(&ctx, md5);
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
return ISO_SUCCESS;
|
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -772,9 +738,6 @@ ex:;
|
|||||||
*/
|
*/
|
||||||
int iso_md5_write_tag(Ecma119Image *t, int flag)
|
int iso_md5_write_tag(Ecma119Image *t, int flag)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
int res, mode, l, i, wres, tag_id_len;
|
int res, mode, l, i, wres, tag_id_len;
|
||||||
void *ctx = NULL;
|
void *ctx = NULL;
|
||||||
char md5[16], tag_block[2048], *tag_id;
|
char md5[16], tag_block[2048], *tag_id;
|
||||||
@ -863,13 +826,6 @@ ex:;
|
|||||||
if (ctx != NULL)
|
if (ctx != NULL)
|
||||||
iso_md5_end(&ctx, md5);
|
iso_md5_end(&ctx, md5);
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
#else /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
return ISO_SUCCESS;
|
|
||||||
|
|
||||||
#endif /* ! Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2660,9 +2660,6 @@ ex:;
|
|||||||
/* API */
|
/* API */
|
||||||
int iso_file_get_md5(IsoImage *image, IsoFile *file, char md5[16], int flag)
|
int iso_file_get_md5(IsoImage *image, IsoFile *file, char md5[16], int flag)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
int ret, i;
|
int ret, i;
|
||||||
size_t value_len;
|
size_t value_len;
|
||||||
char *value = NULL;
|
char *value = NULL;
|
||||||
@ -2702,21 +2699,12 @@ ex:;
|
|||||||
if (value != NULL)
|
if (value != NULL)
|
||||||
free(value);
|
free(value);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
#endif /* ! Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* API */
|
/* API */
|
||||||
int iso_file_make_md5(IsoFile *file, int flag)
|
int iso_file_make_md5(IsoFile *file, int flag)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
int ret, dig = 0;
|
int ret, dig = 0;
|
||||||
char *md5 = NULL;
|
char *md5 = NULL;
|
||||||
|
|
||||||
@ -2737,13 +2725,6 @@ int iso_file_make_md5(IsoFile *file, int flag)
|
|||||||
ret = 1;
|
ret = 1;
|
||||||
ex:;
|
ex:;
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
return ISO_ERROR;
|
|
||||||
|
|
||||||
#endif /* ! Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -864,9 +864,6 @@ int iso_stream_read_buffer(IsoStream *stream, char *buf, size_t count,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
|
|
||||||
/* @param flag bit0= dig out most original stream (e.g. because from old image)
|
/* @param flag bit0= dig out most original stream (e.g. because from old image)
|
||||||
@return 1=ok, md5 is valid,
|
@return 1=ok, md5 is valid,
|
||||||
0= not ok,
|
0= not ok,
|
||||||
@ -923,6 +920,3 @@ ex:;
|
|||||||
iso_md5_end(&ctx, md5);
|
iso_md5_end(&ctx, md5);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user