First pinch of libisofs rewrite

This commit is contained in:
Mario Danic
2006-08-24 19:23:37 +00:00
parent 176e1654ff
commit 48d76e844e
16 changed files with 1610 additions and 3065 deletions

View File

@ -9,10 +9,11 @@
* - Write the volume to a file or create a burn source for use with Libburn.
*/
#ifndef __LIBISOFS
#define __LIBISOFS
#ifndef LIBISO_LIBISOFS_H
#define LIBISO_LIBISOFS_H
#include "libburn/libburn.h"
/* #include <libburn.h> */
struct burn_source;
/**
* Data volume.
@ -27,35 +28,11 @@ struct iso_volume;
struct iso_volset;
/**
* Directory on a volume.
* @see tree.h for details.
*/
struct iso_tree_dir;
/**
* File on a volume.
* @see tree.h for details.
*/
struct iso_tree_file;
/**
* Either a file or a directory.
* A node in the filesystem tree.
* \see tree.h
*/
struct iso_tree_node;
/**
* Possible versions of a file or directory name or identifier.
*/
enum iso_name_version {
ISO_NAME_FULL, /**< In the current locale. */
ISO_NAME_ISO, /**< Current ISO level identifier. */
ISO_NAME_ISO_L1, /**< ISO level 1 identifier. */
ISO_NAME_ISO_L2, /**< ISO level 2 identifier. */
ISO_NAME_ROCKRIDGE, /**< Rock Ridge file or directory name. */
ISO_NAME_JOLIET /**< Joliet identifier. */
};
enum ecma119_extension_flag {
ECMA119_ROCKRIDGE = (1<<0),
ECMA119_JOLIET = (1<<1)
@ -69,6 +46,11 @@ struct iso_volume *iso_volume_new(const char *volume_id,
const char *publisher_id,
const char *data_preparer_id);
struct iso_volume *iso_volume_new_with_root(const char *volume_id,
const char *publisher_id,
const char *data_preparer_id,
struct iso_tree_node *root);
/**
* Free a volume.
*/
@ -77,7 +59,7 @@ void iso_volume_free(struct iso_volume *volume);
/**
* Get the root directory for a volume.
*/
struct iso_tree_dir *iso_volume_get_root(const struct iso_volume *volume);
struct iso_tree_node *iso_volume_get_root(const struct iso_volume *volume);
/**
* Fill in the volume identifier for a volume.
@ -97,37 +79,6 @@ void iso_volume_set_publisher_id(struct iso_volume *volume,
void iso_volume_set_data_preparer_id(struct iso_volume *volume,
const char *data_preparer_id);
/**
* Get the current ISO level for a volume.
*/
int iso_volume_get_iso_level(const struct iso_volume *volume);
/**
* Set the current ISO level for a volume.
* ISO level must be 1 or 2.
*/
void iso_volume_set_iso_level(struct iso_volume *volume, int level);
/**
* See if Rock Ridge (POSIX) is enabled for a volume.
*/
int iso_volume_get_rockridge(const struct iso_volume *volume);
/**
* Enable or disable Rock Ridge (POSIX) for a volume.
*/
void iso_volume_set_rockridge(struct iso_volume *volume, int rockridge);
/**
* See if Joliet (Unicode) is enabled for a volume.
*/
int iso_volume_get_joliet(const struct iso_volume *volume);
/**
* Enable or disable Joliet (Unicode) for a volume.
*/
void iso_volume_set_joliet(struct iso_volume *volume, int joliet);
/**
* Create a new Volume Set consisting of only one volume.
* @param volume The first and only volume for the volset to contain.
@ -142,28 +93,14 @@ struct iso_volset *iso_volset_new(struct iso_volume *volume,
*
* \param path The path, on the local filesystem, of the file.
*
* \pre \p parent is non-NULL
* \pre \p parent is NULL or is a directory.
* \pre \p path is non-NULL and is a valid path to a non-directory on the local
* filesystem.
* \return An iso_tree_file whose path is \p path and whose parent is \p parent.
* \return An iso_tree_node whose path is \p path and whose parent is \p parent.
*/
struct iso_tree_file *iso_tree_add_file(struct iso_tree_dir *parent,
struct iso_tree_node *iso_tree_add_node(struct iso_tree_node *parent,
const char *path);
/**
* Add a directory from the local filesystem to the tree.
* Warning: this only adds the directory itself, no files or subdirectories.
*
* \param path The path, on the local filesystem, of the directory.
*
* \pre \p parent is non-NULL
* \pre \p path is non-NULL and is a valid path to a directory on the local
* filesystem.
* \return a pointer to the newly created directory.
*/
struct iso_tree_dir *iso_tree_add_dir(struct iso_tree_dir *parent,
const char *path);
/**
* Recursively add an existing directory to the tree.
* Warning: when using this, you'll lose pointers to files or subdirectories.
@ -172,18 +109,18 @@ struct iso_tree_dir *iso_tree_add_dir(struct iso_tree_dir *parent,
*
* \param path The path, on the local filesystem, of the directory to add.
*
* \pre \p parent is non-NULL
* \pre \p parent is NULL or is a directory.
* \pre \p path is non-NULL and is a valid path to a directory on the local
* filesystem.
* \return a pointer to the newly created directory.
*/
struct iso_tree_dir *iso_tree_radd_dir(struct iso_tree_dir *parent,
const char *path);
struct iso_tree_node *iso_tree_radd_dir(struct iso_tree_node *parent,
const char *path);
/**
* Creates a new, empty directory on the volume.
*
* \pre \p parent is non-NULL
* \pre \p parent is NULL or is a directory.
* \pre \p name is unique among the children and files belonging to \p parent.
* Also, it doesn't contain '/' characters.
*
@ -191,35 +128,20 @@ struct iso_tree_dir *iso_tree_radd_dir(struct iso_tree_dir *parent,
* POSIX attributes are the same as \p parent's.
* \return a pointer to the newly created directory.
*/
struct iso_tree_dir *iso_tree_add_new_dir(struct iso_tree_dir *parent,
const char *name);
struct iso_tree_node *iso_tree_add_new_dir(struct iso_tree_node *parent,
const char *name);
/**
* Get the name of a node.
* Set the name of a file (using the current locale).
*/
const char *iso_tree_node_get_name(const struct iso_tree_node *node,
enum iso_name_version ver);
/**
* Set the name of a file.
* The name you input here will be the full name and will be used to derive the
* ISO, RockRidge and Joliet names.
*/
void iso_tree_file_set_name(struct iso_tree_file *file, const char *name);
/**
* Set the name of a directory.
* The name you input here will be the full name and will be used to derive the
* ISO, RockRidge and Joliet names.
*/
void iso_tree_dir_set_name(struct iso_tree_dir *dir, const char *name);
void iso_tree_node_set_name(struct iso_tree_node *file, const char *name);
/**
* Recursively print a directory to stdout.
* \param spaces The initial number of spaces on the left. Set to 0 if you
* supply a root directory.
*/
void iso_tree_print(const struct iso_tree_dir *root, int spaces);
void iso_tree_print(const struct iso_tree_node *root, int spaces);
/** Create a burn_source which can be used as a data source for a track
*
@ -240,4 +162,4 @@ struct burn_source* iso_source_new_ecma119 (struct iso_volset *volumeset,
int level,
int flags);
#endif /* __LIBISOFS */
#endif /* LIBISO_LIBISOFS_H */