|
|
|
@ -13,6 +13,7 @@
|
|
|
|
|
#define LIBISO_LIBISOFS_H
|
|
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
|
|
/* #include <libburn.h> */
|
|
|
|
|
struct burn_source;
|
|
|
|
@ -31,15 +32,43 @@ struct iso_volset;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* A node in the filesystem tree.
|
|
|
|
|
*
|
|
|
|
|
* This is opaque struct that represent any kind of nodes. When needed,
|
|
|
|
|
* you can get the type with iso_tree_node_get_type and cast it to the
|
|
|
|
|
* appropiate subtype:
|
|
|
|
|
*
|
|
|
|
|
* iso_tree_node_dir
|
|
|
|
|
* iso_tree_node_file
|
|
|
|
|
* iso_tree_node_symlink
|
|
|
|
|
*
|
|
|
|
|
* \see tree.h
|
|
|
|
|
*/
|
|
|
|
|
struct iso_tree_node;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* El-Torito boot image
|
|
|
|
|
* \see eltorito.h
|
|
|
|
|
* The type of an iso_tree_node.
|
|
|
|
|
* When an user gets an iso_tree_node from libisofs, (s)he can use
|
|
|
|
|
* iso_tree_node_get_type to get the current type of the node, and then
|
|
|
|
|
* cast to the appropriate subtype. For example:
|
|
|
|
|
*
|
|
|
|
|
* struct iso_tree_node *node = iso... TODO
|
|
|
|
|
* if ( iso_tree_node_get_type(node) == LIBISO_NODE_DIR ) {
|
|
|
|
|
* struct iso_tree_node_dir *dir = (struct iso_tree_node_dir *)node;
|
|
|
|
|
* ...
|
|
|
|
|
* }
|
|
|
|
|
*
|
|
|
|
|
* Useful macros are provided.
|
|
|
|
|
*/
|
|
|
|
|
struct el_torito_boot_image;
|
|
|
|
|
enum iso_tree_node_type {
|
|
|
|
|
LIBISO_NODE_DIR,
|
|
|
|
|
LIBISO_NODE_FILE,
|
|
|
|
|
LIBISO_NODE_SYMLINK,
|
|
|
|
|
LIBISO_NODE_BOOTCATALOG
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#define LIBISO_ISDIR(n) (iso_tree_node_get_type(n) == LIBISO_NODE_DIR)
|
|
|
|
|
#define LIBISO_ISREG(n) (iso_tree_node_get_type(n) == LIBISO_NODE_FILE)
|
|
|
|
|
#define LIBISO_ISLNK(n) (iso_tree_node_get_type(n) == LIBISO_NODE_SYMLINK)
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* A directory in the filesystem tree.
|
|
|
|
@ -48,6 +77,44 @@ struct el_torito_boot_image;
|
|
|
|
|
*/
|
|
|
|
|
struct iso_tree_node_dir;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* A node in the filesystem tree that represents a regular file
|
|
|
|
|
*/
|
|
|
|
|
struct iso_tree_node_file;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* A node in the filesystem tree that represents a symbolic link
|
|
|
|
|
*/
|
|
|
|
|
struct iso_tree_node_symlink;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* A node that represents a boot catalog
|
|
|
|
|
* FIXME I'm not very sure how this should be treated.
|
|
|
|
|
*/
|
|
|
|
|
struct iso_tree_node_boot_catalog;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* El-Torito boot image
|
|
|
|
|
* \see eltorito.h
|
|
|
|
|
*/
|
|
|
|
|
struct el_torito_boot_image;
|
|
|
|
|
|
|
|
|
|
/** Iterator for dir children. */
|
|
|
|
|
struct iso_tree_iter;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The procedence of the node.
|
|
|
|
|
*/
|
|
|
|
|
enum tree_node_from {
|
|
|
|
|
/** The node has been added by the user */
|
|
|
|
|
LIBISO_NEW = 0,
|
|
|
|
|
/**
|
|
|
|
|
* The node comes from a previous image. That can be from a previous
|
|
|
|
|
* session on disc, or from an ISO file we want to modify.
|
|
|
|
|
*/
|
|
|
|
|
LIBISO_PREVIMG
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Extensions addition to ECMA-119 (ISO-9660) image. Usage of at least
|
|
|
|
|
* one of these flags is highly recommended if the disc will be used on a
|
|
|
|
@ -155,6 +222,81 @@ struct ecma119_source_opts {
|
|
|
|
|
uid_t uid; /**< uid to use when replace_uid is set. */
|
|
|
|
|
char *input_charset; /**< NULL to use default charset */
|
|
|
|
|
char *ouput_charset; /**< NULL to use default charset */
|
|
|
|
|
uint32_t ms_block;
|
|
|
|
|
/**<
|
|
|
|
|
* Start block for multisession. When this is greater than 0,
|
|
|
|
|
* it's suppossed to be the lba of the next writable address
|
|
|
|
|
* on disc; all block lba on image will take this into account,
|
|
|
|
|
* and files from a previous session will not be written on
|
|
|
|
|
* image. This behavior is only suitable for images to be
|
|
|
|
|
* appended to a multisession disc.
|
|
|
|
|
* When this is 0, no multisession image will be created. If
|
|
|
|
|
* some files are taken from a previous image, its contents
|
|
|
|
|
* will be written again to the new image. Use this with new
|
|
|
|
|
* images or if you plan to modify an existin image.
|
|
|
|
|
*/
|
|
|
|
|
struct data_source* src;
|
|
|
|
|
/**<
|
|
|
|
|
* When modifying a image, this is the source of the original
|
|
|
|
|
* image, used to read file contents.
|
|
|
|
|
* Otherwise it can be NULL.
|
|
|
|
|
*/
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* FIXME documentar isto!!!
|
|
|
|
|
*/
|
|
|
|
|
struct ecma119_read_opts {
|
|
|
|
|
int tree_to_read;
|
|
|
|
|
int block; /** Block where the image begins, usually 0, can be
|
|
|
|
|
* different on a multisession disc.
|
|
|
|
|
*/
|
|
|
|
|
//TODO....
|
|
|
|
|
unsigned int norock:1; /*< Do not read Rock Ridge extensions */
|
|
|
|
|
//nojoliet
|
|
|
|
|
//check -> convert names to lower case
|
|
|
|
|
//uid, gid (when no RR)
|
|
|
|
|
//file and dir mode (when no RR)
|
|
|
|
|
|
|
|
|
|
/* modified by the function */
|
|
|
|
|
unsigned int hasRR:1; /*< It will be set to 1 if RR extensions are present,
|
|
|
|
|
to 0 if not. */
|
|
|
|
|
//hasJoliet
|
|
|
|
|
int error;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Data source used by libisofs for reading an existing image.
|
|
|
|
|
* It contains suitable methods to read arbitrary block. Usually, the block
|
|
|
|
|
* size is 2048 bytes.
|
|
|
|
|
*/
|
|
|
|
|
struct data_source {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Reference count for the data source. Should be 1 when a new source
|
|
|
|
|
* is created. Increment it to take a reference for yourself. Use
|
|
|
|
|
* data_source_free to destroy your reference to it.
|
|
|
|
|
*/
|
|
|
|
|
int refcount;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Read data from the source.
|
|
|
|
|
* @param lba Block to be read.
|
|
|
|
|
* @param buffer Buffer where the data will be written. Its size must
|
|
|
|
|
* be at least 2048 bytes.
|
|
|
|
|
* @return
|
|
|
|
|
* 0 if ok, < 0 on error
|
|
|
|
|
*/
|
|
|
|
|
int (*read_block)(struct data_source *src, int lba, unsigned char *buffer);
|
|
|
|
|
|
|
|
|
|
/** Get the size (number of block) of the source's data */
|
|
|
|
|
int (*get_size)(struct data_source *);
|
|
|
|
|
|
|
|
|
|
/** Clean up the source specific data */
|
|
|
|
|
void (*free_data)(struct data_source *);
|
|
|
|
|
|
|
|
|
|
/** Source specific data */
|
|
|
|
|
void *data;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -208,6 +350,11 @@ void iso_volume_free(struct iso_volume *volume);
|
|
|
|
|
*/
|
|
|
|
|
void iso_volset_free(struct iso_volset *volume);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get a volume from a volume set.
|
|
|
|
|
*/
|
|
|
|
|
struct iso_volume *iso_volset_get_volume(struct iso_volset *volset, int volnum);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the root directory for a volume.
|
|
|
|
|
*/
|
|
|
|
@ -219,30 +366,65 @@ struct iso_tree_node_dir *iso_volume_get_root(const struct iso_volume *volume);
|
|
|
|
|
void iso_volume_set_volume_id(struct iso_volume *volume,
|
|
|
|
|
const char *volume_id);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the volume identifier.
|
|
|
|
|
* The returned string is owned by libisofs and should not be freed nor
|
|
|
|
|
* changed.
|
|
|
|
|
*/
|
|
|
|
|
const char *iso_volume_get_volume_id(struct iso_volume *volume);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Fill in the publisher for a volume.
|
|
|
|
|
*/
|
|
|
|
|
void iso_volume_set_publisher_id(struct iso_volume *volume,
|
|
|
|
|
const char *publisher_id);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the publisher of a volume.
|
|
|
|
|
* The returned string is owned by libisofs and should not be freed nor
|
|
|
|
|
* changed.
|
|
|
|
|
*/
|
|
|
|
|
const char *iso_volume_get_publisher_id(struct iso_volume *volume);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Fill in the data preparer for a volume.
|
|
|
|
|
*/
|
|
|
|
|
void iso_volume_set_data_preparer_id(struct iso_volume *volume,
|
|
|
|
|
const char *data_preparer_id);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the data preparer of a volume.
|
|
|
|
|
* The returned string is owned by libisofs and should not be freed nor
|
|
|
|
|
* changed.
|
|
|
|
|
*/
|
|
|
|
|
const char *iso_volume_get_data_preparer_id(struct iso_volume *volume);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Fill in the system id for a volume. Up to 32 characters.
|
|
|
|
|
*/
|
|
|
|
|
void iso_volume_set_system_id(struct iso_volume *volume,
|
|
|
|
|
const char *system_id);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the system id of a volume.
|
|
|
|
|
* The returned string is owned by libisofs and should not be freed nor
|
|
|
|
|
* changed.
|
|
|
|
|
*/
|
|
|
|
|
const char *iso_volume_get_system_id(struct iso_volume *volume);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Fill in the application id for a volume. Up to 128 chars.
|
|
|
|
|
*/
|
|
|
|
|
void iso_volume_set_application_id(struct iso_volume *volume,
|
|
|
|
|
const char *application_id);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the application id of a volume.
|
|
|
|
|
* The returned string is owned by libisofs and should not be freed nor
|
|
|
|
|
* changed.
|
|
|
|
|
*/
|
|
|
|
|
const char *iso_volume_get_application_id(struct iso_volume *volume);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Fill copyright information for the volume. Usually this refers
|
|
|
|
|
* to a file on disc. Up to 37 characters.
|
|
|
|
@ -250,6 +432,13 @@ void iso_volume_set_application_id(struct iso_volume *volume,
|
|
|
|
|
void iso_volume_set_copyright_file_id(struct iso_volume *volume,
|
|
|
|
|
const char *copyright_file_id);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the copyright information of a volume.
|
|
|
|
|
* The returned string is owned by libisofs and should not be freed nor
|
|
|
|
|
* changed.
|
|
|
|
|
*/
|
|
|
|
|
const char *iso_volume_get_copyright_file_id(struct iso_volume *volume);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Fill abstract information for the volume. Usually this refers
|
|
|
|
|
* to a file on disc. Up to 37 characters.
|
|
|
|
@ -257,6 +446,13 @@ void iso_volume_set_copyright_file_id(struct iso_volume *volume,
|
|
|
|
|
void iso_volume_set_abstract_file_id(struct iso_volume *volume,
|
|
|
|
|
const char *abstract_file_id);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the abstract information of a volume.
|
|
|
|
|
* The returned string is owned by libisofs and should not be freed nor
|
|
|
|
|
* changed.
|
|
|
|
|
*/
|
|
|
|
|
const char *iso_volume_get_abstract_file_id(struct iso_volume *volume);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Fill biblio information for the volume. Usually this refers
|
|
|
|
|
* to a file on disc. Up to 37 characters.
|
|
|
|
@ -264,6 +460,13 @@ void iso_volume_set_abstract_file_id(struct iso_volume *volume,
|
|
|
|
|
void iso_volume_set_biblio_file_id(struct iso_volume *volume,
|
|
|
|
|
const char *biblio_file_id);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the biblio information of a volume.
|
|
|
|
|
* The returned string is owned by libisofs and should not be freed nor
|
|
|
|
|
* changed.
|
|
|
|
|
*/
|
|
|
|
|
const char *iso_volume_get_biblio_file_id(struct iso_volume *volume);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Create a bootable volume by adding a El-Torito boot image.
|
|
|
|
|
*
|
|
|
|
@ -336,13 +539,12 @@ el_torito_set_write_boot_info(struct el_torito_boot_image *bootimg);
|
|
|
|
|
* \param path The path, in the image, of the file.
|
|
|
|
|
*
|
|
|
|
|
* \return The node found or NULL.
|
|
|
|
|
*
|
|
|
|
|
* TODO we need a way to allow developers know which kind of node is.
|
|
|
|
|
* Think about this when designing the read api
|
|
|
|
|
*/
|
|
|
|
|
struct iso_tree_node *iso_tree_volume_path_to_node(struct iso_volume *volume, const char *path);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* TODO I don't like this kind of functions here. I think it should be
|
|
|
|
|
* in genisofs
|
|
|
|
|
* Add a file or a directory (recursively) to a volume by specifying its path on the volume.
|
|
|
|
|
*
|
|
|
|
|
* \param volume The volume to add the file to.
|
|
|
|
@ -356,6 +558,8 @@ struct iso_tree_node *iso_tree_volume_path_to_node(struct iso_volume *volume, co
|
|
|
|
|
// const char *path);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* TODO I don't like this kind of functions here. I think it should be
|
|
|
|
|
* in genisofs
|
|
|
|
|
* Creates a new, empty directory on the volume.
|
|
|
|
|
*
|
|
|
|
|
* \param volume The volume to add the directory to.
|
|
|
|
@ -448,6 +652,9 @@ struct iso_tree_node *iso_tree_add_node(struct iso_tree_node_dir *parent,
|
|
|
|
|
const char *path);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* TODO I don't like this kind of functions here. I think it should be
|
|
|
|
|
* in genisofs
|
|
|
|
|
*
|
|
|
|
|
* Recursively add an existing directory to the tree.
|
|
|
|
|
* Warning: when using this, you'll lose pointers to files or subdirectories.
|
|
|
|
|
* If you want to have pointers to all files and directories,
|
|
|
|
@ -462,11 +669,23 @@ struct iso_tree_node *iso_tree_add_node(struct iso_tree_node_dir *parent,
|
|
|
|
|
void iso_tree_radd_dir(struct iso_tree_node_dir *parent, const char *path,
|
|
|
|
|
struct iso_tree_radd_dir_behavior *behavior);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the type of an iso_tree_node
|
|
|
|
|
*/
|
|
|
|
|
enum iso_tree_node_type iso_tree_node_get_type(struct iso_tree_node *node);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set the name of a tree node (using the current locale).
|
|
|
|
|
*/
|
|
|
|
|
void iso_tree_node_set_name(struct iso_tree_node *node, const char *name);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the name of a tree node (using the current locale).
|
|
|
|
|
* The returned string belongs to the node and should not be modified nor
|
|
|
|
|
* freed. Use strdup if you really need your own copy.
|
|
|
|
|
*/
|
|
|
|
|
const char *iso_tree_node_get_name(struct iso_tree_node *node);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set if the node will be hidden in RR/ISO tree, Joliet tree or both.
|
|
|
|
|
*
|
|
|
|
@ -485,18 +704,37 @@ void iso_tree_node_set_name(struct iso_tree_node *node, const char *name);
|
|
|
|
|
*/
|
|
|
|
|
void iso_tree_node_set_hidden(struct iso_tree_node *node, int hide_attrs);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Check if a node will be hidden in RR/ISO tree, Joliet tree or both.
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
* 0 if the node won't be hidden, otherwise you can AND the return value
|
|
|
|
|
* with hide_node_flag's to get in what trees the node will be hidden.
|
|
|
|
|
*/
|
|
|
|
|
int iso_tree_node_is_hidden(struct iso_tree_node *node);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set the group id for the node. This attribute is only useful when
|
|
|
|
|
* Rock Ridge extensions are enabled.
|
|
|
|
|
*/
|
|
|
|
|
void iso_tree_node_set_gid(struct iso_tree_node *node, gid_t gid);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the group id of the node.
|
|
|
|
|
*/
|
|
|
|
|
gid_t iso_tree_node_get_gid(struct iso_tree_node *node);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set the user id for the node. This attribute is only useful when
|
|
|
|
|
* Rock Ridge extensions are enabled.
|
|
|
|
|
*/
|
|
|
|
|
void iso_tree_node_set_uid(struct iso_tree_node *node, uid_t uid);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the user id of the node.
|
|
|
|
|
*/
|
|
|
|
|
uid_t iso_tree_node_get_uid(struct iso_tree_node *node);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set the permissions for the node. This attribute is only useful when
|
|
|
|
|
* Rock Ridge extensions are enabled.
|
|
|
|
@ -507,6 +745,9 @@ void iso_tree_node_set_uid(struct iso_tree_node *node, uid_t uid);
|
|
|
|
|
*/
|
|
|
|
|
void iso_tree_node_set_permissions(struct iso_tree_node *node, mode_t mode);
|
|
|
|
|
|
|
|
|
|
/** Get the permissions for the node */
|
|
|
|
|
mode_t iso_tree_node_get_permissions(struct iso_tree_node *node);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sets the order in which a node will be written on image. High weihted files
|
|
|
|
|
* will be written first, so in a disc them will be written near the center.
|
|
|
|
@ -519,6 +760,139 @@ void iso_tree_node_set_permissions(struct iso_tree_node *node, mode_t mode);
|
|
|
|
|
*/
|
|
|
|
|
void iso_tree_node_set_sort_weight(struct iso_tree_node *node, int w);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sets the destination of a symbolic link
|
|
|
|
|
*/
|
|
|
|
|
void iso_tree_node_symlink_set_dest(struct iso_tree_node_symlink *node, const char *dest);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the destination of a symbolic link.
|
|
|
|
|
* The returned string is owned by libisofs and should not be freed nor modified.
|
|
|
|
|
*/
|
|
|
|
|
const char *iso_tree_node_symlink_get_dest(struct iso_tree_node_symlink *node);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get an iterator for the children of the given dir.
|
|
|
|
|
* You can iterate over the children with iso_tree_iter_next. When finished,
|
|
|
|
|
* you should free the iterator with iso_tree_iter_free.
|
|
|
|
|
* You musn't delete a child of the same dir, using iso_tree_node_take() or
|
|
|
|
|
* iso_tree_node_remove(), while you're using the iterator. You can use
|
|
|
|
|
* iso_tree_node_take_iter() or iso_tree_node_remove_iter() instead.
|
|
|
|
|
*
|
|
|
|
|
* The usage of an iterator is:
|
|
|
|
|
*
|
|
|
|
|
* struct iso_tree_iter *iter;
|
|
|
|
|
* struct iso_tree_node *node;
|
|
|
|
|
* iter = iso_tree_node_children(dir);
|
|
|
|
|
* while ( (node = iso_tree_iter_next(iter)) != NULL ) {
|
|
|
|
|
* // do something with the child
|
|
|
|
|
* }
|
|
|
|
|
* iso_tree_iter_free(iter);
|
|
|
|
|
*
|
|
|
|
|
* An iterator is intended to be used in a single iteration over the
|
|
|
|
|
* children of a dir. Thus, it should be treated as a temporary object,
|
|
|
|
|
* and free as soon as possible.
|
|
|
|
|
*/
|
|
|
|
|
struct iso_tree_iter *iso_tree_node_children(struct iso_tree_node_dir *dir);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the next child.
|
|
|
|
|
* Take care that the node is owned by libisofs, and will be freed whit the
|
|
|
|
|
* tree it belongs. If you want your own ref to it, call iso_tree_node_ref()
|
|
|
|
|
* on it.
|
|
|
|
|
* This returns NULL if no more children are available.
|
|
|
|
|
*/
|
|
|
|
|
struct iso_tree_node *iso_tree_iter_next(struct iso_tree_iter *iter);
|
|
|
|
|
|
|
|
|
|
/** Free an iteration */
|
|
|
|
|
void iso_tree_iter_free(struct iso_tree_iter *iter);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Removes a child from a directory.
|
|
|
|
|
* The child is not freed, so you will become the owner of the node. Later
|
|
|
|
|
* you can add the node to another dir (calling iso_tree_add_child), or free
|
|
|
|
|
* it if you don't need it (with iso_tree_free).
|
|
|
|
|
*
|
|
|
|
|
* @return 0 on success, -1 if the node doesn't belong to the dir.
|
|
|
|
|
*/
|
|
|
|
|
int iso_tree_node_take(struct iso_tree_node_dir *dir,
|
|
|
|
|
struct iso_tree_node *node);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Removes a child from a directory and free (unref) it.
|
|
|
|
|
* If you want to keep the child alive, you need to iso_tree_node_ref() it
|
|
|
|
|
* before this call, but in that case iso_tree_node_take() is a better
|
|
|
|
|
* alternative.
|
|
|
|
|
*
|
|
|
|
|
* @return 0 on success, -1 if the node doesn't belong to the dir (in this
|
|
|
|
|
* last case the node is not freed).
|
|
|
|
|
*/
|
|
|
|
|
int iso_tree_node_remove(struct iso_tree_node_dir *dir,
|
|
|
|
|
struct iso_tree_node *node);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Removes a child from a directory during an iteration, without freeing it.
|
|
|
|
|
* It's like iso_tree_node_take(), but to be used during a directory
|
|
|
|
|
* iteration.
|
|
|
|
|
* The node removed will be the last returned by the iteration.
|
|
|
|
|
*
|
|
|
|
|
* The behavior on two call to this function without calling iso_tree_iter_next
|
|
|
|
|
* between then is undefined, and should never occur. (TODO protect against this?)
|
|
|
|
|
*
|
|
|
|
|
* @return 0 on success, < 0 on an invalid usage, i.e., if the user call this
|
|
|
|
|
* before an inicial iso_tree_iter_next() or if last
|
|
|
|
|
* iso_tree_iter_next() has returned NULL.
|
|
|
|
|
*/
|
|
|
|
|
int iso_tree_node_take_iter(struct iso_tree_iter *iter);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Removes a child from a directory during an iteration and free it.
|
|
|
|
|
* It's like iso_tree_node_remove(), but to be used during a directory
|
|
|
|
|
* iteration.
|
|
|
|
|
* The node removed will be the last returned by the iteration.
|
|
|
|
|
*
|
|
|
|
|
* The behavior on two call to this function without calling iso_tree_iter_next
|
|
|
|
|
* between then is undefined, and should never occur. (TODO protect against this?)
|
|
|
|
|
*
|
|
|
|
|
* @return 0 on success, < 0 on an invalid usage, i.e., if the user call this
|
|
|
|
|
* before an inicial iso_tree_iter_next() or if last
|
|
|
|
|
* iso_tree_iter_next() has returned NULL.
|
|
|
|
|
*/
|
|
|
|
|
int iso_tree_node_remove_iter(struct iso_tree_iter *iter);
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Get the parent of the given iso tree node.
|
|
|
|
|
* This returns NULL if the node is the root of the tree, or is a node
|
|
|
|
|
* that doesn't pertain to any tree (it was removed/take)
|
|
|
|
|
*/
|
|
|
|
|
struct iso_tree_node_dir *iso_tree_node_get_parent(struct iso_tree_node *node);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Adds a child to a directory.
|
|
|
|
|
* The child will be freed when the parent is freed, so you must be the
|
|
|
|
|
* owner of the child (maybe calling iso_tree_node_ref) before calling this.
|
|
|
|
|
*
|
|
|
|
|
* \pre parent has no child with the same name as \p child
|
|
|
|
|
*/
|
|
|
|
|
void iso_tree_add_child(struct iso_tree_node_dir *parent,
|
|
|
|
|
struct iso_tree_node *child);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Increments the reference counting of the given node.
|
|
|
|
|
* If you call this, you must remember call iso_tree_free when the
|
|
|
|
|
* node is no more needed.
|
|
|
|
|
*/
|
|
|
|
|
void iso_tree_node_ref(struct iso_tree_node *node);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Recursively free a directory.
|
|
|
|
|
*
|
|
|
|
|
* \param root The root of the directory heirarchy to free.
|
|
|
|
|
*
|
|
|
|
|
* \pre \p root is non-NULL.
|
|
|
|
|
*/
|
|
|
|
|
void iso_tree_free(struct iso_tree_node *root);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Recursively print a directory to stdout.
|
|
|
|
|
* \param spaces The initial number of spaces on the left. Set to 0 if you
|
|
|
|
@ -541,4 +915,22 @@ void iso_tree_print(const struct iso_tree_node *root, int spaces);
|
|
|
|
|
struct burn_source* iso_source_new_ecma119(struct iso_volset *volumeset,
|
|
|
|
|
struct ecma119_source_opts *opts);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates a new data source from the given file.
|
|
|
|
|
*
|
|
|
|
|
* Returns NULL on error
|
|
|
|
|
*/
|
|
|
|
|
struct data_source *data_source_from_file(const char *path);
|
|
|
|
|
|
|
|
|
|
/** Free a given data source (decrease its refcount and maybe free it) */
|
|
|
|
|
void data_source_free(struct data_source*);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Read an existing ISO image.
|
|
|
|
|
*
|
|
|
|
|
* TODO documentar
|
|
|
|
|
*/
|
|
|
|
|
struct iso_volset *iso_volset_read(struct data_source *src,
|
|
|
|
|
struct ecma119_read_opts *opts);
|
|
|
|
|
|
|
|
|
|
#endif /* LIBISO_LIBISOFS_H */
|
|
|
|
|