#ifndef ELTORITO_H_
#define ELTORITO_H_

#include "tree.h"
#include "file.h"
#include "ecma119.h"

/**
 * Location of the boot catalog
 */
struct iso_tree_node_boot_catalog
{
	struct iso_tree_node node;
	struct el_torito_boot_catalog *catalog;
};

struct el_torito_boot_catalog {
	int nentries;
	struct el_torito_boot_image **entries;
	struct iso_file *file; /**< The catalog file */
};

struct el_torito_boot_image {
	unsigned char bootable; /**< If the entry is bootable. */
	unsigned char patch_isolinux; /**< If the image will be patched */
	unsigned char type; /**< The type of image */
	unsigned char partition_type; /**< type of partition for HD-emul images */
	short load_seg; /**< Load segment for the initial boot image. */
	short load_size; /**< Number of sector to load. */
	struct iso_tree_node_file *image;
	struct iso_file *file; 
};

/*struct el_torito_boot_entry *
el_torito_add_boot_entry(struct el_torito_boot_catalog *cat, 
                         struct iso_tree_node_file *image);
*/

void el_torito_boot_catalog_free(struct el_torito_boot_catalog *cat);

/**
 * For each boot image file, this gets the related iso_file object.
 * In most cases, the file is already in the hash table. However, if the
 * boot record is hidden in both ISO/RR and joliet trees, this ensures
 * that boot images will be written to image.
 */
void el_torito_get_image_files(struct ecma119_write_target *t);

/**
 * Patch image files if selected. This is needed for isolinux boot images 
 */
void el_torito_patch_image_files(struct ecma119_write_target *t);

void
el_torito_wr_boot_vol_desc(struct ecma119_write_target *t, uint8_t *buf);

void
el_torito_wr_catalog(struct ecma119_write_target *t, uint8_t *buf);

#endif /*ELTORITO_H_*/
