From a8b20b87aa6b8a597b07e49cb52dae15c9298044 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Thu, 24 May 2012 19:27:03 +0200 Subject: [PATCH] New API functions iso_hfsplus_xinfo_func(), iso_hfsplus_xinfo_new() and pre-version 0 of struct iso_hfsplus_xinfo_data. --- libisofs/libisofs.h | 47 +++++++++++++++++++++++++++++++++++++++++++ libisofs/libisofs.ver | 3 +++ libisofs/util.c | 20 ++++++++++++++++++ 3 files changed, 70 insertions(+) diff --git a/libisofs/libisofs.h b/libisofs/libisofs.h index ba04fad..6601ee1 100644 --- a/libisofs/libisofs.h +++ b/libisofs/libisofs.h @@ -6647,6 +6647,53 @@ int iso_md5_end(void **md5_context, char result[16]); int iso_md5_match(char first_md5[16], char second_md5[16]); +/* -------------------------------- For HFS+ ------------------------------- */ + + +/** + * HFS+ attributes which may be attached to IsoNode objects as data parameter + * of iso_node_add_xinfo(). As parameter proc use iso_hfsplus_xinfo_func(). + * Create instances of this struct by iso_hfsplus_xinfo_new(). + * + * @since 1.2.4 + */ +struct iso_hfsplus_xinfo_data { + + /* Currently set to 0 by iso_hfsplus_xinfo_new() */ + int version; + + /* Attributes available with version 0. + * See: http://en.wikipedia.org/wiki/Creator_code , .../Type_code + * @since 1.2.4 + */ + unsigned int creator_code :4; + unsigned int type_code :4; +}; + +/** + * 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 + */ +int iso_hfsplus_xinfo_func(void *data, int flag); + +/** + * Create an instance of struct iso_hfsplus_xinfo_new(). + * + * @param flag + * Bitfield for control purposes. Unused yet. Submit 0. + * @return + * A pointer to the new object + * NULL indicates failure to allocate memory + * + * @since 1.2.4 + */ +struct iso_hfsplus_xinfo_data *iso_hfsplus_xinfo_new(int flag); + + /************ Error codes and return values for libisofs ********************/ /** successfully execution */ diff --git a/libisofs/libisofs.ver b/libisofs/libisofs.ver index 31e249e..85d79b8 100644 --- a/libisofs/libisofs.ver +++ b/libisofs/libisofs.ver @@ -69,6 +69,8 @@ iso_fs_global_id; iso_get_local_charset; iso_get_messenger; iso_gzip_get_refcounts; +iso_hfsplus_xinfo_func; +iso_hfsplus_xinfo_new; iso_image_add_boot_image; iso_image_add_mips_boot_file; iso_image_attach_data; @@ -283,6 +285,7 @@ iso_write_opts_set_dir_rec_mtime; iso_write_opts_set_disc_label; iso_write_opts_set_fifo_size; iso_write_opts_set_hardlinks; +iso_write_opts_set_hfsplus; iso_write_opts_set_iso1999; iso_write_opts_set_iso_level; iso_write_opts_set_joliet; diff --git a/libisofs/util.c b/libisofs/util.c index e4b1379..3b9ef5c 100644 --- a/libisofs/util.c +++ b/libisofs/util.c @@ -2064,4 +2064,24 @@ void *iso_alloc_mem(size_t size, size_t count, int flag) iso_msg_submit(-1, ISO_OUT_OF_MEM, 0, "Out of virtual memory"); return pt; } + + +int iso_hfsplus_xinfo_func(void *data, int flag) +{ + if (flag == 1 && data != NULL) + free(data); + return 1; +} + + +struct iso_hfsplus_xinfo_data *iso_hfsplus_xinfo_new(int flag) +{ + struct iso_hfsplus_xinfo_data *o; + + o = calloc(1, sizeof(struct iso_hfsplus_xinfo_data)); + if (o == NULL) + return NULL; + o->version = 0; + return o; +}