2007-11-24 12:14:45 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2007 Vreixo Formoso
|
|
|
|
*
|
|
|
|
* 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 as
|
|
|
|
* published by the Free Software Foundation. See COPYING file for details.
|
|
|
|
*/
|
|
|
|
#ifndef LIBISO_LIBISOFS_H_
|
|
|
|
#define LIBISO_LIBISOFS_H_
|
|
|
|
|
2007-11-27 19:41:09 +00:00
|
|
|
#include <sys/stat.h>
|
2007-12-30 17:29:39 +00:00
|
|
|
#include <stdint.h>
|
2007-12-02 18:10:30 +00:00
|
|
|
|
2007-12-22 16:09:28 +00:00
|
|
|
struct burn_source;
|
|
|
|
|
2008-01-27 22:50:44 +00:00
|
|
|
/**
|
|
|
|
* Context for image creation. It holds the files that will be added to image,
|
|
|
|
* and several options to control libisofs behavior.
|
|
|
|
*/
|
2007-12-02 18:10:30 +00:00
|
|
|
typedef struct Iso_Image IsoImage;
|
|
|
|
|
2008-01-31 20:03:28 +00:00
|
|
|
/*
|
|
|
|
* A node in the iso tree, i.e. a file that will be written to image.
|
|
|
|
*
|
|
|
|
* It can represent any kind of files. When needed, you can get the type with
|
|
|
|
* iso_node_get_type() and cast it to the appropiate subtype. Useful macros
|
|
|
|
* are provided, see below.
|
|
|
|
*/
|
2007-11-24 15:58:36 +00:00
|
|
|
typedef struct Iso_Node IsoNode;
|
2007-12-02 16:59:36 +00:00
|
|
|
|
2008-01-31 20:03:28 +00:00
|
|
|
/**
|
|
|
|
* A directory in the iso tree. It is an special type of IsoNode and can be
|
|
|
|
* casted to it in any case.
|
|
|
|
*/
|
|
|
|
typedef struct Iso_Dir IsoDir;
|
2008-01-29 23:13:18 +00:00
|
|
|
|
2008-01-31 20:03:28 +00:00
|
|
|
/**
|
|
|
|
* A symbolic link in the iso tree. It is an special type of IsoNode and can be
|
|
|
|
* casted to it in any case.
|
|
|
|
*/
|
|
|
|
typedef struct Iso_Symlink IsoSymlink;
|
2008-01-29 23:13:18 +00:00
|
|
|
|
2008-01-31 20:03:28 +00:00
|
|
|
/**
|
|
|
|
* A regular file in the iso tree. It is an special type of IsoNode and can be
|
|
|
|
* casted to it in any case.
|
|
|
|
*/
|
|
|
|
typedef struct Iso_File IsoFile;
|
2007-11-24 12:14:45 +00:00
|
|
|
|
2008-01-31 20:03:28 +00:00
|
|
|
/**
|
|
|
|
* An special file in the iso tree. This is used to represent any POSIX file
|
|
|
|
* other that regular files, directories or symlinks, i.e.: socket, block and
|
|
|
|
* character devices, and fifos.
|
|
|
|
* It is an special type of IsoNode and can be casted to it in any case.
|
|
|
|
*/
|
|
|
|
typedef struct Iso_Special IsoSpecial;
|
2008-01-10 16:22:53 +00:00
|
|
|
|
2007-12-04 21:33:40 +00:00
|
|
|
/**
|
|
|
|
* The type of an IsoNode.
|
2007-12-07 21:25:31 +00:00
|
|
|
*
|
|
|
|
* When an user gets an IsoNode from an image, (s)he can use
|
|
|
|
* iso_node_get_type() to get the current type of the node, and then
|
|
|
|
* cast to the appropriate subtype. For example:
|
|
|
|
*
|
|
|
|
* ...
|
|
|
|
* IsoNode *node;
|
|
|
|
* res = iso_dir_iter_next(iter, &node);
|
|
|
|
* if (res == 1 && iso_node_get_type(node) == LIBISO_DIR) {
|
|
|
|
* IsoDir *dir = (IsoDir *)node;
|
|
|
|
* ...
|
|
|
|
* }
|
2007-12-04 21:33:40 +00:00
|
|
|
*/
|
|
|
|
enum IsoNodeType {
|
|
|
|
LIBISO_DIR,
|
|
|
|
LIBISO_FILE,
|
|
|
|
LIBISO_SYMLINK,
|
|
|
|
LIBISO_SPECIAL,
|
|
|
|
LIBISO_BOOT
|
|
|
|
};
|
|
|
|
|
2008-01-31 20:03:28 +00:00
|
|
|
/* macros to check node type */
|
|
|
|
#define ISO_NODE_IS_DIR(n) (iso_node_get_type(n) == LIBISO_DIR)
|
|
|
|
#define ISO_NODE_IS_FILE(n) (iso_node_get_type(n) == LIBISO_FILE)
|
|
|
|
#define ISO_NODE_IS_SYMLINK(n) (iso_node_get_type(n) == LIBISO_SYMLINK)
|
|
|
|
#define ISO_NODE_IS_SPECIAL(n) (iso_node_get_type(n) == LIBISO_SPECIAL)
|
|
|
|
#define ISO_NODE_IS_BOOTCAT(n) (iso_node_get_type(n) == LIBISO_BOOT)
|
|
|
|
|
|
|
|
/* macros for safe downcasting */
|
|
|
|
#define ISO_DIR(n) ((IsoDir*)(ISO_NODE_IS_DIR(n) ? n : NULL))
|
|
|
|
#define ISO_FILE(n) ((IsoFile*)(ISO_NODE_IS_FILE(n) ? n : NULL))
|
|
|
|
#define ISO_SYMLINK(n) ((IsoSymlink*)(ISO_NODE_IS_SYMLINK(n) ? n : NULL))
|
|
|
|
#define ISO_SPECIAL(n) ((IsoSpecial*)(ISO_NODE_IS_SPECIAL(n) ? n : NULL))
|
|
|
|
|
|
|
|
#define ISO_NODE(n) ((IsoNode*)n)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Context for iterate on directory children.
|
|
|
|
* @see iso_dir_get_children()
|
|
|
|
*/
|
|
|
|
typedef struct Iso_Dir_Iter IsoDirIter;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* It represents an El-Torito boot image.
|
|
|
|
*/
|
|
|
|
typedef struct el_torito_boot_image ElToritoBootImage;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* An special type of IsoNode that acts as a placeholder for an El-Torito
|
|
|
|
* boot catalog. Once written, it will appear as a regular file.
|
|
|
|
*/
|
|
|
|
typedef struct Iso_Boot IsoBoot;
|
|
|
|
|
2007-12-13 19:27:58 +00:00
|
|
|
/**
|
|
|
|
* Flag used to hide a file in the RR/ISO or Joliet tree.
|
|
|
|
*
|
|
|
|
* \see iso_node_set_hidden
|
|
|
|
*/
|
|
|
|
enum IsoHideNodeFlag {
|
2008-01-16 20:51:41 +00:00
|
|
|
/** Hide the node in the ECMA-119 / RR tree */
|
2007-12-13 19:27:58 +00:00
|
|
|
LIBISO_HIDE_ON_RR = 1 << 0,
|
2008-01-16 20:51:41 +00:00
|
|
|
/** Hide the node in the Joliet tree, if Joliet extension are enabled */
|
|
|
|
LIBISO_HIDE_ON_JOLIET = 1 << 1,
|
|
|
|
/** Hide the node in the ISO-9660:1999 tree, if that format is enabled */
|
|
|
|
LIBISO_HIDE_ON_1999 = 1 << 2
|
2007-12-13 19:27:58 +00:00
|
|
|
};
|
|
|
|
|
2008-01-10 16:22:53 +00:00
|
|
|
/**
|
|
|
|
* El-Torito bootable image type.
|
|
|
|
*/
|
|
|
|
enum eltorito_boot_media_type {
|
|
|
|
ELTORITO_FLOPPY_EMUL,
|
|
|
|
ELTORITO_HARD_DISC_EMUL,
|
|
|
|
ELTORITO_NO_EMUL
|
|
|
|
};
|
|
|
|
|
2008-01-12 17:03:59 +00:00
|
|
|
/**
|
|
|
|
* Replace mode used when addding a node to a file.
|
2008-01-27 22:50:44 +00:00
|
|
|
* This controls how libisofs will act when you tried to add to a dir a file
|
|
|
|
* with the same name that an existing file.
|
2008-01-12 17:03:59 +00:00
|
|
|
*/
|
|
|
|
enum iso_replace_mode {
|
|
|
|
/**
|
|
|
|
* Never replace an existing node, and instead fail with
|
|
|
|
* ISO_NODE_NAME_NOT_UNIQUE.
|
|
|
|
*/
|
|
|
|
ISO_REPLACE_NEVER,
|
|
|
|
/**
|
|
|
|
* Always replace the old node with the new.
|
|
|
|
*/
|
2008-01-26 20:52:42 +00:00
|
|
|
ISO_REPLACE_ALWAYS,
|
|
|
|
/**
|
|
|
|
* Replace with the new node if it is the same file type
|
|
|
|
*/
|
|
|
|
ISO_REPLACE_IF_SAME_TYPE,
|
|
|
|
/**
|
|
|
|
* Replace with the new node if it is the same file type and its ctime
|
|
|
|
* is newer than the old one.
|
|
|
|
*/
|
|
|
|
ISO_REPLACE_IF_SAME_TYPE_AND_NEWER,
|
|
|
|
/**
|
|
|
|
* Replace with the new node if its ctime is newer than the old one.
|
|
|
|
*/
|
|
|
|
ISO_REPLACE_IF_NEWER
|
2008-01-12 17:03:59 +00:00
|
|
|
/*
|
|
|
|
* TODO #00006 define more values
|
|
|
|
* -if both are dirs, add contents (and what to do with conflicts?)
|
|
|
|
*/
|
|
|
|
};
|
|
|
|
|
2008-01-31 20:03:28 +00:00
|
|
|
/**
|
|
|
|
* Options for image written.
|
|
|
|
* @see iso_write_opts_new()
|
|
|
|
*/
|
2008-01-26 12:04:16 +00:00
|
|
|
typedef struct iso_write_opts IsoWriteOpts;
|
2008-01-31 20:03:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Options for image reading or import.
|
|
|
|
* @see iso_read_opts_new()
|
|
|
|
*/
|
2008-01-26 13:00:46 +00:00
|
|
|
typedef struct iso_read_opts IsoReadOpts;
|
2008-01-31 20:03:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Source for image reading.
|
|
|
|
*
|
|
|
|
* @see struct iso_data_source
|
|
|
|
*/
|
2008-01-19 16:17:50 +00:00
|
|
|
typedef struct iso_data_source IsoDataSource;
|
2007-12-30 16:47:44 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Data source used by libisofs for reading an existing image.
|
|
|
|
*
|
|
|
|
* It offers homogeneous read access to arbitrary blocks to different sources
|
|
|
|
* for images, such as .iso files, CD/DVD drives, etc...
|
|
|
|
*
|
|
|
|
* To create a multisession image, libisofs needs a IsoDataSource, that the
|
|
|
|
* user must provide. The function iso_data_source_new_from_file() constructs
|
|
|
|
* an IsoDataSource that uses POSIX I/O functions to access data. You can use
|
|
|
|
* it with regular .iso images, and also with block devices that represent a
|
|
|
|
* drive.
|
|
|
|
*/
|
2008-01-31 18:08:45 +00:00
|
|
|
struct iso_data_source
|
|
|
|
{
|
2008-01-26 12:15:15 +00:00
|
|
|
|
|
|
|
/* reserved for future usage, set to 0 */
|
|
|
|
int version;
|
2008-01-31 18:08:45 +00:00
|
|
|
|
2007-12-30 16:47:44 +00:00
|
|
|
/**
|
|
|
|
* Reference count for the data source. Should be 1 when a new source
|
|
|
|
* is created. Don't access it directly, but with iso_data_source_ref()
|
|
|
|
* and iso_data_source_unref() functions.
|
|
|
|
*/
|
|
|
|
unsigned int refcount;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Opens the given source. You must open() the source before any attempt
|
|
|
|
* to read data from it. The open is the right place for grabbing the
|
|
|
|
* underlying resources.
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
* 1 if success, < 0 on error
|
|
|
|
*/
|
|
|
|
int (*open)(IsoDataSource *src);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Close a given source, freeing all system resources previously grabbed in
|
|
|
|
* open().
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
* 1 if success, < 0 on error
|
|
|
|
*/
|
|
|
|
int (*close)(IsoDataSource *src);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Read an arbitrary block (2048 bytes) of data from the source.
|
|
|
|
*
|
|
|
|
* @param lba
|
|
|
|
* Block to be read.
|
|
|
|
* @param buffer
|
|
|
|
* Buffer where the data will be written. It should have at least
|
|
|
|
* 2048 bytes.
|
|
|
|
* @return
|
|
|
|
* 1 if success, < 0 on error
|
|
|
|
*/
|
2007-12-30 17:29:39 +00:00
|
|
|
int (*read_block)(IsoDataSource *src, uint32_t lba, uint8_t *buffer);
|
2007-12-30 16:47:44 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Clean up the source specific data. Never call this directly, it is
|
|
|
|
* automatically called by iso_data_source_unref() when refcount reach
|
|
|
|
* 0.
|
|
|
|
*/
|
|
|
|
void (*free_data)(IsoDataSource *);
|
|
|
|
|
|
|
|
/** Source specific data */
|
|
|
|
void *data;
|
|
|
|
};
|
|
|
|
|
2008-01-03 18:17:55 +00:00
|
|
|
/**
|
|
|
|
* Return information for image.
|
|
|
|
* Both size, hasRR and hasJoliet will be filled by libisofs with suitable
|
|
|
|
* values.
|
|
|
|
*/
|
|
|
|
struct iso_read_image_features
|
|
|
|
{
|
2008-01-26 14:39:58 +00:00
|
|
|
/**
|
|
|
|
* Will be filled with the size (in 2048 byte block) of the image, as
|
|
|
|
* reported in the PVM.
|
|
|
|
*/
|
2008-01-31 18:08:45 +00:00
|
|
|
uint32_t size;
|
|
|
|
|
2008-01-03 18:17:55 +00:00
|
|
|
/** It will be set to 1 if RR extensions are present, to 0 if not. */
|
2008-01-11 14:43:39 +00:00
|
|
|
unsigned int hasRR :1;
|
2008-01-31 18:08:45 +00:00
|
|
|
|
2008-01-03 18:17:55 +00:00
|
|
|
/** It will be set to 1 if Joliet extensions are present, to 0 if not. */
|
2008-01-11 14:43:39 +00:00
|
|
|
unsigned int hasJoliet :1;
|
2008-01-31 18:08:45 +00:00
|
|
|
|
2008-01-16 23:15:42 +00:00
|
|
|
/**
|
2008-01-19 00:04:19 +00:00
|
|
|
* It will be set to 1 if the image is an ISO 9660:1999, i.e. it has
|
2008-01-16 23:15:42 +00:00
|
|
|
* a version 2 Enhanced Volume Descriptor.
|
|
|
|
*/
|
|
|
|
unsigned int hasIso1999 :1;
|
2008-01-31 18:08:45 +00:00
|
|
|
|
2008-01-11 14:43:39 +00:00
|
|
|
/** It will be set to 1 if El-Torito boot record is present, to 0 if not.*/
|
|
|
|
unsigned int hasElTorito :1;
|
2008-01-03 18:17:55 +00:00
|
|
|
};
|
|
|
|
|
2008-01-31 20:03:28 +00:00
|
|
|
/**
|
|
|
|
* POSIX abstraction for source files.
|
|
|
|
*
|
|
|
|
* @see struct iso_file_source
|
|
|
|
*/
|
2008-01-19 16:41:01 +00:00
|
|
|
typedef struct iso_file_source IsoFileSource;
|
2008-01-31 20:03:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Abstract for source filesystems.
|
|
|
|
*
|
|
|
|
* @see struct iso_filesystem
|
|
|
|
*/
|
2008-01-19 16:41:01 +00:00
|
|
|
typedef struct iso_filesystem IsoFilesystem;
|
2008-01-31 20:03:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Interface that defines the operations (methods) available for an
|
|
|
|
* IsoFileSource.
|
|
|
|
*
|
|
|
|
* @see struct IsoFileSource_Iface
|
|
|
|
*/
|
2008-01-19 16:41:01 +00:00
|
|
|
typedef struct IsoFileSource_Iface IsoFileSourceIface;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* IsoFilesystem implementation to deal with ISO images, and to offer a way to
|
|
|
|
* access specific information of the image, such as several volume attributes,
|
|
|
|
* extensions being used, El-Torito artifacts...
|
|
|
|
*/
|
|
|
|
typedef IsoFilesystem IsoImageFilesystem;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* See IsoFilesystem->get_id() for info about this.
|
|
|
|
*/
|
|
|
|
extern unsigned int iso_fs_global_id;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* An IsoFilesystem is a handler for a source of files, or a "filesystem".
|
|
|
|
* That is defined as a set of files that are organized in a hierarchical
|
|
|
|
* structure.
|
|
|
|
*
|
|
|
|
* A filesystem allows libisofs to access files from several sources in
|
|
|
|
* an homogeneous way, thus abstracting the underlying operations needed to
|
|
|
|
* access and read file contents. Note that this doesn't need to be tied
|
|
|
|
* to the disc filesystem used in the partition being accessed. For example,
|
|
|
|
* we have an IsoFilesystem implementation to access any mounted filesystem,
|
|
|
|
* using standard Linux functions. It is also legal, of course, to implement
|
|
|
|
* an IsoFilesystem to deal with a specific filesystem over raw partitions.
|
|
|
|
* That is what we do, for example, to access an ISO Image.
|
|
|
|
*
|
|
|
|
* Each file inside an IsoFilesystem is represented as an IsoFileSource object,
|
|
|
|
* that defines POSIX-like interface for accessing files.
|
|
|
|
*/
|
|
|
|
struct iso_filesystem
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Type of filesystem.
|
|
|
|
* "file" -> local filesystem
|
|
|
|
* "iso " -> iso image filesystem
|
|
|
|
*/
|
|
|
|
char type[4];
|
|
|
|
|
2008-01-26 12:15:15 +00:00
|
|
|
/* reserved for future usage, set to 0 */
|
|
|
|
int version;
|
|
|
|
|
2008-01-19 16:41:01 +00:00
|
|
|
/**
|
|
|
|
* Get the root of a filesystem.
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
* 1 on success, < 0 on error
|
|
|
|
*/
|
|
|
|
int (*get_root)(IsoFilesystem *fs, IsoFileSource **root);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieve a file from its absolute path inside the filesystem.
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
* 1 success, < 0 error
|
|
|
|
* Error codes:
|
|
|
|
* ISO_FILE_ACCESS_DENIED
|
|
|
|
* ISO_FILE_BAD_PATH
|
|
|
|
* ISO_FILE_DOESNT_EXIST
|
|
|
|
* ISO_MEM_ERROR
|
|
|
|
* ISO_FILE_ERROR
|
|
|
|
* ISO_NULL_POINTER
|
|
|
|
*/
|
|
|
|
int (*get_by_path)(IsoFilesystem *fs, const char *path,
|
|
|
|
IsoFileSource **file);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get filesystem identifier.
|
|
|
|
*
|
|
|
|
* If the filesystem is able to generate correct values of the st_dev
|
|
|
|
* and st_ino fields for the struct stat of each file, this should
|
|
|
|
* return an unique number, greater than 0.
|
|
|
|
*
|
|
|
|
* To get a identifier for your filesystem implementation you should
|
|
|
|
* use iso_fs_global_id, incrementing it by one each time.
|
|
|
|
*
|
|
|
|
* Otherwise, if you can't ensure values in the struct stat are valid,
|
|
|
|
* this should return 0.
|
|
|
|
*/
|
|
|
|
unsigned int (*get_id)(IsoFilesystem *fs);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Opens the filesystem for several read operations. Calling this funcion
|
|
|
|
* is not needed at all, each time that the underlying system resource
|
|
|
|
* needs to be accessed, it is openned propertly.
|
|
|
|
* However, if you plan to execute several operations on the filesystem,
|
|
|
|
* it is a good idea to open it previously, to prevent several open/close
|
|
|
|
* operations to occur.
|
|
|
|
*
|
|
|
|
* @return 1 on success, < 0 on error
|
|
|
|
*/
|
|
|
|
int (*open)(IsoFilesystem *fs);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Close the filesystem, thus freeing all system resources. You should
|
|
|
|
* call this function if you have previously open() it.
|
|
|
|
* Note that you can open()/close() a filesystem several times.
|
|
|
|
*
|
|
|
|
* @return 1 on success, < 0 on error
|
|
|
|
*/
|
|
|
|
int (*close)(IsoFilesystem *fs);
|
2008-01-31 18:08:45 +00:00
|
|
|
|
2008-01-19 16:41:01 +00:00
|
|
|
/**
|
|
|
|
* Free implementation specific data. Should never be called by user.
|
|
|
|
* Use iso_filesystem_unref() instead.
|
|
|
|
*/
|
|
|
|
void (*free)(IsoFilesystem *fs);
|
|
|
|
|
|
|
|
/* internal usage, do never access them directly */
|
|
|
|
unsigned int refcount;
|
|
|
|
void *data;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Interface definition for an IsoFileSource. Defines the POSIX-like function
|
|
|
|
* to access files and abstract underlying source.
|
|
|
|
*/
|
|
|
|
struct IsoFileSource_Iface
|
|
|
|
{
|
2008-01-26 12:15:15 +00:00
|
|
|
/* reserved for future usage, set to 0 */
|
|
|
|
int version;
|
|
|
|
|
2008-01-19 16:41:01 +00:00
|
|
|
/**
|
|
|
|
* Get the path, relative to the filesystem this file source belongs to.
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
* the path of the FileSource inside the filesystem, it should be
|
|
|
|
* freed when no more needed.
|
|
|
|
*/
|
|
|
|
char* (*get_path)(IsoFileSource *src);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the name of the file, with the dir component of the path.
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
* the name of the file, it should be freed when no more needed.
|
|
|
|
*/
|
|
|
|
char* (*get_name)(IsoFileSource *src);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get information about the file. It is equivalent to lstat(2).
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
* 1 success, < 0 error
|
|
|
|
* Error codes:
|
|
|
|
* ISO_FILE_ACCESS_DENIED
|
|
|
|
* ISO_FILE_BAD_PATH
|
|
|
|
* ISO_FILE_DOESNT_EXIST
|
|
|
|
* ISO_MEM_ERROR
|
|
|
|
* ISO_FILE_ERROR
|
|
|
|
* ISO_NULL_POINTER
|
|
|
|
*/
|
|
|
|
int (*lstat)(IsoFileSource *src, struct stat *info);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get information about the file. If the file is a symlink, the info
|
|
|
|
* returned refers to the destination. It is equivalent to stat(2).
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
* 1 success, < 0 error
|
|
|
|
* Error codes:
|
|
|
|
* ISO_FILE_ACCESS_DENIED
|
|
|
|
* ISO_FILE_BAD_PATH
|
|
|
|
* ISO_FILE_DOESNT_EXIST
|
|
|
|
* ISO_MEM_ERROR
|
|
|
|
* ISO_FILE_ERROR
|
|
|
|
* ISO_NULL_POINTER
|
|
|
|
*/
|
|
|
|
int (*stat)(IsoFileSource *src, struct stat *info);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check if the process has access to read file contents. Note that this
|
|
|
|
* is not necessarily related with (l)stat functions. For example, in a
|
|
|
|
* filesystem implementation to deal with an ISO image, if the user has
|
|
|
|
* read access to the image it will be able to read all files inside it,
|
|
|
|
* despite of the particular permission of each file in the RR tree, that
|
|
|
|
* are what the above functions return.
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
* 1 if process has read access, < 0 on error
|
|
|
|
* Error codes:
|
|
|
|
* ISO_FILE_ACCESS_DENIED
|
|
|
|
* ISO_FILE_BAD_PATH
|
|
|
|
* ISO_FILE_DOESNT_EXIST
|
|
|
|
* ISO_MEM_ERROR
|
|
|
|
* ISO_FILE_ERROR
|
|
|
|
* ISO_NULL_POINTER
|
|
|
|
*/
|
|
|
|
int (*access)(IsoFileSource *src);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Opens the source.
|
|
|
|
* @return 1 on success, < 0 on error
|
|
|
|
* Error codes:
|
|
|
|
* ISO_FILE_ALREADY_OPENNED
|
|
|
|
* ISO_FILE_ACCESS_DENIED
|
|
|
|
* ISO_FILE_BAD_PATH
|
|
|
|
* ISO_FILE_DOESNT_EXIST
|
|
|
|
* ISO_MEM_ERROR
|
|
|
|
* ISO_FILE_ERROR
|
|
|
|
* ISO_NULL_POINTER
|
|
|
|
*/
|
|
|
|
int (*open)(IsoFileSource *src);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Close a previuously openned file
|
|
|
|
* @return 1 on success, < 0 on error
|
|
|
|
* Error codes:
|
|
|
|
* ISO_FILE_ERROR
|
|
|
|
* ISO_NULL_POINTER
|
|
|
|
* ISO_FILE_NOT_OPENNED
|
|
|
|
*/
|
|
|
|
int (*close)(IsoFileSource *src);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Attempts to read up to count bytes from the given source into
|
|
|
|
* the buffer starting at buf.
|
|
|
|
*
|
|
|
|
* The file src must be open() before calling this, and close() when no
|
|
|
|
* more needed. Not valid for dirs. On symlinks it reads the destination
|
|
|
|
* file.
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
* number of bytes read, 0 if EOF, < 0 on error
|
|
|
|
* Error codes:
|
|
|
|
* ISO_FILE_ERROR
|
|
|
|
* ISO_NULL_POINTER
|
|
|
|
* ISO_FILE_NOT_OPENNED
|
|
|
|
* ISO_WRONG_ARG_VALUE -> if count == 0
|
|
|
|
* ISO_FILE_IS_DIR
|
|
|
|
* ISO_MEM_ERROR
|
|
|
|
* ISO_INTERRUPTED
|
|
|
|
*/
|
|
|
|
int (*read)(IsoFileSource *src, void *buf, size_t count);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Read a directory.
|
|
|
|
*
|
|
|
|
* Each call to this function will return a new children, until we reach
|
|
|
|
* the end of file (i.e, no more children), in that case it returns 0.
|
|
|
|
*
|
|
|
|
* The dir must be open() before calling this, and close() when no more
|
|
|
|
* needed. Only valid for dirs.
|
|
|
|
*
|
|
|
|
* Note that "." and ".." children MUST NOT BE returned.
|
|
|
|
*
|
|
|
|
* @param child
|
|
|
|
* pointer to be filled with the given child. Undefined on error or OEF
|
|
|
|
* @return
|
|
|
|
* 1 on success, 0 if EOF (no more children), < 0 on error
|
|
|
|
* Error codes:
|
|
|
|
* ISO_FILE_ERROR
|
|
|
|
* ISO_NULL_POINTER
|
|
|
|
* ISO_FILE_NOT_OPENNED
|
|
|
|
* ISO_FILE_IS_NOT_DIR
|
|
|
|
* ISO_MEM_ERROR
|
|
|
|
*/
|
|
|
|
int (*readdir)(IsoFileSource *src, IsoFileSource **child);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Read the destination of a symlink. You don't need to open the file
|
|
|
|
* to call this.
|
|
|
|
*
|
|
|
|
* @param buf
|
|
|
|
* allocated buffer of at least bufsiz bytes.
|
|
|
|
* The dest. will be copied there, and it will be NULL-terminated
|
|
|
|
* @param bufsiz
|
|
|
|
* characters to be copied. Destination link will be truncated if
|
|
|
|
* it is larger than given size. This include the \0 character.
|
|
|
|
* @return
|
|
|
|
* 1 on success, < 0 on error
|
|
|
|
* Error codes:
|
|
|
|
* ISO_FILE_ERROR
|
|
|
|
* ISO_NULL_POINTER
|
|
|
|
* ISO_WRONG_ARG_VALUE -> if bufsiz <= 0
|
|
|
|
* ISO_FILE_IS_NOT_SYMLINK
|
|
|
|
* ISO_MEM_ERROR
|
|
|
|
* ISO_FILE_BAD_PATH
|
|
|
|
* ISO_FILE_DOESNT_EXIST
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
int (*readlink)(IsoFileSource *src, char *buf, size_t bufsiz);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the filesystem for this source. No extra ref is added, so you
|
|
|
|
* musn't unref the IsoFilesystem.
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
* The filesystem, NULL on error
|
|
|
|
*/
|
|
|
|
IsoFilesystem* (*get_filesystem)(IsoFileSource *src);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Free implementation specific data. Should never be called by user.
|
|
|
|
* Use iso_file_source_unref() instead.
|
|
|
|
*/
|
|
|
|
void (*free)(IsoFileSource *src);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* TODO #00004 Add a get_mime_type() function.
|
|
|
|
* This can be useful for GUI apps, to choose the icon of the file
|
|
|
|
*/
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* An IsoFile Source is a POSIX abstraction of a file.
|
|
|
|
*/
|
|
|
|
struct iso_file_source
|
|
|
|
{
|
|
|
|
const IsoFileSourceIface *class;
|
|
|
|
int refcount;
|
|
|
|
void *data;
|
|
|
|
};
|
|
|
|
|
2008-01-19 01:48:12 +00:00
|
|
|
/**
|
|
|
|
* Initialize libisofs. You must call this before any usage of the library.
|
|
|
|
* @return 1 on success, < 0 on error
|
|
|
|
*/
|
|
|
|
int iso_init();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Finalize libisofs.
|
|
|
|
*/
|
|
|
|
void iso_finish();
|
|
|
|
|
2007-12-02 18:10:30 +00:00
|
|
|
/**
|
|
|
|
* Create a new image, empty.
|
|
|
|
*
|
|
|
|
* The image will be owned by you and should be unref() when no more needed.
|
|
|
|
*
|
|
|
|
* @param name
|
|
|
|
* Name of the image. This will be used as volset_id and volume_id.
|
|
|
|
* @param image
|
|
|
|
* Location where the image pointer will be stored.
|
|
|
|
* @return
|
|
|
|
* 1 sucess, < 0 error
|
|
|
|
*/
|
|
|
|
int iso_image_new(const char *name, IsoImage **image);
|
|
|
|
|
2008-01-31 18:38:54 +00:00
|
|
|
|
2008-02-01 09:19:53 +00:00
|
|
|
/**
|
|
|
|
* The following two functions three macros are utilities to help ensuring
|
|
|
|
* version match of application, compile time header, and runtime library.
|
|
|
|
*/
|
2008-01-24 20:20:31 +00:00
|
|
|
/**
|
2008-01-31 18:38:54 +00:00
|
|
|
* Get version of the libisofs library at runtime.
|
2008-01-24 20:20:31 +00:00
|
|
|
*/
|
|
|
|
void iso_lib_version(int *major, int *minor, int *micro);
|
|
|
|
|
2008-01-29 19:16:06 +00:00
|
|
|
/**
|
2008-01-31 18:38:54 +00:00
|
|
|
* Check at runtime if the library is ABI compatible with the given version.
|
2008-01-29 19:16:06 +00:00
|
|
|
*
|
|
|
|
* @return
|
|
|
|
* 1 lib is compatible, 0 is not.
|
|
|
|
*/
|
|
|
|
int iso_lib_is_compatible(int major, int minor, int micro);
|
|
|
|
|
2008-01-31 18:38:54 +00:00
|
|
|
|
2008-02-01 09:19:53 +00:00
|
|
|
/**
|
|
|
|
* These three release version numbers tell the revision of this header file
|
|
|
|
* and of the API it describes. They are memorized by applications at
|
|
|
|
* compile time.
|
|
|
|
* They must show the same values as these symbols in ./configure.ac
|
|
|
|
* LIBISOFS_MAJOR_VERSION=...
|
|
|
|
* LIBISOFS_MINOR_VERSION=...
|
|
|
|
* LIBISOFS_MICRO_VERSION=...
|
|
|
|
* Note to anybody who does own work inside libisofs:
|
|
|
|
* Any change of configure.ac or libisofs.h has to keep up this equality !
|
|
|
|
*
|
|
|
|
* Before usage of these macros on your code, please read the usage discussion
|
|
|
|
* below.
|
|
|
|
*/
|
2008-01-31 18:38:54 +00:00
|
|
|
#define iso_lib_header_version_major 0
|
|
|
|
#define iso_lib_header_version_minor 6
|
|
|
|
#define iso_lib_header_version_micro 1
|
|
|
|
|
2008-02-01 09:19:53 +00:00
|
|
|
/**
|
|
|
|
* Usage discussion:
|
|
|
|
*
|
|
|
|
* Some developers of the libburnia project have differing opinions how to
|
|
|
|
* ensure the compatibility of libaries and applications.
|
|
|
|
*
|
|
|
|
* It is about whether to use at compile time and at runtime the version
|
|
|
|
* numbers provided here. Thomas Schmitt advises to use them. Vreixo Formoso
|
|
|
|
* advises to use other means.
|
|
|
|
*
|
|
|
|
* At compile time:
|
|
|
|
*
|
|
|
|
* Vreixo Formoso advises to leave proper version matching to properly
|
|
|
|
* programmed checks in the the application's build system, which will
|
|
|
|
* eventually refuse compilation.
|
|
|
|
*
|
|
|
|
* Thomas Schmitt advises to use the macros defined here for comparison with
|
|
|
|
* the application's requirements of library revisions and to eventually
|
|
|
|
* break compilation.
|
|
|
|
*
|
|
|
|
* Both advises are combinable. I.e. be master of your build system and have
|
|
|
|
* #if checks in the source code of your application, nevertheless.
|
|
|
|
*
|
|
|
|
* At runtime (via iso_lib_is_compatible()):
|
|
|
|
*
|
|
|
|
* Vreixo Formoso advises to compare the application's requirements of
|
|
|
|
* library revisions with the runtime library. This is to allow runtime
|
|
|
|
* libraries which are young enough for the application but too old for
|
|
|
|
* the lib*.h files seen at compile time.
|
|
|
|
*
|
|
|
|
* Thomas Schmitt advises to compare the header revisions defined here with
|
|
|
|
* the runtime library. This is to enforce a strictly monotonous chain of
|
|
|
|
* revisions from app to header to library, at the cost of excluding some older
|
|
|
|
* libraries.
|
|
|
|
*
|
|
|
|
* These two advises are mutually exclusive.
|
|
|
|
*/
|
2008-01-31 18:38:54 +00:00
|
|
|
|
|
|
|
|
2008-01-26 12:04:16 +00:00
|
|
|
/**
|
|
|
|
* Creates an IsoWriteOpts for writing an image. You should set the options
|
|
|
|
* desired with the correspondent setters.
|
|
|
|
*
|
|
|
|
* Options by default are determined by the selected profile. Fifo size is set
|
|
|
|
* by default to 2 MB.
|
|
|
|
*
|
2008-01-31 20:03:28 +00:00
|
|
|
* @param opts
|
|
|
|
* Pointer to the location where the newly created IsoWriteOpts will be
|
|
|
|
* stored. You should free it with iso_write_opts_free() when no more
|
|
|
|
* needed.
|
2008-01-26 12:04:16 +00:00
|
|
|
* @param profile
|
|
|
|
* Default profile for image creation. For now the following values are
|
|
|
|
* defined:
|
|
|
|
* ---> 0 [BASIC]
|
|
|
|
* No extensions are enabled, and ISO level is set to 1. Only suitable
|
|
|
|
* for usage for very old and limited systems (like MS-DOS), or by a
|
|
|
|
* start point from which to set your custom options.
|
|
|
|
* ---> 1 [BACKUP]
|
|
|
|
* POSIX compatibility for backup. Simple settings, ISO level is set to
|
|
|
|
* 2 and RR extensions are enabled. Useful for backup purposes.
|
|
|
|
* ---> 2 [DISTRIBUTION]
|
|
|
|
* Setting for information distribution. Both RR and Joliet are enabled
|
|
|
|
* to maximize compatibility with most systems. Permissions are set to
|
|
|
|
* default values, and timestamps to the time of recording.
|
|
|
|
* @return
|
|
|
|
* 1 success, < 0 error
|
|
|
|
*/
|
|
|
|
int iso_write_opts_new(IsoWriteOpts **opts, int profile);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Free an IsoWriteOpts previously allocated with iso_write_opts_new().
|
|
|
|
*/
|
|
|
|
void iso_write_opts_free(IsoWriteOpts *opts);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the ISO-9960 level to write at.
|
|
|
|
*
|
|
|
|
* @param level
|
|
|
|
* -> 1 for higher compatibility with old systems. With this level
|
|
|
|
* filenames are restricted to 8.3 characters.
|
|
|
|
* -> 2 to allow up to 31 filename characters.
|
|
|
|
* @return
|
|
|
|
* 1 success, < 0 error
|
|
|
|
*/
|
|
|
|
int iso_write_opts_set_iso_level(IsoWriteOpts *opts, int level);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether to use or not Rock Ridge extensions.
|
|
|
|
*
|
|
|
|
* This are standard extensions to ECMA-119, intended to add POSIX filesystem
|
|
|
|
* features to ECMA-119 images. Thus, usage of this flag is highly recommended
|
|
|
|
* for images used on GNU/Linux systems. With the usage of RR extension, the
|
|
|
|
* resulting image will have long filenames (up to 255 characters), deeper
|
|
|
|
* directory structure, POSIX permissions and owner info on files and
|
|
|
|
* directories, support for symbolic links or special files... All that
|
|
|
|
* attributes can be modified/setted with the appropiate function.
|
|
|
|
*
|
|
|
|
* @param enable
|
|
|
|
* 1 to enable RR extension, 0 to not add them
|
|
|
|
* @return
|
|
|
|
* 1 success, < 0 error
|
|
|
|
*/
|
|
|
|
int iso_write_opts_set_rockridge(IsoWriteOpts *opts, int enable);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether to add the non-standard Joliet extension to the image.
|
|
|
|
*
|
|
|
|
* This extensions are heavily used in Microsoft Windows systems, so if you
|
|
|
|
* plan to use your disc on such a system you should add this extension.
|
|
|
|
* Usage of Joliet supplies longer filesystem length (up to 64 unicode
|
|
|
|
* characters), and deeper directory structure.
|
|
|
|
*
|
|
|
|
* @param enable
|
|
|
|
* 1 to enable Joliet extension, 0 to not add them
|
|
|
|
* @return
|
|
|
|
* 1 success, < 0 error
|
|
|
|
*/
|
|
|
|
int iso_write_opts_set_joliet(IsoWriteOpts *opts, int enable);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether to use newer ISO-9660:1999 version.
|
|
|
|
*
|
|
|
|
* This is the second version of ISO-9660. It allows longer filenames and has
|
|
|
|
* less restrictions than old ISO-9660. However, nobody is using it so there
|
|
|
|
* are no much reasons to enable this.
|
|
|
|
*/
|
|
|
|
int iso_write_opts_set_iso1999(IsoWriteOpts *opts, int enable);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Omit the version number (";1") at the end of the ISO-9660 identifiers.
|
|
|
|
* This breaks ECMA-119 specification, but version numbers are usually not
|
|
|
|
* used, so it should work on most systems. Use with caution.
|
|
|
|
*/
|
|
|
|
int iso_write_opts_set_omit_version_numbers(IsoWriteOpts *opts, int omit);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Allow ISO-9660 directory hierarchy to be deeper than 8 levels.
|
|
|
|
* This breaks ECMA-119 specification. Use with caution.
|
|
|
|
*/
|
|
|
|
int iso_write_opts_set_allow_deep_paths(IsoWriteOpts *opts, int allow);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Allow path in the ISO-9660 tree to have more than 255 characters.
|
|
|
|
* This breaks ECMA-119 specification. Use with caution.
|
|
|
|
*/
|
|
|
|
int iso_write_opts_set_allow_longer_paths(IsoWriteOpts *opts, int allow);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Allow a single file or directory hierarchy to have up to 37 characters.
|
|
|
|
* This is larger than the 31 characters allowed by ISO level 2, and the
|
|
|
|
* extra space is taken from the version number, so this also forces
|
|
|
|
* omit_version_numbers.
|
|
|
|
* This breaks ECMA-119 specification and could lead to buffer overflow
|
|
|
|
* problems on old systems. Use with caution.
|
|
|
|
*/
|
|
|
|
int iso_write_opts_set_max_37_char_filenames(IsoWriteOpts *opts, int allow);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ISO-9660 forces filenames to have a ".", that separates file name from
|
|
|
|
* extension. libisofs adds it if original filename doesn't has one. Set
|
|
|
|
* this to 1 to prevent this behavior.
|
|
|
|
* This breaks ECMA-119 specification. Use with caution.
|
|
|
|
*/
|
|
|
|
int iso_write_opts_set_no_force_dots(IsoWriteOpts *opts, int no);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Allow lowercase characters in ISO-9660 filenames. By default, only
|
|
|
|
* uppercase characters, numbers and a few other characters are allowed.
|
|
|
|
* This breaks ECMA-119 specification. Use with caution.
|
|
|
|
*/
|
|
|
|
int iso_write_opts_set_allow_lowercase(IsoWriteOpts *opts, int allow);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Allow all ASCII characters to be appear on an ISO-9660 filename. Note
|
|
|
|
* that "/" and "\0" characters are never allowed, even in RR names.
|
|
|
|
* This breaks ECMA-119 specification. Use with caution.
|
|
|
|
*/
|
|
|
|
int iso_write_opts_set_allow_full_ascii(IsoWriteOpts *opts, int allow);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Allow paths in the Joliet tree to have more than 240 characters.
|
|
|
|
* This breaks Joliet specification. Use with caution.
|
|
|
|
*/
|
|
|
|
int iso_write_opts_set_joliet_longer_paths(IsoWriteOpts *opts, int allow);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether to sort files based on their weight.
|
|
|
|
*
|
|
|
|
* @see iso_node_set_sort_weight
|
|
|
|
*/
|
|
|
|
int iso_write_opts_set_sort_files(IsoWriteOpts *opts, int sort);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether to set default values for files and directory permissions, gid and
|
|
|
|
* uid. All these take one of three values: 0, 1 or 2.
|
|
|
|
*
|
|
|
|
* If 0, the corresponding attribute will be kept as setted in the IsoNode.
|
|
|
|
* Unless you have changed it, it corresponds to the value on disc, so it
|
|
|
|
* is suitable for backup purposes. If set to 1, the corresponding attrib.
|
|
|
|
* will be changed by a default suitable value. Finally, if you set it to
|
|
|
|
* 2, the attrib. will be changed with the value specified by the functioins
|
|
|
|
* below. Note that for mode attributes, only the permissions are set, the
|
|
|
|
* file type remains unchanged.
|
|
|
|
*
|
|
|
|
* @see iso_write_opts_set_default_dir_mode
|
|
|
|
* @see iso_write_opts_set_default_file_mode
|
|
|
|
* @see iso_write_opts_set_default_uid
|
|
|
|
* @see iso_write_opts_set_default_gid
|
|
|
|
*/
|
|
|
|
int iso_write_opts_set_replace_mode(IsoWriteOpts *opts, int dir_mode,
|
|
|
|
int file_mode, int uid, int gid);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the mode to use on dirs when you set the replace_mode of dirs to 2.
|
|
|
|
*
|
|
|
|
* @see iso_write_opts_set_replace_mode
|
|
|
|
*/
|
|
|
|
int iso_write_opts_set_default_dir_mode(IsoWriteOpts *opts, mode_t dir_mode);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the mode to use on files when you set the replace_mode of files to 2.
|
|
|
|
*
|
|
|
|
* @see iso_write_opts_set_replace_mode
|
|
|
|
*/
|
|
|
|
int iso_write_opts_set_default_file_mode(IsoWriteOpts *opts, mode_t file_mode);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the uid to use when you set the replace_uid to 2.
|
|
|
|
*
|
|
|
|
* @see iso_write_opts_set_replace_mode
|
|
|
|
*/
|
|
|
|
int iso_write_opts_set_default_uid(IsoWriteOpts *opts, uid_t uid);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the gid to use when you set the replace_gid to 2.
|
|
|
|
*
|
|
|
|
* @see iso_write_opts_set_replace_mode
|
|
|
|
*/
|
|
|
|
int iso_write_opts_set_default_gid(IsoWriteOpts *opts, gid_t gid);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 0 to use IsoNode timestamps, 1 to use recording time, 2 to use
|
|
|
|
* values from timestamp field. This has only meaning if RR extensions
|
|
|
|
* are enabled.
|
|
|
|
*
|
|
|
|
* @see iso_write_opts_set_default_timestamp
|
|
|
|
*/
|
|
|
|
int iso_write_opts_set_replace_timestamps(IsoWriteOpts *opts, int replace);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the timestamp to use when you set the replace_timestamps to 2.
|
|
|
|
*
|
|
|
|
* @see iso_write_opts_set_replace_timestamps
|
|
|
|
*/
|
|
|
|
int iso_write_opts_set_default_timestamp(IsoWriteOpts *opts, time_t timestamp);
|
|
|
|
|
2008-01-27 13:23:59 +00:00
|
|
|
/**
|
|
|
|
* Whether to always record timestamps in GMT.
|
|
|
|
*
|
|
|
|
* By default, libisofs stores local time information on image. You can set
|
|
|
|
* this to always store timestamps in GMT. This is useful if you want to hide
|
|
|
|
* your timezone, or you live in a timezone that can't be represented in
|
|
|
|
* ECMA-119. These are timezones whose offset from GMT is greater than +13
|
|
|
|
* hours, lower than -12 hours, or not a multiple of 15 minutes.
|
|
|
|
*/
|
|
|
|
int iso_write_opts_set_always_gmt(IsoWriteOpts *opts, int gmt);
|
|
|
|
|
2008-01-26 12:04:16 +00:00
|
|
|
/**
|
|
|
|
* Set the charset to use for the RR names of the files that will be created
|
|
|
|
* on the image.
|
|
|
|
* NULL to use default charset, that is the locale charset.
|
2008-01-30 12:54:03 +00:00
|
|
|
* You can obtain the list of charsets supported on your system executing
|
|
|
|
* "iconv -l" in a shell.
|
2008-01-26 12:04:16 +00:00
|
|
|
*/
|
|
|
|
int iso_write_opts_set_output_charset(IsoWriteOpts *opts, const char *charset);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the type of the image to create. Libisofs support two kind of images:
|
|
|
|
* stand-alone and appendable.
|
|
|
|
*
|
|
|
|
* A stand-alone image is an image that is valid alone, and that can be
|
|
|
|
* mounted by its own. This is the kind of image you will want to create
|
|
|
|
* in most cases. A stand-alone image can be burned in an empty CD or DVD,
|
|
|
|
* or write to an .iso file for future burning or distribution.
|
|
|
|
*
|
|
|
|
* On the other side, an appendable image is not self contained, it refers
|
|
|
|
* to serveral files that are stored outside the image. Its usage is for
|
|
|
|
* multisession discs, where you add data in a new session, while the
|
|
|
|
* previous session data can still be accessed. In those cases, the old
|
|
|
|
* data is not written again. Instead, the new image refers to it, and thus
|
|
|
|
* it's only valid when appended to the original. Note that in those cases
|
|
|
|
* the image will be written after the original, and thus you will want
|
|
|
|
* to use a ms_block greater than 0.
|
|
|
|
*
|
|
|
|
* Note that if you haven't import a previous image (by means of
|
|
|
|
* iso_image_import()), the image will always be a stand-alone image, as
|
|
|
|
* there is no previous data to refer to.
|
|
|
|
*
|
|
|
|
* @param appendable
|
|
|
|
* 1 to create an appendable image, 0 for an stand-alone one.
|
|
|
|
*/
|
|
|
|
int iso_write_opts_set_appendable(IsoWriteOpts *opts, int appendable);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the start block of the image. It is supposed to be the lba where the
|
|
|
|
* first block of the image will be written on disc. All references inside the
|
|
|
|
* ISO image will take this into account, thus providing a mountable image.
|
|
|
|
*
|
|
|
|
* For appendable images, that are written to a new session, you should
|
|
|
|
* pass here the lba of the next writable address on disc.
|
|
|
|
*
|
|
|
|
* In stand alone images this is usually 0. However, you may want to
|
|
|
|
* provide a different ms_block if you don't plan to burn the image in the
|
|
|
|
* first session on disc, such as in some CD-Extra disc whether the data
|
|
|
|
* image is written in a new session after some audio tracks.
|
|
|
|
*/
|
|
|
|
int iso_write_opts_set_ms_block(IsoWriteOpts *opts, uint32_t ms_block);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the buffer where to store the descriptors that need to be written
|
|
|
|
* at the beginning of a overwriteable media to grow the image.
|
|
|
|
*
|
|
|
|
* @param overwrite
|
|
|
|
* When not NULL, it should point to a buffer of at least 64KiB, where
|
|
|
|
* libisofs will write the contents that should be written at the
|
|
|
|
* beginning of a overwriteable media, to grow the image. The growing
|
|
|
|
* of an image is a way, used by first time in growisofs by Andy Polyakov,
|
|
|
|
* to allow the appending of new data to non-multisession media, such
|
|
|
|
* as DVD+RW, in the same way you append a new session to a multisession
|
|
|
|
* disc, i.e., without need to write again the contents of the previous
|
|
|
|
* image.
|
|
|
|
*
|
|
|
|
* Note that if you want this kind of image growing, you will also need to
|
|
|
|
* set appendable to "1" and provide a valid ms_block after the previous
|
|
|
|
* image.
|
|
|
|
*
|
|
|
|
* You should initialize the buffer either with 0s, or with the contents of
|
|
|
|
* the first blocks of the image you're growing. In most cases, 0 is good
|
|
|
|
* enought.
|
|
|
|
*
|
|
|
|
* If you don't need this information, for example because you're creating a
|
|
|
|
* new image from scratch of because you will create an image for a true
|
|
|
|
* multisession media, just don't set this buffer or set it to NULL.
|
|
|
|
*/
|
|
|
|
int iso_write_opts_set_overwrite_buf(IsoWriteOpts *opts, uint8_t *overwrite);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the size, in number of blocks, of the FIFO buffer used between the
|
|
|
|
* writer thread and the burn_source. You have to provide at least a 32
|
|
|
|
* blocks buffer. Default value is set to 2MB, if that is ok for you, you
|
|
|
|
* don't need to call this function.
|
|
|
|
*/
|
|
|
|
int iso_write_opts_set_fifo_size(IsoWriteOpts *opts, size_t fifo_size);
|
|
|
|
|
2007-12-30 16:47:44 +00:00
|
|
|
/**
|
2008-01-04 23:42:32 +00:00
|
|
|
* Create a burn_source to actually write the image. That burn_source can be
|
|
|
|
* used with libburn as a data source for a track.
|
|
|
|
*
|
|
|
|
* @param image
|
|
|
|
* The image to write.
|
|
|
|
* @param opts
|
2008-01-31 20:03:28 +00:00
|
|
|
* The options for image generation. All needed data will be copied, so
|
|
|
|
* you can free the given struct once this function returns.
|
2008-01-04 23:42:32 +00:00
|
|
|
* @param burn_src
|
|
|
|
* Location where the pointer to the burn_source will be stored
|
|
|
|
* @return
|
|
|
|
* 1 on success, < 0 on error
|
2007-12-30 16:47:44 +00:00
|
|
|
*/
|
2008-01-26 12:04:16 +00:00
|
|
|
int iso_image_create_burn_source(IsoImage *image, IsoWriteOpts *opts,
|
2008-01-04 23:42:32 +00:00
|
|
|
struct burn_source **burn_src);
|
2007-12-22 16:09:28 +00:00
|
|
|
|
2008-01-26 13:00:46 +00:00
|
|
|
/**
|
|
|
|
* Creates an IsoReadOpts for reading an existent image. You should set the
|
|
|
|
* options desired with the correspondent setters. Note that you may want to
|
|
|
|
* set |