xorriso
1.5.4.pl02
About: GNU xorriso creates, loads, manipulates and writes ISO 9660 filesystem images with Rock Ridge extensions. It is suitable for incremental data backup and for production of bootable ISO 9660 images. GNU xorriso is a statical compilation of the libraries libburn, libisofs, libisoburn, and libjte.
![]() ![]() |
#include "libburn.h"
#include "transport.h"
#include "drive.h"
#include "write.h"
#include "options.h"
#include "file.h"
#include "async.h"
#include "init.h"
#include "back_hacks.h"
#include <pthread.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <signal.h>
#include "libdax_msgs.h"
Go to the source code of this file.
Data Structures | |
struct | scan_opts |
struct | erase_opts |
struct | format_opts |
struct | write_opts |
struct | fifo_opts |
union | w_list_data |
struct | w_list |
Macros | |
#define | Libburn_create_detached_threadS 1 |
#define | Burnworker_type_scaN 0 |
#define | Burnworker_type_erasE 1 |
#define | Burnworker_type_formaT 2 |
#define | Burnworker_type_writE 3 |
#define | Burnworker_type_fifO 4 |
#define | SCAN_GOING() |
#define | Libburn_protect_erase_threaD 1 |
#define | Libburn_protect_format_threaD 1 |
#define | Libburn_protect_write_threaD 1 |
#define | Libburn_protect_fifo_threaD 1 |
Typedefs | |
typedef void *(* | WorkerFunc) (void *) |
Functions | |
static void * | fifo_worker_func (struct w_list *w) |
int | burn_async_manage_lock (int mode) |
static struct w_list * | find_worker (struct burn_drive *d) |
static void | add_worker (int w_type, struct burn_drive *d, WorkerFunc f, union w_list_data *data) |
static void | remove_worker (pthread_t th) |
static void * | scan_worker_func (struct w_list *w) |
static void | reset_progress (struct burn_drive *d, int sessions, int tracks, int indices, int sectors, int flag) |
int | burn_drive_scan (struct burn_drive_info *drives[], unsigned int *n_drives) |
static void * | erase_worker_func (struct w_list *w) |
void | burn_disc_erase (struct burn_drive *drive, int fast) |
static void * | format_worker_func (struct w_list *w) |
void | burn_disc_format (struct burn_drive *drive, off_t size, int flag) |
static void * | write_disc_worker_func (struct w_list *w) |
void | burn_disc_write (struct burn_write_opts *opts, struct burn_disc *disc) |
int | burn_fifo_start (struct burn_source *source, int flag) |
int | burn_fifo_abort (struct burn_source_fifo *fs, int flag) |
Variables | |
struct libdax_msgs * | libdax_messenger |
static struct w_list * | workers = NULL |
#define Libburn_protect_erase_threaD 1 |
#define Libburn_protect_fifo_threaD 1 |
#define Libburn_protect_format_threaD 1 |
#define Libburn_protect_write_threaD 1 |
#define SCAN_GOING | ( | ) |
|
static |
Definition at line 174 of file async.c.
References BURN_ASYNC_LOCK_INIT, BURN_ASYNC_LOCK_OBTAIN, burn_async_manage_lock(), BURN_DRIVE_SPAWNING, burn_drive::busy, w_list::drive, fifo_worker_func(), w_list::next, w_list::thread, w_list::u, w_list::w_type, and workers.
Referenced by burn_disc_erase(), burn_disc_format(), burn_disc_write(), burn_drive_scan(), and burn_fifo_start().
int burn_async_manage_lock | ( | int | mode | ) |
Definition at line 128 of file async.c.
References BURN_ASYNC_LOCK_INIT, BURN_ASYNC_LOCK_OBTAIN, and BURN_ASYNC_LOCK_RELEASE.
Referenced by add_worker(), burn_fifo_abort(), and burn_fifo_source_shoveller().
void burn_disc_erase | ( | struct burn_drive * | drive, |
int | fast | ||
) |
Erase a disc in the drive. The drive must be grabbed successfully BEFORE calling this functions. Always ensure that the drive reports a status of BURN_DISC_FULL before calling this function. An erase operation is not cancellable, as control of the operation is passed wholly to the drive and there is no way to interrupt it safely.
drive | The drive with which to erase a disc. Only drive roles 1 (MMC) and 5 (stdio random write-only) support erasing. |
fast | Nonzero to do a fast erase, where only the disc's headers are erased; zero to erase the entire disc. With DVD-RW, fast blanking yields media capable only of DAO. |
Definition at line 390 of file async.c.
References add_worker(), BURN_DISC_APPENDABLE, BURN_DISC_BLANK, BURN_DISC_FULL, Burnworker_type_erasE, burn_drive::cancel, burn_drive::current_profile, erase_opts::drive, burn_drive::drive_role, w_list_data::erase, erase_worker_func(), erase_opts::fast, find_worker(), burn_drive::global_index, libdax_messenger, LIBDAX_MSGS_PRIO_HIGH, LIBDAX_MSGS_SEV_SORRY, libdax_msgs_submit(), reset_progress(), SCAN_GOING, and burn_drive::status.
Referenced by isoburn_disc_erase(), and Xorriso_blank_media().
void burn_disc_format | ( | struct burn_drive * | drive, |
off_t | size, | ||
int | flag | ||
) |
Format media for use with libburn. This currently applies to DVD-RW in state "Sequential Recording" (profile 0014h) which get formatted to state "Restricted Overwrite" (profile 0013h). DVD+RW can be "de-iced" by setting bit4 of flag. DVD-RAM and BD-RE may get formatted initially or re-formatted to adjust their Defect Management. This function usually returns while the drive is still in the process of formatting. The formatting is done, when burn_drive_get_status() returns BURN_DRIVE_IDLE. This may be immediately after return or may need several thousand seconds to occur.
drive | The drive with the disc to format. |
size | The size in bytes to be used with the format command. It should be divisible by 32*1024. The effect of this parameter may depend on the media profile and on parameter flag. |
flag | Bitfield for control purposes: bit0= after formatting, write the given number of zero-bytes to the media and eventually perform preliminary closing. bit1+2: size mode 0 = use parameter size as far as it makes sense 1 = insist in size 0 even if there is a better default known (on DVD-RAM or BD-R identical to size mode 0, i.e. they never get formatted with payload size 0) 2 = without bit7: format to maximum available size with bit7 : take size from indexed format descriptor 3 = without bit7: format to default size with bit7 : take size from indexed format descriptor bit3= -reserved- bit4= enforce re-format of (partly) formatted media bit5= try to disable eventual defect management bit6= try to avoid lengthy media certification bit7, bit8 to bit15 = bit7 enables MMC expert application mode (else libburn tries to choose a suitable format type): If it is set then bit8 to bit15 contain the index of the format to use. See burn_disc_get_formats(), burn_disc_get_format_descr(). Acceptable types are: 0x00, 0x01, 0x10, 0x11, 0x13, 0x15, 0x26, 0x30, 0x31, 0x32. If bit7 is set, then bit4 is set automatically. bit16= enable POW on blank BD-R |
Definition at line 491 of file async.c.
References add_worker(), BURN_DISC_BLANK, BURN_FORMAT_IS_FORMATTED, Burnworker_type_formaT, burn_drive::cancel, burn_drive::current_feat23h_byte4, burn_drive::current_profile, format_opts::drive, burn_drive::drive_role, find_worker(), format_opts::flag, w_list_data::format, burn_drive::format_descr_type, format_worker_func(), burn_drive::global_index, libdax_messenger, LIBDAX_MSGS_PRIO_HIGH, LIBDAX_MSGS_SEV_FATAL, LIBDAX_MSGS_SEV_NOTE, LIBDAX_MSGS_SEV_SORRY, libdax_msgs_submit(), burn_drive::read_format_capacities, reset_progress(), SCAN_GOING, format_opts::size, and burn_drive::status.
Referenced by Xorriso_format_media().
void burn_disc_write | ( | struct burn_write_opts * | o, |
struct burn_disc * | disc | ||
) |
Write a disc in the drive. The drive must be grabbed successfully before calling this function. Always ensure that the drive reports a status of BURN_DISC_BLANK ot BURN_DISC_APPENDABLE before calling this function. Note: write_type BURN_WRITE_SAO is currently not capable of writing a mix of data and audio tracks. You must use BURN_WRITE_TAO for such sessions. To be set by burn_write_opts_set_write_type(). Note: This function is not suitable for overwriting data in the middle of a valid data area because it is allowed to append trailing data. For exact random access overwriting use burn_random_access_write(). Note: After writing it is advised to give up the drive and to grab it again in order to learn about its view on the new media state. Note: Before mounting the written media it might be necessary to eject and reload in order to allow the operating system to notice the new media state.
o | The options for the writing operation. |
disc | The struct burn_disc * that described the disc to be created |
Definition at line 633 of file async.c.
References add_worker(), BURN_ALLOC_MEM_VOID, BURN_FORMAT_IS_FORMATTED, BURN_FREE_MEM, burn_precheck_write(), BURN_REASONS_LEN, BURN_WRITE_NONE, Burnworker_type_writE, burn_drive::cancel, burn_drive::current_profile, write_opts::disc, burn_drive::disc, write_opts::drive, burn_write_opts::drive, burn_drive::drive_role, find_worker(), burn_drive::format_descr_type, burn_drive::global_index, burn_track::indices, libdax_messenger, LIBDAX_MSGS_PRIO_HIGH, LIBDAX_MSGS_SEV_FAILURE, LIBDAX_MSGS_SEV_FATAL, LIBDAX_MSGS_SEV_SORRY, libdax_msgs_submit(), burn_drive::mdata, write_opts::opts, burn_drive::read_format_capacities, burn_write_opts::refcount, reset_progress(), SCAN_GOING, burn_disc::session, burn_disc::sessions, burn_session::track, burn_session::tracks, w_list_data::write, write_disc_worker_func(), and burn_write_opts::write_type.
Referenced by isoburn_disc_write(), and Xorriso_burn_track().
int burn_drive_scan | ( | struct burn_drive_info * | drive_infos[], |
unsigned int * | n_drives | ||
) |
Scan for drives. This function MUST be called until it returns nonzero. In case of re-scanning: All pointers to struct burn_drive and all struct burn_drive_info arrays are invalidated by using this function. Do NOT store drive pointers across calls to this function ! To avoid invalid pointers one MUST free all burn_drive_info arrays by burn_drive_info_free() before calling burn_drive_scan() a second time. If there are drives left, then burn_drive_scan() will refuse to work.
After this call all drives depicted by the returned array are subject to eventual (O_EXCL) locking. See burn_preset_device_open(). This state ends either with burn_drive_info_forget() or with burn_drive_release(). It is unfriendly to other processes on the system to hold drives locked which one does not definitely plan to use soon.
drive_infos | Returns an array of drive info items (cdroms/burners). The returned array must be freed by burn_drive_info_free() before burn_finish(), and also before calling this function burn_drive_scan() again. |
n_drives | Returns the number of drive items in drive_infos. |
Definition at line 297 of file async.c.
References add_worker(), burn_drives_are_clear(), burn_running, Burnworker_type_scaN, scan_opts::done, w_list::drive, scan_opts::drives, libdax_messenger, LIBDAX_MSGS_PRIO_HIGH, LIBDAX_MSGS_SEV_FATAL, LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_SEV_WARNING, libdax_msgs_submit(), scan_opts::n_drives, remove_worker(), w_list_data::scan, scan_worker_func(), w_list::thread, w_list::u, and workers.
Referenced by Xorriso_show_devices().
int burn_fifo_abort | ( | struct burn_source_fifo * | fs, |
int | flag | ||
) |
Definition at line 795 of file async.c.
References BURN_ASYNC_LOCK_OBTAIN, BURN_ASYNC_LOCK_RELEASE, burn_async_manage_lock(), burn_source_fifo::do_abort, burn_source_fifo::thread_handle, and burn_source_fifo::thread_is_valid.
Referenced by fifo_free().
int burn_fifo_start | ( | struct burn_source * | source, |
int | flag | ||
) |
Definition at line 770 of file async.c.
References add_worker(), burn_source_fifo::buf, burn_os_alloc_buffer(), Burnworker_type_fifO, burn_source_fifo::chunks, burn_source_fifo::chunksize, burn_source::data, w_list_data::fifo, fifo_worker_func(), fifo_opts::flag, burn_source_fifo::is_started, and fifo_opts::source.
Referenced by fifo_read().
|
static |
Definition at line 364 of file async.c.
References burn_disc_erase_sync(), erase_opts::drive, w_list_data::erase, erase_opts::fast, remove_worker(), and w_list::u.
Referenced by burn_disc_erase().
|
static |
Definition at line 743 of file async.c.
References burn_fifo_source_shoveller(), w_list_data::fifo, fifo_opts::flag, remove_worker(), fifo_opts::source, and w_list::u.
Referenced by add_worker(), and burn_fifo_start().
|
static |
Definition at line 164 of file async.c.
References w_list::drive, w_list::next, and workers.
Referenced by burn_disc_erase(), burn_disc_format(), and burn_disc_write().
|
static |
Definition at line 462 of file async.c.
References burn_disc_format_sync(), format_opts::drive, format_opts::flag, w_list_data::format, remove_worker(), format_opts::size, and w_list::u.
Referenced by burn_disc_format().
|
static |
Definition at line 225 of file async.c.
References libdax_messenger, LIBDAX_MSGS_PRIO_HIGH, LIBDAX_MSGS_SEV_WARNING, libdax_msgs_submit(), w_list::next, w_list::thread, and workers.
Referenced by burn_drive_scan(), erase_worker_func(), fifo_worker_func(), format_worker_func(), and write_disc_worker_func().
|
static |
Definition at line 281 of file async.c.
References burn_progress::index, burn_progress::indices, burn_drive::progress, burn_progress::sector, burn_progress::sectors, burn_progress::session, burn_progress::sessions, burn_progress::start_sector, burn_progress::track, and burn_progress::tracks.
Referenced by burn_disc_erase(), burn_disc_format(), and burn_disc_write().
|
static |
Definition at line 269 of file async.c.
References burn_drive_scan_sync(), scan_opts::done, scan_opts::drives, scan_opts::n_drives, w_list_data::scan, and w_list::u.
Referenced by burn_drive_scan().
|
static |
Definition at line 589 of file async.c.
References burn_disc_write_sync(), BURN_DRIVE_IDLE, burn_write_opts_free(), burn_drive::busy, write_opts::disc, write_opts::drive, burn_drive::global_index, libdax_messenger, LIBDAX_MSGS_PRIO_HIGH, LIBDAX_MSGS_SEV_DEBUG, libdax_msgs_submit(), write_opts::opts, remove_worker(), burn_drive::thread_pid, burn_drive::thread_pid_valid, burn_drive::thread_tid, w_list::u, and w_list_data::write.
Referenced by burn_disc_write().
|
extern |
Definition at line 42 of file init.c.
Referenced by burn_disc_erase(), burn_disc_format(), burn_disc_write(), burn_drive_scan(), remove_worker(), and write_disc_worker_func().
|
static |
Definition at line 123 of file async.c.
Referenced by add_worker(), burn_drive_scan(), find_worker(), and remove_worker().