Created API and hfsplus interface of HFS+ blessing.

But iso_write_opts_bless() is still a dummy.
This commit is contained in:
Thomas Schmitt 2012-05-25 14:40:06 +02:00
parent 177864bd13
commit ab11c954d9
5 changed files with 88 additions and 0 deletions

View File

@ -119,6 +119,9 @@ void ecma119_image_free(Ecma119Image *t)
for (i = 0; i < ISO_MAX_PARTITIONS; i++) for (i = 0; i < ISO_MAX_PARTITIONS; i++)
if (t->appended_partitions[i] != NULL) if (t->appended_partitions[i] != NULL)
free(t->appended_partitions[i]); free(t->appended_partitions[i]);
for (i = 0; i < ISO_HFSPLUS_BLESS_MAX; i++)
if (t->hfsplus_blessed[i] != NULL)
iso_node_unref(t->hfsplus_blessed[i]);
free(t); free(t);
} }
@ -1868,6 +1871,11 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
target->appended_part_start[i] = target->appended_part_size[i] = 0; target->appended_part_start[i] = target->appended_part_size[i] = 0;
} }
strcpy(target->ascii_disc_label, opts->ascii_disc_label); strcpy(target->ascii_disc_label, opts->ascii_disc_label);
for (i = 0; i < ISO_HFSPLUS_BLESS_MAX; i++) {
target->hfsplus_blessed[i] = opts->hfsplus_blessed[i];
if (target->hfsplus_blessed[i] != NULL)
iso_node_ref(target->hfsplus_blessed[i]);
}
/* /*
* 2. Based on those options, create needed writers: iso, joliet... * 2. Based on those options, create needed writers: iso, joliet...
@ -2599,6 +2607,8 @@ int iso_write_opts_new(IsoWriteOpts **opts, int profile)
wopts->allow_dir_id_ext = 0; wopts->allow_dir_id_ext = 0;
wopts->old_empty = 0; wopts->old_empty = 0;
wopts->untranslated_name_len = 0; wopts->untranslated_name_len = 0;
for (i = 0; i < ISO_HFSPLUS_BLESS_MAX; i++)
wopts->hfsplus_blessed[i] = NULL;
*opts = wopts; *opts = wopts;
return ISO_SUCCESS; return ISO_SUCCESS;
@ -2625,6 +2635,9 @@ void iso_write_opts_free(IsoWriteOpts *opts)
for (i = 0; i < ISO_MAX_PARTITIONS; i++) for (i = 0; i < ISO_MAX_PARTITIONS; i++)
if (opts->appended_partitions[i] != NULL) if (opts->appended_partitions[i] != NULL)
free(opts->appended_partitions[i]); free(opts->appended_partitions[i]);
for (i = 0; i < ISO_HFSPLUS_BLESS_MAX; i++)
if (opts->hfsplus_blessed[i] != NULL)
iso_node_unref(opts->hfsplus_blessed[i]);
free(opts); free(opts);
} }
@ -3218,3 +3231,12 @@ int iso_write_opts_set_disc_label(IsoWriteOpts *opts, char *label)
return ISO_SUCCESS; return ISO_SUCCESS;
} }
/* API */
int iso_write_opts_bless(IsoWriteOpts *opts, enum IsoHfsplusBlessings blessing,
IsoNode *node, int flag)
{
/* >>> */;
return 0;
}

View File

@ -443,6 +443,14 @@ struct iso_write_opts {
/* Eventual name of the non-ISO aspect of the image. E.g. SUN ASCII label. /* Eventual name of the non-ISO aspect of the image. E.g. SUN ASCII label.
*/ */
char ascii_disc_label[ISO_DISC_LABEL_SIZE]; char ascii_disc_label[ISO_DISC_LABEL_SIZE];
/* Pointers to directories or files which shall be get a HFS+ blessing.
libisofs/hfsplus.c et.al. will compare these pointers
with the ->node pointer of Ecma119Nodes.
See libisofs.h
*/
IsoNode *hfsplus_blessed[ISO_HFSPLUS_BLESS_MAX];
}; };
typedef struct ecma119_image Ecma119Image; typedef struct ecma119_image Ecma119Image;
@ -774,6 +782,7 @@ struct ecma119_image
char ascii_disc_label[ISO_DISC_LABEL_SIZE]; char ascii_disc_label[ISO_DISC_LABEL_SIZE];
IsoNode *hfsplus_blessed[ISO_HFSPLUS_BLESS_MAX];
}; };
#define BP(a,b) [(b) - (a) + 1] #define BP(a,b) [(b) - (a) + 1]

View File

@ -6694,6 +6694,60 @@ int iso_hfsplus_xinfo_func(void *data, int flag);
struct iso_hfsplus_xinfo_data *iso_hfsplus_xinfo_new(int flag); struct iso_hfsplus_xinfo_data *iso_hfsplus_xinfo_new(int flag);
/**
* HFS+ blessings are relationships between HFS+ enhanced ISO images and
* particular files in such images. Except for ISO_HFSPLUS_BLESS_INTEL_BOOTFILE
* and ISO_HFSPLUS_BLESS_MAX, these files have to be directories.
* No file may have more than one blessing. Each blessing can only be issued
* to one file.
*
* @since 1.2.4
*/
enum IsoHfsplusBlessings {
/* The blessing that is issued by mkisofs option -hfs-bless. */
ISO_HFSPLUS_BLESS_PPC_BOOTDIR,
/* To be applied to a data file */
ISO_HFSPLUS_BLESS_INTEL_BOOTFILE,
/* Further blessings for directories */
ISO_HFSPLUS_BLESS_SHOWFOLDER,
ISO_HFSPLUS_BLESS_OS9_FOLDER,
ISO_HFSPLUS_BLESS_OSX_FOLDER,
/* Not a blessing, but telling the number of blessings in this list */
ISO_HFSPLUS_BLESS_MAX
};
/**
* Issue a blessing to a particular IsoNode. If the blessing is already issued
* to some file, then it gets revoked from that one.
*
* @param opts
* The option set to be manipulated.
* @param blessing
* The kind of blessing to be issued. Use
* @param node
* The file that shall be blessed. It must actually be an IsoDir or
* IsoFile as is appropriate for the kind of blessing. (See above enum.)
* The node may not yet bear a blessing other than the desired one.
* @param flag
* Bitfield for control purposes.
* bit0= Revoke blessing rather than issue it
* bit1= Revoke any blessing of the node,
* regardless of parameter blessing
* @return
* 1 means successful blessing or revokation of an existing blessing
* 0 means that the blessing could not be issued,
* or that the node was not blessed and revokation was desired
* <0 is one of the listed error codes
*
* @since 1.2.4
*/
int iso_write_opts_bless(IsoWriteOpts *opts, enum IsoHfsplusBlessings blessing,
IsoNode *node, int flag);
/************ Error codes and return values for libisofs ********************/ /************ Error codes and return values for libisofs ********************/
/** successfully execution */ /** successfully execution */

View File

@ -262,6 +262,7 @@ iso_tree_set_replace_mode;
iso_tree_set_report_callback; iso_tree_set_report_callback;
iso_util_decode_md5_tag; iso_util_decode_md5_tag;
iso_write_opts_attach_jte; iso_write_opts_attach_jte;
iso_write_opts_bless;
iso_write_opts_detach_jte; iso_write_opts_detach_jte;
iso_write_opts_free; iso_write_opts_free;
iso_write_opts_get_data_start; iso_write_opts_get_data_start;

View File

@ -2066,6 +2066,7 @@ void *iso_alloc_mem(size_t size, size_t count, int flag)
} }
/* API, >>> ts B20525 : should finally go to hfplus.c */
int iso_hfsplus_xinfo_func(void *data, int flag) int iso_hfsplus_xinfo_func(void *data, int flag)
{ {
if (flag == 1 && data != NULL) if (flag == 1 && data != NULL)
@ -2074,6 +2075,7 @@ int iso_hfsplus_xinfo_func(void *data, int flag)
} }
/* API, >>> ts B20525 : should finally go to hfplus.c */
struct iso_hfsplus_xinfo_data *iso_hfsplus_xinfo_new(int flag) struct iso_hfsplus_xinfo_data *iso_hfsplus_xinfo_new(int flag)
{ {
struct iso_hfsplus_xinfo_data *o; struct iso_hfsplus_xinfo_data *o;