Enabled the opportunity to set HFSPLUS_BLOCK_SIZE to 512 for experiments.
This commit is contained in:
parent
af367561a6
commit
7e49fb553b
@ -1518,6 +1518,9 @@ void *write_function(void *arg)
|
|||||||
0, "FATAL", 0);
|
0, "FATAL", 0);
|
||||||
}
|
}
|
||||||
if (target->bytes_written != target->total_size) {
|
if (target->bytes_written != target->total_size) {
|
||||||
|
iso_msg_debug(target->image->id,
|
||||||
|
"bytes_written = %.f <-> total_size = %.f",
|
||||||
|
(double) target->bytes_written, (double) target->total_size);
|
||||||
iso_msgs_submit(0,
|
iso_msgs_submit(0,
|
||||||
"Image is most likely damaged. Calculated/written image end address mismatch.",
|
"Image is most likely damaged. Calculated/written image end address mismatch.",
|
||||||
0, "FATAL", 0);
|
0, "FATAL", 0);
|
||||||
|
@ -734,8 +734,11 @@ int mangle_single_dir(Ecma119Image *img, Ecma119Node *dir, int max_file_len,
|
|||||||
ret = ISO_OUT_OF_MEM;
|
ret = ISO_OUT_OF_MEM;
|
||||||
goto mangle_cleanup;
|
goto mangle_cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef Libisofs_extra_verbose_debuG
|
||||||
iso_msg_debug(img->image->id, "\"%s\" renamed to \"%s\"",
|
iso_msg_debug(img->image->id, "\"%s\" renamed to \"%s\"",
|
||||||
children[k]->iso_name, new);
|
children[k]->iso_name, new);
|
||||||
|
#endif
|
||||||
|
|
||||||
iso_htable_remove_ptr(table, children[k]->iso_name, NULL);
|
iso_htable_remove_ptr(table, children[k]->iso_name, NULL);
|
||||||
free(children[k]->iso_name);
|
free(children[k]->iso_name);
|
||||||
|
@ -10,6 +10,17 @@
|
|||||||
* See COPYING file for details.
|
* See COPYING file for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/* Some extra debugging messages for Vladimir Serbinko
|
||||||
|
#define Libisofs_hfsplus_verbose_debuG yes
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Some extra debugging messages for Thomas Schmitt
|
||||||
|
*/
|
||||||
|
#define Libisofs_ts_debuG yes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "../config.h"
|
#include "../config.h"
|
||||||
#endif
|
#endif
|
||||||
@ -30,8 +41,10 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#define HFSPLUS_BLOCK_SIZE BLOCK_SIZE
|
#define HFSPLUS_BLOCK_SIZE 2048
|
||||||
#define HFSPLUS_CAT_NODE_SIZE (2 * BLOCK_SIZE)
|
#define HFSPLUS_CAT_NODE_SIZE (2 * HFSPLUS_BLOCK_SIZE)
|
||||||
|
|
||||||
|
#define HFSPLUS_ISO_BLOCK_FAC (2048 / HFSPLUS_BLOCK_SIZE)
|
||||||
|
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
/* For these prototypes:
|
/* For these prototypes:
|
||||||
@ -40,6 +53,26 @@ uint16_t htons(uint16_t hostshort);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/* ts B20623: pad up output block to full 2048 bytes */
|
||||||
|
static
|
||||||
|
int pad_up_block(Ecma119Image *t)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
static char buffer[2048], buf_zeroed = 0;
|
||||||
|
|
||||||
|
if (!buf_zeroed) {
|
||||||
|
memset(buffer, 0, 2048);
|
||||||
|
buf_zeroed = 1;
|
||||||
|
}
|
||||||
|
if (t->bytes_written % 2048) {
|
||||||
|
ret = iso_write(t, buffer, 2048 - (t->bytes_written % 2048));
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static
|
static
|
||||||
int filesrc_block_and_size(Ecma119Image *t, IsoFileSrc *src,
|
int filesrc_block_and_size(Ecma119Image *t, IsoFileSrc *src,
|
||||||
uint32_t *start_block, uint64_t *total_size)
|
uint32_t *start_block, uint64_t *total_size)
|
||||||
@ -275,8 +308,15 @@ int create_tree(Ecma119Image *t, IsoNode *iso, uint32_t parent_id)
|
|||||||
cat_id = t->hfsp_cat_id++;
|
cat_id = t->hfsp_cat_id++;
|
||||||
|
|
||||||
for (i = 0; i < ISO_HFSPLUS_BLESS_MAX; i++)
|
for (i = 0; i < ISO_HFSPLUS_BLESS_MAX; i++)
|
||||||
if (t->hfsplus_blessed[i] == iso)
|
if (t->hfsplus_blessed[i] == iso) {
|
||||||
|
|
||||||
|
#ifdef Libisofs_ts_debuG
|
||||||
|
iso_msg_debug(t->image->id, "hfsplus bless %d to cat_id %u ('%s')",
|
||||||
|
i, cat_id, iso->name);
|
||||||
|
#endif /* Libisofs_ts_debuG */
|
||||||
|
|
||||||
t->hfsp_bless_id[i] = cat_id;
|
t->hfsp_bless_id[i] = cat_id;
|
||||||
|
}
|
||||||
|
|
||||||
set_hfsplus_name (t, iso->name, &t->hfsp_leafs[t->hfsp_curleaf]);
|
set_hfsplus_name (t, iso->name, &t->hfsp_leafs[t->hfsp_curleaf]);
|
||||||
t->hfsp_leafs[t->hfsp_curleaf].node = iso;
|
t->hfsp_leafs[t->hfsp_curleaf].node = iso;
|
||||||
@ -382,14 +422,19 @@ int hfsplus_tail_writer_compute_data_blocks(IsoImageWriter *writer)
|
|||||||
{
|
{
|
||||||
Ecma119Image *t;
|
Ecma119Image *t;
|
||||||
uint32_t hfsp_size;
|
uint32_t hfsp_size;
|
||||||
|
|
||||||
if (writer == NULL) {
|
if (writer == NULL) {
|
||||||
return ISO_OUT_OF_MEM;
|
return ISO_OUT_OF_MEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
t = writer->target;
|
t = writer->target;
|
||||||
|
|
||||||
hfsp_size = t->curblock - t->hfsp_part_start + 1;
|
#ifdef Libisofs_ts_debuG
|
||||||
|
iso_msg_debug(t->image->id, "hfsplus tail writer start = %.f",
|
||||||
|
((double) t->curblock) * 2048.0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
hfsp_size = t->curblock * HFSPLUS_ISO_BLOCK_FAC - t->hfsp_part_start + 1;
|
||||||
|
|
||||||
/* We need one bit for every block. */
|
/* We need one bit for every block. */
|
||||||
/* So if we allocate x blocks we have to satisfy:
|
/* So if we allocate x blocks we have to satisfy:
|
||||||
@ -398,13 +443,23 @@ int hfsplus_tail_writer_compute_data_blocks(IsoImageWriter *writer)
|
|||||||
*/
|
*/
|
||||||
t->hfsp_allocation_blocks = hfsp_size
|
t->hfsp_allocation_blocks = hfsp_size
|
||||||
/ (8 * HFSPLUS_BLOCK_SIZE - 1) + 1;
|
/ (8 * HFSPLUS_BLOCK_SIZE - 1) + 1;
|
||||||
t->hfsp_allocation_file_start = t->curblock;
|
t->hfsp_allocation_file_start = t->curblock * HFSPLUS_ISO_BLOCK_FAC;
|
||||||
t->curblock += t->hfsp_allocation_blocks;
|
t->curblock += t->hfsp_allocation_blocks / HFSPLUS_ISO_BLOCK_FAC;
|
||||||
|
if (t->hfsp_allocation_blocks % HFSPLUS_ISO_BLOCK_FAC)
|
||||||
|
t->curblock++;
|
||||||
t->curblock++;
|
t->curblock++;
|
||||||
t->hfsp_total_blocks = t->curblock - t->hfsp_part_start;
|
|
||||||
|
|
||||||
t->apm_block_size = 0x800;
|
#ifdef Libisofs_ts_debuG
|
||||||
return iso_quick_apm_entry(t, t->hfsp_part_start, t->hfsp_total_blocks,
|
iso_msg_debug(t->image->id, "hfsplus tail writer end = %.f",
|
||||||
|
((double) t->curblock) * 2048.0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
t->hfsp_total_blocks = t->curblock * HFSPLUS_ISO_BLOCK_FAC
|
||||||
|
- t->hfsp_part_start;
|
||||||
|
t->apm_block_size = HFSPLUS_BLOCK_SIZE;
|
||||||
|
return iso_quick_apm_entry(t, t->hfsp_part_start / HFSPLUS_ISO_BLOCK_FAC,
|
||||||
|
t->hfsp_total_blocks / HFSPLUS_ISO_BLOCK_FAC +
|
||||||
|
!!(t->hfsp_total_blocks % HFSPLUS_ISO_BLOCK_FAC),
|
||||||
"HFSPLUS_Hybrid", "Apple_HFS");
|
"HFSPLUS_Hybrid", "Apple_HFS");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -412,7 +467,7 @@ static
|
|||||||
int hfsplus_writer_compute_data_blocks(IsoImageWriter *writer)
|
int hfsplus_writer_compute_data_blocks(IsoImageWriter *writer)
|
||||||
{
|
{
|
||||||
Ecma119Image *t;
|
Ecma119Image *t;
|
||||||
uint32_t i;
|
uint32_t i, link_blocks;
|
||||||
|
|
||||||
if (writer == NULL) {
|
if (writer == NULL) {
|
||||||
return ISO_OUT_OF_MEM;
|
return ISO_OUT_OF_MEM;
|
||||||
@ -421,23 +476,43 @@ int hfsplus_writer_compute_data_blocks(IsoImageWriter *writer)
|
|||||||
t = writer->target;
|
t = writer->target;
|
||||||
|
|
||||||
iso_msg_debug(t->image->id, "(b) curblock=%d, nodes =%d", t->curblock, t->hfsp_nnodes);
|
iso_msg_debug(t->image->id, "(b) curblock=%d, nodes =%d", t->curblock, t->hfsp_nnodes);
|
||||||
t->hfsp_part_start = t->curblock;
|
t->hfsp_part_start = t->curblock * HFSPLUS_ISO_BLOCK_FAC;
|
||||||
|
|
||||||
t->curblock++;
|
t->curblock++;
|
||||||
|
|
||||||
t->hfsp_catalog_file_start = t->curblock;
|
t->hfsp_catalog_file_start = t->curblock * HFSPLUS_ISO_BLOCK_FAC;
|
||||||
t->curblock += 2 * t->hfsp_nnodes;
|
|
||||||
|
|
||||||
t->hfsp_extent_file_start = t->curblock;
|
/* ts B20623 was:
|
||||||
|
t->curblock += 2 * t->hfsp_nnodes;
|
||||||
|
*/
|
||||||
|
t->curblock += (t->hfsp_nnodes * HFSPLUS_CAT_NODE_SIZE + 2047) / 2048;
|
||||||
|
|
||||||
|
t->hfsp_extent_file_start = t->curblock * HFSPLUS_ISO_BLOCK_FAC;
|
||||||
t->curblock++;
|
t->curblock++;
|
||||||
|
|
||||||
iso_msg_debug(t->image->id, "(d) curblock=%d, nodes =%d", t->curblock, t->hfsp_nnodes);
|
iso_msg_debug(t->image->id, "(d) curblock=%d, nodes =%d", t->curblock, t->hfsp_nnodes);
|
||||||
|
|
||||||
|
link_blocks = 0;
|
||||||
for (i = 0; i < t->hfsp_nleafs; i++)
|
for (i = 0; i < t->hfsp_nleafs; i++)
|
||||||
if (t->hfsp_leafs[i].unix_type == UNIX_SYMLINK)
|
if (t->hfsp_leafs[i].unix_type == UNIX_SYMLINK)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/* ts B20623 : was:
|
||||||
t->hfsp_leafs[i].symlink_block = t->curblock;
|
t->hfsp_leafs[i].symlink_block = t->curblock;
|
||||||
t->curblock += (t->hfsp_leafs[i].symlink_size + HFSPLUS_BLOCK_SIZE - 1) / HFSPLUS_BLOCK_SIZE;
|
t->curblock += (t->hfsp_leafs[i].symlink_size + HFSPLUS_BLOCK_SIZE - 1) / HFSPLUS_BLOCK_SIZE;
|
||||||
|
*/
|
||||||
|
|
||||||
|
t->hfsp_leafs[i].symlink_block =
|
||||||
|
t->curblock * HFSPLUS_ISO_BLOCK_FAC + link_blocks;
|
||||||
|
link_blocks += (t->hfsp_leafs[i].symlink_size +
|
||||||
|
HFSPLUS_BLOCK_SIZE - 1) / HFSPLUS_BLOCK_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ts B20623 */
|
||||||
|
t->curblock += link_blocks / HFSPLUS_ISO_BLOCK_FAC;
|
||||||
|
if (link_blocks % HFSPLUS_ISO_BLOCK_FAC)
|
||||||
|
t->curblock++;
|
||||||
|
|
||||||
iso_msg_debug(t->image->id, "(a) curblock=%d, nodes =%d", t->curblock, t->hfsp_nnodes);
|
iso_msg_debug(t->image->id, "(a) curblock=%d, nodes =%d", t->curblock, t->hfsp_nnodes);
|
||||||
|
|
||||||
return ISO_SUCCESS;
|
return ISO_SUCCESS;
|
||||||
@ -517,7 +592,7 @@ write_sb (Ecma119Image *t)
|
|||||||
set_time (&sb.fsck_time, t->now);
|
set_time (&sb.fsck_time, t->now);
|
||||||
iso_msb ((uint8_t *) &sb.file_count, t->hfsp_nfiles, 4);
|
iso_msb ((uint8_t *) &sb.file_count, t->hfsp_nfiles, 4);
|
||||||
iso_msb ((uint8_t *) &sb.folder_count, t->hfsp_ndirs - 1, 4);
|
iso_msb ((uint8_t *) &sb.folder_count, t->hfsp_ndirs - 1, 4);
|
||||||
iso_msb ((uint8_t *) &sb.blksize, 0x800, 4);
|
iso_msb ((uint8_t *) &sb.blksize, HFSPLUS_BLOCK_SIZE, 4);
|
||||||
iso_msb ((uint8_t *) &sb.catalog_node_id, t->hfsp_cat_id, 4);
|
iso_msb ((uint8_t *) &sb.catalog_node_id, t->hfsp_cat_id, 4);
|
||||||
iso_msb ((uint8_t *) &sb.rsrc_clumpsize, HFSPLUS_BLOCK_SIZE, 4);
|
iso_msb ((uint8_t *) &sb.rsrc_clumpsize, HFSPLUS_BLOCK_SIZE, 4);
|
||||||
iso_msb ((uint8_t *) &sb.data_clumpsize, HFSPLUS_BLOCK_SIZE, 4);
|
iso_msb ((uint8_t *) &sb.data_clumpsize, HFSPLUS_BLOCK_SIZE, 4);
|
||||||
@ -544,13 +619,19 @@ write_sb (Ecma119Image *t)
|
|||||||
iso_msb ((uint8_t *) &sb.catalog_file.extents[0].count, 2 * t->hfsp_nnodes, 4);
|
iso_msb ((uint8_t *) &sb.catalog_file.extents[0].count, 2 * t->hfsp_nnodes, 4);
|
||||||
iso_msg_debug(t->image->id, "catalog_file_start = %d\n", (int)t->hfsp_catalog_file_start);
|
iso_msg_debug(t->image->id, "catalog_file_start = %d\n", (int)t->hfsp_catalog_file_start);
|
||||||
|
|
||||||
for (i = 0; i < ISO_HFSPLUS_BLESS_MAX; i++)
|
for (i = 0; i < ISO_HFSPLUS_BLESS_MAX; i++) {
|
||||||
iso_msb ((uint8_t *) (&sb.ppc_bootdir + i
|
iso_msb ((uint8_t *) (&sb.ppc_bootdir + i
|
||||||
+ (i == ISO_HFSPLUS_BLESS_OSX_FOLDER)),
|
+ (i == ISO_HFSPLUS_BLESS_OSX_FOLDER)),
|
||||||
t->hfsp_bless_id[i], 4);
|
t->hfsp_bless_id[i], 4);
|
||||||
|
|
||||||
memcpy (&sb.num_serial, &t->hfsp_serial_number, 8);
|
#ifdef Libisofs_ts_debuG
|
||||||
|
iso_msg_debug(t->image->id, "hfsplus bless %d written for cat_id %u",
|
||||||
|
i, t->hfsp_bless_id[i]);
|
||||||
|
#endif /* Libisofs_ts_debuG */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy (&sb.num_serial, &t->hfsp_serial_number, 8);
|
||||||
ret = iso_write(t, &sb, sizeof (sb));
|
ret = iso_write(t, &sb, sizeof (sb));
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
@ -610,7 +691,10 @@ int hfsplus_writer_write_data(IsoImageWriter *writer)
|
|||||||
buffer[HFSPLUS_CAT_NODE_SIZE - 7] = (char) ((HFSPLUS_CAT_NODE_SIZE - 8) & 0xff);
|
buffer[HFSPLUS_CAT_NODE_SIZE - 7] = (char) ((HFSPLUS_CAT_NODE_SIZE - 8) & 0xff);
|
||||||
buffer[HFSPLUS_CAT_NODE_SIZE - 8] = (HFSPLUS_CAT_NODE_SIZE - 8) >> 8;
|
buffer[HFSPLUS_CAT_NODE_SIZE - 8] = (HFSPLUS_CAT_NODE_SIZE - 8) >> 8;
|
||||||
|
|
||||||
|
#ifdef Libisofs_hfsplus_verbose_debuG
|
||||||
iso_msg_debug(t->image->id, "Write\n");
|
iso_msg_debug(t->image->id, "Write\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
ret = iso_write(t, buffer, HFSPLUS_CAT_NODE_SIZE);
|
ret = iso_write(t, buffer, HFSPLUS_CAT_NODE_SIZE);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
@ -649,7 +733,10 @@ int hfsplus_writer_write_data(IsoImageWriter *writer)
|
|||||||
curnode++;
|
curnode++;
|
||||||
}
|
}
|
||||||
iso_msb ((uint8_t *) buffer + HFSPLUS_CAT_NODE_SIZE - j * 2 - 2, curoff, 2);
|
iso_msb ((uint8_t *) buffer + HFSPLUS_CAT_NODE_SIZE - j * 2 - 2, curoff, 2);
|
||||||
|
|
||||||
|
#ifdef Libisofs_hfsplus_verbose_debuG
|
||||||
iso_msg_debug(t->image->id, "Write\n");
|
iso_msg_debug(t->image->id, "Write\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
ret = iso_write(t, buffer, HFSPLUS_CAT_NODE_SIZE);
|
ret = iso_write(t, buffer, HFSPLUS_CAT_NODE_SIZE);
|
||||||
|
|
||||||
@ -680,6 +767,9 @@ int hfsplus_writer_write_data(IsoImageWriter *writer)
|
|||||||
for (j = 0; j < t->hfsp_levels[level].nodes[i].cnt; j++)
|
for (j = 0; j < t->hfsp_levels[level].nodes[i].cnt; j++)
|
||||||
{
|
{
|
||||||
iso_msb ((uint8_t *) buffer + HFSPLUS_CAT_NODE_SIZE - j * 2 - 2, curoff, 2);
|
iso_msb ((uint8_t *) buffer + HFSPLUS_CAT_NODE_SIZE - j * 2 - 2, curoff, 2);
|
||||||
|
|
||||||
|
#ifdef Libisofs_hfsplus_verbose_debuG
|
||||||
|
|
||||||
if (t->hfsp_leafs[curnode].node->name == NULL)
|
if (t->hfsp_leafs[curnode].node->name == NULL)
|
||||||
{
|
{
|
||||||
iso_msg_debug(t->image->id, "%d out of %d",
|
iso_msg_debug(t->image->id, "%d out of %d",
|
||||||
@ -692,6 +782,8 @@ int hfsplus_writer_write_data(IsoImageWriter *writer)
|
|||||||
t->hfsp_leafs[curnode].node->name);
|
t->hfsp_leafs[curnode].node->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* Libisofs_hfsplus_verbose_debuG */
|
||||||
|
|
||||||
switch (t->hfsp_leafs[curnode].type)
|
switch (t->hfsp_leafs[curnode].type)
|
||||||
{
|
{
|
||||||
case HFSPLUS_FILE_THREAD:
|
case HFSPLUS_FILE_THREAD:
|
||||||
@ -763,6 +855,24 @@ int hfsplus_writer_write_data(IsoImageWriter *writer)
|
|||||||
4);
|
4);
|
||||||
memcpy (common->file_creator,
|
memcpy (common->file_creator,
|
||||||
xinfo->creator_code, 4);
|
xinfo->creator_code, 4);
|
||||||
|
|
||||||
|
#ifdef Libisofs_ts_debuG
|
||||||
|
{
|
||||||
|
char crtp[14];
|
||||||
|
|
||||||
|
crtp[0] = '\'';
|
||||||
|
memcpy(crtp+1, xinfo->creator_code, 4);
|
||||||
|
strcpy(crtp + 5, "','");
|
||||||
|
memcpy(crtp + 8, xinfo->type_code, 4);
|
||||||
|
crtp[12] = '\'';
|
||||||
|
crtp[13]= 0;
|
||||||
|
iso_msg_debug(t->image->id,
|
||||||
|
"hfsplus creator,type %s to '%s/%s'",
|
||||||
|
crtp, ((IsoNode *) t->hfsp_leafs[curnode].node->parent)->name,
|
||||||
|
t->hfsp_leafs[curnode].node->name);
|
||||||
|
}
|
||||||
|
#endif /* Libisofs_ts_debuG */
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (ret < 0)
|
else if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
@ -810,6 +920,7 @@ int hfsplus_writer_write_data(IsoImageWriter *writer)
|
|||||||
&blk, &sz);
|
&blk, &sz);
|
||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
blk *= HFSPLUS_ISO_BLOCK_FAC;
|
||||||
}
|
}
|
||||||
if (sz == 0)
|
if (sz == 0)
|
||||||
blk = t->hfsp_part_start;
|
blk = t->hfsp_part_start;
|
||||||
@ -829,17 +940,25 @@ int hfsplus_writer_write_data(IsoImageWriter *writer)
|
|||||||
curnode++;
|
curnode++;
|
||||||
}
|
}
|
||||||
iso_msb ((uint8_t *) buffer + HFSPLUS_CAT_NODE_SIZE - j * 2 - 2, curoff, 2);
|
iso_msb ((uint8_t *) buffer + HFSPLUS_CAT_NODE_SIZE - j * 2 - 2, curoff, 2);
|
||||||
|
|
||||||
|
#ifdef Libisofs_hfsplus_verbose_debuG
|
||||||
iso_msg_debug(t->image->id, "Write\n");
|
iso_msg_debug(t->image->id, "Write\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
ret = iso_write(t, buffer, HFSPLUS_CAT_NODE_SIZE);
|
ret = iso_write(t, buffer, HFSPLUS_CAT_NODE_SIZE);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
curpos = next_lev;
|
curpos = next_lev;
|
||||||
}
|
}
|
||||||
|
memset (buffer, 0, sizeof (buffer));
|
||||||
|
|
||||||
|
ret = pad_up_block(t);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
iso_msg_debug(t->image->id, "real extent_file_start = %d\n", (int)t->bytes_written / 2048);
|
iso_msg_debug(t->image->id, "real extent_file_start = %d\n", (int)t->bytes_written / 2048);
|
||||||
|
|
||||||
memset (buffer, 0, sizeof (buffer));
|
|
||||||
node_head = (struct hfsplus_btnode *) buffer;
|
node_head = (struct hfsplus_btnode *) buffer;
|
||||||
node_head->type = 1;
|
node_head->type = 1;
|
||||||
iso_msb ((uint8_t *) &node_head->count, 3, 2);
|
iso_msb ((uint8_t *) &node_head->count, 3, 2);
|
||||||
@ -862,6 +981,10 @@ int hfsplus_writer_write_data(IsoImageWriter *writer)
|
|||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
ret = pad_up_block(t);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
iso_msg_debug(t->image->id, "(d) %d written", (int) t->bytes_written / 0x800);
|
iso_msg_debug(t->image->id, "(d) %d written", (int) t->bytes_written / 0x800);
|
||||||
memset (buffer, 0, sizeof (buffer));
|
memset (buffer, 0, sizeof (buffer));
|
||||||
for (i = 0; i < t->hfsp_nleafs; i++)
|
for (i = 0; i < t->hfsp_nleafs; i++)
|
||||||
@ -880,6 +1003,10 @@ int hfsplus_writer_write_data(IsoImageWriter *writer)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = pad_up_block(t);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
iso_msg_debug(t->image->id, "(a) %d written", (int) t->bytes_written / 0x800);
|
iso_msg_debug(t->image->id, "(a) %d written", (int) t->bytes_written / 0x800);
|
||||||
return ISO_SUCCESS;
|
return ISO_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -899,6 +1026,11 @@ int hfsplus_tail_writer_write_data(IsoImageWriter *writer)
|
|||||||
|
|
||||||
t = writer->target;
|
t = writer->target;
|
||||||
|
|
||||||
|
#ifdef Libisofs_ts_debuG
|
||||||
|
iso_msg_debug(t->image->id, "hfsplus tail writer writes at = %.f",
|
||||||
|
(double) t->bytes_written);
|
||||||
|
#endif
|
||||||
|
|
||||||
memset (buffer, -1, sizeof (buffer));
|
memset (buffer, -1, sizeof (buffer));
|
||||||
complete_blocks = (t->hfsp_allocation_size - 1) / HFSPLUS_BLOCK_SIZE;
|
complete_blocks = (t->hfsp_allocation_size - 1) / HFSPLUS_BLOCK_SIZE;
|
||||||
remaining_blocks = t->hfsp_allocation_blocks - complete_blocks;
|
remaining_blocks = t->hfsp_allocation_blocks - complete_blocks;
|
||||||
@ -928,9 +1060,26 @@ int hfsplus_tail_writer_write_data(IsoImageWriter *writer)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = pad_up_block(t);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
iso_msg_debug(t->image->id, "%d written", (int) t->bytes_written);
|
iso_msg_debug(t->image->id, "%d written", (int) t->bytes_written);
|
||||||
|
|
||||||
return write_sb (t);
|
#ifdef Libisofs_ts_debuG
|
||||||
|
iso_msg_debug(t->image->id, "hfsplus tail writer writes sb at = %.f",
|
||||||
|
(double) t->bytes_written);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
ret = write_sb (t);
|
||||||
|
|
||||||
|
#ifdef Libisofs_ts_debuG
|
||||||
|
iso_msg_debug(t->image->id, "hfsplus tail writer ends at = %.f",
|
||||||
|
(double) t->bytes_written);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
|
Loading…
Reference in New Issue
Block a user