xorriso  1.5.4.pl02
About: GNU xorriso creates, loads, manipulates and writes ISO 9660 filesystem images with Rock Ridge extensions. It is suitable for incremental data backup and for production of bootable ISO 9660 images. GNU xorriso is a statical compilation of the libraries libburn, libisofs, libisoburn, and libjte.
  Fossies Dox: xorriso-1.5.4.pl02.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

hfsplus.c File Reference
#include "hfsplus.h"
#include "messages.h"
#include "writer.h"
#include "image.h"
#include "filesrc.h"
#include "eltorito.h"
#include "libisofs.h"
#include "util.h"
#include "ecma119.h"
#include "system_area.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
Include dependency graph for hfsplus.c:

Go to the source code of this file.

Macros

#define Libisofs_ts_debuG   yes
 
#define HFSPLUS_DEFAULT_BLOCK_SIZE   2048
 
#define HFSPLUS_MAX_BLOCK_SIZE   2048
 

Functions

uint16_t iso_hfsplus_cichar (uint16_t x)
 
static int pad_up_block (Ecma119Image *t)
 
static int filesrc_block_and_size (Ecma119Image *t, IsoFileSrc *src, uint32_t *start_block, uint64_t *total_size)
 
static uint8_t get_class (uint16_t v)
 
int iso_get_hfsplus_name (char *input_charset, int imgid, char *name, uint16_t **result, uint32_t *result_len, uint16_t **cmp_name)
 
static int set_hfsplus_name (Ecma119Image *t, char *name, HFSPlusNode *node)
 
static int hfsplus_count_tree (Ecma119Image *t, IsoNode *iso)
 
static int create_tree (Ecma119Image *t, IsoNode *iso, uint32_t parent_id)
 
static int cmp_node (const void *f1, const void *f2)
 
static int hfsplus_tail_writer_compute_data_blocks (IsoImageWriter *writer)
 
static int hfsplus_writer_compute_data_blocks (IsoImageWriter *writer)
 
static uint32_t mac_time_offset (uint32_t t)
 
int nop_writer_write_vol_desc (IsoImageWriter *writer)
 
static uid_t px_get_uid (Ecma119Image *t, IsoNode *n)
 
static uid_t px_get_gid (Ecma119Image *t, IsoNode *n)
 
static mode_t px_get_mode (Ecma119Image *t, IsoNode *n, int isdir)
 
int write_sb (Ecma119Image *t)
 
static int hfsplus_writer_write_data (IsoImageWriter *writer)
 
static int hfsplus_tail_writer_write_data (IsoImageWriter *writer)
 
static int hfsplus_writer_free_data (IsoImageWriter *writer)
 
static int nop_writer_free_data (IsoImageWriter *writer)
 
static int search_mangled_pos (Ecma119Image *target, uint32_t idx, uint32_t *new_idx, uint32_t search_start, uint32_t search_end, int flag)
 
static void rotate_hfs_list (Ecma119Image *target, uint32_t old_idx, uint32_t new_idx, int flag)
 
static int subst_symlink_dest_comp (Ecma119Image *target, uint32_t idx, char **dest, unsigned int *dest_len, char **comp_start, char **comp_end, char *new_name, int flag)
 
static int update_symlink (Ecma119Image *target, uint32_t changed_idx, char *new_name, uint32_t link_idx, int *depth, int flag)
 
static int update_name_followers (Ecma119Image *target, uint32_t idx, char *new_name, uint16_t *old_name, uint16_t *old_cmp_name, uint32_t old_strlen)
 
static int try_mangle (Ecma119Image *target, uint32_t idx, uint32_t prev_idx, uint32_t search_start, uint32_t search_end, uint32_t *new_idx, char *prefix, int flag)
 
static int mangle_leafs (Ecma119Image *target, int flag)
 
void iso_setup_hfsplus_block_size (Ecma119Image *target)
 
int hfsplus_writer_create (Ecma119Image *target)
 
int hfsplus_tail_writer_create (Ecma119Image *target)
 
int iso_hfsplus_xinfo_func (void *data, int flag)
 
struct iso_hfsplus_xinfo_dataiso_hfsplus_xinfo_new (int flag)
 
int iso_hfsplus_xinfo_cloner (void *old_data, void **new_data, int flag)
 

Macro Definition Documentation

◆ HFSPLUS_DEFAULT_BLOCK_SIZE

#define HFSPLUS_DEFAULT_BLOCK_SIZE   2048

Definition at line 47 of file hfsplus.c.

◆ HFSPLUS_MAX_BLOCK_SIZE

#define HFSPLUS_MAX_BLOCK_SIZE   2048

Definition at line 51 of file hfsplus.c.

◆ Libisofs_ts_debuG

#define Libisofs_ts_debuG   yes

Definition at line 20 of file hfsplus.c.

Function Documentation

◆ cmp_node()

static int cmp_node ( const void *  f1,
const void *  f2 
)
static

◆ create_tree()

◆ filesrc_block_and_size()

static int filesrc_block_and_size ( Ecma119Image t,
IsoFileSrc src,
uint32_t *  start_block,
uint64_t *  total_size 
)
static

◆ get_class()

static uint8_t get_class ( uint16_t  v)
static

Definition at line 106 of file hfsplus.c.

References hfsplus_class_pages, and iso_ntohs().

Referenced by iso_get_hfsplus_name().

◆ hfsplus_count_tree()

◆ hfsplus_tail_writer_compute_data_blocks()

◆ hfsplus_tail_writer_create()

◆ hfsplus_tail_writer_write_data()

◆ hfsplus_writer_compute_data_blocks()

◆ hfsplus_writer_create()

int hfsplus_writer_create ( Ecma119Image target)

Definition at line 1590 of file hfsplus.c.

References hfsplus_node::cat_id, Iso_Dir::children, hfsplus_node::cmp_name, cmp_node(), hfsplus_btree_node::cnt, Iso_Image_Writer::compute_data_blocks, create_tree(), Iso_Image_Writer::data, hfsplus_node::file, Iso_Image_Writer::free_data, ecma119_image::hfsp_bless_id, ecma119_image::hfsp_cat_id, ecma119_image::hfsp_cat_node_size, ecma119_image::hfsp_curleaf, ecma119_image::hfsp_leafs, ecma119_image::hfsp_levels, ecma119_image::hfsp_ndirs, ecma119_image::hfsp_nfiles, ecma119_image::hfsp_nleafs, ecma119_image::hfsp_nlevels, ecma119_image::hfsp_nnodes, hfsplus_count_tree(), HFSPLUS_DIR, HFSPLUS_DIR_THREAD, hfsplus_writer_compute_data_blocks(), hfsplus_writer_free_data(), hfsplus_writer_write_data(), Iso_Image::id, ecma119_image::image, ISO_HFSPLUS_BLESS_MAX, ISO_HFSPLUS_TOO_MANY_FILES, iso_msg_debug(), iso_msg_submit(), ISO_OUT_OF_MEM, iso_setup_hfsplus_block_size(), ISO_SUCCESS, hfsplus_btree_level::level_size, make_hfsplus_class_pages(), make_hfsplus_decompose_pages(), mangle_leafs(), hfsplus_node::name, hfsplus_node::nchildren, Iso_Node::next, hfsplus_node::node, hfsplus_btree_level::nodes, nop_writer_write_vol_desc(), ecma119_image::nwriters, hfsplus_btree_node::parent_id, hfsplus_node::parent_id, Iso_Image::root, set_hfsplus_name(), hfsplus_btree_node::start, hfsplus_btree_node::str, hfsplus_btree_node::strlen, hfsplus_node::strlen, Iso_Image_Writer::target, hfsplus_node::type, hfsplus_node::unix_type, hfsplus_node::used_size, Iso_Image::volume_id, Iso_Image_Writer::write_data, Iso_Image_Writer::write_vol_desc, and ecma119_image::writers.

Referenced by ecma119_image_new().

◆ hfsplus_writer_free_data()

◆ hfsplus_writer_write_data()

static int hfsplus_writer_write_data ( IsoImageWriter writer)
static

Definition at line 673 of file hfsplus.c.

References hfsplus_catfile_common::atime, Iso_Node::atime, hfsplus_catfile_common::attr_mtime, hfsplus_btheader::attributes, hfsplus_forkdata::blocks, ecma119_image::bytes_written, hfsplus_node::cat_id, hfsplus_btheader::clump_size, hfsplus_forkdata::clumpsize, hfsplus_btree_node::cnt, hfsplus_extent::count, hfsplus_btnode::count, iso_hfsplus_xinfo_data::creator_code, hfsplus_catfile_common::ctime, Iso_Node::ctime, hfsplus_btheader::depth, hfsplus_forkdata::extents, hfsplus_node::file, hfsplus_catfile_common::file_creator, hfsplus_catfile_common::file_type, hfsplus_catfile_common::fileid, filesrc_block_and_size(), hfsplus_btheader::first_leaf_node, hfsplus_catfile_common::flags, hfsplus_btheader::free_nodes, hfsplus_catfile_common::gid, hfsplus_btnode::height, iso_write_opts::hfsp_block_size, ecma119_image::hfsp_cat_node_size, ecma119_image::hfsp_iso_block_fac, ecma119_image::hfsp_leafs, ecma119_image::hfsp_levels, ecma119_image::hfsp_nleafs, ecma119_image::hfsp_nlevels, ecma119_image::hfsp_nnodes, ecma119_image::hfsp_part_start, HFSPLUS_DIR, HFSPLUS_DIR_THREAD, HFSPLUS_FILE, HFSPLUS_FILE_THREAD, HFSPLUS_MAX_BLOCK_SIZE, Iso_Image::id, ecma119_image::image, iso_hfsplus_xinfo_func(), iso_msb(), iso_msg_debug(), iso_node_get_xinfo(), ISO_NULL_POINTER, ISO_SUCCESS, iso_write(), hfsplus_btheader::key_compare, hfsplus_btheader::keysize, hfsplus_btheader::last_leaf_node, hfsplus_btheader::leaf_records, hfsplus_btree_level::level_size, LIBISO_HFSPLUS_NAME_MAX, mac_time_offset(), hfsplus_catfile_common::mode, Iso_Node::mode, hfsplus_catfile_common::mtime, Iso_Node::mtime, hfsplus_node::name, Iso_Node::name, hfsplus_catfile_thread::namelen, hfsplus_node::nchildren, hfsplus_btnode::next, hfsplus_node::node, hfsplus_btree_level::nodes, hfsplus_btheader::nodesize, ecma119_image::opts, pad_up_block(), Iso_Node::parent, hfsplus_btree_node::parent_id, hfsplus_node::parent_id, hfsplus_catfile_thread::parentid, hfsplus_btnode::prev, px_get_gid(), px_get_mode(), px_get_uid(), hfsplus_btheader::root, hfsplus_forkdata::size, hfsplus_catfile_common::special, hfsplus_btree_node::start, hfsplus_extent::start, hfsplus_btree_node::str, hfsplus_btree_node::strlen, hfsplus_node::strlen, hfsplus_node::symlink_block, hfsplus_node::symlink_dest, Iso_Image_Writer::target, hfsplus_btheader::total_nodes, hfsplus_node::type, hfsplus_btnode::type, hfsplus_catfile_thread::type, hfsplus_catfile_common::type, iso_hfsplus_xinfo_data::type_code, hfsplus_catfile_common::uid, hfsplus_node::unix_type, hfsplus_catfile_common::valence, and write_sb().

Referenced by hfsplus_writer_create().

◆ iso_get_hfsplus_name()

int iso_get_hfsplus_name ( char *  input_charset,
int  imgid,
char *  name,
uint16_t **  result,
uint32_t *  result_len,
uint16_t **  cmp_name 
)

◆ iso_hfsplus_cichar()

uint16_t iso_hfsplus_cichar ( uint16_t  x)

◆ iso_hfsplus_xinfo_cloner()

int iso_hfsplus_xinfo_cloner ( void *  old_data,
void **  new_data,
int  flag 
)

Definition at line 1864 of file hfsplus.c.

References iso_hfsplus_xinfo_new(), ISO_OUT_OF_MEM, ISO_SUCCESS, and ISO_XINFO_NO_CLONE.

Referenced by iso_init_with_flag().

◆ iso_hfsplus_xinfo_func()

int iso_hfsplus_xinfo_func ( void *  data,
int  flag 
)

The function that is used to mark struct iso_hfsplus_xinfo_data at IsoNodes and finally disposes such structs when their IsoNodes get disposed. Usually an application does not call this function, but only uses it as parameter of xinfo calls like iso_node_add_xinfo() or iso_node_get_xinfo().

Since
1.2.4

Definition at line 1841 of file hfsplus.c.

Referenced by Exprtest_match(), hfsplus_writer_write_data(), iso_init_with_flag(), Xorriso_findi_action(), Xorriso_remove_hfsplus_crtp(), and Xorriso_set_hfsplus_crtp().

◆ iso_hfsplus_xinfo_new()

struct iso_hfsplus_xinfo_data* iso_hfsplus_xinfo_new ( int  flag)

Create an instance of struct iso_hfsplus_xinfo_new().

Parameters
flagBitfield for control purposes. Unused yet. Submit 0.
Returns
A pointer to the new object NULL indicates failure to allocate memory
Since
1.2.4

Definition at line 1849 of file hfsplus.c.

References iso_hfsplus_xinfo_data::version.

Referenced by iso_hfsplus_xinfo_cloner(), and Xorriso_set_hfsplus_crtp().

◆ iso_setup_hfsplus_block_size()

◆ mac_time_offset()

static uint32_t mac_time_offset ( uint32_t  t)
inlinestatic

Definition at line 546 of file hfsplus.c.

References iso_msb().

Referenced by hfsplus_writer_write_data(), and write_sb().

◆ mangle_leafs()

◆ nop_writer_free_data()

static int nop_writer_free_data ( IsoImageWriter writer)
static

Definition at line 1129 of file hfsplus.c.

References ISO_SUCCESS.

Referenced by hfsplus_tail_writer_create().

◆ nop_writer_write_vol_desc()

int nop_writer_write_vol_desc ( IsoImageWriter writer)

Definition at line 554 of file hfsplus.c.

References ISO_SUCCESS.

Referenced by hfsplus_tail_writer_create(), and hfsplus_writer_create().

◆ pad_up_block()

static int pad_up_block ( Ecma119Image t)
static

◆ px_get_gid()

static uid_t px_get_gid ( Ecma119Image t,
IsoNode n 
)
static

Definition at line 570 of file hfsplus.c.

References ecma119_image::gid, Iso_Node::gid, and ecma119_image::replace_gid.

Referenced by hfsplus_writer_write_data().

◆ px_get_mode()

static mode_t px_get_mode ( Ecma119Image t,
IsoNode n,
int  isdir 
)
static

◆ px_get_uid()

static uid_t px_get_uid ( Ecma119Image t,
IsoNode n 
)
static

Definition at line 560 of file hfsplus.c.

References ecma119_image::replace_uid, ecma119_image::uid, and Iso_Node::uid.

Referenced by hfsplus_writer_write_data().

◆ rotate_hfs_list()

static void rotate_hfs_list ( Ecma119Image target,
uint32_t  old_idx,
uint32_t  new_idx,
int  flag 
)
static

Definition at line 1171 of file hfsplus.c.

References ecma119_image::hfsp_leafs.

Referenced by try_mangle().

◆ search_mangled_pos()

static int search_mangled_pos ( Ecma119Image target,
uint32_t  idx,
uint32_t *  new_idx,
uint32_t  search_start,
uint32_t  search_end,
int  flag 
)
static

◆ set_hfsplus_name()

static int set_hfsplus_name ( Ecma119Image t,
char *  name,
HFSPlusNode node 
)
static

◆ subst_symlink_dest_comp()

static int subst_symlink_dest_comp ( Ecma119Image target,
uint32_t  idx,
char **  dest,
unsigned int *  dest_len,
char **  comp_start,
char **  comp_end,
char *  new_name,
int  flag 
)
static

Definition at line 1192 of file hfsplus.c.

References ecma119_image::hfsp_leafs, ISO_OUT_OF_MEM, ISO_SUCCESS, and hfsplus_node::symlink_dest.

Referenced by update_symlink().

◆ try_mangle()

static int try_mangle ( Ecma119Image target,
uint32_t  idx,
uint32_t  prev_idx,
uint32_t  search_start,
uint32_t  search_end,
uint32_t *  new_idx,
char *  prefix,
int  flag 
)
static

◆ update_name_followers()

static int update_name_followers ( Ecma119Image target,
uint32_t  idx,
char *  new_name,
uint16_t *  old_name,
uint16_t *  old_cmp_name,
uint32_t  old_strlen 
)
static

◆ update_symlink()

◆ write_sb()

int write_sb ( Ecma119Image t)

Definition at line 595 of file hfsplus.c.

References hfsplus_volheader::allocations_file, hfsplus_volheader::attributes, hfsplus_volheader::blksize, hfsplus_forkdata::blocks, hfsplus_volheader::catalog_file, hfsplus_volheader::catalog_node_id, hfsplus_forkdata::clumpsize, hfsplus_extent::count, hfsplus_volheader::ctime, hfsplus_volheader::data_clumpsize, hfsplus_volheader::encodings_bitmap, hfsplus_forkdata::extents, hfsplus_volheader::extents_file, hfsplus_volheader::file_count, hfsplus_volheader::folder_count, hfsplus_volheader::fsck_time, ecma119_image::hfsp_allocation_file_start, ecma119_image::hfsp_allocation_size, ecma119_image::hfsp_bless_id, iso_write_opts::hfsp_block_size, ecma119_image::hfsp_cat_id, ecma119_image::hfsp_catalog_file_start, ecma119_image::hfsp_extent_file_start, ecma119_image::hfsp_ndirs, ecma119_image::hfsp_nfiles, ecma119_image::hfsp_nnodes, ecma119_image::hfsp_part_start, iso_write_opts::hfsp_serial_number, ecma119_image::hfsp_total_blocks, Iso_Image::id, ecma119_image::image, ISO_HFSPLUS_BLESS_MAX, ISO_HFSPLUS_BLESS_OSX_FOLDER, iso_msb(), iso_msg_debug(), iso_write(), hfsplus_volheader::last_mounted_version, mac_time_offset(), hfsplus_volheader::magic, ecma119_image::now, hfsplus_volheader::num_serial, ecma119_image::opts, hfsplus_volheader::ppc_bootdir, hfsplus_volheader::rsrc_clumpsize, hfsplus_forkdata::size, hfsplus_extent::start, hfsplus_volheader::total_blocks, hfsplus_volheader::utime, and hfsplus_volheader::version.

Referenced by hfsplus_tail_writer_write_data(), and hfsplus_writer_write_data().