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.
  Fossies Dox: xorriso-1.5.4.pl02.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

async.c File Reference
#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"
Include dependency graph for async.c:

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_listfind_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_listworkers = NULL
 

Macro Definition Documentation

◆ Burnworker_type_erasE

#define Burnworker_type_erasE   1

Definition at line 56 of file async.c.

◆ Burnworker_type_fifO

#define Burnworker_type_fifO   4

Definition at line 59 of file async.c.

◆ Burnworker_type_formaT

#define Burnworker_type_formaT   2

Definition at line 57 of file async.c.

◆ Burnworker_type_scaN

#define Burnworker_type_scaN   0

Definition at line 55 of file async.c.

◆ Burnworker_type_writE

#define Burnworker_type_writE   3

Definition at line 58 of file async.c.

◆ Libburn_create_detached_threadS

#define Libburn_create_detached_threadS   1

Definition at line 18 of file async.c.

◆ Libburn_protect_erase_threaD

#define Libburn_protect_erase_threaD   1

◆ Libburn_protect_fifo_threaD

#define Libburn_protect_fifo_threaD   1

◆ Libburn_protect_format_threaD

#define Libburn_protect_format_threaD   1

◆ Libburn_protect_write_threaD

#define Libburn_protect_write_threaD   1

◆ SCAN_GOING

#define SCAN_GOING ( )
Value:
(workers != NULL && \
#define Burnworker_type_scaN
Definition: async.c:55
static struct w_list * workers
Definition: async.c:123
int w_type
Definition: async.c:113

Definition at line 61 of file async.c.

Typedef Documentation

◆ WorkerFunc

typedef void*(* WorkerFunc) (void *)

Definition at line 64 of file async.c.

Function Documentation

◆ add_worker()

◆ burn_async_manage_lock()

int burn_async_manage_lock ( int  mode)

◆ burn_disc_erase()

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.

Parameters
driveThe drive with which to erase a disc. Only drive roles 1 (MMC) and 5 (stdio random write-only) support erasing.
fastNonzero 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().

◆ burn_disc_format()

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.

Parameters
driveThe drive with the disc to format.
sizeThe 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.
flagBitfield 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
Since
0.3.0

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().

◆ burn_disc_write()

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.

Parameters
oThe options for the writing operation.
discThe 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().

◆ burn_drive_scan()

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.

Parameters
drive_infosReturns 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_drivesReturns the number of drive items in drive_infos.
Returns
0 while scanning is not complete >0 when it is finished successfully, <0 when finished but failed.

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().

◆ burn_fifo_abort()

◆ burn_fifo_start()

◆ erase_worker_func()

static void* erase_worker_func ( struct w_list w)
static

◆ fifo_worker_func()

static void * fifo_worker_func ( struct w_list w)
static

◆ find_worker()

static struct w_list* find_worker ( struct burn_drive d)
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().

◆ format_worker_func()

static void* format_worker_func ( struct w_list w)
static

◆ remove_worker()

◆ reset_progress()

static void reset_progress ( struct burn_drive d,
int  sessions,
int  tracks,
int  indices,
int  sectors,
int  flag 
)
static

◆ scan_worker_func()

static void* scan_worker_func ( struct w_list w)
static

◆ write_disc_worker_func()

Variable Documentation

◆ libdax_messenger

struct libdax_msgs* libdax_messenger
extern

◆ workers

struct w_list* workers = NULL
static

Definition at line 123 of file async.c.

Referenced by add_worker(), burn_drive_scan(), find_worker(), and remove_worker().