Attributed HFS+ blessings to IsoImage rather than IsoWriteOpts.
This commit is contained in:
parent
1842921b2c
commit
82f39020cf
@ -1872,7 +1872,7 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
||||
}
|
||||
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];
|
||||
target->hfsplus_blessed[i] = src->hfsplus_blessed[i];
|
||||
if (target->hfsplus_blessed[i] != NULL)
|
||||
iso_node_ref(target->hfsplus_blessed[i]);
|
||||
}
|
||||
@ -2607,8 +2607,6 @@ int iso_write_opts_new(IsoWriteOpts **opts, int profile)
|
||||
wopts->allow_dir_id_ext = 0;
|
||||
wopts->old_empty = 0;
|
||||
wopts->untranslated_name_len = 0;
|
||||
for (i = 0; i < ISO_HFSPLUS_BLESS_MAX; i++)
|
||||
wopts->hfsplus_blessed[i] = NULL;
|
||||
|
||||
*opts = wopts;
|
||||
return ISO_SUCCESS;
|
||||
@ -2635,9 +2633,6 @@ void iso_write_opts_free(IsoWriteOpts *opts)
|
||||
for (i = 0; i < ISO_MAX_PARTITIONS; i++)
|
||||
if (opts->appended_partitions[i] != NULL)
|
||||
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);
|
||||
}
|
||||
@ -3231,12 +3226,3 @@ int iso_write_opts_set_disc_label(IsoWriteOpts *opts, char *label)
|
||||
return ISO_SUCCESS;
|
||||
}
|
||||
|
||||
/* API */
|
||||
int iso_write_opts_bless(IsoWriteOpts *opts, enum IsoHfsplusBlessings blessing,
|
||||
IsoNode *node, int flag)
|
||||
{
|
||||
/* >>> */;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -444,13 +444,6 @@ struct iso_write_opts {
|
||||
*/
|
||||
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;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
* Copyright (c) 2009 Thomas Schmitt
|
||||
* Copyright (c) 2009 - 2012 Thomas Schmitt
|
||||
*
|
||||
* This file is part of the libisofs project; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2
|
||||
@ -93,6 +93,9 @@ int iso_image_new(const char *name, IsoImage **image)
|
||||
img->checksum_idx_count = 0;
|
||||
img->checksum_array = NULL;
|
||||
img->generator_is_running = 0;
|
||||
for (i = 0; i < ISO_HFSPLUS_BLESS_MAX; i++)
|
||||
img->hfsplus_blessed[i] = NULL;
|
||||
|
||||
*image = img;
|
||||
return ISO_SUCCESS;
|
||||
}
|
||||
@ -112,20 +115,22 @@ void iso_image_ref(IsoImage *image)
|
||||
*/
|
||||
void iso_image_unref(IsoImage *image)
|
||||
{
|
||||
if (--image->refcount == 0) {
|
||||
int nexcl;
|
||||
int nexcl, i;
|
||||
|
||||
if (--image->refcount == 0) {
|
||||
/* we need to free the image */
|
||||
|
||||
if (image->user_data_free != NULL) {
|
||||
/* free attached data */
|
||||
image->user_data_free(image->user_data);
|
||||
}
|
||||
|
||||
for (nexcl = 0; nexcl < image->nexcludes; ++nexcl) {
|
||||
free(image->excludes[nexcl]);
|
||||
}
|
||||
free(image->excludes);
|
||||
|
||||
for (i = 0; i < ISO_HFSPLUS_BLESS_MAX; i++)
|
||||
if (image->hfsplus_blessed[i] != NULL)
|
||||
iso_node_unref(image->hfsplus_blessed[i]);
|
||||
iso_node_unref((IsoNode*)image->root);
|
||||
iso_node_builder_unref(image->builder);
|
||||
iso_filesystem_unref(image->fs);
|
||||
@ -657,3 +662,48 @@ int iso_image_give_up_mips_boot(IsoImage *image, int flag)
|
||||
image->num_mips_boot_files = 0;
|
||||
return ISO_SUCCESS;
|
||||
}
|
||||
|
||||
/* API */
|
||||
int iso_image_hfsplus_bless(IsoImage *img, enum IsoHfsplusBlessings blessing,
|
||||
IsoNode *node, int flag)
|
||||
{
|
||||
unsigned int i, ok = 0;
|
||||
|
||||
if (flag & 2) {
|
||||
/* Delete any blessing */
|
||||
for (i = 0; i < ISO_HFSPLUS_BLESS_MAX; i++) {
|
||||
if (img->hfsplus_blessed[i] == node || node == NULL) {
|
||||
img->hfsplus_blessed[i] = NULL;
|
||||
ok = 1;
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
if (blessing == ISO_HFSPLUS_BLESS_MAX)
|
||||
return ISO_WRONG_ARG_VALUE;
|
||||
if (flag & 1) {
|
||||
/* Delete a particular blessing */
|
||||
if (img->hfsplus_blessed[blessing] == node || node == NULL) {
|
||||
img->hfsplus_blessed[blessing] = NULL;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* No two hats on one node */
|
||||
for (i = 0; i < ISO_HFSPLUS_BLESS_MAX && node != NULL; i++)
|
||||
if (i != blessing && img->hfsplus_blessed[i] == node)
|
||||
return 0;
|
||||
/* Enforce correct file type */
|
||||
if (blessing == ISO_HFSPLUS_BLESS_INTEL_BOOTFILE) {
|
||||
if (node->type != LIBISO_FILE)
|
||||
return 0;
|
||||
} else {
|
||||
if (node->type != LIBISO_DIR)
|
||||
return 0;
|
||||
}
|
||||
|
||||
img->hfsplus_blessed[blessing] = node;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -180,6 +180,13 @@ struct Iso_Image
|
||||
*/
|
||||
int generator_is_running;
|
||||
|
||||
/* 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];
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -6723,28 +6723,30 @@ enum IsoHfsplusBlessings {
|
||||
* 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 image
|
||||
* The image to manipulate.
|
||||
* @param blessing
|
||||
* The kind of blessing to be issued. Use
|
||||
* The kind of blessing to be issued.
|
||||
* @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.
|
||||
* If node is NULL, then the blessing will be revoked from any node
|
||||
* which bears it.
|
||||
* @param flag
|
||||
* Bitfield for control purposes.
|
||||
* bit0= Revoke blessing rather than issue it
|
||||
* bit1= Revoke any blessing of the node,
|
||||
* regardless of parameter blessing
|
||||
* bit0= Revoke blessing if node != NULL bears it.
|
||||
* bit1= Revoke any blessing of the node, regardless of parameter
|
||||
* blessing. If node is NULL, then revoke all blessings in opts.
|
||||
* @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
|
||||
* 1 means successful blessing or revokation of an existing blessing.
|
||||
* 0 means the node already bears another blessing, or is of wrong type,
|
||||
* 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,
|
||||
int iso_image_hfsplus_bless(IsoImage *img, enum IsoHfsplusBlessings blessing,
|
||||
IsoNode *node, int flag);
|
||||
|
||||
|
||||
|
@ -105,6 +105,7 @@ iso_image_get_system_id;
|
||||
iso_image_get_volset_id;
|
||||
iso_image_get_volume_id;
|
||||
iso_image_give_up_mips_boot;
|
||||
iso_image_hfsplus_bless;
|
||||
iso_image_import;
|
||||
iso_image_new;
|
||||
iso_image_ref;
|
||||
@ -262,7 +263,6 @@ iso_tree_set_replace_mode;
|
||||
iso_tree_set_report_callback;
|
||||
iso_util_decode_md5_tag;
|
||||
iso_write_opts_attach_jte;
|
||||
iso_write_opts_bless;
|
||||
iso_write_opts_detach_jte;
|
||||
iso_write_opts_free;
|
||||
iso_write_opts_get_data_start;
|
||||
|
Loading…
Reference in New Issue
Block a user