libisoburn-0.4.8.pl00/libisoburn/libisoburn.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define isoburn_libisofs_req_major   0
 The minimum version of libisofs to be used with this version of libisoburn at compile time.
#define isoburn_libisofs_req_minor   6
#define isoburn_libisofs_req_micro   26
#define isoburn_libburn_req_major   0
 The minimum version of libburn to be used with this version of libisoburn at compile time.
#define isoburn_libburn_req_minor   7
#define isoburn_libburn_req_micro   6
#define isoburn_header_version_major   0
 These three release version numbers tell the revision of this header file and of the API it describes.
#define isoburn_header_version_minor   4
#define isoburn_header_version_micro   8
#define isoburn_ropt_norock   1
 Which existing ISO 9660 extensions in the image to read or not to read.
#define isoburn_ropt_nojoliet   2
#define isoburn_ropt_noiso1999   4
#define isoburn_ropt_preferjoliet   8
#define isoburn_ropt_pretend_blank   16
#define isoburn_ropt_noaaip   32
#define isoburn_ropt_noacl   64
#define isoburn_ropt_noea   128
#define isoburn_ropt_noino   256
#define isoburn_ropt_nomd5   512
#define isoburn_ropt_has_rockridge   1
 After calling function isoburn_read_image() there are informations available in the option set.
#define isoburn_ropt_has_joliet   2
#define isoburn_ropt_has_iso1999   4
#define isoburn_ropt_has_el_torito   8
#define isoburn_igopt_rockridge   1
 Which extensions to support.
#define isoburn_igopt_joliet   2
#define isoburn_igopt_iso1999   4
#define isoburn_igopt_hardlinks   8
#define isoburn_igopt_aaip   32
#define isoburn_igopt_session_md5   64
#define isoburn_igopt_file_md5   128
#define isoburn_igopt_file_stability   256
#define isoburn_igopt_omit_version_numbers   1
 Relaxed constraints.
#define isoburn_igopt_allow_deep_paths   2
#define isoburn_igopt_allow_longer_paths   4
#define isoburn_igopt_max_37_char_filenames   8
#define isoburn_igopt_no_force_dots   16
#define isoburn_igopt_allow_lowercase   32
#define isoburn_igopt_allow_full_ascii   64
#define isoburn_igopt_joliet_longer_paths   128
#define isoburn_igopt_always_gmt   256
#define isoburn_igopt_rrip_version_1_10   512
#define isoburn_igopt_dir_rec_mtime   1024
#define isoburn_igopt_aaip_susp_1_10   2048
#define isoburn_igopt_sort_files_by_weight   1
 Whether and how files should be sorted.

Functions

int isoburn_initialize (char msg[1024], int flag)
 Overview.
int isoburn_is_compatible (int major, int minor, int micro, int flag)
 Check whether all features of header file libisoburn.h from the given major.minor.micro revision triple can be delivered by the library version which is performing this call.
void isoburn_version (int *major, int *minor, int *micro)
 Obtain the three release version numbers of the library.
int isoburn_libisofs_req (int *major, int *minor, int *micro)
 The minimum version of libisofs to be used with this version of libisoburn at runtime.
int isoburn_libburn_req (int *major, int *minor, int *micro)
 The minimum version of libburn to be used with this version of libisoburn at runtime.
int isoburn_set_msgs_submit (int(*msgs_submit)(void *handle, int error_code, char msg_text[], int os_errno, char severity[], int flag), void *submit_handle, int submit_flag, int flag)
 Note: Above version numbers are also recorded in configure.ac because libtool wants them as parameters at build time.
int isoburn_drive_scan_and_grab (struct burn_drive_info *drive_infos[], char *adr, int load)
 Aquire a target drive by its filesystem path resp.
int isoburn_drive_aquire (struct burn_drive_info *drive_infos[], char *adr, int flag)
 Aquire a target drive by its filesystem path resp.
int isoburn_drive_grab (struct burn_drive *drive, int load)
 Aquire a drive from the burn_drive_info[] array which was obtained by a previous call of burn_drive_scan().
int isoburn_drive_set_msgs_submit (struct burn_drive *d, int(*msgs_submit)(void *handle, int error_code, char msg_text[], int os_errno, char severity[], int flag), void *submit_handle, int submit_flag, int flag)
 Attach to a drive an application provided method for immediate delivery of messages.
enum burn_disc_status isoburn_disc_get_status (struct burn_drive *drive)
 Inquire the media status.
int isoburn_disc_erasable (struct burn_drive *d)
 Tells whether the media can be treated by isoburn_disc_erase().
void isoburn_disc_erase (struct burn_drive *drive, int fast)
 Mark the media as blank.
int isoburn_set_msc1 (struct burn_drive *d, int adr_mode, char *adr_value, int flag)
 Set up isoburn_disc_get_msc1() to return a fabricated value.
struct isoburn_toc_discisoburn_toc_drive_get_disc (struct burn_drive *d)
 Obtain a master handle for the table of content.
int isoburn_toc_disc_get_sectors (struct isoburn_toc_disc *disc)
 Tell the number of 2048 byte blocks covered by the table of content.
struct isoburn_toc_session ** isoburn_toc_disc_get_sessions (struct isoburn_toc_disc *disc, int *num)
 Get the array of session handles from the table of content.
int isoburn_toc_session_get_sectors (struct isoburn_toc_session *s)
 Tell the number of 2048 byte blocks covered by a particular session.
void isoburn_toc_session_get_leadout_entry (struct isoburn_toc_session *s, struct burn_toc_entry *entry)
 Obtain a copy of the entry which describes the end of a particular session.
struct isoburn_toc_track ** isoburn_toc_session_get_tracks (struct isoburn_toc_session *s, int *num)
 Get the array of track handles from a particular session.
void isoburn_toc_track_get_entry (struct isoburn_toc_track *t, struct burn_toc_entry *entry)
 Obtain a copy of the entry which describes a particular track.
int isoburn_toc_track_get_emul (struct isoburn_toc_track *t, int *start_lba, int *image_blocks, char volid[33], int flag)
 Obtain eventual ISO image parameters of an emulated track.
void isoburn_toc_disc_free (struct isoburn_toc_disc *disc)
 Release the memory associated with a master handle of media.
int isoburn_read_iso_head (struct burn_drive *d, int lba, int *image_blocks, char *info, int flag)
 Try whether the data at the given address look like a ISO 9660 image header and obtain its alleged size.
int isoburn_get_mount_params (struct burn_drive *d, int adr_mode, char *adr_value, int *lba, int *track, int *session, char volid[33], int flag)
 Try to convert the given entity address into various entity addresses which would describe it.
int isoburn_ropt_new (struct isoburn_read_opts **o, int flag)
 Produces a set of image read options, initialized with default values.
int isoburn_ropt_destroy (struct isoburn_read_opts **o, int flag)
 Deletes an option set which was created by isoburn_ropt_new().
int isoburn_ropt_set_extensions (struct isoburn_read_opts *o, int ext)
int isoburn_ropt_get_extensions (struct isoburn_read_opts *o, int *ext)
int isoburn_ropt_set_default_perms (struct isoburn_read_opts *o, uid_t uid, gid_t gid, mode_t mode)
 Default attributes to use if no RockRidge extension gets loaded.
int isoburn_ropt_get_default_perms (struct isoburn_read_opts *o, uid_t *uid, gid_t *gid, mode_t *mode)
int isoburn_ropt_set_default_dirperms (struct isoburn_read_opts *o, mode_t mode)
 Default attributes to use on directories if no RockRidge extension gets loaded.
int isoburn_ropt_get_default_dirperms (struct isoburn_read_opts *o, mode_t *mode)
int isoburn_ropt_set_input_charset (struct isoburn_read_opts *o, char *input_charset)
 Set the character set for reading RR file names from ISO images.
int isoburn_ropt_get_input_charset (struct isoburn_read_opts *o, char **input_charset)
int isoburn_ropt_set_auto_incharset (struct isoburn_read_opts *o, int mode)
 Enable or disable methods to automatically choose an input charset.
int isoburn_ropt_get_auto_incharset (struct isoburn_read_opts *o, int *mode)
int isoburn_ropt_get_size_what (struct isoburn_read_opts *o, uint32_t *size, int *has_what)
int isoburn_igopt_new (struct isoburn_imgen_opts **o, int flag)
 Produces a set of generation and transfer options, initialized with default values.
int isoburn_igopt_destroy (struct isoburn_imgen_opts **o, int flag)
 Deletes an option set which was created by isoburn_igopt_new().
int isoburn_igopt_set_level (struct isoburn_imgen_opts *o, int level)
 ISO level to write at.
int isoburn_igopt_get_level (struct isoburn_imgen_opts *o, int *level)
int isoburn_igopt_set_extensions (struct isoburn_imgen_opts *o, int ext)
int isoburn_igopt_get_extensions (struct isoburn_imgen_opts *o, int *ext)
int isoburn_igopt_set_relaxed (struct isoburn_imgen_opts *o, int relax)
int isoburn_igopt_get_relaxed (struct isoburn_imgen_opts *o, int *relax)
int isoburn_igopt_set_sort_files (struct isoburn_imgen_opts *o, int value)
int isoburn_igopt_get_sort_files (struct isoburn_imgen_opts *o, int *value)
int isoburn_igopt_set_over_mode (struct isoburn_imgen_opts *o, int replace_dir_mode, int replace_file_mode, mode_t dir_mode, mode_t file_mode)
 Set the override values for files and directory permissions.
int isoburn_igopt_get_over_mode (struct isoburn_imgen_opts *o, int *replace_dir_mode, int *replace_file_mode, mode_t *dir_mode, mode_t *file_mode)
int isoburn_igopt_set_over_ugid (struct isoburn_imgen_opts *o, int replace_uid, int replace_gid, uid_t uid, gid_t gid)
 Set the override values values for group id and user id.
int isoburn_igopt_get_over_ugid (struct isoburn_imgen_opts *o, int *replace_uid, int *replace_gid, uid_t *uid, gid_t *gid)
int isoburn_igopt_set_out_charset (struct isoburn_imgen_opts *o, char *output_charset)
 Set the charcter set to use for representing filenames in the image.
int isoburn_igopt_get_out_charset (struct isoburn_imgen_opts *o, char **output_charset)
int isoburn_igopt_set_fifo_size (struct isoburn_imgen_opts *o, int fifo_size)
 The number of bytes to be used for the fifo which decouples libisofs and libburn for better throughput and for reducing the risk of interrupting signals hitting the libburn thread which operates the MMC drive.
int isoburn_igopt_get_fifo_size (struct isoburn_imgen_opts *o, int *fifo_size)
int isoburn_igopt_get_effective_lba (struct isoburn_imgen_opts *o, int *lba)
 Obtain after image preparation the block address where the session will start on media.
int isoburn_igopt_get_data_start (struct isoburn_imgen_opts *o, int *lba)
 Obtain after image preparation the lowest block address of file content data.
int isoburn_igopt_set_scdbackup_tag (struct isoburn_imgen_opts *o, char *name, char *timestamp, char *tag_written)
 Set resp.
int isoburn_igopt_get_scdbackup_tag (struct isoburn_imgen_opts *o, char name[81], char timestamp[19], char **tag_written)
IsoImage * isoburn_get_attached_image (struct burn_drive *d)
 Get the image attached to a drive, if any.
int isoburn_read_image (struct burn_drive *d, struct isoburn_read_opts *read_opts, IsoImage **image)
 Load the ISO filesystem directory tree from the media in the given drive.
int isoburn_set_read_pacifier (struct burn_drive *drive, int(*read_pacifier)(IsoImage *, IsoFileSource *), void *app_handle)
 Set a callback function for producing pacifier messages during the lengthy process of image reading.
int isoburn_attach_image (struct burn_drive *d, IsoImage *image)
 Set the IsoImage to be used with a drive.
off_t isoburn_disc_available_space (struct burn_drive *d, struct burn_write_opts *o)
 Return the best possible estimation of the currently available capacity of the media.
int isoburn_disc_get_msc1 (struct burn_drive *d, int *start_lba)
 Obtain the start block number of the most recent session on media.
int isoburn_disc_track_lba_nwa (struct burn_drive *d, struct burn_write_opts *o, int trackno, int *lba, int *nwa)
 Use this with trackno==0 to obtain the predicted start block number of the new session.
int isoburn_get_min_start_byte (struct burn_drive *d, off_t *start_byte, int flag)
 Obtain the size which was attributed to an emulated appendable on actually overwriteable media.
int isoburn_prepare_disc (struct burn_drive *drive, struct burn_disc **disc, struct isoburn_imgen_opts *opts)
 To choose the expansion method of Growing: Create a disc object for writing the new session from the created or loaded iso_volset which has been manipulated via libisofs, to the same media from where the image was eventually loaded.
int isoburn_prepare_new_image (struct burn_drive *in_drive, struct burn_disc **disc, struct isoburn_imgen_opts *opts, struct burn_drive *out_drive)
 To choose the expansion method of Modifying: Create a disc object for producing a new image from a previous image plus the changes made by user.
int isoburn_prepare_blind_grow (struct burn_drive *in_drive, struct burn_disc **disc, struct isoburn_imgen_opts *opts, struct burn_drive *out_drive, int nwa)
 To choose the expansion method of Blind Growing: Create a disc object for writing an add-on session from the created or loaded IsoImage which has been manipulated via libisofs, to a different drive than the one from where it was loaded.
int isoburn_cancel_prepared_write (struct burn_drive *input_drive, struct burn_drive *output_drive, int flag)
 Revoke isoburn_prepare_*() instead of running isoburn_disc_write().
void isoburn_disc_write (struct burn_write_opts *o, struct burn_disc *disc)
 Start writing of the new session.
int isoburn_get_fifo_status (struct burn_drive *d, int *size, int *free_bytes, char **status_text)
 Inquire state and fill parameters of the fifo which is attached to the emerging track.
int isoburn_drive_wrote_well (struct burn_drive *d)
 Inquire whether the most recent write run was successful.
int isoburn_activate_session (struct burn_drive *d)
 Call this after isoburn_disc_write has finished and burn_drive_wrote_well() indicates success.
int isoburn_sync_after_write (struct burn_drive *input_drive, struct burn_drive *output_drive, int flag)
 Wait after normal end of operations until libisofs ended all write threads and freed resource reservations.
void isoburn_drive_release (struct burn_drive *drive, int eject)
 Release an aquired drive.
void isoburn_finish (void)
 Shutdown all three libraries.
int isoburn_needs_emulation (struct burn_drive *d)
 Inquire wether the media needs emulation or would be suitable for generic multi-session via libburn.

Define Documentation

#define isoburn_header_version_major   0

These three release version numbers tell the revision of this header file and of the API it describes.

They are memorized by applications at build time.

Since:
0.1.0

Definition at line 261 of file libisoburn.h.

Referenced by isoburn_version().

#define isoburn_header_version_micro   8

Definition at line 263 of file libisoburn.h.

Referenced by isoburn_version().

#define isoburn_header_version_minor   4

Definition at line 262 of file libisoburn.h.

Referenced by isoburn_version().

#define isoburn_igopt_aaip   32

Definition at line 950 of file libisoburn.h.

#define isoburn_igopt_aaip_susp_1_10   2048

Definition at line 1028 of file libisoburn.h.

Referenced by isoburn_igopt_set_relaxed().

#define isoburn_igopt_allow_deep_paths   2

Definition at line 1018 of file libisoburn.h.

#define isoburn_igopt_allow_full_ascii   64

Definition at line 1023 of file libisoburn.h.

#define isoburn_igopt_allow_longer_paths   4

Definition at line 1019 of file libisoburn.h.

#define isoburn_igopt_allow_lowercase   32

Definition at line 1022 of file libisoburn.h.

#define isoburn_igopt_always_gmt   256

Definition at line 1025 of file libisoburn.h.

Referenced by isoburn_igopt_set_relaxed().

#define isoburn_igopt_dir_rec_mtime   1024

Definition at line 1027 of file libisoburn.h.

Referenced by isoburn_igopt_set_relaxed().

#define isoburn_igopt_file_md5   128

Definition at line 952 of file libisoburn.h.

#define isoburn_igopt_file_stability   256

Definition at line 953 of file libisoburn.h.

#define isoburn_igopt_hardlinks   8

Definition at line 949 of file libisoburn.h.

#define isoburn_igopt_iso1999   4

Definition at line 948 of file libisoburn.h.

#define isoburn_igopt_joliet   2

Definition at line 947 of file libisoburn.h.

#define isoburn_igopt_joliet_longer_paths   128

Definition at line 1024 of file libisoburn.h.

#define isoburn_igopt_max_37_char_filenames   8

Definition at line 1020 of file libisoburn.h.

#define isoburn_igopt_no_force_dots   16

Definition at line 1021 of file libisoburn.h.

#define isoburn_igopt_omit_version_numbers   1

Relaxed constraints.

Setting any of the bits to 1 break the specifications, but it is supposed to work on most moderns systems. Use with caution.

Since:
0.1.0
Parameters:
o The option set to work on
relax Bitfield: bit0= omit_version_numbers Omit the version number (";1") at the end of the ISO-9660 identifiers. Version numbers are usually not used. bit1= allow_deep_paths Allow ISO-9660 directory hierarchy to be deeper than 8 levels. bit2= allow_longer_paths Allow path in the ISO-9660 tree to have more than 255 characters. bit3= max_37_char_filenames 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. bit4= no_force_dots ISO-9660 forces filenames to have a ".", that separates file name from extension. libisofs adds it if original filename has none. Set this to 1 to prevent this behavior. bit5= allow_lowercase Allow lowercase characters in ISO-9660 filenames. By default, only uppercase characters, numbers and a few other characters are allowed. bit6= allow_full_ascii Allow all ASCII characters to be appear on an ISO-9660 filename. Note * that "/" and "\0" characters are never allowed, even in RR names. bit7= joliet_longer_paths Allow paths in the Joliet tree to have more than 240 characters. bit8= always_gmt Write timestamps as GMT although the specs prescribe local time with eventual non-zero timezone offset. Negative timezones (west of GMT) can trigger bugs in some operating systems which typically appear in mounted ISO images as if the timezone shift from GMT was applied twice (e.g. in New York 22:36 becomes 17:36). bit9= rrip_version_1_10 Write Rock Ridge info as of specification RRIP-1.10 rather than RRIP-1.12: signature "RRIP_1991A" rather than "IEEE_1282", field PX without file serial number. bit10= dir_rec_mtime Store as ECMA-119 Directory Record timestamp the mtime of the source rather than the image creation time. bit11= aaip_susp_1_10 Write AAIP fields without announcing AAIP by an ER field and without distinguishing RRIP fields from the AAIP field by prefixed ES fields. This saves 5 to 10 bytes per file and might avoid problems with readers which only accept RRIP. SUSP-1.10 allows it, SUSP-1.12 frowns on it.
Returns:
1 success, <=0 failure

Definition at line 1017 of file libisoburn.h.

#define isoburn_igopt_rockridge   1

Which extensions to support.

Since:
0.1.0
Parameters:
o The option set to work on
ext Bitfield: bit0= rockridge Rock Ridge extensions add POSIX file attributes like owner, group, access permissions, long filenames. Very advisable if the designed audience has Unix style systems. bit1= joliet Longer filenames for Windows systems. Weaker than RockRidge, but also readable with Linux. bit2= iso1999 This is rather exotic. Better do not surprise the readers. bit3= hardlinks Enable hardlink consolidation. IsoNodes which refer to the same source object and have the same properties will get the same ISO image inode numbers. If combined with isoburn_igopt_rrip_version_1_10 below, then the PX entry layout of RRIP-1.12 will be used within RRIP-1.10 (mkisofs does this without causing visible trouble). bit5= aaip The libisofs specific SUSP based extension of ECMA-119 which can encode ACL and XFS-style Extended Attributes. bit6= session_md5
Since:
0.4.2 Produce and write a MD5 checksum of the whole session stream. bit7= file_md5
0.4.2 Produce and write MD5 checksums for each single IsoFile. bit8= file_stability (only together with file_md5)
0.4.2 Compute MD5 of each file before copying it into the image and compare this with the MD5 of the actual copying. If they do not match then issue MISHAP event. See also libisofs.h iso_write_opts_set_record_md5()
Returns:
1 success, <=0 failure

Definition at line 946 of file libisoburn.h.

#define isoburn_igopt_rrip_version_1_10   512

Definition at line 1026 of file libisoburn.h.

Referenced by isoburn_igopt_set_relaxed().

#define isoburn_igopt_session_md5   64

Definition at line 951 of file libisoburn.h.

#define isoburn_igopt_sort_files_by_weight   1

Whether and how files should be sorted.

Since:
0.1.0
Parameters:
o The option set to work on
value Bitfield: bit0= sort_files_by_weight files should be sorted based on their weight. Weight is attributed to files in the image by libisofs call iso_node_set_sort_weight().
Returns:
1 success, <=0 failure

Definition at line 1042 of file libisoburn.h.

#define isoburn_libburn_req_major   0

The minimum version of libburn to be used with this version of libisoburn at compile time.

Since:
0.1.0

Definition at line 225 of file libisoburn.h.

#define isoburn_libburn_req_micro   6

Definition at line 227 of file libisoburn.h.

#define isoburn_libburn_req_minor   7

Definition at line 226 of file libisoburn.h.

#define isoburn_libisofs_req_major   0

The minimum version of libisofs to be used with this version of libisoburn at compile time.

Since:
0.1.0

Definition at line 217 of file libisoburn.h.

Referenced by isoburn_initialize().

#define isoburn_libisofs_req_micro   26

Definition at line 219 of file libisoburn.h.

Referenced by isoburn_initialize().

#define isoburn_libisofs_req_minor   6

Definition at line 218 of file libisoburn.h.

Referenced by isoburn_initialize().

#define isoburn_ropt_has_el_torito   8

Definition at line 847 of file libisoburn.h.

#define isoburn_ropt_has_iso1999   4

Definition at line 846 of file libisoburn.h.

#define isoburn_ropt_has_joliet   2

Definition at line 845 of file libisoburn.h.

#define isoburn_ropt_has_rockridge   1

After calling function isoburn_read_image() there are informations available in the option set.

This info can be obtained as bits in parameter has_what. Like: joliet_available = (has_what & isoburn_ropt_has_joliet);

Since:
0.1.0
Parameters:
o The option set to work on
size Number of image data blocks, 2048 bytes each.
has_what Bitfield: bit0= has_rockridge RockRidge extension info is available (POSIX filesystem) bit1= has_joliet Joliet extension info is available (suitable for MS-Windows) bit2= has_iso1999 ISO version 2 Enhanced Volume Descriptor is available. This is rather exotic. bit3= has_el_torito El-Torito boot record is present
Returns:
1 success, <=0 failure

Definition at line 844 of file libisoburn.h.

#define isoburn_ropt_noaaip   32

Definition at line 753 of file libisoburn.h.

#define isoburn_ropt_noacl   64

Definition at line 754 of file libisoburn.h.

#define isoburn_ropt_noea   128

Definition at line 755 of file libisoburn.h.

#define isoburn_ropt_noino   256

Definition at line 756 of file libisoburn.h.

#define isoburn_ropt_noiso1999   4

Definition at line 750 of file libisoburn.h.

#define isoburn_ropt_nojoliet   2

Definition at line 749 of file libisoburn.h.

#define isoburn_ropt_nomd5   512

Definition at line 757 of file libisoburn.h.

#define isoburn_ropt_norock   1

Which existing ISO 9660 extensions in the image to read or not to read.

Whether to read the content of an existing image at all. The bits can be combined by | resp. inquired by &.

Since:
0.1.0
Parameters:
ext Bitfield: bit0= norock Do not read Rock Ridge extensions bit1= nojoliet Do not read Joliet extensions bit2= noiso1999 Do not read ISO 9660:1999 enhanced tree bit3= preferjoliet When both Joliet and RR extensions are present, the RR tree is used. If you prefer using Joliet, set this to 1. bit4= pretend_blank Always create empty image.Ignore any image on input drive. bit5= noaaip
Since:
0.3.4 Do not load AAIP information from image. This information eventually contains ACL or XFS-style Extended Attributes. bit6= noacl
0.3.4 Do not obtain ACL from external filesystem objects (e.g. local filesystem files). bit7= noea
0.3.4 Do not obtain XFS-style Extended Attributes from external filesystem objects (e.g. local filesystem files). bit8= noino
0.4.0 Do not load eventual inode numbers from RRIP entry PX, but generate a new unique inode number for each imported IsoNode object. PX inode numbers allow to mark families of hardlinks by giving all family members the same inode number. libisofs keeps the PX inode numbers unaltered when IsoNode objects get written into an ISO image. bit9= nomd5
0.4.2 Do not load the eventual MD5 checksum array.
Returns:
1 success, <=0 failure

Definition at line 748 of file libisoburn.h.

#define isoburn_ropt_preferjoliet   8

Definition at line 751 of file libisoburn.h.

#define isoburn_ropt_pretend_blank   16

Definition at line 752 of file libisoburn.h.


Function Documentation

int isoburn_activate_session ( struct burn_drive *  d  ) 

Call this after isoburn_disc_write has finished and burn_drive_wrote_well() indicates success.

It will eventually complete the emulation of multi-session functionality, if needed at all. Let libisoburn decide. Not a wrapper, but peculiar to libisoburn.

Since:
0.1.0
Parameters:
d The output drive to which the session was written
Returns:
1 success , <=0 failure

Definition at line 276 of file isofs_wrap.c.

References isoburn::emulation_mode, isoburn::fabricated_disc_status, isoburn::fabricated_msc2, isoburn_find_emulator(), Libisoburn_target_head_sizE, isoburn::target_iso_head, and isoburn::zero_nwa.

Referenced by isoburn_invalidate_iso().

00277 {
00278  int ret;
00279  struct isoburn *o;
00280 
00281  ret = isoburn_find_emulator(&o, drive, 0);
00282  if (ret < 0)
00283    return -1;
00284 
00285  if (o->emulation_mode != 1)
00286    return 1; /* don't need to activate session */
00287  if (o->fabricated_msc2 >= 0)
00288    return 1; /* blind growing: do not alter anything outside the session */
00289  
00290  if (!(o->fabricated_disc_status == BURN_DISC_APPENDABLE ||
00291        (o->fabricated_disc_status == BURN_DISC_BLANK &&
00292         o->zero_nwa > 0)))
00293    return 1;
00294  
00295  ret = burn_random_access_write(drive, (off_t) 0, (char*)o->target_iso_head, 
00296                                 Libisoburn_target_head_sizE, 1);
00297 
00298  return ret;
00299 }

int isoburn_attach_image ( struct burn_drive *  d,
IsoImage *  image 
)

Set the IsoImage to be used with a drive.

This eventually releases the reference to the old IsoImage attached to the drive. Caution: Use with care. It hardly makes sense to replace an image that reflects a valid ISO image on media. This call is rather intended for writing a newly created and populated image to blank media. The use case in xorriso is to let an image survive the change or demise of the outdev target drive.

Since:
0.1.0
Parameters:
d The drive which shall be write target of the volset.
image The image that represents the image to be written. This image pointer MUST already be a valid reference suitable for iso_image_unref(). It may have been obtained by appropriate libisofs calls or by isoburn_read_image() with d==NULL.
Returns:
<=0 error , 1 = success

Definition at line 253 of file isofs_wrap.c.

References isoburn::image, isoburn_find_emulator(), and isoburn_msgs_submit().

00254 {
00255  int ret;
00256  struct isoburn *o;
00257 
00258  ret = isoburn_find_emulator(&o, d, 0);
00259  if (ret < 0 || o == NULL)
00260    return 0;
00261  if (image == NULL) {
00262    isoburn_msgs_submit(o, 0x00060000,
00263                        "Program error: isoburn_attach_image: image==NULL",
00264                        0, "FATAL", 0);
00265    return -1;
00266  }
00267  if(o->image != NULL)
00268    iso_image_unref(o->image);
00269  o->image = image;
00270  return(1);
00271 }

int isoburn_cancel_prepared_write ( struct burn_drive *  input_drive,
struct burn_drive *  output_drive,
int  flag 
)

Revoke isoburn_prepare_*() instead of running isoburn_disc_write().

libisofs reserves resources and maybe already starts generating the image stream when one of above three calls is performed. It is mandatory to either run isoburn_disc_write() or to revoke the preparations by the call described here.

Since:
0.1.0
Parameters:
input_drive The drive resp. in_drive which was used with the preparation call.
output_drive The out_drive used with isoburn_prepare_new_image(), NULL if none.
flag Bitfield, submit 0 for now. bit0= -reserved for internal use-
Returns:
<0 error, 0= no pending preparations detectable, 1 = canceled

Definition at line 571 of file isoburn.c.

References isoburn::iso_source, and isoburn_find_emulator().

Referenced by isoburn_sync_after_write().

00573 {
00574  int ret;
00575  struct isoburn *o= NULL;
00576 
00577  if(output_drive!=NULL) {
00578    ret= isoburn_find_emulator(&o, output_drive, 0);
00579    if(ret<0 || o==NULL)
00580      o= NULL;
00581    else if(o->iso_source==NULL)
00582      o= NULL;
00583  }
00584  if(o==NULL) {
00585    ret= isoburn_find_emulator(&o, d, 0);
00586    if(ret<0)
00587      return(-1);
00588    if(o==NULL)
00589      return(0);
00590    if(o->iso_source==NULL)
00591      return(0);
00592  }
00593  if(o->iso_source->read!=NULL)
00594    return(0);
00595  if(o->iso_source->version<1)
00596    return(0);
00597  o->iso_source->cancel(o->iso_source);
00598  burn_source_free(o->iso_source);
00599  o->iso_source= NULL;
00600  return(1);
00601 }

off_t isoburn_disc_available_space ( struct burn_drive *  d,
struct burn_write_opts *  o 
)

Return the best possible estimation of the currently available capacity of the media.

This might depend on particular write option settings and on drive state. An eventual start address for emulated multi-session will be subtracted from the capacity estimation given by burn_disc_available_space(). Negative results get defaulted to 0. Wrapper for: burn_disc_available_space()

Since:
0.1.0
Parameters:
d The drive to query.
o If not NULL: write parameters to be set on drive before query
Returns:
number of most probably available free bytes

Definition at line 605 of file burn_wrap.c.

References isoburn::emulation_mode, isoburn_disc_get_status(), isoburn_find_emulator(), and isoburn::nwa.

00607 {
00608  int ret;
00609  struct isoburn *o;
00610  struct burn_write_opts *eff_opts= NULL, *local_opts= NULL;
00611  enum burn_disc_status s;
00612  off_t avail;
00613 
00614  eff_opts= opts;
00615  ret= isoburn_find_emulator(&o, d, 0);
00616  if(ret>0 && o!=NULL)
00617    if(o->emulation_mode!=0) {
00618      s= isoburn_disc_get_status(d);
00619      if(s==BURN_DISC_FULL) /* unknown data format in first 64 kB */
00620        return((off_t) 0);
00621      local_opts= burn_write_opts_new(d);
00622      eff_opts= local_opts;
00623      burn_write_opts_set_start_byte(eff_opts, ((off_t) o->nwa) * (off_t) 2048);
00624    }
00625  avail= burn_disc_available_space(d, eff_opts);
00626  if(local_opts!=NULL)
00627    burn_write_opts_free(local_opts);
00628  local_opts= NULL;
00629  return(avail);
00630 }

int isoburn_disc_erasable ( struct burn_drive *  d  ) 

Tells whether the media can be treated by isoburn_disc_erase().

Wrapper for: burn_disc_erasable()

Since:
0.1.0
Parameters:
d The drive to inquire.
Returns:
0=not erasable , else erasable

Definition at line 550 of file burn_wrap.c.

References isoburn::emulation_mode, and isoburn_find_emulator().

00551 {
00552  int ret;
00553  struct isoburn *o;
00554 
00555  ret= isoburn_find_emulator(&o, d, 0);
00556  if(ret>0)
00557    if(o->emulation_mode==1)
00558      return(1);
00559  return burn_disc_erasable(d);
00560 }

void isoburn_disc_erase ( struct burn_drive *  drive,
int  fast 
)

Mark the media as blank.

With multi-session media this will call burn_disc_erase(). With random access media, an eventual ISO-9660 filesystem will get invalidated by altering its start blocks on media. In case of success, the media is in status BURN_DISC_BLANK afterwards. Wrapper for: burn_disc_erase()

Since:
0.1.0
Parameters:
drive The drive with the media to erase.
fast 1=fast erase, 0=thorough erase With DVD-RW, fast erase yields media incapable of multi-session.

Definition at line 563 of file burn_wrap.c.

References isoburn::emulation_mode, isoburn_disc_get_status(), isoburn_find_emulator(), isoburn_invalidate_iso(), and Libisoburn_target_head_sizE.

00564 {
00565  int ret, do_pseudo_blank= 0;
00566  struct isoburn *o;
00567  enum burn_disc_status s;
00568  char zero_buffer[Libisoburn_target_head_sizE];
00569  struct burn_multi_caps *caps= NULL;
00570 
00571  ret= isoburn_find_emulator(&o, drive, 0);
00572  if(ret>0) {
00573    if(o->emulation_mode==-1) {
00574      /* To cause a negative reply with burn_drive_wrote_well() */
00575      burn_drive_cancel(drive);
00576      goto ex;
00577    }
00578 
00579    if(o->emulation_mode > 0) { /* might be readonly with emulated sessions */
00580      ret= burn_disc_get_multi_caps(drive, BURN_WRITE_NONE, &caps, 0);
00581      if(ret > 0 && caps->start_adr)
00582        do_pseudo_blank= 1;
00583    }
00584    if(do_pseudo_blank) {
00585      s= isoburn_disc_get_status(drive);
00586      if(s==BURN_DISC_FULL) { /* unknown data format in first 64 kB */
00587        memset(zero_buffer, 0, Libisoburn_target_head_sizE);
00588        ret= burn_random_access_write(drive, (off_t) 0, zero_buffer,
00589                                      (off_t) Libisoburn_target_head_sizE, 1);
00590      } else {
00591        ret= isoburn_invalidate_iso(o, 0);
00592      }
00593      if(ret<=0)
00594        burn_drive_cancel(drive); /* mark run as failure */
00595      goto ex;
00596    }
00597  }
00598  burn_disc_erase(drive, fast);
00599 ex:;
00600  if(caps!=NULL)
00601    burn_disc_free_multi_caps(&caps);
00602 }

int isoburn_disc_get_msc1 ( struct burn_drive *  d,
int *  start_lba 
)

Obtain the start block number of the most recent session on media.

In case of random access media this will normally be 0. Successfull return is not a guarantee that there is a ISO-9660 image at all. The call will fail, nevertheless,if isoburn_disc_get_status() returns not BURN_DISC_APPENDABLE or BURN_DISC_FULL. Note: The result of this call may be fabricated by a previous call of isoburn_set_msc1() which can override the rule to load the most recent session. Wrapper for: burn_disc_get_msc1()

Since:
0.1.0
Parameters:
d The drive to inquire
start_lba Contains on success the start address in 2048 byte blocks
Returns:
<=0 error , 1 = success

Definition at line 633 of file burn_wrap.c.

References isoburn::emulation_mode, isoburn::fabricated_msc1, isoburn_disc_get_status(), isoburn_find_emulator(), and isoburn_msgs_submit().

Referenced by isoburn_read_image().

00634 {
00635  int ret;
00636  struct isoburn *o;
00637 
00638 #ifdef Hardcoded_cd_rW
00639  /* <<< A70929 : hardcoded CD-RW with fabricated -msinfo */
00640  *start_lba= Hardcoded_cd_rw_c1;
00641  return(1);
00642 #endif
00643 
00644  if(isoburn_disc_get_status(d)!=BURN_DISC_APPENDABLE &&
00645     isoburn_disc_get_status(d)!=BURN_DISC_FULL) {
00646    isoburn_msgs_submit(NULL, 0x00060000,
00647                        "Media contains no recognizable data", 0, "SORRY", 0);
00648    return(0);
00649  }
00650  ret= isoburn_find_emulator(&o, d, 0);
00651  if(ret<0)
00652    return(0);
00653  if(o->fabricated_msc1>=0) {
00654    *start_lba= o->fabricated_msc1;
00655    return(1);
00656  }
00657  if(ret>0) if(o->emulation_mode>0) {
00658    *start_lba= 0;
00659    return(1);
00660  }
00661  return(burn_disc_get_msc1(d, start_lba));
00662 }

enum burn_disc_status isoburn_disc_get_status ( struct burn_drive *  drive  ) 

Inquire the media status.

Expect the whole spectrum of libburn BURN_DISC_* with multi-session media. Emulated states with random access media are BURN_DISC_BLANK and BURN_DISC_APPENDABLE. Wrapper for: burn_disc_get_status()

Since:
0.1.0
Parameters:
drive The drive to inquire.
Returns:
The status of the drive, or what kind of disc is in it. Note: BURN_DISC_UNGRABBED indicates wrong API usage

Definition at line 527 of file burn_wrap.c.

References isoburn::emulation_mode, isoburn::fabricated_disc_status, isoburn_find_emulator(), isoburn::nwa, and isoburn::zero_nwa.

Referenced by isoburn_disc_available_space(), isoburn_disc_erase(), isoburn_disc_get_msc1(), isoburn_is_intermediate_dvd_rw(), isoburn_needs_emulation(), isoburn_prepare_disc_aux(), and isoburn_read_image().

00528 {
00529  int ret;
00530  struct isoburn *o;
00531 
00532  ret= isoburn_find_emulator(&o, drive, 0);
00533  if(ret<0)
00534    return(BURN_DISC_UNSUITABLE);
00535  if(o!=NULL)
00536    if(o->fabricated_disc_status!=BURN_DISC_UNREADY)
00537      return(o->fabricated_disc_status);
00538  if(ret==0)
00539    return(burn_disc_get_status(drive));
00540 
00541  /* emulated status */
00542  if(o->emulation_mode==-1)
00543    return(BURN_DISC_UNSUITABLE);
00544  if(o->nwa>o->zero_nwa)
00545    return(BURN_DISC_APPENDABLE);
00546  return(BURN_DISC_BLANK);
00547 }

int isoburn_disc_track_lba_nwa ( struct burn_drive *  d,
struct burn_write_opts *  o,
int  trackno,
int *  lba,
int *  nwa 
)

Use this with trackno==0 to obtain the predicted start block number of the new session.

The interesting number is returned in parameter nwa. Wrapper for: burn_disc_track_lba_nwa()

Since:
0.1.0
Parameters:
d The drive to inquire
o If not NULL: write parameters to be set on drive before query
trackno Submit 0.
lba return value: start lba
nwa return value: Next Writeable Address
Returns:
1=nwa is valid , 0=nwa is not valid , -1=error

Definition at line 665 of file burn_wrap.c.

References isoburn::emulation_mode, isoburn_find_emulator(), and isoburn::nwa.

Referenced by isoburn_get_msc2(), and isoburn_prepare_disc_aux().

00668 {
00669  int ret;
00670  struct isoburn *o;
00671 
00672 #ifdef Hardcoded_cd_rW
00673  /* <<< A70929 : hardcoded CD-RW with fabricated -msinfo */
00674  *lba= Hardcoded_cd_rw_c1;
00675  *nwa= Hardcoded_cd_rw_nwA;
00676  return(1);
00677 #endif
00678 
00679  *nwa= *lba= 0;
00680  ret= isoburn_find_emulator(&o, d, 0);
00681  if(ret<0)
00682    return(0);
00683  if(ret>0) if(o->emulation_mode>0) {
00684    *lba= 0;
00685    *nwa= o->nwa;
00686    return(1);
00687  }
00688  if(burn_drive_get_drive_role(d) != 1)
00689    return(1);
00690  return(burn_disc_track_lba_nwa(d, opts, trackno, lba, nwa));
00691 }

void isoburn_disc_write ( struct burn_write_opts *  o,
struct burn_disc *  disc 
)

Start writing of the new session.

This call is asynchrounous. I.e. it returns quite soon and the progress has to be watched by a loop with call burn_drive_get_status() until BURN_DRIVE_IDLE is returned. Wrapper for: burn_disc_write()

Since:
0.1.0
Parameters:
o Options which control the burn process. See burnwrite_opts_*() in libburn.h.
disc Disc object created either by isoburn_prepare_disc() or by isoburn_prepare_new_image().

Definition at line 711 of file burn_wrap.c.

References isoburn::emulation_mode, isoburn_find_emulator(), isoburn_is_intermediate_dvd_rw(), isoburn_msgs_submit(), isoburn::nwa, isoburn::truncate, and isoburn::wrote_well.

00712 {
00713  int ret;
00714  off_t nwa= 0;
00715  struct isoburn *o;
00716  struct burn_drive *drive;
00717  char reasons[BURN_REASONS_LEN],msg[160+BURN_REASONS_LEN];
00718  char adr[BURN_DRIVE_ADR_LEN];
00719  enum burn_write_types write_type;
00720  struct stat stbuf;
00721 
00722  drive= burn_write_opts_get_drive(opts);
00723  ret= isoburn_find_emulator(&o, drive, 0);
00724  if(ret<0)
00725    return;
00726  if(o!=NULL) {
00727    o->wrote_well= -1;
00728    if(o->emulation_mode!=0) {
00729      burn_write_opts_set_multi(opts, 0);
00730      if(o->emulation_mode>0 && o->nwa >= 0) {
00731        nwa= o->nwa;
00732 
00733        /* This caters for unwritten formatted DVD-RW. They need to be written
00734           sequentially on the first use. Only written areas are random access.
00735           If the first session is not written to LBA 0, then re-opening of
00736           formatting and padding is needed. 
00737           This can be done. But when the track gets closed after padding,
00738           this lasts a long time. There is a high risk that an app will not
00739           poll the message queue while waiting for  isoburn_disc_write()  to
00740           return. The pacifier loop usually happens only afterwards.
00741           So automatic formatting might cause a nervous clueless user.
00742        */
00743        ret= isoburn_is_intermediate_dvd_rw(drive, 0);
00744        if(ret>0 && nwa>0 && nwa <= o->zero_nwa) {
00745          /* actually this should not happen since such media get recognized
00746             by isoburn_welcome_media and o->zero_nwa gets set to 0
00747          */
00748          sprintf(msg,
00749         "DVD-RW insufficiently formatted. (Intermediate State, size unknown)");
00750          isoburn_msgs_submit(o, 0x00060000, msg, 0, "FAILURE", 0);
00751          sprintf(msg,
00752                 "It might help to first deformat it and then format it again");
00753          isoburn_msgs_submit(o, 0x00060000, msg, 0, "HINT", 0);
00754          burn_drive_cancel(drive); /* mark run as failure */
00755          return;
00756        }
00757        /* end of DVD-RW oriented check */
00758 
00759        burn_write_opts_set_start_byte(opts, nwa * (off_t) 2048);
00760      }
00761    }
00762  }
00763 
00764  write_type= burn_write_opts_auto_write_type(opts, disc, reasons, 0);
00765  if (write_type == BURN_WRITE_NONE) {
00766     sprintf(msg, "Failed to find a suitable write mode:\n%s", reasons);
00767     isoburn_msgs_submit(o, 0x00060000, msg, 0, "FAILURE", 0);
00768     if(o!=NULL)
00769       o->wrote_well= 0;
00770     /* To cause a negative reply with burn_drive_wrote_well() */
00771     burn_drive_cancel(drive);
00772     return;
00773  }
00774 
00775  sprintf(reasons, "%d", (int) write_type);
00776  sprintf(msg, "Write_type = %s\n",
00777               (write_type == BURN_WRITE_SAO ? "SAO" :
00778               (write_type == BURN_WRITE_TAO ? "TAO" : reasons)));
00779  isoburn_msgs_submit(o, 0x00060000, msg, 0, "DEBUG", 0);
00780 
00781 #ifdef Hardcoded_cd_rW
00782  /* <<< A70929 : hardcoded CD-RW with fabricated -msinfo */
00783  fprintf(stderr, "Setting write address to LBA %d\n", Hardcoded_cd_rw_nwA);
00784  burn_write_opts_set_start_byte(opts,
00785                  ((off_t) Hardcoded_cd_rw_nwA) * (off_t) 2048);
00786 #endif
00787 
00788  if(o->truncate) {
00789    ret= burn_drive_get_drive_role(drive);
00790    if(ret==2) {
00791      ret= burn_drive_d_get_adr(drive, adr);
00792      if(ret>0) {
00793        ret= lstat(adr, &stbuf);
00794        if(ret!=-1)
00795          if(S_ISREG(stbuf.st_mode))
00796            truncate(adr, nwa * (off_t) 2048);
00797      }
00798    }
00799  }
00800 
00801  burn_disc_write(opts, disc);
00802 }

int isoburn_drive_aquire ( struct burn_drive_info *  drive_infos[],
char *  adr,
int  flag 
)

Aquire a target drive by its filesystem path resp.

libburn persistent address. This is a modern successor of isoburn_drive_scan_and_grab(). Wrapper for: burn_drive_scan_and_grab()

Since:
0.1.2
Parameters:
drive_infos On success returns a one element array with the drive (cdrom/burner). Thus use with driveno 0 only. On failure the array has no valid elements at all. The returned array should be freed via burn_drive_info_free() when the drive is no longer needed. But before this is done one has to call isoburn_drive_release(drive_infos[0].drive).
adr The persistent address of the desired drive.
flag bit0= attempt to load the disc tray. Else: failure if not loaded. bit1= regard overwriteable media as blank bit2= if the drive is a regular disk file: truncate it to the write start address bit3= if the drive reports a read-only profile try to read table of content by scanning for ISO image headers. (depending on media type and drive this might help or it might make the resulting toc even worse) bit4= do not emulate table of content on overwriteable media bit5= ignore ACL from external filesystems bit6= ignore POSIX Extended Attributes from external filesystems bit7= pretend read-only profile and scan for table of content
Returns:
1 = success , 0 = drive not found , <0 = other error
Parameters:
flag bit0= load bit1= regard overwriteable media as blank bit2= if the drive is a regular disk file: truncate it to the write start address bit3= if the drive reports a -ROM profile then try to read table of content by scanning for ISO image headers. (depending on media type and drive state this might help or it might make the resulting toc even worse) bit4= do not emulate TOC on overwriteable media bit5= ignore ACL from external filesystems bit6= ignore POSIX Extended Attributes from external filesystems bit7= pretend -ROM profile and scan for table of content

Definition at line 425 of file burn_wrap.c.

References isoburn::drive, isoburn_destroy(), isoburn_find_emulator(), isoburn_welcome_media(), and isoburn::truncate.

Referenced by isoburn_drive_scan_and_grab().

00427 {
00428  int ret, drive_grabbed= 0;
00429  struct isoburn *o= NULL;
00430 
00431 #ifndef NIX
00432 
00433 /* <<< should be obsolete by new drive addressing of libburn-0.5.2 */
00434 /* >>> but helps with kernel 2.4 to use /dev/sr */
00435 
00436  int conv_ret;
00437  char libburn_drive_adr[BURN_DRIVE_ADR_LEN];
00438 
00439  conv_ret= burn_drive_convert_fs_adr(adr, libburn_drive_adr);
00440  if(conv_ret<=0)
00441    strcpy(libburn_drive_adr, adr);
00442  ret= burn_drive_scan_and_grab(drive_infos, libburn_drive_adr, flag&1);
00443 
00444 #else
00445 
00446  ret= burn_drive_scan_and_grab(drive_infos, adr, flag & 1);
00447 
00448 #endif /* ! NIX */
00449 
00450  if(ret<=0)
00451    goto ex;
00452  drive_grabbed= 1;
00453  ret= isoburn_welcome_media(&o, (*drive_infos)[0].drive,
00454                             (flag & (8 | 16 | 32 | 64 | 128)) | !!(flag&2));
00455  if(ret<=0)
00456    goto ex;
00457 
00458  if(flag&4) {
00459    ret= isoburn_find_emulator(&o, (*drive_infos)[0].drive, 0);
00460    if(ret>0 && o!=NULL)
00461      o->truncate= 1;
00462  }
00463 
00464  ret= 1;
00465 ex:
00466  if(ret<=0) {
00467    if(drive_grabbed)
00468      burn_drive_release((*drive_infos)[0].drive, 0);
00469    isoburn_destroy(&o, 0);
00470  }
00471  return(ret);
00472 }

int isoburn_drive_grab ( struct burn_drive *  drive,
int  load 
)

Aquire a drive from the burn_drive_info[] array which was obtained by a previous call of burn_drive_scan().

Wrapper for: burn_drive_grab()

Since:
0.1.0
Parameters:
drive The drive to grab. E.g. drive_infos[1].drive . Call isoburn_drive_release(drive) when it it no longer needed.
load 1 attempt to load the disc tray. 0 no attempt, rather failure.
Returns:
1 success, <=0 failure

Definition at line 485 of file burn_wrap.c.

References isoburn_destroy(), and isoburn_welcome_media().

00486 {
00487  int ret;
00488  struct isoburn *o= NULL;
00489 
00490  ret= burn_drive_grab(drive, load);
00491  if(ret<=0)
00492    goto ex;
00493  ret= isoburn_welcome_media(&o, drive, 0);
00494  if(ret<=0)
00495    goto ex;
00496  
00497  ret= 1;
00498 ex:
00499  if(ret<=0)
00500    isoburn_destroy(&o,0);
00501  return(ret);
00502 }

void isoburn_drive_release ( struct burn_drive *  drive,
int  eject 
)

Release an aquired drive.

Wrapper for: burn_drive_release()

Since:
0.1.0
Parameters:
drive The drive to be released
eject 1= eject media from drive , 0= do not eject

Definition at line 805 of file burn_wrap.c.

References isoburn_destroy(), and isoburn_find_emulator().

00806 {
00807  int ret;
00808  struct isoburn *o;
00809 
00810  ret= isoburn_find_emulator(&o, drive, 0);
00811  if(ret<0)
00812    return;
00813  if(o!=NULL) {
00814    isoburn_destroy(&o, 0);
00815  }
00816  burn_drive_release(drive, eject);
00817 }

int isoburn_drive_scan_and_grab ( struct burn_drive_info *  drive_infos[],
char *  adr,
int  load 
)

Aquire a target drive by its filesystem path resp.

libburn persistent address. Wrapper for: burn_drive_scan_and_grab()

Since:
0.1.0
Parameters:
drive_infos On success returns a one element array with the drive (cdrom/burner). Thus use with driveno 0 only. On failure the array has no valid elements at all. The returned array should be freed via burn_drive_info_free() when the drive is no longer needed. But before this is done one has to call isoburn_drive_release(drive_infos[0].drive).
adr The persistent address of the desired drive.
load 1 attempt to load the disc tray. 0 no attempt,rather failure.
Returns:
1 = success , 0 = drive not found , <0 = other error

Definition at line 475 of file burn_wrap.c.

References isoburn_drive_aquire().

00477 {
00478  int ret;
00479 
00480  ret= isoburn_drive_aquire(drive_infos, adr, !!load);
00481  return(ret);
00482 }

int isoburn_drive_set_msgs_submit ( struct burn_drive *  d,
int(*)(void *handle, int error_code, char msg_text[], int os_errno, char severity[], int flag)  msgs_submit,
void *  submit_handle,
int  submit_flag,
int  flag 
)

Attach to a drive an application provided method for immediate delivery of messages.

If no method is set or if the method is set to NULL then libisoburn delivers messages of the drive through the global msgs_submit() method set by isoburn_set_msgs_submiti() or by the message queue of libburn.

Since:
0.2.0
Parameters:
d The drive to which this function, handle and flag shall apply
msgs_submit The function call which implements the method
submit_handle Handle to be used as first argument of msgs_submit
submit_flag Flag to be used as last argument of msgs_submit
flag Unused yet, submit 0

Definition at line 1610 of file burn_wrap.c.

References isoburn_find_emulator(), isoburn::msgs_submit, isoburn::msgs_submit_flag, and isoburn::msgs_submit_handle.

01615 {
01616  struct isoburn *o;
01617  int ret;
01618 
01619  ret= isoburn_find_emulator(&o, d, 0);
01620  if(ret<0 || o==NULL)
01621    return(-1);
01622  o->msgs_submit= msgs_submit;
01623  o->msgs_submit_handle= submit_handle;
01624  o->msgs_submit_flag= submit_flag;
01625  return(1);
01626 }

int isoburn_drive_wrote_well ( struct burn_drive *  d  ) 

Inquire whether the most recent write run was successful.

Wrapper for: burn_drive_wrote_well()

Since:
0.1.0
Parameters:
d The drive to inquire
Returns:
1=burn seems to have went well, 0=burn failed

Definition at line 896 of file burn_wrap.c.

References isoburn_find_emulator(), and isoburn::wrote_well.

00897 {
00898  int ret;
00899  struct isoburn *o;
00900  
00901  ret= isoburn_find_emulator(&o, d, 0);
00902  if(ret<0)
00903    return(-1);
00904  if(o!=NULL)
00905    if(o->wrote_well>=0)
00906      return(o->wrote_well);
00907  ret= burn_drive_wrote_well(d);
00908  return ret;
00909 }

void isoburn_finish ( void   ) 

Shutdown all three libraries.

Wrapper for : iso_finish() and burn_finish().

Since:
0.1.0

Definition at line 820 of file burn_wrap.c.

References isoburn_destroy_all().

00821 {
00822  isoburn_destroy_all(&isoburn_list_start, 0);
00823  burn_finish();
00824  iso_finish();
00825 }

IsoImage* isoburn_get_attached_image ( struct burn_drive *  d  ) 

Get the image attached to a drive, if any.

Since:
0.1.0
Parameters:
d The drive to inquire
Returns:
A reference to attached image, or NULL if the drive has no image attached. This reference needs to be released via iso_image_unref() when it is not longer needed.

Definition at line 87 of file isofs_wrap.c.

References isoburn::image, and isoburn_find_emulator().

00088 {
00089  int ret;
00090  struct isoburn *o= NULL;
00091  ret = isoburn_find_emulator(&o, d, 0);
00092  if (ret < 0)
00093    return NULL;
00094   
00095  if (o == NULL) {
00096    return NULL;
00097  }
00098  iso_image_ref(o->image);
00099  return o->image;
00100 }

int isoburn_get_fifo_status ( struct burn_drive *  d,
int *  size,
int *  free_bytes,
char **  status_text 
)

Inquire state and fill parameters of the fifo which is attached to the emerging track.

This should be done in the pacifier loop while isoburn_disc_write() or burn_disc_write() are active. This works only with drives obtained by isoburn_drive_scan_and_grab() or isoburn_drive_grab(). If isoburn_prepare_new_image() was used, then parameter out_drive must have announced the track output drive. Hint: If only burn_write_opts and not burn_drive is known, then the drive can be obtained by burn_write_opts_get_drive().

Since:
0.1.0
Parameters:
d The drive to which the track with the fifo gets burned.
size The total size of the fifo
free_bytes The current free capacity of the fifo
status_text Returns a pointer to a constant text, see below
Returns:
<0 reply invalid, >=0 fifo status code: bit0+1=input status, bit2=consumption status, i.e: 0="standby" : data processing not started yet 1="active" : input and consumption are active 2="ending" : input has ended without error 3="failing" : input had error and ended, 4="unused" : ( consumption has ended before processing start ) 5="abandoned" : consumption has ended prematurely 6="ended" : consumption has ended without input error 7="aborted" : consumption has ended after input error

Definition at line 912 of file burn_wrap.c.

References isoburn::iso_source, and isoburn_find_emulator().

00914 {
00915  int ret;
00916  struct isoburn *o;
00917  size_t hsize= 0, hfree_bytes= 0;
00918 
00919  ret= isoburn_find_emulator(&o, d, 0);
00920  if(ret<0)
00921    return(-1);
00922 
00923  if(o==NULL)
00924    return(-1);
00925  if(o->iso_source==NULL)
00926    return(-1);
00927  ret= iso_ring_buffer_get_status(o->iso_source, &hsize, &hfree_bytes);
00928  if(hsize > 1024*1024*1024)
00929    *size= 1024*1024*1024;
00930  else
00931    *size= hsize;
00932  if(hfree_bytes > 1024*1024*1024)
00933    *free_bytes= 1024*1024*1024;
00934  else
00935    *free_bytes= hfree_bytes;
00936  *status_text= "";
00937  if(ret==0)
00938    *status_text= "standby";
00939  else if(ret==1)
00940    *status_text= "active";
00941  else if(ret==2)
00942    *status_text= "ending";
00943  else if(ret==3)
00944    *status_text= "failing";
00945  else if(ret==4)
00946    *status_text= "unused";
00947  else if(ret==5)
00948    *status_text= "abandoned";
00949  else if(ret==6)
00950    *status_text= "ended";
00951  else if(ret==7)
00952    *status_text= "aborted";
00953  return(ret);
00954 }

int isoburn_get_min_start_byte ( struct burn_drive *  d,
off_t *  start_byte,
int  flag 
)

Obtain the size which was attributed to an emulated appendable on actually overwriteable media.

This value is supposed to be <= 2048 * nwa as of isoburn_disc_track_lba_nwa().

Since:
0.1.0
Parameters:
d The drive holding the media.
start_byte The reply value counted in bytes, not in sectors.
flag Unused yet. Submit 0.
Returns:
1=stat_byte is valid, 0=not an emulated appendable, -1=error

Definition at line 878 of file burn_wrap.c.

References isoburn_find_emulator(), and isoburn::min_start_byte.

00880 {
00881  int ret;
00882  struct isoburn *o;
00883 
00884  ret= isoburn_find_emulator(&o, d, 0);
00885  if(ret<0)
00886    return(-1);
00887  if(ret==0) 
00888    return(0);
00889  *start_byte= o->min_start_byte;
00890  if(o->min_start_byte<=0)
00891    return(0);
00892  return(1);
00893 }

int isoburn_get_mount_params ( struct burn_drive *  d,
int  adr_mode,
char *  adr_value,
int *  lba,
int *  track,
int *  session,
char  volid[33],
int  flag 
)

Try to convert the given entity address into various entity addresses which would describe it.

Note: Sessions and tracks are counted beginning with 1, not with 0.

Since:
0.3.2
Parameters:
d The drive where msc1 is to be set
adr_mode Determines how to interpret the input adr_value. If adr_value shall represent a number then decimal ASCII digits are expected. 0= start lba of last session in TOC, ignore adr_value 1= start lba of session number given by adr_value 2= start lba of track given number by adr_value 3= adr_value itself is the lba to be used 4= start lba of last session with volume id given by adr_value
adr_value A string describing the value to be eventually used.
lba returns the block address of the entity, -1 means invalid
track returns the track number of the entity, -1 means invalid
session returns the session number of the entity, -1 means invalid
volid returns the volume id of the entity if it is a ISO session
flag Bitfield for control purposes. bit2= with adr_mode 4: use adr_value as regular expression
Returns:
<=0 error , 1 ok, ISO session, 2 ok, not an ISO session

Definition at line 1785 of file burn_wrap.c.

References isoburn_toc_disc::disc, isoburn::fabricated_msc1, isoburn_find_emulator(), isoburn_get_track_lba(), isoburn_read_iso_head(), isoburn_set_msc1(), isoburn_toc_disc_get_sessions(), isoburn_toc_drive_get_disc(), and isoburn_toc_session_get_tracks().

01789 {
01790  int msc1_mem, ret, total_tracks, num_sessions, num_tracks, i, j, track_lba;
01791  int size, is_iso= 0;
01792  struct isoburn *o;
01793  struct isoburn_toc_disc *disc= NULL;
01794  struct isoburn_toc_session **sessions= NULL;
01795  struct isoburn_toc_track **tracks= NULL;
01796 
01797  *lba= *track= *session= -1;
01798  volid[0]= 0;
01799  ret= isoburn_find_emulator(&o, d, 0);
01800  if(ret < 0 || o == NULL)
01801    return(-1);
01802  msc1_mem= o->fabricated_msc1;
01803  ret= isoburn_set_msc1(d, adr_mode, adr_value, 2 | (flag & 4));
01804  if(ret <= 0)
01805    return(ret);
01806  *lba= o->fabricated_msc1;
01807 
01808  disc= isoburn_toc_drive_get_disc(d);
01809  if(disc==NULL) 
01810    {ret= -1; goto ex;} /* cannot happen because checked by isoburn_set_msc1 */
01811  sessions= isoburn_toc_disc_get_sessions(disc, &num_sessions);
01812  if(sessions==NULL || num_sessions<=0)
01813    {ret= -1; goto ex;} /* cannot happen because checked by isoburn_set_msc1 */
01814  total_tracks= 0;
01815  for(i=0; i<num_sessions && *session < 0; i++) {
01816    tracks= isoburn_toc_session_get_tracks(sessions[i], &num_tracks);
01817    if(tracks==NULL)
01818  continue;
01819    for(j= 0; j<num_tracks && *track < 0; j++) {
01820      total_tracks++;
01821      isoburn_get_track_lba(tracks[j], &track_lba, 0);
01822      if(track_lba == *lba) {
01823        *track= total_tracks;
01824        *session= i + 1;
01825      }
01826    }
01827  }
01828  ret= isoburn_read_iso_head(d, *lba, &size, volid, 1);
01829  if(ret <= 0)
01830    volid[0]= 0;
01831  else
01832    is_iso= 1;
01833 
01834 ex:;
01835  o->fabricated_msc1= msc1_mem;
01836  return(2 - is_iso); 
01837 }

int isoburn_igopt_destroy ( struct isoburn_imgen_opts **  o,
int  flag 
)

Deletes an option set which was created by isoburn_igopt_new().

Since:
0.1.0
Parameters:
o The option set to give up
flag Bitfield for control purposes. Submit 0 for now.
Returns:
1= **o destroyed , 0= *o was already NULL (harmless)

Definition at line 855 of file isoburn.c.

00856 {
00857  if(*o==NULL)
00858    return(0);
00859  free(*o);
00860  *o= NULL;
00861  return(1);
00862 }

int isoburn_igopt_get_data_start ( struct isoburn_imgen_opts o,
int *  lba 
)

Obtain after image preparation the lowest block address of file content data.

Failure can occur if libisofs is too old to provide this information, if the result exceeds 31 bit, or if the call is made before image preparation. This value cannot be set by the application but only be inquired.

Since:
0.3.6
Parameters:
o The option set to work on
lba The block number of the session start on media. <0 means that no address has been determined yet.
Returns:
1 success, <=0 failure

Definition at line 1029 of file isoburn.c.

References isoburn_imgen_opts::data_start_lba.

01030 {
01031  *lba= o->data_start_lba;
01032  return(1);
01033 }

int isoburn_igopt_get_effective_lba ( struct isoburn_imgen_opts o,
int *  lba 
)

Obtain after image preparation the block address where the session will start on media.

This value cannot be set by the application but only be inquired.

Since:
0.1.4
Parameters:
o The option set to work on
lba The block number of the session start on media. <0 means that no address has been determined yet.
Returns:
1 success, <=0 failure

Definition at line 1022 of file isoburn.c.

References isoburn_imgen_opts::effective_lba.

01023 {
01024  *lba= o->effective_lba;
01025  return(1);
01026 }

int isoburn_igopt_get_extensions ( struct isoburn_imgen_opts o,
int *  ext 
)

Definition at line 892 of file isoburn.c.

References isoburn_imgen_opts::aaip, isoburn_imgen_opts::file_md5, isoburn_imgen_opts::hardlinks, isoburn_imgen_opts::iso1999, isoburn_imgen_opts::joliet, isoburn_imgen_opts::rockridge, and isoburn_imgen_opts::session_md5.

00893 {
00894  *ext= (!!o->rockridge) | ((!!o->joliet)<<1) | ((!!o->iso1999)<<2) |
00895        ((!!o->hardlinks) << 3) | ((!!o->aaip) << 5) |
00896        ((!!o->session_md5) << 6) | ((o->file_md5 & 3) << 7);
00897  return(1);
00898 }

int isoburn_igopt_get_fifo_size ( struct isoburn_imgen_opts o,
int *  fifo_size 
)

Definition at line 1015 of file isoburn.c.

References isoburn_imgen_opts::fifo_size.

01016 {
01017  *fifo_size= o->fifo_size;
01018  return(1);
01019 }

int isoburn_igopt_get_level ( struct isoburn_imgen_opts o,
int *  level 
)

Definition at line 872 of file isoburn.c.

References isoburn_imgen_opts::level.

00873 {
00874  *level= o->level;
00875  return(1);
00876 }

int isoburn_igopt_get_out_charset ( struct isoburn_imgen_opts o,
char **  output_charset 
)

Definition at line 1000 of file isoburn.c.

References isoburn_imgen_opts::output_charset.

01002 {
01003  *output_charset= o->output_charset;
01004  return(1);
01005 }

int isoburn_igopt_get_over_mode ( struct isoburn_imgen_opts o,
int *  replace_dir_mode,
int *  replace_file_mode,
mode_t *  dir_mode,
mode_t *  file_mode 
)

Definition at line 957 of file isoburn.c.

References isoburn_imgen_opts::dir_mode, isoburn_imgen_opts::file_mode, isoburn_imgen_opts::replace_dir_mode, and isoburn_imgen_opts::replace_file_mode.

00960 {
00961  *replace_dir_mode= o->replace_dir_mode%3;
00962  *replace_file_mode= o->replace_file_mode%3;
00963  *dir_mode= o->dir_mode;
00964  *file_mode= o->file_mode;
00965  return(1);
00966 }

int isoburn_igopt_get_over_ugid ( struct isoburn_imgen_opts o,
int *  replace_uid,
int *  replace_gid,
uid_t *  uid,
gid_t *  gid 
)

Definition at line 980 of file isoburn.c.

References isoburn_imgen_opts::gid, isoburn_imgen_opts::replace_gid, isoburn_imgen_opts::replace_uid, and isoburn_imgen_opts::uid.

00983 {
00984  *replace_uid= o->replace_uid%3;
00985  *replace_gid= o->replace_gid%3;
00986  *uid= o->uid;
00987  *gid= o->gid;
00988  return(1);
00989 }

int isoburn_igopt_get_relaxed ( struct isoburn_imgen_opts o,
int *  relax 
)
int isoburn_igopt_get_scdbackup_tag ( struct isoburn_imgen_opts o,
char  name[81],
char  timestamp[19],
char **  tag_written 
)

Definition at line 1050 of file isoburn.c.

References isoburn_imgen_opts::scdbackup_tag_name, isoburn_imgen_opts::scdbackup_tag_time, and isoburn_imgen_opts::scdbackup_tag_written.

01053 {
01054  strncpy(name, o->scdbackup_tag_name, 80);
01055  name[80]= 0;
01056  strncpy(timestamp, o->scdbackup_tag_time, 18);
01057  timestamp[18]= 0;
01058  *tag_written= o->scdbackup_tag_written;
01059  return(1);
01060 }

int isoburn_igopt_get_sort_files ( struct isoburn_imgen_opts o,
int *  value 
)

Definition at line 938 of file isoburn.c.

References isoburn_imgen_opts::sort_files.

00939 {
00940  *value= !!o->sort_files;
00941  return(1);
00942 }

int isoburn_igopt_new ( struct isoburn_imgen_opts **  o,
int  flag 
)

Produces a set of generation and transfer options, initialized with default values.

Since:
0.1.0
Parameters:
o the newly created option set object
flag Bitfield for control purposes. Submit 0 for now.
Returns:
1=ok , <0 = failure

Definition at line 809 of file isoburn.c.

References isoburn_imgen_opts::aaip, isoburn_imgen_opts::aaip_susp_1_10, isoburn_imgen_opts::allow_deep_paths, isoburn_imgen_opts::allow_full_ascii, isoburn_imgen_opts::allow_longer_paths, isoburn_imgen_opts::allow_lowercase, isoburn_imgen_opts::always_gmt, isoburn_imgen_opts::data_start_lba, isoburn_imgen_opts::dir_mode, isoburn_imgen_opts::dir_rec_mtime, isoburn_imgen_opts::effective_lba, isoburn_imgen_opts::fifo_size, isoburn_imgen_opts::file_mode, isoburn_imgen_opts::gid, isoburn_imgen_opts::hardlinks, isoburn_imgen_opts::iso1999, isoburn_msgs_submit(), isoburn_imgen_opts::joliet, isoburn_imgen_opts::joliet_longer_paths, isoburn_imgen_opts::level, isoburn_imgen_opts::max_37_char_filenames, isoburn_imgen_opts::no_force_dots, isoburn_imgen_opts::omit_version_numbers, isoburn_imgen_opts::output_charset, isoburn_imgen_opts::replace_dir_mode, isoburn_imgen_opts::replace_file_mode, isoburn_imgen_opts::replace_gid, isoburn_imgen_opts::replace_uid, isoburn_imgen_opts::rockridge, isoburn_imgen_opts::rrip_version_1_10, isoburn_imgen_opts::sort_files, and isoburn_imgen_opts::uid.

00810 {
00811  struct isoburn_imgen_opts *o;
00812 
00813  o= (*new_o)= calloc(1, sizeof(struct isoburn_imgen_opts));
00814  if(o==NULL) {
00815    isoburn_msgs_submit(NULL, 0x00060000,
00816                        "Cannot allocate memory for image generation options",
00817                        0, "FATAL", 0);
00818    return(-1);
00819  }
00820  o->level= 2;
00821  o->rockridge= 1;
00822  o->joliet= 0;
00823  o->iso1999= 0;
00824  o->hardlinks= 0;
00825  o->aaip = 0;
00826  o->omit_version_numbers= 0;
00827  o->allow_deep_paths= 1;
00828  o->allow_longer_paths= 0;
00829  o->max_37_char_filenames= 0;
00830  o->no_force_dots= 0;
00831  o->allow_lowercase= 0;
00832  o->allow_full_ascii= 0;
00833  o->joliet_longer_paths= 0;
00834  o->always_gmt= 0;
00835  o->rrip_version_1_10= 0;
00836  o->dir_rec_mtime= 0;
00837  o->aaip_susp_1_10= 0;
00838  o->sort_files= 0;
00839  o->replace_dir_mode= 0;
00840  o->replace_file_mode= 0;
00841  o->replace_uid= 0;
00842  o->replace_gid= 0;
00843  o->dir_mode= 0555;
00844  o->file_mode= 0444;
00845  o->uid= 0;
00846  o->gid= 0;
00847  o->output_charset= NULL;
00848  o->fifo_size= 4*1024*1024;
00849  o->effective_lba= -1;
00850  o->data_start_lba= -1;
00851  return(1);
00852 }

int isoburn_igopt_set_extensions ( struct isoburn_imgen_opts o,
int  ext 
)

Definition at line 879 of file isoburn.c.

References isoburn_imgen_opts::aaip, isoburn_imgen_opts::file_md5, isoburn_imgen_opts::hardlinks, isoburn_imgen_opts::iso1999, isoburn_imgen_opts::joliet, isoburn_imgen_opts::rockridge, and isoburn_imgen_opts::session_md5.

00880 {
00881  o->rockridge= !!(ext&1);
00882  o->joliet= !!(ext&2);
00883  o->iso1999= !!(ext&4);
00884  o->hardlinks= !!(ext & 8);
00885  o->aaip= !!(ext & 32);
00886  o->session_md5= !!(ext & 64);
00887  o->file_md5= (ext & (128 | 256)) >> 7;
00888  return(1);
00889 }

int isoburn_igopt_set_fifo_size ( struct isoburn_imgen_opts o,
int  fifo_size 
)

The number of bytes to be used for the fifo which decouples libisofs and libburn for better throughput and for reducing the risk of interrupting signals hitting the libburn thread which operates the MMC drive.

The size will be rounded up to the next full 2048. Minimum is 64kiB, maximum is 1 GiB (but that is too much anyway).

Since:
0.1.0
Parameters:
o The option set to work on
fifo_size Number of bytes to use
Returns:
1 success, <=0 failure

Definition at line 1008 of file isoburn.c.

References isoburn_imgen_opts::fifo_size.

01009 {
01010  o->fifo_size= fifo_size;
01011  return(1);
01012 }

int isoburn_igopt_set_level ( struct isoburn_imgen_opts o,
int  level 
)

ISO level to write at.

Since:
0.1.0
Parameters:
o The option set to work on
level is a term of the ISO 9660 standard. It should be one of: 1= filenames restricted to form 8.3 2= filenames allowed up to 31 characters
Returns:
1 success, <=0 failure

Definition at line 865 of file isoburn.c.

References isoburn_imgen_opts::level.

00866 {
00867  o->level= level;
00868  return(1);
00869 }

int isoburn_igopt_set_out_charset ( struct isoburn_imgen_opts o,
char *  output_charset 
)

Set the charcter set to use for representing filenames in the image.

Since:
0.1.0
Parameters:
o The option set to work on
output_charset Set this to NULL to use the default output charset. For selecting a particular character set, submit its name, e.g. as listed by program iconv -l. Example: "UTF-8".
Returns:
1 success, <=0 failure

Definition at line 992 of file isoburn.c.

References isoburn_imgen_opts::output_charset.

00994 {
00995  o->output_charset= output_charset;
00996  return(1);
00997 }

int isoburn_igopt_set_over_mode ( struct isoburn_imgen_opts o,
int  replace_dir_mode,
int  replace_file_mode,
mode_t  dir_mode,
mode_t  file_mode 
)

Set the override values for files and directory permissions.

The parameters replace_* these take one of three values: 0, 1 or 2. If 0, the corresponding attribute will be kept as set in the IsoNode at the time of image generation. If set to 1, the corresponding attrib. will be changed by a default suitable value. With value 2, the attrib. will be changed with the value specified in the corresponding *_mode options. Note that only the permissions are set, the file type remains unchanged.

Since:
0.1.0
Parameters:
o The option set to work on
replace_dir_mode whether and how to override directories
replace_file_mode whether and how to override files of other type
dir_mode Mode to use on dirs with replace_dir_mode == 2.
file_mode; Mode to use on files with replace_file_mode == 2.
Returns:
1 success, <=0 failure

Definition at line 945 of file isoburn.c.

References isoburn_imgen_opts::dir_mode, isoburn_imgen_opts::file_mode, isoburn_imgen_opts::replace_dir_mode, and isoburn_imgen_opts::replace_file_mode.

00948 {
00949  o->replace_dir_mode= replace_dir_mode%3;
00950  o->replace_file_mode= replace_file_mode%3;
00951  o->dir_mode= dir_mode;
00952  o->file_mode= file_mode;
00953  return(1);
00954 }

int isoburn_igopt_set_over_ugid ( struct isoburn_imgen_opts o,
int  replace_uid,
int  replace_gid,
uid_t  uid,
gid_t  gid 
)

Set the override values values for group id and user id.

The rules are like with above overriding of mode values. replace_* controls whether and how. The other two parameters provide values for eventual use.

Since:
0.1.0
Parameters:
o The option set to work on
replace_uid whether and how to override user ids
replace_gid whether and how to override group ids
uid User id to use with replace_uid == 2.
gid Group id to use on files with replace_gid == 2.
Returns:
1 success, <=0 failure

Definition at line 969 of file isoburn.c.

References isoburn_imgen_opts::gid, isoburn_imgen_opts::replace_gid, isoburn_imgen_opts::replace_uid, and isoburn_imgen_opts::uid.

00972 {
00973  o->replace_uid= replace_uid%3;
00974  o->replace_gid= replace_gid%3;
00975  o->uid= uid;
00976  o->gid= gid;
00977  return(1);
00978 }

int isoburn_igopt_set_relaxed ( struct isoburn_imgen_opts o,
int  relax 
)
int isoburn_igopt_set_scdbackup_tag ( struct isoburn_imgen_opts o,
char *  name,
char *  timestamp,
char *  tag_written 
)

Set resp.

get parameters "name" and "timestamp" for a scdbackup checksum tag. It will be appended to the libisofs session tag if the image starts at LBA 0. See isoburn_disc_track_lba_nwa. The scdbackup tag can be used to verify the image by command scdbackup_verify <device> -auto_end. See scdbackup/README appendix VERIFY for its inner details.

Since:
0.4.4
Parameters:
o The option set to work on
name The tag name. 80 characters max.
timestamp A string of up to 13 characters YYMMDD.hhmmss A9 = 2009, B0 = 2010, B1 = 2011, ... C0 = 2020, ...
tag_written Either NULL or the address of an array with at least 512 characters. In the latter case the eventually produced scdbackup tag will be copied to this array when the image gets written. This call sets scdbackup_tag_written[0] = 0 to mark its preliminary invalidity.
Returns:
1 success, <=0 failure

Definition at line 1036 of file isoburn.c.

References isoburn_imgen_opts::scdbackup_tag_name, isoburn_imgen_opts::scdbackup_tag_time, and isoburn_imgen_opts::scdbackup_tag_written.

01038 {
01039  strncpy(o->scdbackup_tag_name, name, 80);
01040  o->scdbackup_tag_name[80]= 0;
01041  strncpy(o->scdbackup_tag_time, timestamp, 18);
01042  o->scdbackup_tag_time[18]= 0;
01043  o->scdbackup_tag_written = tag_written;
01044  if(tag_written != NULL)
01045    tag_written[0]= 0;
01046  return(1);
01047 }

int isoburn_igopt_set_sort_files ( struct isoburn_imgen_opts o,
int  value 
)

Definition at line 931 of file isoburn.c.

References isoburn_imgen_opts::sort_files.

00932 {
00933  o->sort_files= !!(value&1);
00934  return(1);
00935 }

int isoburn_initialize ( char  msg[1024],
int  flag 
)

Overview.

libisoburn is a frontend for libraries libburn and libisofs which enables creation and expansion of ISO-9660 filesystems on all CD/DVD media supported by libburn. This includes media like DVD+RW, which do not support multi-session management on media level and even plain disk files or block devices.

The price for that is thorough specialization on data files in ISO-9660 filesystem images. So libisoburn is not suitable for audio (CD-DA) or any other CD layout which does not entirely consist of ISO-9660 sessions.

Connector functions

libisofs and libburn do not depend on each other but share some interfaces by which they can cooperate. libisoburn establishes the connection between both modules by creating the necessary interface objects and attaching them to the right places.

Wrapper functions

The priciple of this frontend is that you may use any call of libisofs or libburn unless it has a isoburn_*() wrapper listed in the following function documentation.

E.g. call isoburn_initialize() rather than iso_init(); burn_initialize(); and call isoburn_drive_scan_and_grab() rather than burn_drive_scan_and_grab(). But you may call burn_disc_get_profile() directly if you want to display the media type.

The wrappers will transparently provide the necessary emulations which are appropriate for particular target drives and media states. To learn about them you have to read both API descriptions: the one of the wrapper and the one of the underlying libburn or libisofs call.

Macros BURN_* and functions burn_*() are documented in <libburn/libburn.h> Macros ISO_* and functions iso_*() are documented in <libisofs/libisofs.h>

Usage model

There may be an input drive and an output drive. Either of them may be missing with the consequence that no reading resp. writing is possible. Both drive roles can be fulfilled by the same drive.

Input can be a random access readable libburn drive: optical media, regular files, block devices. Output can be any writeable libburn drive: writeable optical media in burner, writeable file objects (no directories).

libburn demands rw-permissions to drive device file resp. file object.

If the input drive provides a suitable ISO RockRidge image, then its tree may be loaded into memory and can then be manipulated by libisofs API calls. The loading is done by isoburn_read_image() under control of struct isoburn_read_opts which the application obtains from libisoburn and manipulates by the family of isoburn_ropt_set_*() functions.

Writing of result images is controlled by libisofs related parameters in a struct isoburn_imgen_opts which the application obtains from libisoburn and manipulates by the family of isoburn_igopt_set_*() functions.

All multi-session aspects are handled by libisoburn according to these settings. The application does not have to analyze media state and write job parameters. It rather states its desires which libisoburn tries to fulfill, or else will refuse to start the write run.

Setup for Growing, Modifying or Blind Growing

The connector function family offers alternative API calls for performing the setup for several alternative image generation strategies.

Growing: If input and output drive are the same, then isoburn_prepare_disc() is to be used. It will lead to an add-on session on appendable or overwriteable media with existing ISO image. With blank media it will produce a first session.

Modifying: If the output drive is not the input drive, and if it bears blank media or overwriteable without a valid ISO image, then one may produce a consolidated image with old and new data. This will copy file data from an eventual input drive with valid image, add any newly introduced data from the local filesystem, and produce a first session on output media. To prepare for such an image generation run, use isoburn_prepare_new_image().

Blind Growing: This method reads the old image from one drive and writes the add-on session to a different drive. That output drive is nevertheless supposed to finally lead to the same media from where the session was loaded. Usually it will be stdio:/dev/fd/1 (i.e. stdout) being piped into some burn program like with this classic gesture: mkisofs -M $dev -C $msc1,$nwa | cdrecord -waiti dev=$dev Blind growing is prepared by the call isoburn_prepare_blind_grow(). The input drive should be released immediately after this call in order to allow the consumer of the output stream to access that drive for writing.

After either of these setups, some peripheral libburn drive parameter settings like burn_write_opts_set_simulate(), burn_write_opts_set_multi(), burn_drive_set_speed(), burn_write_opts_set_underrun_proof() should be made. Do not set the write mode. It will be chosen by libisoburn so it matches job and media state.

Writing the image

Then one may start image generation and write threads by isoburn_disc_write(). Progress may be watched at the output drive by burn_drive_get_status() and isoburn_get_fifo_status().

At some time, the output drive will be BURN_DRIVE_IDLE indicating that writing has ended. One should inquire isoburn_drive_wrote_well() to learn about overall success.

Finally one must call isoburn_activate_session() which will complete any eventual multi-session emulation.

Application Constraints

Applications shall include libisofs/libisofs.h , libburn/libburn.h and this file itself: libisoburn/libisoburn.h . They shall link with -lisofs -lburn -lisoburn or with the .o files emerging from building those libraries from their sources.

Applications must use 64 bit off_t, e.g. on 32-bit Linux by defining define _LARGEFILE_SOURCE define _FILE_OFFSET_BITS 64 or take special precautions to interface with the library by 64 bit integers where above .h files prescribe off_t. Not to use 64 bit file i/o will keep the application from producing and processing ISO images of more than 2 GB size. Initialize libisoburn, libisofs and libburn. Wrapper for : iso_init() and burn_initialize()

Since:
0.1.0
Parameters:
msg A character array for eventual messages (e.g. with errors)
flag Bitfield for control purposes (unused yet, submit 0)
Returns:
1 indicates success, 0 is failure

Definition at line 65 of file burn_wrap.c.

References isoburn_destroy_all(), isoburn_libisofs_req_major, isoburn_libisofs_req_micro, isoburn_libisofs_req_minor, and isoburn_version().

00066 {
00067  int major, minor, micro, bad_match= 0;
00068 
00069 
00070 /* First two ugly compile time checks for header version compatibility.
00071    If everthing matches, then they produce no C code. In case of mismatch,
00072    intentionally faulty C code will be inserted.
00073 */
00074 
00075 #ifdef iso_lib_header_version_major
00076 /* The minimum requirement of libisoburn towards the libisofs header
00077    at compile time is defined in libisoburn/libisoburn.h :
00078      isoburn_libisofs_req_major
00079      isoburn_libisofs_req_minor
00080      isoburn_libisofs_req_micro
00081    It gets compared against the version macros in libisofs/libisofs.h :
00082      iso_lib_header_version_major
00083      iso_lib_header_version_minor
00084      iso_lib_header_version_micro
00085    If the header is too old then the following code shall cause failure of
00086    libisoburn compilation rather than to allow production of a program with
00087    unpredictable bugs or memory corruption.
00088    The compiler messages supposed to appear in this case are:
00089       error: 'LIBISOFS_MISCONFIGURATION' undeclared (first use in this function)
00090       error: 'INTENTIONAL_ABORT_OF_COMPILATION__HEADERFILE_libisofs_dot_h_TOO_OLD__SEE_libisoburn_dot_h_AND_burn_wrap_dot_h' undeclared (first use in this function)
00091       error: 'LIBISOFS_MISCONFIGURATION_' undeclared (first use in this function)
00092 */
00093 /* The indendation is an advise of man gcc to help old compilers ignoring */
00094  #if isoburn_libisofs_req_major > iso_lib_header_version_major
00095  #define Isoburn_libisofs_dot_h_too_olD 1
00096  #endif
00097  #if isoburn_libisofs_req_major == iso_lib_header_version_major && isoburn_libisofs_req_minor > iso_lib_header_version_minor
00098  #define Isoburn_libisofs_dot_h_too_olD 1
00099  #endif
00100  #if isoburn_libisofs_req_minor == iso_lib_header_version_minor && isoburn_libisofs_req_micro > iso_lib_header_version_micro
00101  #define Isoburn_libisofs_dot_h_too_olD 1
00102  #endif
00103 
00104 #ifdef Isoburn_libisofs_dot_h_too_olD
00105 LIBISOFS_MISCONFIGURATION = 0;
00106 INTENTIONAL_ABORT_OF_COMPILATION__HEADERFILE_libisofs_dot_h_TOO_OLD__SEE_libisoburn_dot_h_AND_burn_wrap_dot_h = 0;
00107 LIBISOFS_MISCONFIGURATION_ = 0;
00108 #endif
00109 
00110 #endif /* iso_lib_header_version_major */
00111 
00112 /* The minimum requirement of libisoburn towards the libburn header
00113    at compile time is defined in libisoburn/libisoburn.h :
00114      isoburn_libburn_req_major
00115      isoburn_libburn_req_minor
00116      isoburn_libburn_req_micro
00117    It gets compared against the version macros in libburn/libburn.h :
00118      burn_header_version_major
00119      burn_header_version_minor
00120      burn_header_version_micro
00121    If the header is too old then the following code shall cause failure of
00122    cdrskin compilation rather than to allow production of a program with
00123    unpredictable bugs or memory corruption.
00124    The compiler messages supposed to appear in this case are:
00125       error: 'LIBBURN_MISCONFIGURATION' undeclared (first use in this function)
00126       error: 'INTENTIONAL_ABORT_OF_COMPILATION__HEADERFILE_libburn_dot_h_TOO_OLD__SEE_libisoburn_dot_h_and_burn_wrap_dot_h' undeclared (first use in this function)
00127       error: 'LIBBURN_MISCONFIGURATION_' undeclared (first use in this function)
00128 */
00129 
00130 /* The indendation is an advise of man gcc to help old compilers ignoring */
00131  #if isoburn_libburn_req_major > burn_header_version_major
00132  #define Isoburn_libburn_dot_h_too_olD 1
00133  #endif
00134  #if isoburn_libburn_req_major == burn_header_version_major && isoburn_libburn_req_minor > burn_header_version_minor
00135  #define Isoburn_libburn_dot_h_too_olD 1
00136  #endif
00137  #if isoburn_libburn_req_minor == burn_header_version_minor && isoburn_libburn_req_micro > burn_header_version_micro
00138  #define Isoburn_libburn_dot_h_too_olD 1
00139  #endif
00140 
00141 #ifdef Isoburn_libburn_dot_h_too_olD
00142 LIBBURN_MISCONFIGURATION = 0;
00143 INTENTIONAL_ABORT_OF_COMPILATION__HEADERFILE_libburn_dot_h_TOO_OLD__SEE_libisoburn_dot_h_and_burn_wrap_dot_h = 0;
00144 LIBBURN_MISCONFIGURATION_ = 0;
00145 #endif
00146 
00147 /* End of ugly compile time tests (scroll up for explanation) */
00148 
00149 
00150 
00151  msg[0]= 0;
00152  if(iso_init()<0) {
00153    sprintf(msg+strlen(msg), "Cannot initialize libisofs\n");
00154    return(0);
00155  }
00156  iso_lib_version(&major, &minor, &micro);
00157  sprintf(msg+strlen(msg), "libisofs-%d.%d.%d ", major, minor, micro);
00158 #ifdef iso_lib_header_version_major
00159  if(iso_lib_is_compatible(iso_lib_header_version_major,
00160                           iso_lib_header_version_minor,
00161                           iso_lib_header_version_micro)) {
00162    sprintf(msg+strlen(msg), "ok, ");
00163  } else {
00164    sprintf(msg+strlen(msg),"- TOO OLD -, need at least libisofs-%d.%d.%d ,\n",
00165            iso_lib_header_version_major, iso_lib_header_version_minor,
00166            iso_lib_header_version_micro);
00167    bad_match= 1;
00168  }
00169 #else
00170  if(iso_lib_is_compatible(isoburn_libisofs_req_major,
00171                           isoburn_libisofs_req_minor,
00172                           isoburn_libisofs_req_micro)) {
00173    sprintf(msg+strlen(msg), "suspicious, ");
00174  } else {
00175    sprintf(msg+strlen(msg),"- TOO OLD -, need at least libisofs-%d.%d.%d ,\n",
00176            isoburn_libisofs_req_major, isoburn_libisofs_req_minor,
00177            isoburn_libisofs_req_micro);
00178    bad_match= 1;
00179  }
00180 #endif /* ! iso_lib_header_version_major */
00181 
00182  if(!burn_initialize()) {
00183    sprintf(msg+strlen(msg), "Cannot initialize libburn\n");
00184    return(0);
00185  }
00186  burn_version(&major, &minor, &micro);
00187  sprintf(msg+strlen(msg), "libburn-%d.%d.%d ", major, minor, micro);
00188  if(major > burn_header_version_major
00189     || (major == burn_header_version_major
00190         && (minor > burn_header_version_minor
00191             || (minor == burn_header_version_minor
00192                 && micro >= burn_header_version_micro)))) {
00193    sprintf(msg+strlen(msg), "ok, ");
00194  } else {
00195    sprintf(msg+strlen(msg), "- TOO OLD -, need at least libburn-%d.%d.%d ,\n",
00196            burn_header_version_major, burn_header_version_minor,
00197            burn_header_version_micro);
00198    bad_match= 1;
00199  }
00200 
00201  isoburn_version(&major, &minor, &micro);
00202  sprintf(msg+strlen(msg), "for libisoburn-%d.%d.%d", major, minor, micro);
00203  if(bad_match)
00204    return(0);
00205 
00206  isoburn_destroy_all(&isoburn_list_start, 0); /* isoburn_list_start= NULL */
00207  return(1);
00208 }

int isoburn_is_compatible ( int  major,
int  minor,
int  micro,
int  flag 
)

Check whether all features of header file libisoburn.h from the given major.minor.micro revision triple can be delivered by the library version which is performing this call.

An application of libisoburn can easily memorize the version of the libisofs.h header in its own code. Immediately after isoburn_initialize() it should simply do this check: if (! isoburn_is_compatible(isoburn_header_version_major, isoburn_header_version_minor, isoburn_header_version_micro, 0)) ...refuse to start the program with this dynamic library version...

Since:
0.1.0
Parameters:
major obtained at build time
minor obtained at build time
micro obtained at build time
flag Bitfield for control purposes. Unused yet. Submit 0.
Returns:
1= library can work for caller 0= library is not usable in some aspects. Caller must restrict itself to an earlier API version or must not use this libray at all.

Definition at line 628 of file isoburn.c.

References isoburn_version().

00629 {
00630  int own_major, own_minor, own_micro;
00631 
00632  isoburn_version(&own_major, &own_minor, &own_micro);
00633  return(own_major > major ||
00634         (own_major == major && (own_minor > minor ||
00635          (own_minor == minor && own_micro >= micro))));
00636 }

int isoburn_libburn_req ( int *  major,
int *  minor,
int *  micro 
)

The minimum version of libburn to be used with this version of libisoburn at runtime.

This is checked already in isoburn_initialize() which will refuse on outdated version. So this call is for information purposes after successful startup only.

Since:
0.1.0
Parameters:
major isoburn_libburn_req_major as seen at build time
minor as seen at build time
micro as seen at build time
Returns:
1 success, <=0 might in future become an error indication

Definition at line 222 of file burn_wrap.c.

00223 {
00224  *major= burn_header_version_major;
00225  *minor= burn_header_version_minor;
00226  *micro= burn_header_version_micro;
00227  return(1);
00228 }

int isoburn_libisofs_req ( int *  major,
int *  minor,
int *  micro 
)

The minimum version of libisofs to be used with this version of libisoburn at runtime.

This is checked already in isoburn_initialize() which will refuse on outdated version. So this call is for information purposes after successful startup only.

Since:
0.1.0
Parameters:
major isoburn_libisofs_req_major as seen at build time
minor as seen at build time
micro as seen at build time
Returns:
1 success, <=0 might in future become an error indication

Definition at line 212 of file burn_wrap.c.

00213 {
00214  *major= iso_lib_header_version_major;
00215  *minor= iso_lib_header_version_minor;
00216  *micro= iso_lib_header_version_micro;
00217  return(1);
00218 }

int isoburn_needs_emulation ( struct burn_drive *  d  ) 

Inquire wether the media needs emulation or would be suitable for generic multi-session via libburn.

Since:
0.1.0
Parameters:
d The drive to inquire
Returns:
0 is generic multi-session 1 is emulated multi-session -1 is not suitable for isoburn

Definition at line 828 of file burn_wrap.c.

References isoburn::emulation_mode, isoburn_disc_get_status(), and isoburn_find_emulator().

00829 {
00830  int ret;
00831  struct isoburn *o;
00832  enum burn_disc_status s;
00833 
00834  s= isoburn_disc_get_status(drive);
00835  if(s!=BURN_DISC_BLANK && s!=BURN_DISC_APPENDABLE)
00836    return(-1);
00837  ret= isoburn_find_emulator(&o, drive, 0);
00838  if(ret<0)
00839    return(-1);
00840  if(ret>0)
00841    if(o->emulation_mode>0)
00842      return(1);
00843  return(0);  
00844 }

int isoburn_prepare_blind_grow ( struct burn_drive *  in_drive,
struct burn_disc **  disc,
struct isoburn_imgen_opts opts,
struct burn_drive *  out_drive,
int  nwa 
)

To choose the expansion method of Blind Growing: Create a disc object for writing an add-on session from the created or loaded IsoImage which has been manipulated via libisofs, to a different drive than the one from where it was loaded.

Usually output will be stdio:/dev/fd/1 (i.e. stdout) being piped into some burn program like with this classic gesture: mkisofs -M $dev -C $msc1,$nwa | cdrecord -waiti dev=$dev Parameter translation into libisoburn: $dev is the address by which parameter in_drive of this call was aquired $msc1 was set by isoburn_set_msc1() before image reading or was detected from the in_drive media $nwa is a parameter of this call or can be used as detected from the in_drive media

This call waits for libisofs output to become available and then detaches the input drive object from the data source object by which libisofs was reading from the input drive. So, as far as libisofs is concerned, that drive may be released immediately after this call in order to allow the consumer to access the drive for writing. The consumer should wait for input to become available and only then open its burn drive. With cdrecord this is caused by option -waiti.

The resulting burn_disc object has to be disposed when all its writing is done and the drive is BURN_DRIVE_IDLE again after asynchronous burn_disc_write().

Since:
0.2.2
Parameters:
in_drive The input drive,grabbed with isoburn_drive_scan_and_grab().
disc Returns the newly created burn_disc object.
opts Options for image generation and data transport to media.
out_drive The output drive, from isoburn_drive_aquire() et.al.. typically stdio:/dev/fd/1 .
nwa The address (2048 byte block count) where the add-on session will be finally stored on a mountable media or in a mountable file. If nwa is -1 then the address is used as determined from the in_drive media.
Returns:
<=0 error , 1 = success

Definition at line 544 of file isoburn.c.

References isoburn::fabricated_msc2, isoburn_find_emulator(), isoburn_prepare_disc_aux(), isoburn::nwa, and isoburn::zero_nwa.

00547 {  
00548  int ret;
00549  struct isoburn *o= NULL;
00550 
00551  ret= isoburn_find_emulator(&o, out_drive, 0);
00552  if(ret<0 || o==NULL)
00553    return(-1);
00554  if(nwa >= 0)
00555    o->fabricated_msc2= nwa;
00556  if(o->nwa == o->zero_nwa)
00557    o->nwa= o->zero_nwa= 0;
00558  else
00559    o->zero_nwa= 0;
00560  ret= isoburn_prepare_disc_aux(d, out_drive, disc, opts, 2);
00561  if (ret<=0)
00562    return ret;
00563  return(1);
00564 }

int isoburn_prepare_disc ( struct burn_drive *  drive,
struct burn_disc **  disc,
struct isoburn_imgen_opts opts 
)

To choose the expansion method of Growing: Create a disc object for writing the new session from the created or loaded iso_volset which has been manipulated via libisofs, to the same media from where the image was eventually loaded.

This struct burn_disc is ready for use by a subsequent call to isoburn_disc_write(). After this asynchronous writing has ended and the drive is BURN_DRIVE_IDLE again, the burn_disc object has to be disposed by burn_disc_free().

Since:
0.1.0
Parameters:
drive The combined source and target drive, grabbed with isoburn_drive_scan_and_grab(). .
disc Returns the newly created burn_disc object.
opts Image generation options, see isoburn_igopt_*()
Returns:
<=0 error , 1 = success

Definition at line 523 of file isoburn.c.

References isoburn_prepare_disc_aux().

00525 {
00526  return isoburn_prepare_disc_aux(d, d, disc, opts, 0);
00527 }

int isoburn_prepare_new_image ( struct burn_drive *  in_drive,
struct burn_disc **  disc,
struct isoburn_imgen_opts opts,
struct burn_drive *  out_drive 
)

To choose the expansion method of Modifying: Create a disc object for producing a new image from a previous image plus the changes made by user.

The generated burn_disc is suitable to be written to a grabbed drive with blank writeable media. But you must not use the same drive for input and output, because data will be read from the source drive while at the same time the target drive is already writing. The resulting burn_disc object has to be disposed when all its writing is done and the drive is BURN_DRIVE_IDLE again after asynchronous burn_disc_write().

Since:
0.1.0
Parameters:
in_drive The input drive, grabbed with isoburn_drive_aquire() or one of its alternatives.
disc Returns the newly created burn_disc object.
opts Options for image generation and data transport to media.
out_drive The output drive, from isoburn_drive_aquire() et.al..
Returns:
<=0 error , 1 = success

Definition at line 530 of file isoburn.c.

References isoburn_prepare_disc_aux().

00533 {
00534  int ret;
00535 
00536  ret= isoburn_prepare_disc_aux(d, out_drive, disc, opts, 1);
00537  if (ret<=0)
00538    return ret;
00539  return 1; 
00540 }

int isoburn_read_image ( struct burn_drive *  d,
struct isoburn_read_opts read_opts,
IsoImage **  image 
)

Load the ISO filesystem directory tree from the media in the given drive.

This will give libisoburn the base on which it can let libisofs perform image growing or image modification. The loaded volset gets attached to the drive object and handed out to the application. Not a wrapper, but peculiar to libisoburn.

Since:
0.1.0
Parameters:
d The drive which holds an existing ISO filesystem or blank media. d is allowed to be NULL which produces an empty ISO image. In this case one has to call before writing isoburn_attach_volset() with the volset from this call and with the intended output drive.
read_opts The read options which can be chosen by the application
image the image read, if the disc is blank it will have no files. This reference needs to be released via iso_image_unref() when it is not longer needed. The drive, if not NULL, will hold an own reference which it will release when it gets a new volset or when it gets released via isoburn_drive_release(). You can pass NULL if you already have a reference or you plan to obtain it later with isoburn_get_attached_image(). Of course, if you haven't specified a valid drive (i.e., if d == NULL), this parameter can't be NULL.
Returns:
<=0 error , 1 = success

Definition at line 111 of file isofs_wrap.c.

References isoburn_read_opts::auto_input_charset, isoburn_read_opts::dirmode, isoburn_read_opts::gid, isoburn_read_opts::hasElTorito, isoburn_read_opts::hasIso1999, isoburn_read_opts::hasJoliet, isoburn_read_opts::hasRR, isoburn::image, isoburn_read_opts::input_charset, isoburn::iso_data_source, isoburn_data_source_new(), isoburn_disc_get_msc1(), isoburn_disc_get_status(), isoburn_find_emulator(), isoburn_idle_free_function(), isoburn_msgs_submit(), isoburn_read_iso_head(), isoburn_report_iso_error(), isoburn_read_opts::mode, isoburn_read_opts::noaaip, isoburn_read_opts::noacl, isoburn_read_opts::noea, isoburn_read_opts::noino, isoburn_read_opts::noiso1999, isoburn_read_opts::nojoliet, isoburn_read_opts::nomd5, isoburn_read_opts::norock, isoburn_read_opts::preferjoliet, isoburn_read_opts::pretend_blank, isoburn::read_pacifier, isoburn::read_pacifier_handle, isoburn_read_opts::size, and isoburn_read_opts::uid.

00114 {
00115  int ret, int_num, dummy;
00116  IsoReadOpts *ropts= NULL;
00117  IsoReadImageFeatures *features= NULL;
00118  uint32_t ms_block;
00119  char msg[160];
00120  enum burn_disc_status status= BURN_DISC_BLANK;
00121  IsoDataSource *ds= NULL;
00122  struct isoburn *o= NULL;
00123 
00124  if(d != NULL) {
00125    ret = isoburn_find_emulator(&o, d, 0);
00126    if (ret < 0 || o == NULL)
00127      return 0;
00128    status = isoburn_disc_get_status(d);
00129  }
00130  if(read_opts==NULL) {
00131    isoburn_msgs_submit(o, 0x00060000,
00132                        "Program error: isoburn_read_image: read_opts==NULL",
00133                        0, "FATAL", 0);
00134    return(-1);
00135  }
00136  if (d == NULL || status == BURN_DISC_BLANK || read_opts->pretend_blank) {
00137 create_blank_image:;
00138    /*
00139     * Blank disc, we create a new image without files.
00140     */
00141    
00142    if (d == NULL) {
00143      /* New empty image without relation to a drive */
00144      if (image==NULL) {
00145        isoburn_msgs_submit(o, 0x00060000,
00146                            "Program error: isoburn_read_image: image==NULL",
00147                            0, "FATAL", 0);
00148        return -1;
00149      }
00150      /* create a new image */
00151      ret = iso_image_new("ISOIMAGE", image);
00152      if (ret < 0) {
00153        isoburn_report_iso_error(ret, "Cannot create image", 0, "FATAL", 0);
00154        return ret;
00155      }
00156    } else {
00157      /* Blank new image for the drive */
00158      iso_image_unref(o->image);
00159      ret = iso_image_new("ISOIMAGE", &o->image);
00160      if (ret < 0) {
00161        isoburn_report_iso_error(ret, "Cannot create image", 0, "FATAL", 0);
00162        return ret;
00163      }
00164      if (image) {
00165        *image = o->image;
00166        iso_image_ref(*image); /*protects object from premature free*/
00167      }
00168    }
00169    iso_image_set_ignore_aclea(*image,
00170                          (!!(read_opts->noacl)) | ((!!read_opts->noea) << 1) );
00171    return 1;
00172  }
00173  
00174  if (status != BURN_DISC_APPENDABLE && status != BURN_DISC_FULL) {
00175    isoburn_msgs_submit(o, 0x00060000,
00176                     "Program error: isoburn_read_image: incorrect disc status",
00177                     0, "FATAL", 0);
00178    return -4;   
00179  }
00180  
00181  memset((char *) &ropts, 0, sizeof(ropts));
00182 
00183  ret = isoburn_disc_get_msc1(d, &int_num);
00184  if (ret <= 0)
00185    return -2;
00186  ms_block= int_num;
00187  ret = isoburn_read_iso_head(d, int_num, &dummy, NULL, 0);
00188  if (ret <= 0) {
00189    sprintf(msg, "No ISO 9660 image at LBA %d. Creating blank image.", int_num);
00190    isoburn_msgs_submit(o, 0x00060000, msg, 0, "WARNING", 0);
00191    goto create_blank_image;
00192  }
00193 
00194  /* create the data source */
00195  ret = iso_read_opts_new(&ropts, 0);
00196  if (ret < 0) {
00197    isoburn_report_iso_error(ret, "Cannot create write opts", 0, "FATAL", 0);
00198    return ret;
00199  }
00200  /* Important: do not return until iso_read_opts_free() */
00201  iso_read_opts_set_start_block(ropts, ms_block);
00202  iso_read_opts_set_no_rockridge(ropts, read_opts->norock);
00203  iso_read_opts_set_no_aaip(ropts, read_opts->noaaip);
00204  iso_read_opts_set_no_md5(ropts, read_opts->nomd5);
00205 
00206  iso_read_opts_set_new_inos(ropts, read_opts->noino);
00207 
00208  iso_read_opts_set_no_joliet(ropts, read_opts->nojoliet);
00209  iso_read_opts_set_no_iso1999(ropts, read_opts->noiso1999);
00210  iso_read_opts_set_preferjoliet(ropts, read_opts->preferjoliet);
00211  iso_read_opts_set_default_permissions(ropts,
00212                                        read_opts->mode, read_opts->dirmode);
00213  iso_read_opts_set_default_uid(ropts, read_opts->uid);
00214  iso_read_opts_set_default_gid(ropts, read_opts->gid);
00215  iso_read_opts_set_input_charset(ropts, read_opts->input_charset);
00216  iso_read_opts_auto_input_charset(ropts, read_opts->auto_input_charset);
00217 
00218  ds = isoburn_data_source_new(d);
00219  if(o->iso_data_source!=NULL)
00220    iso_data_source_unref(o->iso_data_source);
00221  o->iso_data_source= ds;
00222  iso_image_attach_data(o->image, o->read_pacifier_handle,
00223                        isoburn_idle_free_function);
00224  if(o->read_pacifier_handle==NULL)
00225    iso_tree_set_report_callback(o->image, NULL);
00226  else
00227    iso_tree_set_report_callback(o->image, o->read_pacifier);
00228  ret = iso_image_import(o->image, ds, ropts, &features);
00229  iso_tree_set_report_callback(o->image, NULL);
00230  iso_read_opts_free(ropts);
00231 
00232  if (ret < 0) {
00233    isoburn_report_iso_error(ret, "Cannot import image", 0, "FAILURE", 0);
00234    return ret;
00235  }
00236  /* Important: do not return until free(features) */
00237  if (image!=NULL) {
00238    *image = o->image;
00239    iso_image_ref(*image); /*protects object from premature free*/
00240  }
00241  read_opts->hasRR = iso_read_image_features_has_rockridge(features);
00242  read_opts->hasJoliet = iso_read_image_features_has_joliet(features);
00243  read_opts->hasIso1999 = iso_read_image_features_has_iso1999(features);
00244  read_opts->hasElTorito = iso_read_image_features_has_eltorito(features);
00245  read_opts->size = iso_read_image_features_get_size(features);
00246  iso_read_image_features_destroy(features);
00247  return 1;
00248 }

int isoburn_read_iso_head ( struct burn_drive *  d,
int  lba,
int *  image_blocks,
char *  info,
int  flag 
)

Try whether the data at the given address look like a ISO 9660 image header and obtain its alleged size.

Depending on the info mode one other string of text information can be retrieved too.

Since:
0.1.6
Parameters:
d The drive with the media to inspect
lba The block number from where to read
image_blocks The number of 2048 bytes blocks
info Caller provided memory, enough to take eventual info reply
flag bit0-7: info return mode 0= do not return anything in info (do not even touch it) 1= copy volume id to info (info needs 33 bytes) 2=
Since:
0.2.2 : copy 64 kB header to info (needs 65536 bytes) bit13=
0.2.2: do not read head from media but use first 64 kB from info bit14= check both half buffers (not only second) return 2 if found in first block bit15= return -1 on read error
Returns:
>0 seems to be a valid ISO image, 0 format not recognized, <0 error

Definition at line 1065 of file burn_wrap.c.

References isoburn_read_iso_head_parse().

Referenced by isoburn_emulate_toc(), isoburn_get_mount_params(), isoburn_read_image(), and isoburn_set_msc1().

01067 {
01068  unsigned char buffer[64*1024];
01069  int ret, info_mode, capacity, role;
01070  off_t data_count;
01071 
01072  info_mode= flag&255;
01073  *image_blocks= 0;
01074  if(flag&(1<<13)) {
01075    memcpy(buffer, info, 64*1024);
01076  } else {
01077    role = burn_drive_get_drive_role(d);
01078    ret = burn_get_read_capacity(d, &capacity, 0);
01079    if (ret <= 0 && role == 2) {
01080      /* Might be a block device on a system where libburn cannot determine its
01081         size.  Try to read anyway. */
01082      capacity = 0x7ffffff0;
01083      ret = 1;
01084    }
01085    if(ret > 0 && (off_t) capacity * (off_t) 2048 >= (off_t) (64 * 1024)) {
01086      ret = burn_read_data(d, ((off_t) lba) * (off_t) 2048, (char *) buffer,
01087                       (off_t) 64*1024, &data_count, 2); /* no error messages */
01088   } else
01089     ret= 0;
01090    if(ret<=0)
01091      return(-1*!!(flag&(1<<15)));
01092    if(info_mode==2)
01093      memcpy(info, buffer, 64*1024);
01094  }
01095 
01096  if(flag&(1<<14)) {
01097    ret= isoburn_read_iso_head_parse(d, buffer, image_blocks, info, info_mode);
01098    if(ret<0)
01099      return(ret);
01100    if(ret>0)
01101      return(2);
01102  }
01103  ret= isoburn_read_iso_head_parse(d, buffer+32*1024, image_blocks, info,
01104                                   info_mode);
01105  if(ret<=0)
01106    return(ret);
01107  return(1);
01108 }

int isoburn_ropt_destroy ( struct isoburn_read_opts **  o,
int  flag 
)

Deletes an option set which was created by isoburn_ropt_new().

Since:
0.1.0
Parameters:
o The option set to work on
flag Bitfield for control purposes. Submit 0 for now.
Returns:
1= **o destroyed , 0= *o was already NULL (harmless)

Definition at line 680 of file isoburn.c.

00681 {
00682  if(*o==NULL)
00683    return(0);
00684  free(*o);
00685  *o= NULL;
00686  return(1);
00687 }

int isoburn_ropt_get_auto_incharset ( struct isoburn_read_opts o,
int *  mode 
)

Definition at line 785 of file isoburn.c.

References isoburn_read_opts::auto_input_charset.

00786 {
00787  *mode= o->auto_input_charset;
00788  return(1);
00789 }

int isoburn_ropt_get_default_dirperms ( struct isoburn_read_opts o,
mode_t *  mode 
)

Definition at line 754 of file isoburn.c.

References isoburn_read_opts::dirmode.

00756 {
00757  *mode= o->dirmode;
00758  return(1);
00759 }

int isoburn_ropt_get_default_perms ( struct isoburn_read_opts o,
uid_t *  uid,
gid_t *  gid,
mode_t *  mode 
)

Definition at line 736 of file isoburn.c.

References isoburn_read_opts::gid, isoburn_read_opts::mode, and isoburn_read_opts::uid.

00738 {
00739  *uid= o->uid;
00740  *gid= o->gid;
00741  *mode= o->mode;
00742  return(1);
00743 }

int isoburn_ropt_get_extensions ( struct isoburn_read_opts o,
int *  ext 
)

Definition at line 706 of file isoburn.c.

References isoburn_read_opts::noaaip, isoburn_read_opts::noacl, isoburn_read_opts::noea, isoburn_read_opts::noino, isoburn_read_opts::noiso1999, isoburn_read_opts::nojoliet, isoburn_read_opts::nomd5, isoburn_read_opts::norock, isoburn_read_opts::preferjoliet, and isoburn_read_opts::pretend_blank.

00707 {
00708  *ext= (!!o->norock) | ((!!o->nojoliet)<<1) | ((!!o->noiso1999)<<2) |
00709        ((!!o->preferjoliet)<<3) | ((!!o->pretend_blank)<<4) |
00710        ((!!o->noaaip) << 5) | ((!!o->noacl) << 6) | ((!!o->noea) << 7) |
00711        ((!!o->noino) << 8) | ((!!o->nomd5) << 9);
00712  return(1);
00713 }

int isoburn_ropt_get_input_charset ( struct isoburn_read_opts o,
char **  input_charset 
)

Definition at line 770 of file isoburn.c.

References isoburn_read_opts::input_charset.

00772 {
00773  *input_charset= o->input_charset;
00774  return(1);
00775 }

int isoburn_ropt_get_size_what ( struct isoburn_read_opts o,
uint32_t *  size,
int *  has_what 
)

Definition at line 792 of file isoburn.c.

References isoburn_read_opts::hasElTorito, isoburn_read_opts::hasIso1999, isoburn_read_opts::hasJoliet, isoburn_read_opts::hasRR, and isoburn_read_opts::size.

00794 {
00795  *size= o->size;
00796  *has_what= (!!o->hasRR) | ((!!o->hasJoliet)<<1) |
00797             ((!!o->hasIso1999)<<2) | ((!!o->hasElTorito)<<3); 
00798  return(1);
00799 }

int isoburn_ropt_new ( struct isoburn_read_opts **  o,
int  flag 
)

Produces a set of image read options, initialized with default values.

Since:
0.1.0
Parameters:
o the newly created option set object
flag Bitfield for control purposes. Submit 0 for now.
Returns:
1=ok , <0 = failure

Definition at line 646 of file isoburn.c.

References isoburn_read_opts::dirmode, isoburn_read_opts::gid, isoburn_read_opts::hasElTorito, isoburn_read_opts::hasIso1999, isoburn_read_opts::hasJoliet, isoburn_read_opts::hasRR, isoburn_read_opts::input_charset, isoburn_msgs_submit(), isoburn_read_opts::mode, isoburn_read_opts::noaaip, isoburn_read_opts::noacl, isoburn_read_opts::noea, isoburn_read_opts::noino, isoburn_read_opts::noiso1999, isoburn_read_opts::nojoliet, isoburn_read_opts::nomd5, isoburn_read_opts::norock, isoburn_read_opts::preferjoliet, isoburn_read_opts::pretend_blank, isoburn_read_opts::size, and isoburn_read_opts::uid.

00647 {
00648  struct isoburn_read_opts *o;
00649 
00650  o= (*new_o)= calloc(1, sizeof(struct isoburn_read_opts));
00651  if(o==NULL) {
00652    isoburn_msgs_submit(NULL, 0x00060000,
00653                      "Cannot allocate memory for read options", 0, "FATAL", 0);
00654    return(-1);
00655  }
00656  o->norock= 0;
00657  o->nojoliet= 0;
00658  o->noiso1999= 1;
00659  o->noaaip= 1;
00660  o->noacl= 1;
00661  o->noea= 1;
00662  o->noino= 1;
00663  o->nomd5= 1;
00664  o->preferjoliet= 0;
00665  o->uid= geteuid();
00666  o->gid= getegid();
00667  o->mode= 0444;
00668  o->dirmode= 0555;
00669  o->input_charset= NULL;
00670  o->hasRR= 0;
00671  o->hasJoliet= 0;
00672  o->hasIso1999= 0;
00673  o->hasElTorito= 0;
00674  o->size= 0;
00675  o->pretend_blank= 1;
00676  return(1);
00677 }

int isoburn_ropt_set_auto_incharset ( struct isoburn_read_opts o,
int  mode 
)

Enable or disable methods to automatically choose an input charset.

This eventually overrides the name set via isoburn_ropt_set_input_charset()

Since:
0.3.8
Parameters:
o The option set to work on
mode Bitfield for control purposes: bit0= allow to set the input character set automatically from attribute "isofs.cs" of root directory. Submit any other bits with value 0.
Returns:
1 success, <=0 failure

Definition at line 778 of file isoburn.c.

References isoburn_read_opts::auto_input_charset.

00779 {
00780  o->auto_input_charset= mode & 1;
00781  return(1);
00782 }

int isoburn_ropt_set_default_dirperms ( struct isoburn_read_opts o,
mode_t  mode 
)

Default attributes to use on directories if no RockRidge extension gets loaded.

Above call isoburn_ropt_set_default_perms() automatically adds x-permissions to r-permissions for directories. This call here may be done afterwards to set independend permissions for directories, especially to override the automatically added x-permissions.

Since:
0.1.0
Parameters:
o The option set to work on
mode permissions (not file type) as of man 2 stat.
Returns:
1 success, <=0 failure

Definition at line 746 of file isoburn.c.

References isoburn_read_opts::dirmode.

00748 {
00749  o->dirmode= mode;
00750  return(1);
00751 }

int isoburn_ropt_set_default_perms ( struct isoburn_read_opts o,
uid_t  uid,
gid_t  gid,
mode_t  mode 
)

Default attributes to use if no RockRidge extension gets loaded.

Since:
0.1.0
Parameters:
o The option set to work on
uid user id number (see /etc/passwd)
gid group id number (see /etc/group)
mode permissions (not file type) as of man 2 stat. With directories, r-permissions will automatically imply x-permissions. See isoburn_ropt_set_default_dirperms() below.
Returns:
1 success, <=0 failure

Definition at line 716 of file isoburn.c.

References isoburn_read_opts::dirmode, isoburn_read_opts::gid, isoburn_read_opts::mode, and isoburn_read_opts::uid.

00718 {
00719  mode_t dirmode;
00720 
00721  o->uid= uid;
00722  o->gid= gid;
00723  o->mode= mode;
00724  dirmode= mode;
00725  if(dirmode & S_IRUSR)
00726    dirmode|= S_IXUSR;
00727  if(dirmode & S_IRGRP)
00728    dirmode|= S_IXGRP;
00729  if(dirmode & S_IROTH)
00730    dirmode|= S_IXOTH;
00731  o->dirmode= dirmode;
00732  return(1);
00733 }

int isoburn_ropt_set_extensions ( struct isoburn_read_opts o,
int  ext 
)

Definition at line 690 of file isoburn.c.

References isoburn_read_opts::noaaip, isoburn_read_opts::noacl, isoburn_read_opts::noea, isoburn_read_opts::noino, isoburn_read_opts::noiso1999, isoburn_read_opts::nojoliet, isoburn_read_opts::nomd5, isoburn_read_opts::norock, isoburn_read_opts::preferjoliet, and isoburn_read_opts::pretend_blank.

00691 {
00692  o->norock= !!(ext&1);
00693  o->nojoliet= !!(ext&2);
00694  o->noiso1999= !!(ext&4);
00695  o->preferjoliet= !!(ext&8);
00696  o->pretend_blank= !!(ext&16);
00697  o->noaaip= !!(ext & 32);
00698  o->noacl= !!(ext & 64);
00699  o->noea= !!(ext & 128);
00700  o->noino= !!(ext & 256);
00701  o->nomd5= !!(ext & 512);
00702  return(1);
00703 }

int isoburn_ropt_set_input_charset ( struct isoburn_read_opts o,
char *  input_charset 
)

Set the character set for reading RR file names from ISO images.

Since:
0.1.0
Parameters:
o The option set to work on
input_charset Set this to NULL to use the default locale charset For selecting a particular character set, submit its name, e.g. as listed by program iconv -l. Example: "UTF-8".
Returns:
1 success, <=0 failure

Definition at line 762 of file isoburn.c.

References isoburn_read_opts::input_charset.

00764 {
00765  o->input_charset= input_charset;
00766  return(1);
00767 }

int isoburn_set_msc1 ( struct burn_drive *  d,
int  adr_mode,
char *  adr_value,
int  flag 
)

Set up isoburn_disc_get_msc1() to return a fabricated value.

This makes only sense between aquiring the drive and reading the image. After isoburn_read_image() it will confuse the coordination of libisoburn and libisofs. Note: Sessions and tracks are counted beginning with 1, not with 0.

Since:
0.1.6
Parameters:
d The drive where msc1 is to be set
adr_mode Determines how to interpret adr_value and to set msc1. If adr_value shall represent a number then decimal ASCII digits are expected. 0= start lba of last session in TOC, ignore adr_value 1= start lba of session number given by adr_value 2= start lba of track given number by adr_value 3= adr_value itself is the lba to be used 4= start lba of last session with volume id given by adr_value
adr_value A string describing the value to be eventually used.
flag Bitfield for control purposes. bit0=
Since:
0.2.2 with adr_mode 3: adr_value might be 16 blocks too high (e.g. -C stemming from growisofs). Probe for ISO head at adr_value-16 and eventually adjust setting. bit1= insist in seeing a disc object with at least one session bit2= with adr_mode 4: use adr_value as regular expression

Definition at line 1633 of file burn_wrap.c.

References isoburn_toc_disc::disc, isoburn::fabricated_msc1, isoburn_find_emulator(), isoburn_get_track_lba(), isoburn_msgs_submit(), isoburn_read_iso_head(), isoburn_toc_disc_free(), isoburn_toc_disc_get_sessions(), isoburn_toc_drive_get_disc(), isoburn_toc_session_get_tracks(), and isoburn_toc_track_get_emul().

Referenced by isoburn_get_mount_params().

01635 {
01636  int ret, num_sessions, num_tracks, adr_num, i, j, total_tracks;
01637  int lba, best_lba, size, re_valid= 0, track_count= 0;
01638  time_t start_time= 0, last_pacifier= 0, now;
01639  char volid[33], msg[160];
01640  struct isoburn *o;
01641  struct isoburn_toc_disc *disc= NULL;
01642  struct isoburn_toc_session **sessions= NULL;
01643  struct isoburn_toc_track **tracks= NULL;
01644  static char mode_names[][20]= {"auto", "session", "track", "lba", "volid"};
01645  static int max_mode_names= 4;
01646  regex_t re;
01647  regmatch_t match[1];
01648 
01649  ret= isoburn_find_emulator(&o, d, 0);
01650  if(ret<0)
01651    return(-1);
01652  if(o==NULL)
01653    return(-1);
01654 
01655  start_time= last_pacifier= time(NULL);
01656  adr_num= atoi(adr_value);
01657  if(adr_mode!=3 || (flag & 2)) {
01658    disc= isoburn_toc_drive_get_disc(d);
01659    if(disc==NULL) {
01660 not_found:;
01661      if(adr_mode<0 || adr_mode>max_mode_names)
01662        goto unknown_mode;
01663      sprintf(msg, "Failed to find %s %s", mode_names[adr_mode],
01664                   strlen(adr_value)<=80 ?  adr_value : "-oversized-string-");
01665      isoburn_msgs_submit(o, 0x00060000, msg, 0, "FAILURE", 0);
01666      ret= 0; goto ex;
01667    }
01668    sessions= isoburn_toc_disc_get_sessions(disc, &num_sessions);
01669    if(sessions==NULL || num_sessions<=0)
01670      goto not_found;
01671  }
01672  if(adr_mode==0) {
01673    /* Set fabricated_msc1 to last session in TOC */
01674    tracks= isoburn_toc_session_get_tracks(sessions[num_sessions-1],
01675                                           &num_tracks);
01676    if(tracks==NULL || num_tracks<=0)
01677      goto not_found;
01678    isoburn_get_track_lba(tracks[0], &(o->fabricated_msc1), 0);
01679 
01680  } else if(adr_mode==1) {
01681    /* Use adr_num as session index (first session is 1, not 0) */
01682    if(adr_num<1 || adr_num>num_sessions)
01683      goto not_found;
01684    tracks= isoburn_toc_session_get_tracks(sessions[adr_num-1], &num_tracks);
01685    if(tracks==NULL || num_tracks<=0)
01686      goto not_found;
01687    isoburn_get_track_lba(tracks[0], &(o->fabricated_msc1), 0);
01688 
01689  } else if(adr_mode==2) {
01690    /* use adr_num as track index */
01691    total_tracks= 0;
01692    for(i=0; i<num_sessions; i++) {
01693      tracks= isoburn_toc_session_get_tracks(sessions[i], &num_tracks);
01694      if(tracks==NULL)
01695    continue;
01696      for(j= 0; j<num_tracks; j++) {
01697        total_tracks++;
01698        if(total_tracks==adr_num) {
01699          isoburn_get_track_lba(tracks[j], &(o->fabricated_msc1), 0);
01700          ret= 1; goto ex;
01701        }
01702      }
01703    }
01704    goto not_found;
01705 
01706  } else if(adr_mode==3) {
01707    o->fabricated_msc1= adr_num;
01708    if((flag & 1) && o->fabricated_msc1 >= 16) {
01709      /* adr_num is possibly 16 blocks too high */
01710      ret= isoburn_read_iso_head(d, o->fabricated_msc1, &size,volid, 1|(1<<14));
01711      if(ret==2)
01712        o->fabricated_msc1-= 16;
01713    }
01714  } else if(adr_mode==4) {
01715    /* search for volume id that is equal to adr_value */
01716    if(flag & 4) {
01717      ret= regcomp(&re, adr_value, 0);
01718      if(ret != 0)
01719        flag&= ~4;
01720      else
01721        re_valid= 1;
01722    }
01723    best_lba= -1;
01724    for(i=0; i<num_sessions; i++) {
01725      tracks= isoburn_toc_session_get_tracks(sessions[i], &num_tracks);
01726      if(tracks==NULL)
01727    continue;
01728      for(j= 0; j<num_tracks; j++) {
01729        now= time(NULL);
01730        if(now - last_pacifier >= 5 && track_count > 0) {
01731          last_pacifier= now;
01732          sprintf(msg,
01733                  "Scanned %d tracks for matching volid in %.f seconds",
01734                  track_count, (double) (now - start_time));
01735          isoburn_msgs_submit(o, 0x00060000, msg, 0, "UPDATE", 0);
01736        }
01737        track_count++;
01738        ret= isoburn_toc_track_get_emul(tracks[0], &lba, &size, volid, 0);
01739        if(ret < 0)
01740      continue;
01741        if(ret == 0) {
01742          isoburn_get_track_lba(tracks[0], &lba, 0);
01743          ret= isoburn_read_iso_head(d, lba, &size, volid, 1);
01744          if(ret<=0)
01745      continue;
01746        }
01747        if(flag & 4) {
01748          ret= regexec(&re, volid, 1, match, 0);
01749          if(ret != 0)
01750      continue;
01751        } else {
01752          if(strcmp(volid, adr_value)!=0)
01753      continue;
01754        }
01755        best_lba= lba;
01756      }
01757    }
01758    if(best_lba<0)
01759      goto not_found;
01760    o->fabricated_msc1= best_lba;
01761 
01762  } else {
01763 unknown_mode:;
01764    sprintf(msg, "Program error: Unknown msc1 address mode %d", adr_mode);
01765    isoburn_msgs_submit(o, 0x00060000, msg, 0, "FATAL", 0);
01766    ret= 0; goto ex;
01767  }
01768  ret= 1;
01769 ex:;
01770  if(start_time != last_pacifier && track_count > 0) {
01771    now= time(NULL);
01772    sprintf(msg,
01773            "Scanned %d tracks for matching volid in %.f seconds",
01774            track_count, (double) (now - start_time));
01775    isoburn_msgs_submit(o, 0x00060000, msg, 0, "UPDATE", 0);
01776  }
01777  if(disc!=NULL)
01778    isoburn_toc_disc_free(disc);
01779  if((flag & 4) && re_valid)
01780    regfree(&re);
01781  return(ret);
01782 }

int isoburn_set_msgs_submit ( int(*)(void *handle, int error_code, char msg_text[], int os_errno, char severity[], int flag)  msgs_submit,
void *  submit_handle,
int  submit_flag,
int  flag 
)

Note: Above version numbers are also recorded in configure.ac because libtool wants them as parameters at build time.

For the library compatibility check, ISOBURN_*_VERSION in configure.ac are not decisive. Only the three numbers here do matter. 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 isoburn_header_version_* 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 *_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.

-----------------------------------------------------

For an implementation of the Thomas Schmitt approach, see libisoburn/burn_wrap.c : isoburn_initialize() This connects libisoburn as "application" with libisofs as "library".

The compatible part of Vreixo Formoso's approach is implemented in configure.ac LIBBURN_REQUIRED, LIBISOFS_REQUIRED. In isoburn_initialize() it would rather test by iso_lib_is_compatible(isoburn_libisofs_req_major,... than by iso_lib_is_compatible(iso_lib_header_version_major,... and would leave out the ugly compile time traps. Announce to the library an application provided method for immediate delivery of messages. It is used when no drive is affected directly or if the drive has no own msgs_submit() method attached by isoburn_drive_set_msgs_submit. If no method is preset or if the method is set to NULL then libisoburn delivers its messages through the message queue of libburn.

Parameters:
msgs_submit The function call which implements the method
submit_handle Handle to be used as first argument of msgs_submit
submit_flag Flag to be used as last argument of msgs_submit
flag Unused yet, submit 0
Since:
0.2.0

Definition at line 231 of file burn_wrap.c.

References libisoburn_default_msgs_submit, libisoburn_default_msgs_submit_flag, libisoburn_default_msgs_submit_handle, and isoburn::msgs_submit.

00235 {
00236  libisoburn_default_msgs_submit= msgs_submit;
00237  libisoburn_default_msgs_submit_handle= submit_handle;
00238  libisoburn_default_msgs_submit_flag= submit_flag;
00239  return(1);
00240 }

int isoburn_set_read_pacifier ( struct burn_drive *  drive,
int(*)(IsoImage *, IsoFileSource *)  read_pacifier,
void *  app_handle 
)

Set a callback function for producing pacifier messages during the lengthy process of image reading.

The callback function and the application handle are stored until they are needed for the underlying call to libisofs. Other than with libisofs the handle is managed entirely by the application. An idle .free() function is exposed to libisofs. The handle has to stay valid until isoburn_read_image() is done. It has to be detached by isoburn_set_read_pacifier(drive, NULL, NULL); before it may be removed from memory.

Since:
0.1.0
Parameters:
drive The drive which will be used with isoburn_read_image() It has to be aquired by an isoburn_* wrapper call.
read_pacifier The callback function
app_handle The app handle which the callback function can obtain via iso_image_get_attached_data() from its IsoImage*
Returns:
1 success, <=0 failure

Definition at line 416 of file isofs_wrap.c.

References isoburn_find_emulator(), isoburn::read_pacifier, and isoburn::read_pacifier_handle.

00419 {
00420  int ret;
00421  struct isoburn *o;
00422 
00423  ret = isoburn_find_emulator(&o, drive, 0);
00424  if(ret < 0 || o == NULL)
00425    return -1;
00426  o->read_pacifier_handle= read_handle;
00427  o->read_pacifier= read_pacifier;
00428  return(1);
00429 }

int isoburn_sync_after_write ( struct burn_drive *  input_drive,
struct burn_drive *  output_drive,
int  flag 
)

Wait after normal end of operations until libisofs ended all write threads and freed resource reservations.

This call is not mandatory. But without it, messages from the ending threads might appear after the application ended its write procedure.

Since:
0.1.0
Parameters:
input_drive The drive resp. in_drive which was used with the preparation call.
output_drive The out_drive used with isoburn_prepare_new_image(), NULL if none.
flag Bitfield, submit 0 for now.
Returns:
<=0 error , 1 = success

Definition at line 605 of file isoburn.c.

References isoburn_cancel_prepared_write().

00607 {
00608  return isoburn_cancel_prepared_write(d, output_drive, 1);
00609 }

void isoburn_toc_disc_free ( struct isoburn_toc_disc disc  ) 

Release the memory associated with a master handle of media.

The handle is invalid afterwards and may not be used any more. Wrapper for: burn_disc_free()

Since:
0.1.6
Parameters:
disc The master handle of the media

Definition at line 1588 of file burn_wrap.c.

References isoburn_toc_disc::disc, and isoburn_toc_destroy_arrays().

Referenced by isoburn_set_msc1(), and isoburn_welcome_media().

01589 {
01590  if(d->disc!=NULL)
01591    burn_disc_free(d->disc);
01592  isoburn_toc_destroy_arrays(d, 0);
01593  free((char *) d);
01594 }

int isoburn_toc_disc_get_sectors ( struct isoburn_toc_disc disc  ) 

Tell the number of 2048 byte blocks covered by the table of content.

This number includes the eventual gaps between sessions and tracks. So this call is not really a wrapper for burn_disc_get_sectors().

Since:
0.1.6
Parameters:
disc The master handle of the media
Returns:
Number of blocks, <=0 indicates unknown or unreadable state

Definition at line 1443 of file burn_wrap.c.

References isoburn_toc_disc::disc, isoburn_toc_entry::next, isoburn_toc_entry::start_lba, isoburn_toc_disc::toc, and isoburn_toc_entry::track_blocks.

01444 {
01445  struct isoburn_toc_entry *t;
01446  int ret= 0, num_sessions, num_tracks;
01447  struct burn_session **sessions;
01448  struct burn_track **tracks;
01449  struct burn_toc_entry entry;
01450 
01451  if(disc==NULL)
01452    return(0);
01453  if(disc->toc!=NULL) {
01454    for(t= disc->toc; t!=NULL; t= t->next)
01455      ret= t->start_lba + t->track_blocks;
01456  } else if(disc->disc!=NULL) {
01457    sessions= burn_disc_get_sessions(disc->disc, &num_sessions);
01458    if(num_sessions > 0) {
01459      tracks = burn_session_get_tracks(sessions[num_sessions - 1],
01460                                       &num_tracks);
01461      if(num_tracks > 0) {
01462        burn_track_get_entry(tracks[num_tracks - 1], &entry);
01463        if(entry.extensions_valid & 1)
01464          ret= entry.start_lba + entry.track_blocks;
01465      }
01466    }
01467 /*
01468    ret= burn_disc_get_sectors(disc->disc);
01469 */
01470  }
01471  return(ret);
01472 }

struct isoburn_toc_session** isoburn_toc_disc_get_sessions ( struct isoburn_toc_disc disc,
int *  num 
) [read]

Get the array of session handles from the table of content.

Wrapper for: burn_disc_get_sessions()

Since:
0.1.6
Parameters:
disc The master handle of the media
num returns the number of sessions in the array
Returns:
the address of the array of session handles

Definition at line 1475 of file burn_wrap.c.

References isoburn_toc_disc::session_count, and isoburn_toc_disc::session_pointers.

Referenced by isoburn_get_mount_params(), isoburn_set_msc1(), and isoburn_welcome_media().

01477 {
01478  *num= disc->session_count;
01479  return(disc->session_pointers);
01480 }

struct isoburn_toc_disc* isoburn_toc_drive_get_disc ( struct burn_drive *  d  )  [read]

Obtain a master handle for the table of content.

This handle governs allocated resources which have to be released by isoburn_toc_disc_free() when no longer needed. Wrapper for: burn_drive_get_disc()

Since:
0.1.6
Parameters:
d The drive with the media to inspect
Returns:
NULL in case there is no content info, else it is a valid handle

Definition at line 1357 of file burn_wrap.c.

References isoburn_toc_disc::disc, isoburn_find_emulator(), isoburn_toc_new_arrays(), isoburn_toc_entry::next, isoburn_toc_session::session, isoburn_toc_disc::session_count, isoburn_toc_disc::session_pointers, isoburn_toc_disc::sessions, isoburn::toc, isoburn_toc_disc::toc, isoburn_toc_track::toc_entry, isoburn_toc_session::toc_entry, isoburn_toc_track::track, isoburn_toc_session::track_count, isoburn_toc_disc::track_count, isoburn_toc_session::track_pointers, isoburn_toc_disc::track_pointers, and isoburn_toc_disc::tracks.

Referenced by isoburn_get_mount_params(), isoburn_set_msc1(), and isoburn_welcome_media().

01358 {
01359  int ret, session_count= 0, track_count= 0, num_tracks= 0, i, j;
01360  struct isoburn *o;
01361  struct isoburn_toc_entry *t;
01362  struct isoburn_toc_disc *toc_disc= NULL;
01363  struct burn_session **s;
01364  struct burn_track **tracks;
01365 
01366  toc_disc= calloc(1, sizeof(struct isoburn_toc_disc));
01367  if(toc_disc==NULL)
01368    return(NULL);
01369  toc_disc->disc= NULL;
01370  toc_disc->sessions= NULL;
01371  toc_disc->session_pointers= NULL;
01372  toc_disc->tracks= NULL;
01373  toc_disc->track_pointers= NULL;
01374  toc_disc->session_count= 0;
01375  toc_disc->track_count= 0;
01376  toc_disc->toc= NULL; 
01377 
01378  /* is the media emulated multi-session ? */
01379  ret= isoburn_find_emulator(&o, d, 0);
01380  if(ret<0)
01381    goto libburn;
01382  if(o->toc==NULL)
01383    goto libburn;
01384 
01385  /* This is an emulated TOC */
01386  toc_disc->toc= o->toc;
01387  for(t= toc_disc->toc; t!=NULL; t= t->next)
01388    session_count++;
01389  ret= isoburn_toc_new_arrays(toc_disc, session_count, session_count, 0);
01390  if(ret<=0)
01391    goto failure;
01392  t= toc_disc->toc;
01393  for(i= 0; i<session_count; i++) {
01394    toc_disc->sessions[i].track_pointers= toc_disc->track_pointers+i;
01395    toc_disc->sessions[i].track_count= 1;
01396    toc_disc->sessions[i].toc_entry= t;
01397    toc_disc->session_pointers[i]= toc_disc->sessions+i;
01398    toc_disc->tracks[i].toc_entry= t;
01399    toc_disc->track_pointers[i]= toc_disc->tracks+i;
01400    t= t->next;
01401  }
01402  toc_disc->session_count= session_count;
01403  toc_disc->track_count= session_count;
01404  return(toc_disc);
01405 
01406 libburn:;
01407  /* This is a libburn provided TOC */
01408  toc_disc->disc= burn_drive_get_disc(d);
01409  if(toc_disc->disc == NULL) {
01410 failure:;
01411    free((char *) toc_disc);
01412    return(NULL);
01413  }
01414  s= burn_disc_get_sessions(toc_disc->disc, &session_count);
01415  for(i= 0; i<session_count; i++) {
01416    tracks = burn_session_get_tracks(s[i], &num_tracks);
01417    track_count+= num_tracks;
01418  }
01419  if(session_count<=0 || track_count<=0)
01420    goto failure;
01421  ret= isoburn_toc_new_arrays(toc_disc, session_count, track_count, 0);
01422  if(ret<=0)
01423    goto failure;
01424  track_count= 0;
01425  for(i= 0; i<session_count; i++) {
01426    tracks = burn_session_get_tracks(s[i], &num_tracks);
01427    toc_disc->sessions[i].session= s[i];
01428    toc_disc->sessions[i].track_pointers= toc_disc->track_pointers+track_count;
01429    toc_disc->sessions[i].track_count= num_tracks;
01430    toc_disc->session_pointers[i]= toc_disc->sessions+i;
01431    for(j= 0; j<num_tracks; j++) {
01432      toc_disc->tracks[track_count+j].track= tracks[j];
01433      toc_disc->track_pointers[track_count+j]= toc_disc->tracks+(track_count+j);
01434    }
01435    track_count+= num_tracks;
01436  }
01437  toc_disc->session_count= session_count;
01438  toc_disc->track_count= track_count;
01439  return(toc_disc);
01440 }

void isoburn_toc_session_get_leadout_entry ( struct isoburn_toc_session s,
struct burn_toc_entry *  entry 
)

Obtain a copy of the entry which describes the end of a particular session.

Wrapper for: burn_session_get_leadout_entry()

Since:
0.1.6
Parameters:
s The session handle
entry A pointer to memory provided by the caller. It will be filled with info according to struct burn_toc_entry as defined in libburn.h

Definition at line 1526 of file burn_wrap.c.

References isoburn_toc_entry_finish(), isoburn_toc_entry::session, isoburn_toc_session::session, isoburn_toc_entry::start_lba, isoburn_toc_track::toc_entry, isoburn_toc_session::toc_entry, isoburn_toc_entry::track_blocks, isoburn_toc_session::track_count, isoburn_toc_entry::track_no, and isoburn_toc_session::track_pointers.

01528 {
01529  struct isoburn_toc_track *t;
01530 
01531  if(s==NULL)
01532    return;
01533  if(s->session!=NULL && s->toc_entry==NULL) {
01534    burn_session_get_leadout_entry(s->session, entry);
01535    return;
01536  }
01537  if(s->track_count<=0 || s->track_pointers==NULL || s->toc_entry==NULL)
01538    return;
01539  t= s->track_pointers[s->track_count-1];
01540  entry->start_lba= t->toc_entry->start_lba + t->toc_entry->track_blocks;
01541  entry->track_blocks= 0;
01542  isoburn_toc_entry_finish(entry, s->toc_entry->session, t->toc_entry->track_no,
01543                           0);
01544 }

int isoburn_toc_session_get_sectors ( struct isoburn_toc_session s  ) 

Tell the number of 2048 byte blocks covered by a particular session.

Wrapper for: burn_session_get_sectors()

Since:
0.1.6
Parameters:
s The session handle
Returns:
number of blocks, <=0 indicates unknown or unreadable state

Definition at line 1483 of file burn_wrap.c.

References isoburn_toc_entry::next, isoburn_toc_session::session, isoburn_toc_session::toc_entry, isoburn_toc_entry::track_blocks, and isoburn_toc_session::track_count.

01484 {
01485  struct isoburn_toc_entry *t;
01486  int count= 0, i;
01487 
01488  if(s==NULL)
01489    return(0);
01490  if(s->toc_entry!=NULL) {
01491    t= s->toc_entry;
01492    for(i= 0; i<s->track_count; i++) {
01493      count+= t->track_blocks;
01494      t= t->next;
01495    }
01496  } else if(s->session!=NULL)
01497    count= burn_session_get_sectors(s->session);
01498  return(count);
01499 }

struct isoburn_toc_track** isoburn_toc_session_get_tracks ( struct isoburn_toc_session s,
int *  num 
) [read]

Get the array of track handles from a particular session.

Wrapper for: burn_session_get_tracks()

Since:
0.1.6
Parameters:
s The session handle
num returns the number of tracks in the array
Returns:
the address of the array of track handles

Definition at line 1547 of file burn_wrap.c.

References isoburn_toc_session::track_count, and isoburn_toc_session::track_pointers.

Referenced by isoburn_get_mount_params(), isoburn_set_msc1(), and isoburn_welcome_media().

01549 {
01550  *num= s->track_count;
01551  return(s->track_pointers);
01552 }

int isoburn_toc_track_get_emul ( struct isoburn_toc_track t,
int *  start_lba,
int *  image_blocks,
char  volid[33],
int  flag 
)

Obtain eventual ISO image parameters of an emulated track.

This info was gained with much effort and thus gets cached in the track object. If this call returns 1 then one can save a call of isoburn_read_iso_head() with return mode 1 which could cause an expensive read operation.

Since:
0.4.0
Parameters:
t The track handle
start_lba Returns the start address of the ISO session
image_blocks Returns the number of 2048 bytes blocks
volid Caller provided memory for the volume id
flag unused yet, submit 0
Returns:
0= not an emulated ISO session , 1= reply is valid

Definition at line 1573 of file burn_wrap.c.

References isoburn_toc_entry::start_lba, isoburn_toc_track::toc_entry, isoburn_toc_entry::track_blocks, and isoburn_toc_entry::volid.

Referenced by isoburn_set_msc1().

01575 {
01576  if(t->toc_entry == NULL)
01577    return(0);
01578  if(t->toc_entry->volid == NULL)
01579    return(0);
01580  *start_lba= t->toc_entry->start_lba;
01581  *image_blocks= t->toc_entry->track_blocks;
01582  strncpy(volid, t->toc_entry->volid, 32);
01583  volid[32]= 0;
01584  return(1);
01585 }

void isoburn_toc_track_get_entry ( struct isoburn_toc_track t,
struct burn_toc_entry *  entry 
)

Obtain a copy of the entry which describes a particular track.

Wrapper for: burn_track_get_entry()

Since:
0.1.6
Parameters:
t The track handle
entry A pointer to memory provided by the caller. It will be filled with info according to struct burn_toc_entry as defined in libburn.h

Definition at line 1555 of file burn_wrap.c.

References isoburn_toc_entry_finish(), isoburn_toc_entry::session, isoburn_toc_entry::start_lba, isoburn_toc_track::toc_entry, isoburn_toc_track::track, isoburn_toc_entry::track_blocks, and isoburn_toc_entry::track_no.

Referenced by isoburn_get_track_lba().

01557 {
01558  if(t==0)
01559    return;
01560  if(t->track!=NULL && t->toc_entry==NULL) {
01561    burn_track_get_entry(t->track, entry);
01562    return;
01563  }
01564  if(t->toc_entry==NULL)
01565    return;
01566  entry->start_lba= t->toc_entry->start_lba;
01567  entry->track_blocks= t->toc_entry->track_blocks;
01568  isoburn_toc_entry_finish(entry, t->toc_entry->session, t->toc_entry->track_no,
01569                           0);
01570 }

void isoburn_version ( int *  major,
int *  minor,
int *  micro 
)

Obtain the three release version numbers of the library.

These are the numbers encountered by the application when linking with libisoburn, i.e. possibly not before run time. Better do not base the fundamental compatibility decision of an application on these numbers. For a reliable check use isoburn_is_compatible().

Since:
0.1.0
Parameters:
major The maturity version (0 for now, as we are still learning)
minor The development goal version.
micro The development step version. This has an additional meaning:

Pare numbers indicate a version with frozen API. I.e. you can rely on the same set of features to be present in all published releases with that major.minor.micro combination. Features of a pare release will stay available and ABI compatible as long as the SONAME of libisoburn stays "1". Currently there are no plans to ever change the SONAME.

Odd numbers indicate that API upgrades are in progress. I.e. new features might be already present or they might be still missing. Newly introduced features may be changed incompatibly or even be revoked before release of a pare version. So micro revisions {1,3,5,7,9} should never be used for dynamic linking unless the proper library match can be guaranteed by external circumstances.

Returns:
1 success, <=0 might in future become an error indication

Definition at line 612 of file isoburn.c.

References isoburn_header_version_major, isoburn_header_version_micro, and isoburn_header_version_minor.

Referenced by isoburn_initialize(), and isoburn_is_compatible().

00613 {
00614  *major= isoburn_header_version_major;
00615  *minor= isoburn_header_version_minor;
00616  *micro= isoburn_header_version_micro;
00617 
00618 /* No more: values from version.h generated from version.h.in and
00619             macro values defined in configure.ac
00620 
00621  *major = ISOBURN_MAJOR_VERSION;
00622  *minor = ISOBURN_MINOR_VERSION;
00623  *micro = ISOBURN_MICRO_VERSION;
00624 */
00625 }


Generated by  doxygen 1.6.2