Removed development marks and an obsolete conditional compilation case.
This commit is contained in:
parent
90f37b8183
commit
d5c4af7378
@ -265,7 +265,7 @@ int ecma119_writer_compute_data_blocks(IsoImageWriter *writer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (target->partition_offset > 0) {
|
if (target->partition_offset > 0) {
|
||||||
/* TWINTREE: take into respect second directory tree */
|
/* Take into respect the second directory tree */
|
||||||
ndirs = target->ndirs;
|
ndirs = target->ndirs;
|
||||||
target->ndirs = 0;
|
target->ndirs = 0;
|
||||||
calc_dir_pos(target, target->partition_root);
|
calc_dir_pos(target, target->partition_root);
|
||||||
@ -274,7 +274,7 @@ int ecma119_writer_compute_data_blocks(IsoImageWriter *writer)
|
|||||||
"Number of directories differs in ECMA-119 partiton_tree");
|
"Number of directories differs in ECMA-119 partiton_tree");
|
||||||
return ISO_ASSERT_FAILURE;
|
return ISO_ASSERT_FAILURE;
|
||||||
}
|
}
|
||||||
/* TWINTREE: take into respect second set of path tables */
|
/* Take into respect the second set of path tables */
|
||||||
path_table_size = calc_path_table_size(target->partition_root);
|
path_table_size = calc_path_table_size(target->partition_root);
|
||||||
target->partition_l_table_pos = target->curblock;
|
target->partition_l_table_pos = target->curblock;
|
||||||
target->curblock += DIV_UP(path_table_size, BLOCK_SIZE);
|
target->curblock += DIV_UP(path_table_size, BLOCK_SIZE);
|
||||||
@ -350,7 +350,6 @@ void write_one_dir_record(Ecma119Image *t, Ecma119Node *node, int file_id,
|
|||||||
node = node->parent;
|
node = node->parent;
|
||||||
|
|
||||||
rec->len_dr[0] = len_dr + (info != NULL ? info->suf_len : 0);
|
rec->len_dr[0] = len_dr + (info != NULL ? info->suf_len : 0);
|
||||||
/* TWINTREE: - t->eff_partition_offset */
|
|
||||||
iso_bb(rec->block, block - t->eff_partition_offset, 4);
|
iso_bb(rec->block, block - t->eff_partition_offset, 4);
|
||||||
iso_bb(rec->length, len, 4);
|
iso_bb(rec->length, len, 4);
|
||||||
if (t->dir_rec_mtime) {
|
if (t->dir_rec_mtime) {
|
||||||
@ -439,18 +438,15 @@ int ecma119_writer_write_vol_desc(IsoImageWriter *writer)
|
|||||||
vol.vol_desc_version[0] = 1;
|
vol.vol_desc_version[0] = 1;
|
||||||
strncpy_pad((char*)vol.system_id, system_id, 32);
|
strncpy_pad((char*)vol.system_id, system_id, 32);
|
||||||
strncpy_pad((char*)vol.volume_id, vol_id, 32);
|
strncpy_pad((char*)vol.volume_id, vol_id, 32);
|
||||||
|
|
||||||
/* TWINTREE: - t->eff_partition_offset */
|
|
||||||
iso_bb(vol.vol_space_size, t->vol_space_size - t->eff_partition_offset,
|
iso_bb(vol.vol_space_size, t->vol_space_size - t->eff_partition_offset,
|
||||||
4);
|
4);
|
||||||
|
|
||||||
iso_bb(vol.vol_set_size, (uint32_t) 1, 2);
|
iso_bb(vol.vol_set_size, (uint32_t) 1, 2);
|
||||||
iso_bb(vol.vol_seq_number, (uint32_t) 1, 2);
|
iso_bb(vol.vol_seq_number, (uint32_t) 1, 2);
|
||||||
iso_bb(vol.block_size, (uint32_t) BLOCK_SIZE, 2);
|
iso_bb(vol.block_size, (uint32_t) BLOCK_SIZE, 2);
|
||||||
iso_bb(vol.path_table_size, t->path_table_size, 4);
|
iso_bb(vol.path_table_size, t->path_table_size, 4);
|
||||||
|
|
||||||
if (t->eff_partition_offset > 0) {
|
if (t->eff_partition_offset > 0) {
|
||||||
/* TWINTREE: point to second tables and second root */
|
/* Point to second tables and second root */
|
||||||
iso_lsb(vol.l_path_table_pos,
|
iso_lsb(vol.l_path_table_pos,
|
||||||
t->partition_l_table_pos - t->eff_partition_offset, 4);
|
t->partition_l_table_pos - t->eff_partition_offset, 4);
|
||||||
iso_msb(vol.m_path_table_pos,
|
iso_msb(vol.m_path_table_pos,
|
||||||
@ -679,7 +675,6 @@ int write_path_table(Ecma119Image *t, Ecma119Node **pathlist, int l_type)
|
|||||||
rec = (struct ecma119_path_table_record*) buf;
|
rec = (struct ecma119_path_table_record*) buf;
|
||||||
rec->len_di[0] = dir->parent ? (uint8_t) strlen(dir->iso_name) : 1;
|
rec->len_di[0] = dir->parent ? (uint8_t) strlen(dir->iso_name) : 1;
|
||||||
rec->len_xa[0] = 0;
|
rec->len_xa[0] = 0;
|
||||||
/* TWINTREE: - t->eff_partition_offset */
|
|
||||||
write_int(rec->block, dir->info.dir->block - t->eff_partition_offset,
|
write_int(rec->block, dir->info.dir->block - t->eff_partition_offset,
|
||||||
4);
|
4);
|
||||||
write_int(rec->parent, parent + 1, 2);
|
write_int(rec->parent, parent + 1, 2);
|
||||||
@ -721,7 +716,6 @@ int write_path_tables(Ecma119Image *t)
|
|||||||
return ISO_OUT_OF_MEM;
|
return ISO_OUT_OF_MEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TWINTREE: t->partition_root */
|
|
||||||
if (t->eff_partition_offset > 0) {
|
if (t->eff_partition_offset > 0) {
|
||||||
pathlist[0] = t->partition_root;
|
pathlist[0] = t->partition_root;
|
||||||
} else {
|
} else {
|
||||||
@ -770,7 +764,6 @@ int ecma119_writer_write_dirs(IsoImageWriter *writer)
|
|||||||
t = writer->target;
|
t = writer->target;
|
||||||
|
|
||||||
/* first of all, we write the directory structure */
|
/* first of all, we write the directory structure */
|
||||||
/* TWINTREE: t->root -> root */
|
|
||||||
if (t->eff_partition_offset > 0) {
|
if (t->eff_partition_offset > 0) {
|
||||||
root = t->partition_root;
|
root = t->partition_root;
|
||||||
|
|
||||||
@ -845,7 +838,6 @@ int ecma119_writer_write_data(IsoImageWriter *writer)
|
|||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if (t->partition_offset > 0) {
|
if (t->partition_offset > 0) {
|
||||||
/* TWINTREE: */
|
|
||||||
t->eff_partition_offset = t->partition_offset;
|
t->eff_partition_offset = t->partition_offset;
|
||||||
ret = ecma119_writer_write_dirs(writer);
|
ret = ecma119_writer_write_dirs(writer);
|
||||||
t->eff_partition_offset = 0;
|
t->eff_partition_offset = 0;
|
||||||
@ -888,7 +880,6 @@ int ecma119_writer_create(Ecma119Image *target)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TWINTREE: */
|
|
||||||
if(target->partition_offset > 0) {
|
if(target->partition_offset > 0) {
|
||||||
/* Create second tree */
|
/* Create second tree */
|
||||||
target->eff_partition_offset = target->partition_offset;
|
target->eff_partition_offset = target->partition_offset;
|
||||||
@ -914,7 +905,6 @@ int pad_writer_compute_data_blocks(IsoImageWriter *writer)
|
|||||||
return ISO_ASSERT_FAILURE;
|
return ISO_ASSERT_FAILURE;
|
||||||
}
|
}
|
||||||
target = writer->target;
|
target = writer->target;
|
||||||
/* TWINTREE: */
|
|
||||||
min_size = 32 + target->partition_offset;
|
min_size = 32 + target->partition_offset;
|
||||||
if (target->curblock < min_size) {
|
if (target->curblock < min_size) {
|
||||||
target->pad_blocks = min_size - target->curblock;
|
target->pad_blocks = min_size - target->curblock;
|
||||||
@ -1079,7 +1069,7 @@ int write_head_part2(Ecma119Image *target, int *write_count, int flag)
|
|||||||
if (target->partition_offset <= 0)
|
if (target->partition_offset <= 0)
|
||||||
return ISO_SUCCESS;
|
return ISO_SUCCESS;
|
||||||
|
|
||||||
/* TWINTREE: write padding up to target->partition_offset + 16 */
|
/* Write padding up to target->partition_offset + 16 */
|
||||||
memset(buf, 0, 2048);
|
memset(buf, 0, 2048);
|
||||||
for(; *write_count < target->partition_offset + 16; (*write_count)++) {
|
for(; *write_count < target->partition_offset + 16; (*write_count)++) {
|
||||||
res = iso_write(target, buf, BLOCK_SIZE);
|
res = iso_write(target, buf, BLOCK_SIZE);
|
||||||
@ -1087,17 +1077,18 @@ int write_head_part2(Ecma119Image *target, int *write_count, int flag)
|
|||||||
goto write_error;
|
goto write_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TWINTREE: write volume descriptors subtracting
|
/* Write volume descriptors subtracting
|
||||||
target->partiton_offset from any LBA pointer.
|
target->partiton_offset from any LBA pointer.
|
||||||
*/
|
*/
|
||||||
target->eff_partition_offset = target->partition_offset;
|
target->eff_partition_offset = target->partition_offset;
|
||||||
for (i = 0; i < target->nwriters; ++i) {
|
for (i = 0; i < target->nwriters; ++i) {
|
||||||
writer = target->writers[i];
|
writer = target->writers[i];
|
||||||
/* TWINTREE:
|
/* Not all writers have an entry in the partion volume descriptor set.
|
||||||
Not all writers have an entry in the partion volume descriptor set.
|
|
||||||
It must be guaranteed that they write exactly one block.
|
It must be guaranteed that they write exactly one block.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* >>> TWINTREE: Enhance ISO1999 writer and add it here */
|
/* >>> TWINTREE: Enhance ISO1999 writer and add it here */
|
||||||
|
|
||||||
if(writer->write_vol_desc != ecma119_writer_write_vol_desc &&
|
if(writer->write_vol_desc != ecma119_writer_write_vol_desc &&
|
||||||
writer->write_vol_desc != joliet_writer_write_vol_desc)
|
writer->write_vol_desc != joliet_writer_write_vol_desc)
|
||||||
continue;
|
continue;
|
||||||
@ -1183,10 +1174,7 @@ void *write_function(void *arg)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
write_error: ;
|
write_error: ;
|
||||||
|
|
||||||
/* TWINTREE: */
|
|
||||||
target->eff_partition_offset = 0;
|
target->eff_partition_offset = 0;
|
||||||
|
|
||||||
if (res == ISO_CANCELED) {
|
if (res == ISO_CANCELED) {
|
||||||
/* canceled */
|
/* canceled */
|
||||||
iso_msg_submit(target->image->id, ISO_IMAGE_WRITE_CANCELED, 0, NULL);
|
iso_msg_submit(target->image->id, ISO_IMAGE_WRITE_CANCELED, 0, NULL);
|
||||||
@ -1304,9 +1292,6 @@ int checksum_prepare_nodes(Ecma119Image *target, IsoNode *node, int flag)
|
|||||||
return ISO_SUCCESS;
|
return ISO_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
*/
|
|
||||||
#define Libisofs_twintreE yes
|
|
||||||
|
|
||||||
static
|
static
|
||||||
int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
||||||
@ -1417,7 +1402,6 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
|||||||
target->vol_effective_time = opts->vol_effective_time;
|
target->vol_effective_time = opts->vol_effective_time;
|
||||||
strcpy(target->vol_uuid, opts->vol_uuid);
|
strcpy(target->vol_uuid, opts->vol_uuid);
|
||||||
|
|
||||||
/* TWINTREE: */
|
|
||||||
target->partition_offset = opts->partition_offset;
|
target->partition_offset = opts->partition_offset;
|
||||||
target->partition_secs_per_head = opts->partition_secs_per_head;
|
target->partition_secs_per_head = opts->partition_secs_per_head;
|
||||||
target->partition_heads_per_cyl = opts->partition_heads_per_cyl;
|
target->partition_heads_per_cyl = opts->partition_heads_per_cyl;
|
||||||
@ -1474,7 +1458,7 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
|||||||
|
|
||||||
if (opts->overwrite != NULL && target->ms_block != 0 &&
|
if (opts->overwrite != NULL && target->ms_block != 0 &&
|
||||||
target->ms_block < target->partition_offset + 32) {
|
target->ms_block < target->partition_offset + 32) {
|
||||||
/* TWINTREE: not enough room for superblock relocation */
|
/* Not enough room for superblock relocation */
|
||||||
ret = ISO_OVWRT_MS_TOO_SMALL;
|
ret = ISO_OVWRT_MS_TOO_SMALL;
|
||||||
goto target_cleanup;
|
goto target_cleanup;
|
||||||
}
|
}
|
||||||
@ -1572,24 +1556,26 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (target->partition_offset > 0) {
|
if (target->partition_offset > 0) {
|
||||||
/* >>> TWINTREE: After volume descriptors and superblock tag are
|
/* After volume descriptors and superblock tag are accounted for:
|
||||||
accounted for: account for second volset */
|
account for second volset
|
||||||
|
*/
|
||||||
if (target->ms_block + target->partition_offset + 16
|
if (target->ms_block + target->partition_offset + 16
|
||||||
< target->curblock) {
|
< target->curblock) {
|
||||||
/* TWINTREE: Overflow of partition system area */
|
/* Overflow of partition system area */
|
||||||
ret = ISO_PART_OFFST_TOO_SMALL;
|
ret = ISO_PART_OFFST_TOO_SMALL;
|
||||||
goto target_cleanup;
|
goto target_cleanup;
|
||||||
}
|
}
|
||||||
target->curblock = target->ms_block + target->partition_offset + 16;
|
target->curblock = target->ms_block + target->partition_offset + 16;
|
||||||
|
|
||||||
/* TWINTREE: Account for partition tree volume descriptors */
|
/* Account for partition tree volume descriptors */
|
||||||
for (i = 0; i < target->nwriters; ++i) {
|
for (i = 0; i < target->nwriters; ++i) {
|
||||||
/* Not all writers have an entry in the partition
|
/* Not all writers have an entry in the partition
|
||||||
volume descriptor set.
|
volume descriptor set.
|
||||||
*/
|
*/
|
||||||
writer = target->writers[i];
|
writer = target->writers[i];
|
||||||
|
|
||||||
/* >>> TWINTREE: Enhance ISO1999 writer and add it here */
|
/* >>> TWINTREE: Enhance ISO1999 writer and add it here */
|
||||||
|
|
||||||
if(writer->write_vol_desc != ecma119_writer_write_vol_desc &&
|
if(writer->write_vol_desc != ecma119_writer_write_vol_desc &&
|
||||||
writer->write_vol_desc != joliet_writer_write_vol_desc)
|
writer->write_vol_desc != joliet_writer_write_vol_desc)
|
||||||
continue;
|
continue;
|
||||||
@ -1642,8 +1628,7 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
|||||||
/* create the ring buffer */
|
/* create the ring buffer */
|
||||||
if (opts->overwrite != NULL &&
|
if (opts->overwrite != NULL &&
|
||||||
opts->fifo_size / 2048 < 32 + target->partition_offset) {
|
opts->fifo_size / 2048 < 32 + target->partition_offset) {
|
||||||
/* TWINTREE:
|
/* The ring buffer must be large enough to take opts->overwrite
|
||||||
The ring buffer must be large enough to take opts->overwrite
|
|
||||||
*/
|
*/
|
||||||
ret = ISO_OVWRT_FIFO_TOO_SMALL;
|
ret = ISO_OVWRT_FIFO_TOO_SMALL;
|
||||||
}
|
}
|
||||||
@ -1655,14 +1640,11 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
|||||||
/* check if we need to provide a copy of volume descriptors */
|
/* check if we need to provide a copy of volume descriptors */
|
||||||
if (opts->overwrite != NULL) {
|
if (opts->overwrite != NULL) {
|
||||||
|
|
||||||
/* >>> TWINTREE: >>>
|
/* opts->overwrite must be larger by partion_offset
|
||||||
opts->overwrite must be larger by partion_offset
|
|
||||||
This storage is provided by the application.
|
This storage is provided by the application.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifdef Libisofs_twintreE
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* In the PVM to be written in the 16th sector of the disc, we
|
* In the PVM to be written in the 16th sector of the disc, we
|
||||||
* need to specify the full size.
|
* need to specify the full size.
|
||||||
@ -1686,64 +1668,6 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
|||||||
goto target_cleanup;
|
goto target_cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* Libisofs_twintreE */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get a copy of the volume descriptors to be written in a DVD+RW
|
|
||||||
* disc
|
|
||||||
*/
|
|
||||||
|
|
||||||
uint8_t *buf;
|
|
||||||
struct ecma119_vol_desc_terminator *vol;
|
|
||||||
IsoImageWriter *writer;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* In the PVM to be written in the 16th sector of the disc, we
|
|
||||||
* need to specify the full size.
|
|
||||||
*/
|
|
||||||
target->vol_space_size = target->curblock;
|
|
||||||
|
|
||||||
/* write volume descriptor */
|
|
||||||
for (i = 0; i < target->nwriters; ++i) {
|
|
||||||
writer = target->writers[i];
|
|
||||||
ret = writer->write_vol_desc(writer);
|
|
||||||
if (ret < 0) {
|
|
||||||
iso_msg_debug(target->image->id,
|
|
||||||
"Error writing overwrite volume descriptors");
|
|
||||||
goto target_cleanup;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* write the system area to the start of the overwrite buffer */
|
|
||||||
ret = iso_write_system_area(target, opts->overwrite);
|
|
||||||
if (ret < 0) {
|
|
||||||
iso_msg_debug(target->image->id,
|
|
||||||
"Error writing system area to overwrite buffer");
|
|
||||||
goto target_cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* copy the volume descriptors to the overwrite buffer... */
|
|
||||||
buf = opts->overwrite + 16 * BLOCK_SIZE;
|
|
||||||
voldesc_size *= BLOCK_SIZE;
|
|
||||||
ret = iso_ring_buffer_read(target->buffer, buf, voldesc_size);
|
|
||||||
if (ret < 0) {
|
|
||||||
iso_msg_debug(target->image->id,
|
|
||||||
"Error reading overwrite volume descriptors");
|
|
||||||
goto target_cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ...including the vol desc terminator */
|
|
||||||
memset(buf + voldesc_size, 0, BLOCK_SIZE);
|
|
||||||
vol = (struct ecma119_vol_desc_terminator*) (buf + voldesc_size);
|
|
||||||
vol->vol_desc_type[0] = 255;
|
|
||||||
memcpy(vol->std_identifier, "CD001", 5);
|
|
||||||
vol->vol_desc_version[0] = 1;
|
|
||||||
|
|
||||||
write_count = voldesc_size / BLOCK_SIZE + 16;
|
|
||||||
write_count_mem= write_count;
|
|
||||||
|
|
||||||
#endif /* ! Libisofs_twintreE */
|
|
||||||
|
|
||||||
/* 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) {
|
||||||
@ -1777,13 +1701,13 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
|||||||
opts->overwrite[i * 2048] = 0;
|
opts->overwrite[i * 2048] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TWINTREE: Write second set of volume descriptors */
|
/* Write second set of volume descriptors */
|
||||||
write_count_mem= write_count;
|
write_count_mem= write_count;
|
||||||
ret = write_head_part2(target, &write_count, 0);
|
ret = write_head_part2(target, &write_count, 0);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto target_cleanup;
|
goto target_cleanup;
|
||||||
|
|
||||||
/* TWINTREE: read written data into opts->overwrite */
|
/* Read written data into opts->overwrite */
|
||||||
ret = iso_ring_buffer_read(target->buffer,
|
ret = iso_ring_buffer_read(target->buffer,
|
||||||
opts->overwrite + write_count_mem * BLOCK_SIZE,
|
opts->overwrite + write_count_mem * BLOCK_SIZE,
|
||||||
(write_count - write_count_mem) * BLOCK_SIZE);
|
(write_count - write_count_mem) * BLOCK_SIZE);
|
||||||
|
@ -314,13 +314,14 @@ struct iso_write_opts {
|
|||||||
*/
|
*/
|
||||||
char vol_uuid[17];
|
char vol_uuid[17];
|
||||||
|
|
||||||
/* TWINTREE: The number of unclaimed 2K blocks before
|
/* The number of unclaimed 2K blocks before start of partition 1 as of
|
||||||
start of partition 1 as of the MBR in system area.
|
the MBR in system area.
|
||||||
Must be 0 or >= 16. (Actually >= #voldescr + checksum tag) */
|
Must be 0 or >= 16. (Actually >= number of voldescr + checksum tag)
|
||||||
|
*/
|
||||||
uint32_t partition_offset;
|
uint32_t partition_offset;
|
||||||
/* TWINTREE: Partition table parameter: 1 to 63, 0= disabled/default */
|
/* Partition table parameter: 1 to 63, 0= disabled/default */
|
||||||
int partition_secs_per_head;
|
int partition_secs_per_head;
|
||||||
/* TWINTREE: 1 to 255, 0= disabled/default */
|
/* 1 to 255, 0= disabled/default */
|
||||||
int partition_heads_per_cyl;
|
int partition_heads_per_cyl;
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -542,25 +543,26 @@ struct ecma119_image
|
|||||||
*/
|
*/
|
||||||
char vol_uuid[17];
|
char vol_uuid[17];
|
||||||
|
|
||||||
/* TWINTREE: The number of unclaimed 2K blocks before
|
/* The number of unclaimed 2K blocks before
|
||||||
start of partition 1 as of the MBR in system area. */
|
start of partition 1 as of the MBR in system area. */
|
||||||
uint32_t partition_offset;
|
uint32_t partition_offset;
|
||||||
/* TWINTREE: Partition table parameter: 1 to 63, 0= disabled/default */
|
/* Partition table parameter: 1 to 63, 0= disabled/default */
|
||||||
int partition_secs_per_head;
|
int partition_secs_per_head;
|
||||||
/* TWINTREE: 1 to 255, 0= disabled/default */
|
/* 1 to 255, 0= disabled/default */
|
||||||
int partition_heads_per_cyl;
|
int partition_heads_per_cyl;
|
||||||
|
|
||||||
/* TWINTREE: The currently applicable LBA offset. To be subtracted from
|
/* The currently applicable LBA offset. To be subtracted from any LBA
|
||||||
any LBA that is mentioned in volume descriptors or
|
* that is mentioned in volume descriptors, trees, path tables,
|
||||||
ECMA-119 tree. Either 0 or .partition_offset */
|
* Either 0 or .partition_offset
|
||||||
|
*/
|
||||||
uint32_t eff_partition_offset;
|
uint32_t eff_partition_offset;
|
||||||
|
|
||||||
/* TWINTREE: The second ECMA-119 directory tree and path tables */
|
/* The second ECMA-119 directory tree and path tables */
|
||||||
Ecma119Node *partition_root;
|
Ecma119Node *partition_root;
|
||||||
uint32_t partition_l_table_pos;
|
uint32_t partition_l_table_pos;
|
||||||
uint32_t partition_m_table_pos;
|
uint32_t partition_m_table_pos;
|
||||||
|
|
||||||
/* TWINTREE: The second Joliet directory tree and path tables */
|
/* The second Joliet directory tree and path tables */
|
||||||
JolietNode *j_part_root;
|
JolietNode *j_part_root;
|
||||||
uint32_t j_part_l_path_table_pos;
|
uint32_t j_part_l_path_table_pos;
|
||||||
uint32_t j_part_m_path_table_pos;
|
uint32_t j_part_m_path_table_pos;
|
||||||
|
@ -724,7 +724,6 @@ int mangle_tree(Ecma119Image *img, int recurse)
|
|||||||
} else {
|
} else {
|
||||||
max_file = max_dir = 31;
|
max_file = max_dir = 31;
|
||||||
}
|
}
|
||||||
/* TWINTREE: */
|
|
||||||
if (img->eff_partition_offset > 0) {
|
if (img->eff_partition_offset > 0) {
|
||||||
root = img->partition_root;
|
root = img->partition_root;
|
||||||
} else {
|
} else {
|
||||||
@ -856,7 +855,6 @@ int reorder_tree(Ecma119Image *img, Ecma119Node *dir, int level, int pathlen)
|
|||||||
max_path = pathlen + 1 + max_child_name_len(dir);
|
max_path = pathlen + 1 + max_child_name_len(dir);
|
||||||
|
|
||||||
if (level > 8 || max_path > 255) {
|
if (level > 8 || max_path > 255) {
|
||||||
/* TWINTREE: */
|
|
||||||
if (img->eff_partition_offset > 0) {
|
if (img->eff_partition_offset > 0) {
|
||||||
root = img->partition_root;
|
root = img->partition_root;
|
||||||
} else {
|
} else {
|
||||||
@ -1069,7 +1067,6 @@ int ecma119_tree_create(Ecma119Image *img)
|
|||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
/* TWINTREE: */
|
|
||||||
if (img->eff_partition_offset > 0) {
|
if (img->eff_partition_offset > 0) {
|
||||||
img->partition_root = root;
|
img->partition_root = root;
|
||||||
} else {
|
} else {
|
||||||
@ -1077,7 +1074,6 @@ int ecma119_tree_create(Ecma119Image *img)
|
|||||||
}
|
}
|
||||||
|
|
||||||
iso_msg_debug(img->image->id, "Matching hardlinks...");
|
iso_msg_debug(img->image->id, "Matching hardlinks...");
|
||||||
/* TWINTREE: img->root -> root */
|
|
||||||
ret = match_hardlinks(img, root, 0);
|
ret = match_hardlinks(img, root, 0);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
return ret;
|
return ret;
|
||||||
@ -1095,7 +1091,6 @@ int ecma119_tree_create(Ecma119Image *img)
|
|||||||
if (img->rockridge && !img->allow_deep_paths) {
|
if (img->rockridge && !img->allow_deep_paths) {
|
||||||
|
|
||||||
/* reorder the tree, acording to RRIP, 4.1.5 */
|
/* reorder the tree, acording to RRIP, 4.1.5 */
|
||||||
/* TWINTREE: img->root -> root */
|
|
||||||
ret = reorder_tree(img, root, 1, 0);
|
ret = reorder_tree(img, root, 1, 0);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -1158,11 +1158,8 @@ int eltorito_writer_write_vol_desc(IsoImageWriter *writer)
|
|||||||
memcpy(vol.std_identifier, "CD001", 5);
|
memcpy(vol.std_identifier, "CD001", 5);
|
||||||
vol.vol_desc_version[0] = 1;
|
vol.vol_desc_version[0] = 1;
|
||||||
memcpy(vol.boot_sys_id, "EL TORITO SPECIFICATION", 23);
|
memcpy(vol.boot_sys_id, "EL TORITO SPECIFICATION", 23);
|
||||||
|
|
||||||
/* TWINTREE: t->cat->sections[0].block - t->eff_partition_offset */
|
|
||||||
iso_lsb(vol.boot_catalog,
|
iso_lsb(vol.boot_catalog,
|
||||||
t->cat->sections[0].block - t->eff_partition_offset, 4);
|
t->cat->sections[0].block - t->eff_partition_offset, 4);
|
||||||
|
|
||||||
return iso_write(t, &vol, sizeof(struct ecma119_boot_rec_vol_desc));
|
return iso_write(t, &vol, sizeof(struct ecma119_boot_rec_vol_desc));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -556,7 +556,6 @@ int joliet_tree_create(Ecma119Image *t)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* the Joliet tree is stored in Ecma119Image target */
|
/* the Joliet tree is stored in Ecma119Image target */
|
||||||
/* TWINTREE: */
|
|
||||||
if (t->eff_partition_offset > 0) {
|
if (t->eff_partition_offset > 0) {
|
||||||
t->j_part_root = root;
|
t->j_part_root = root;
|
||||||
} else {
|
} else {
|
||||||
@ -701,7 +700,7 @@ int joliet_writer_compute_data_blocks(IsoImageWriter *writer)
|
|||||||
t->joliet_path_table_size = path_table_size;
|
t->joliet_path_table_size = path_table_size;
|
||||||
|
|
||||||
if (t->partition_offset > 0) {
|
if (t->partition_offset > 0) {
|
||||||
/* TWINTREE: take into respect second directory tree */
|
/* Take into respect second directory tree */
|
||||||
ndirs = t->joliet_ndirs;
|
ndirs = t->joliet_ndirs;
|
||||||
t->joliet_ndirs = 0;
|
t->joliet_ndirs = 0;
|
||||||
calc_dir_pos(t, t->j_part_root);
|
calc_dir_pos(t, t->j_part_root);
|
||||||
@ -710,7 +709,7 @@ int joliet_writer_compute_data_blocks(IsoImageWriter *writer)
|
|||||||
"Number of directories differs in Joliet partiton_tree");
|
"Number of directories differs in Joliet partiton_tree");
|
||||||
return ISO_ASSERT_FAILURE;
|
return ISO_ASSERT_FAILURE;
|
||||||
}
|
}
|
||||||
/* TWINTREE: take into respect second set of path tables */
|
/* Take into respect second set of path tables */
|
||||||
path_table_size = calc_path_table_size(t->j_part_root);
|
path_table_size = calc_path_table_size(t->j_part_root);
|
||||||
t->j_part_l_path_table_pos = t->curblock;
|
t->j_part_l_path_table_pos = t->curblock;
|
||||||
t->curblock += DIV_UP(path_table_size, BLOCK_SIZE);
|
t->curblock += DIV_UP(path_table_size, BLOCK_SIZE);
|
||||||
@ -780,7 +779,6 @@ void write_one_dir_record(Ecma119Image *t, JolietNode *node, int file_id,
|
|||||||
node = node->parent;
|
node = node->parent;
|
||||||
|
|
||||||
rec->len_dr[0] = len_dr;
|
rec->len_dr[0] = len_dr;
|
||||||
/* TWINTREE: - t->eff_partition_offset */
|
|
||||||
iso_bb(rec->block, block - t->eff_partition_offset, 4);
|
iso_bb(rec->block, block - t->eff_partition_offset, 4);
|
||||||
iso_bb(rec->length, len, 4);
|
iso_bb(rec->length, len, 4);
|
||||||
iso_datetime_7(rec->recording_time, t->now, t->always_gmt);
|
iso_datetime_7(rec->recording_time, t->now, t->always_gmt);
|
||||||
@ -857,18 +855,15 @@ int joliet_writer_write_vol_desc(IsoImageWriter *writer)
|
|||||||
|
|
||||||
/* make use of UCS-2 Level 3 */
|
/* make use of UCS-2 Level 3 */
|
||||||
memcpy(vol.esc_sequences, "%/E", 3);
|
memcpy(vol.esc_sequences, "%/E", 3);
|
||||||
|
|
||||||
/* TWINTREE: - t->eff_partition_offset */
|
|
||||||
iso_bb(vol.vol_space_size, t->vol_space_size - t->eff_partition_offset,
|
iso_bb(vol.vol_space_size, t->vol_space_size - t->eff_partition_offset,
|
||||||
4);
|
4);
|
||||||
|
|
||||||
iso_bb(vol.vol_set_size, (uint32_t) 1, 2);
|
iso_bb(vol.vol_set_size, (uint32_t) 1, 2);
|
||||||
iso_bb(vol.vol_seq_number, (uint32_t) 1, 2);
|
iso_bb(vol.vol_seq_number, (uint32_t) 1, 2);
|
||||||
iso_bb(vol.block_size, (uint32_t) BLOCK_SIZE, 2);
|
iso_bb(vol.block_size, (uint32_t) BLOCK_SIZE, 2);
|
||||||
iso_bb(vol.path_table_size, t->joliet_path_table_size, 4);
|
iso_bb(vol.path_table_size, t->joliet_path_table_size, 4);
|
||||||
|
|
||||||
if (t->eff_partition_offset > 0) {
|
if (t->eff_partition_offset > 0) {
|
||||||
/* TWINTREE: point to second tables and second root */
|
/* Point to second tables and second root */
|
||||||
iso_lsb(vol.l_path_table_pos,
|
iso_lsb(vol.l_path_table_pos,
|
||||||
t->j_part_l_path_table_pos - t->eff_partition_offset, 4);
|
t->j_part_l_path_table_pos - t->eff_partition_offset, 4);
|
||||||
iso_msb(vol.m_path_table_pos,
|
iso_msb(vol.m_path_table_pos,
|
||||||
@ -1018,7 +1013,6 @@ int write_path_table(Ecma119Image *t, JolietNode **pathlist, int l_type)
|
|||||||
rec = (struct ecma119_path_table_record*) buf;
|
rec = (struct ecma119_path_table_record*) buf;
|
||||||
rec->len_di[0] = dir->parent ? (uint8_t) ucslen(dir->name) * 2 : 1;
|
rec->len_di[0] = dir->parent ? (uint8_t) ucslen(dir->name) * 2 : 1;
|
||||||
rec->len_xa[0] = 0;
|
rec->len_xa[0] = 0;
|
||||||
/* TWINTREE: - t->eff_partition_offset */
|
|
||||||
write_int(rec->block, dir->info.dir->block - t->eff_partition_offset,
|
write_int(rec->block, dir->info.dir->block - t->eff_partition_offset,
|
||||||
4);
|
4);
|
||||||
write_int(rec->parent, parent + 1, 2);
|
write_int(rec->parent, parent + 1, 2);
|
||||||
@ -1060,7 +1054,6 @@ int write_path_tables(Ecma119Image *t)
|
|||||||
return ISO_OUT_OF_MEM;
|
return ISO_OUT_OF_MEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TWINTREE: t->partition_root */
|
|
||||||
if (t->eff_partition_offset > 0) {
|
if (t->eff_partition_offset > 0) {
|
||||||
pathlist[0] = t->j_part_root;
|
pathlist[0] = t->j_part_root;
|
||||||
} else {
|
} else {
|
||||||
@ -1102,7 +1095,6 @@ int joliet_writer_write_dirs(IsoImageWriter *writer)
|
|||||||
t = writer->target;
|
t = writer->target;
|
||||||
|
|
||||||
/* first of all, we write the directory structure */
|
/* first of all, we write the directory structure */
|
||||||
/* TWINTREE: t->root -> root */
|
|
||||||
if (t->eff_partition_offset > 0) {
|
if (t->eff_partition_offset > 0) {
|
||||||
root = t->j_part_root;
|
root = t->j_part_root;
|
||||||
} else {
|
} else {
|
||||||
@ -1135,7 +1127,6 @@ int joliet_writer_write_data(IsoImageWriter *writer)
|
|||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if (t->partition_offset > 0) {
|
if (t->partition_offset > 0) {
|
||||||
/* TWINTREE: */
|
|
||||||
t->eff_partition_offset = t->partition_offset;
|
t->eff_partition_offset = t->partition_offset;
|
||||||
ret = joliet_writer_write_dirs(writer);
|
ret = joliet_writer_write_dirs(writer);
|
||||||
t->eff_partition_offset = 0;
|
t->eff_partition_offset = 0;
|
||||||
@ -1184,7 +1175,6 @@ int joliet_writer_create(Ecma119Image *target)
|
|||||||
/* add this writer to image */
|
/* add this writer to image */
|
||||||
target->writers[target->nwriters++] = writer;
|
target->writers[target->nwriters++] = writer;
|
||||||
|
|
||||||
/* TWINTREE: */
|
|
||||||
if(target->partition_offset > 0) {
|
if(target->partition_offset > 0) {
|
||||||
/* Create second tree */
|
/* Create second tree */
|
||||||
target->eff_partition_offset = target->partition_offset;
|
target->eff_partition_offset = target->partition_offset;
|
||||||
|
@ -55,7 +55,7 @@ struct joliet_node
|
|||||||
int joliet_writer_create(Ecma119Image *target);
|
int joliet_writer_create(Ecma119Image *target);
|
||||||
|
|
||||||
|
|
||||||
/* TWINTREE: Not to be called but only for comparison with target->writers[i]
|
/* Not to be called but only for comparison with target->writers[i]
|
||||||
*/
|
*/
|
||||||
int joliet_writer_write_vol_desc(IsoImageWriter *writer);
|
int joliet_writer_write_vol_desc(IsoImageWriter *writer);
|
||||||
|
|
||||||
|
@ -1713,7 +1713,8 @@ int iso_write_opts_set_ms_block(IsoWriteOpts *opts, uint32_t ms_block);
|
|||||||
* You should initialize the buffer either with 0s, or with the contents
|
* You should initialize the buffer either with 0s, or with the contents
|
||||||
* of the first 32 blocks of the image you are growing. In most cases,
|
* of the first 32 blocks of the image you are growing. In most cases,
|
||||||
* 0 is good enought.
|
* 0 is good enought.
|
||||||
* >>> TWINTREE: must be larger by partion_offset
|
* IMPORTANT: If you use iso_write_opts_set_part_offset() then the
|
||||||
|
* overwrite buffer must be larger by the offset defined there.
|
||||||
*
|
*
|
||||||
* @since 0.6.2
|
* @since 0.6.2
|
||||||
*/
|
*/
|
||||||
@ -1802,21 +1803,20 @@ int iso_write_opts_set_pvd_times(IsoWriteOpts *opts,
|
|||||||
char *vol_uuid);
|
char *vol_uuid);
|
||||||
|
|
||||||
|
|
||||||
/* CAUTION : Not yet completely implemented for checksums in the second tree
|
/*
|
||||||
* set and not yet tested for multi-session with overwrite buffer.
|
|
||||||
* Already usable for single session including bootability and
|
|
||||||
* Joliet directory tree.
|
|
||||||
*
|
|
||||||
* Control production of a second set of volume descriptors (superblock)
|
* Control production of a second set of volume descriptors (superblock)
|
||||||
* and directory trees, together with a partition table entry in the MBR which
|
* and directory trees, together with a partition table in the MBR where the
|
||||||
* has non-zero start address.
|
* first partition has non-zero start address and the others are zeroed.
|
||||||
* The second volume descriptor set and trees will allow to mount the ISO image
|
* The first partition stretches to the end of the whole ISO image.
|
||||||
* at the start of the first partition, while it is still possible to mount it
|
* The additional volume descriptor set and trees will allow to mount the
|
||||||
* via the normal first volume descriptor set and tree at the start of the
|
* ISO image at the start of the first partition, while it is still possible
|
||||||
* image resp. storage device.
|
* to mount it via the normal first volume descriptor set and tree at the
|
||||||
|
* start of the image resp. storage device.
|
||||||
* This makes few sense on optical media. But on USB sticks it creates a
|
* This makes few sense on optical media. But on USB sticks it creates a
|
||||||
* conventional partition table which makes it mountable on e.g. Linux via
|
* conventional partition table which makes it mountable on e.g. Linux via
|
||||||
* /dev/sdb and /dev/sdb1 alike.
|
* /dev/sdb and /dev/sdb1 alike.
|
||||||
|
* IMPORTANT: When submitting memory by iso_write_opts_set_overwrite_buf()
|
||||||
|
* then its size must be at least 64 KiB + partition offset.
|
||||||
*
|
*
|
||||||
* @param opts
|
* @param opts
|
||||||
* The option set to be manipulated.
|
* The option set to be manipulated.
|
||||||
@ -1824,7 +1824,7 @@ int iso_write_opts_set_pvd_times(IsoWriteOpts *opts,
|
|||||||
* The offset of the partition start relative to device start.
|
* The offset of the partition start relative to device start.
|
||||||
* This is counted in 2 kB blocks. The partition table will show the
|
* This is counted in 2 kB blocks. The partition table will show the
|
||||||
* according number of 512 byte sectors.
|
* according number of 512 byte sectors.
|
||||||
* Default is 0 which causes no second set and trees.
|
* Default is 0 which causes no special partition table preparations.
|
||||||
* If it is not 0 then it must not be smaller than 16.
|
* If it is not 0 then it must not be smaller than 16.
|
||||||
* @param secs_512_per_head
|
* @param secs_512_per_head
|
||||||
* Number of 512 byte sectors per head. 1 to 63. 0=automatic.
|
* Number of 512 byte sectors per head. 1 to 63. 0=automatic.
|
||||||
|
@ -184,7 +184,6 @@ int rrip_add_PL(Ecma119Image *t, Ecma119Node *n, struct susp_info *susp)
|
|||||||
PL[3] = 1;
|
PL[3] = 1;
|
||||||
|
|
||||||
/* write the location of the real parent, already computed */
|
/* write the location of the real parent, already computed */
|
||||||
/* TWINTREE: - t->eff_partition_offset */
|
|
||||||
iso_bb(&PL[4],
|
iso_bb(&PL[4],
|
||||||
n->info.dir->real_parent->info.dir->block - t->eff_partition_offset, 4);
|
n->info.dir->real_parent->info.dir->block - t->eff_partition_offset, 4);
|
||||||
return susp_append(t, susp, PL);
|
return susp_append(t, susp, PL);
|
||||||
@ -279,7 +278,6 @@ int rrip_add_CL(Ecma119Image *t, Ecma119Node *n, struct susp_info *susp)
|
|||||||
CL[1] = 'L';
|
CL[1] = 'L';
|
||||||
CL[2] = 12;
|
CL[2] = 12;
|
||||||
CL[3] = 1;
|
CL[3] = 1;
|
||||||
/* TWINTREE: - t->eff_partition_offset */
|
|
||||||
iso_bb(&CL[4], n->info.real_me->info.dir->block - t->eff_partition_offset,
|
iso_bb(&CL[4], n->info.real_me->info.dir->block - t->eff_partition_offset,
|
||||||
4);
|
4);
|
||||||
return susp_append(t, susp, CL);
|
return susp_append(t, susp, CL);
|
||||||
@ -702,7 +700,6 @@ int susp_add_CE(Ecma119Image *t, size_t ce_len, struct susp_info *susp)
|
|||||||
CE[2] = 28;
|
CE[2] = 28;
|
||||||
CE[3] = 1;
|
CE[3] = 1;
|
||||||
|
|
||||||
/* TWINTREE: susp->ce_block - t->eff_partition_offset */
|
|
||||||
iso_bb(&CE[4], susp->ce_block - t->eff_partition_offset, 4);
|
iso_bb(&CE[4], susp->ce_block - t->eff_partition_offset, 4);
|
||||||
iso_bb(&CE[12], susp->ce_len, 4);
|
iso_bb(&CE[12], susp->ce_len, 4);
|
||||||
iso_bb(&CE[20], (uint32_t) ce_len, 4);
|
iso_bb(&CE[20], (uint32_t) ce_len, 4);
|
||||||
|
@ -262,14 +262,13 @@ int iso_write_system_area(Ecma119Image *t, uint8_t *buf)
|
|||||||
return ret;
|
return ret;
|
||||||
} else if(t->partition_offset > 0) {
|
} else if(t->partition_offset > 0) {
|
||||||
/* Write a simple partition table. */
|
/* Write a simple partition table. */
|
||||||
/* >>> TWINTREE: ??? Shall the partition stay marked as bootable ? */
|
|
||||||
ret = make_grub_msdos_label(img_blocks, buf, 2);
|
ret = make_grub_msdos_label(img_blocks, buf, 2);
|
||||||
if (ret != ISO_SUCCESS) /* error should never happen */
|
if (ret != ISO_SUCCESS) /* error should never happen */
|
||||||
return ISO_ASSERT_FAILURE;
|
return ISO_ASSERT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (t->partition_offset > 0) {
|
if (t->partition_offset > 0) {
|
||||||
/* TWINTREE: adjust partition table to partition offset */
|
/* Adjust partition table to partition offset */
|
||||||
img_blocks = t->curblock; /* value might be altered */
|
img_blocks = t->curblock; /* value might be altered */
|
||||||
ret = iso_offset_partition_start(img_blocks, t->partition_offset,
|
ret = iso_offset_partition_start(img_blocks, t->partition_offset,
|
||||||
t->partition_secs_per_head,
|
t->partition_secs_per_head,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user