Example #1
0
/* Read a raw hfsp_fork from memory.
 *
 * return pointer right after the structure.
 */
void*
volume_readfork(void *p, hfsp_fork_raw* f)
{
	f->total_size   = bswabU64_inc(p);
	f->clump_size   = bswabU32_inc(p);
	f->total_blocks = bswabU32_inc(p);

	return volume_readextent(p, f->extents);
}
Example #2
0
/* intialize the record with the given index entry in the btree. */
static int record_init_extent(extent_record* r, btree* bt, node_buf* buf, UInt16 index)
{
    void *p;
    r-> tree   = bt;
    p = btree_key_by_index(bt, buf,index);
    if (!p)
	return -1;
    p = record_extent_readkey(p, &r->key);
    if (!p)
	return -1;
    p = volume_readextent(p, r->extent);
    if (!p)
	return -1;
    r->node_index = buf->index;
    r-> keyind    = index;

    return 0;
}
Example #3
0
/* intialize the extent_record to the extent identified by the
 * (first) blockindex.
 *
 * forktype: either HFSP_EXTEND_DATA or HFSP_EXTEND_RSRC
 */
int record_init_file(extent_record* r, btree* tree,
		    UInt8 forktype, UInt32 fileId, UInt32 blockindex)
{
    int		    keyind;
    UInt16	    node_index;
    hfsp_extent_key key = { 10, forktype, 0, fileId, blockindex };
    void	    *p = record_find_key(tree, &key, &keyind, &node_index);

    if (p)
    {
	r -> tree      = tree;
	r -> node_index= node_index;
	r -> keyind    = keyind;
	r -> key       = key; // Better use a record_key_copy ...
	p =  volume_readextent(p, r->extent);
	if (!p)
	    HFSP_ERROR(-1, "record_init_file: unexpected error");
	return 0;
    }
  fail:
    return -1;
}
Example #4
0
// For dependency reasons this actually is found in volume.h
char* record_extent_readrecord(char *p, void* entry)
{
    return volume_readextent(p, (hfsp_extent*) entry);
}