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)  

drive.c File Reference
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <dirent.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <pthread.h>
#include <errno.h>
#include <fcntl.h>
#include "libburn.h"
#include "init.h"
#include "drive.h"
#include "transport.h"
#include "debug.h"
#include "toc.h"
#include "util.h"
#include "sg.h"
#include "structure.h"
#include "error.h"
#include "options.h"
#include "write.h"
#include "spc.h"
#include "mmc.h"
#include "os.h"
#include "libdax_msgs.h"
Include dependency graph for drive.c:

Go to the source code of this file.

Macros

#define O_BINARY   0
 
#define Libburn_ticket_62_re_register_is_possiblE   1
 
#define O_LARGEFILE   0
 
#define BURN_DRIVE_MAX_LINK_DEPTH   20
 

Functions

int burn_setup_drive (struct burn_drive *d, char *fname)
 
void burn_drive_free_subs (struct burn_drive *d)
 
void burn_drive_free (struct burn_drive *d)
 
void burn_drive_free_all (void)
 
int burn_drive_is_open (struct burn_drive *d)
 
int burn_drive_force_idle (struct burn_drive *d)
 
int burn_drive_is_released (struct burn_drive *d)
 
int burn_drive_is_occupied (struct burn_drive *d)
 
unsigned int burn_drive_count (void)
 
int burn_drive_is_listed (char *path, struct burn_drive **found, int flag)
 
int burn_drive_inquire_media (struct burn_drive *d)
 
int burn_drive_send_default_page_05 (struct burn_drive *d, int flag)
 
int burn_drive__fd_from_special_adr (char *adr)
 
static int burn_drive__is_rdwr (char *fname, int *stat_ret, struct stat *stbuf_ret, off_t *read_size_ret, int flag)
 
int burn_drive_grab_stdio (struct burn_drive *d, int flag)
 
int burn_drive_grab (struct burn_drive *d, int le)
 
struct burn_driveburn_drive_register (struct burn_drive *d)
 
int burn_drive_unregister (struct burn_drive *d)
 
struct burn_driveburn_drive_finish_enum (struct burn_drive *d)
 
int burn_drive_mark_unready (struct burn_drive *d, int flag)
 
int burn_drive_release_fl (struct burn_drive *d, int flag)
 
int burn_drive_snooze (struct burn_drive *d, int flag)
 
void burn_drive_release (struct burn_drive *d, int le)
 
int burn_drive_re_assess (struct burn_drive *d, int flag)
 
int burn_drive_leave_locked (struct burn_drive *d, int flag)
 
int burn_drives_are_clear (int flag)
 
void burn_disc_erase_sync (struct burn_drive *d, int fast)
 
void burn_disc_format_sync (struct burn_drive *d, off_t size, int flag)
 
int burn_disc_get_formats (struct burn_drive *d, int *status, off_t *size, unsigned *bl_sas, int *num_formats)
 
int burn_disc_get_format_descr (struct burn_drive *d, int index, int *type, off_t *size, unsigned *tdp)
 
enum burn_disc_status burn_disc_get_status (struct burn_drive *d)
 
int burn_disc_erasable (struct burn_drive *d)
 
enum burn_drive_status burn_drive_get_status (struct burn_drive *d, struct burn_progress *p)
 
int burn_drive_set_stream_recording (struct burn_drive *d, int recmode, int start, int flag)
 
void burn_drive_cancel (struct burn_drive *d)
 
static void strip_spaces (char *str, size_t len)
 
static int drive_getcaps (struct burn_drive *d, struct burn_drive_info *out)
 
int burn_drive_probe_cd_write_modes (struct burn_drive_info *dinfo)
 
int burn_drive_scan_sync (struct burn_drive_info *drives[], unsigned int *n_drives, int flag)
 
int burn_drive_forget (struct burn_drive *d, int force)
 
int burn_drive_info_forget (struct burn_drive_info *info, int force)
 
void burn_drive_info_free (struct burn_drive_info drive_infos[])
 
struct burn_discburn_drive_get_disc (struct burn_drive *d)
 
void burn_drive_set_speed (struct burn_drive *d, int r, int w)
 
int burn_drive_set_speed_exact (struct burn_drive *d, int r, int w)
 
int burn_drive_set_buffer_waiting (struct burn_drive *d, int enable, int min_usec, int max_usec, int timeout_sec, int min_percent, int max_percent)
 
int burn_drive_reset_simulate (struct burn_drive *d, int simulate)
 
int burn_msf_to_sectors (int m, int s, int f)
 
void burn_sectors_to_msf (int sectors, int *m, int *s, int *f)
 
int burn_drive_get_read_speed (struct burn_drive *d)
 
int burn_drive_get_write_speed (struct burn_drive *d)
 
int burn_drive_get_min_write_speed (struct burn_drive *d)
 
int burn_drive_add_whitelist (char *device_address)
 
void burn_drive_clear_whitelist (void)
 
int burn_drive_is_banned (char *device_address)
 
int burn_drive_whitelist_count (void)
 
char * burn_drive_whitelist_item (int idx, int flag)
 
static int burn_role_by_access (char *fname, int flag)
 
int burn_drive_grab_dummy (struct burn_drive_info *drive_infos[], char *fname)
 
int burn_drive_scan_and_grab (struct burn_drive_info *drive_infos[], char *adr, int load)
 
int burn_drive_adr_debug_msg (char *fmt, char *arg)
 
int burn_drive_d_get_adr (struct burn_drive *d, char adr[])
 
int burn_drive_get_adr (struct burn_drive_info *drive_info, char adr[])
 
int burn_drive_is_enumerable_adr (char *adr)
 
int burn_drive_resolve_link (char *path, char adr[], int *recursion_count, int flag)
 
int burn_drive_find_devno (dev_t devno, char adr[])
 
int burn_drive_obtain_scsi_adr (char *path, int *bus_no, int *host_no, int *channel_no, int *target_no, int *lun_no)
 
int burn_drive_convert_scsi_adr (int bus_no, int host_no, int channel_no, int target_no, int lun_no, char adr[])
 
int burn_drive_find_scsi_equiv (char *path, char adr[])
 
int burn_drive_convert_fs_adr_sub (char *path, char adr[], int *rec_count)
 
int burn_drive_convert_fs_adr (char *path, char adr[])
 
int burn_lookup_device_link (char *dev_adr, char link_adr[], char *dir_adr, char **ranks, int rank_count, int flag)
 
int burn_abort_pacifier (void *handle, int patience, int elapsed)
 
int burn_abort_5 (int patience, int(*pacifier_func)(void *handle, int patience, int elapsed), void *handle, int elapsed, int flag)
 
int burn_abort (int patience, int(*pacifier_func)(void *handle, int patience, int elapsed), void *handle)
 
int burn_drive_get_start_end_lba (struct burn_drive *d, int *start_lba, int *end_lba, int flag)
 
int burn_disc_pretend_blank (struct burn_drive *d)
 
int burn_disc_pretend_full (struct burn_drive *d)
 
int burn_disc_pretend_full_uncond (struct burn_drive *d)
 
int burn_disc_read_atip (struct burn_drive *d)
 
int burn_disc_track_lba_nwa (struct burn_drive *d, struct burn_write_opts *o, int trackno, int *lba, int *nwa)
 
int burn_disc_get_msc1 (struct burn_drive *d, int *start)
 
off_t burn_disc_available_space (struct burn_drive *d, struct burn_write_opts *o)
 
int burn_disc_get_profile (struct burn_drive *d, int *pno, char name[80])
 
int burn_drive_get_all_profiles (struct burn_drive *d, int *num_profiles, int profiles[64], char is_current[64])
 
int burn_obtain_profile_name (int profile_number, char name[80])
 
int burn_drive_wrote_well (struct burn_drive *d)
 
int burn_speed_descriptor_new (struct burn_speed_descriptor **s, struct burn_speed_descriptor *prev, struct burn_speed_descriptor *next, int flag)
 
int burn_speed_descriptor_destroy (struct burn_speed_descriptor **s, int flag)
 
int burn_speed_descriptor_copy (struct burn_speed_descriptor *from, struct burn_speed_descriptor *to, int flag)
 
int burn_mdata_free_subs (struct scsi_mode_data *m)
 
int burn_drive_get_speedlist (struct burn_drive *d, struct burn_speed_descriptor **speed_list)
 
int burn_drive_get_best_speed (struct burn_drive *d, int speed_goal, struct burn_speed_descriptor **best_descr, int flag)
 
int burn_drive_free_speedlist (struct burn_speed_descriptor **speed_list)
 
int burn_disc_get_multi_caps (struct burn_drive *d, enum burn_write_types wt, struct burn_multi_caps **caps, int flag)
 
int burn_disc_free_multi_caps (struct burn_multi_caps **caps)
 
int burn_disc_get_write_mode_demands (struct burn_disc *disc, struct burn_write_opts *opts, struct burn_disc_mode_demands *result, int flag)
 
int burn_drive_get_drive_role (struct burn_drive *d)
 
static int burn__split_path (char *adr, char **dpt, char **npt)
 
int burn_drive_equals_adr (struct burn_drive *d1, char *adr2_in, int role2)
 
int burn_drive_find_by_thread_pid (struct burn_drive **d, pid_t pid, pthread_t tid)
 
int burn_drive_set_media_capacity_remaining (struct burn_drive *d, off_t value)
 
int burn_get_read_capacity (struct burn_drive *d, int *capacity, int flag)
 
int burn_disc_get_media_id (struct burn_drive *d, char **product_id, char **media_code1, char **media_code2, char **book_type, int flag)
 
int burn_disc_get_cd_info (struct burn_drive *d, char disc_type[80], unsigned int *disc_id, char bar_code[9], int *app_code, int *valid)
 
int burn_disc_get_bd_spare_info (struct burn_drive *d, int *alloc_blocks, int *free_blocks, int flag)
 
int burn_disc_get_phys_format_info (struct burn_drive *d, int *disk_category, char **book_name, int *part_version, int *num_layers, int *num_blocks, int flag)
 
int burn_disc_next_track_is_damaged (struct burn_drive *d, int flag)
 
int burn_disc_get_leadin_text (struct burn_drive *d, unsigned char **text_packs, int *num_packs, int flag)
 
int burn_drive_was_feat21_failure (struct burn_drive *d)
 
int burn_feature_descr_new (struct burn_feature_descr **new, unsigned char *descr, int descr_len, int flag)
 
int burn_feature_descr_free (struct burn_feature_descr **descr, int flag)
 
int burn_drive_has_feature (struct burn_drive *d, int feature_code, struct burn_feature_descr **descr, int flag)
 
int burn_drive_get_serial_no (struct burn_drive *d, char **sno, int *sno_len)
 
int burn_drive_get_media_sno (struct burn_drive *d, char **sno, int *sno_len)
 
int burn_drive_get_bd_r_pow (struct burn_drive *d)
 
int burn_drive_set_immed (struct burn_drive *drive, int enable)
 
int burn_drive_get_immed (struct burn_drive *drive)
 
int burn_drive_get_feature (struct burn_drive *d, unsigned int feature_code, unsigned char *flags, unsigned char *additional_length, unsigned char **feature_data, char **feature_text)
 
void burn_drive_get_feature_codes (struct burn_drive *d, int *count, unsigned int **feature_codes)
 

Variables

struct libdax_msgs * libdax_messenger
 
static struct burn_drive drive_array [255]
 
static int drivetop = -1
 
int burn_support_untested_profiles
 
int burn_drive_role_4_allowed
 
static char * enumeration_whitelist [255]
 
static int enumeration_whitelist_top = -1
 

Macro Definition Documentation

◆ BURN_DRIVE_MAX_LINK_DEPTH

#define BURN_DRIVE_MAX_LINK_DEPTH   20

Definition at line 2050 of file drive.c.

◆ Libburn_ticket_62_re_register_is_possiblE

#define Libburn_ticket_62_re_register_is_possiblE   1

Definition at line 538 of file drive.c.

◆ O_BINARY

#define O_BINARY   0

Definition at line 32 of file drive.c.

◆ O_LARGEFILE

#define O_LARGEFILE   0

Function Documentation

◆ burn__split_path()

static int burn__split_path ( char *  adr,
char **  dpt,
char **  npt 
)
static

Definition at line 3213 of file drive.c.

Referenced by burn_drive_equals_adr().

◆ burn_abort()

int burn_abort ( int  patience,
int(*)(void *handle, int patience, int elapsed)  pacifier_func,
void *  handle 
)

Abort any running drive operation and finish libburn.

Parameters
patienceMaximum number of seconds to wait for drives to finish
pacifier_funcFunction to produce appeasing messages. See burn_abort_pacifier() for an example.
Returns
1 ok, all went well 0 had to leave a drive in unclean state <0 severe error, do no use libburn again

Definition at line 2557 of file drive.c.

References burn_abort_5().

Referenced by burn_abort_exit(), burn_finish(), burn_init_catch_on_abort(), and Xorriso_abort().

◆ burn_abort_5()

int burn_abort_5 ( int  patience,
int(*)(void *handle, int patience, int elapsed)  pacifier_func,
void *  handle,
int  elapsed,
int  flag 
)

◆ burn_abort_pacifier()

int burn_abort_pacifier ( void *  handle,
int  patience,
int  elapsed 
)

A pacifier function suitable for burn_abort.

Parameters
handleIf not NULL, a pointer to a text suitable for printf("%s")

Definition at line 2432 of file drive.c.

Referenced by burn_abort_exit(), burn_builtin_abort_handler(), burn_finish(), burn_init_catch_on_abort(), and Xorriso_abort().

◆ burn_disc_available_space()

off_t burn_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. For inquiring the space with such a set of options, the drive has to be grabbed and BURN_DRIVE_IDLE. If not, then one will only get a canned value from the most recent automatic inquiry (e.g. during last drive grabbing). An eventual start address from burn_write_opts_set_start_byte() will be taken into respect with the capacity estimation. Negative results get defaulted to 0. If the drive is actually a file in a large filesystem or a large block device, then the capacity is curbed to a maximum of 0x7ffffff0 blocks = 4 TB - 32 KB.

Parameters
dThe drive to query.
oIf not NULL: write parameters to be set on drive before query
Returns
number of most probably available free bytes
Since
0.3.4

Definition at line 2711 of file drive.c.

References BURN_DRIVE_IDLE, burn_drive_is_released(), burn_drive_set_media_capacity_remaining(), burn_os_stdio_capacity(), burn_drive::busy, burn_drive::devname, burn_drive::drive_role, burn_drive::get_nwa, burn_drive::media_capacity_remaining, burn_drive::send_write_parameters, and burn_write_opts::start_byte.

Referenced by isoburn_disc_available_space(), and Xorriso_sanitize_image_size().

◆ burn_disc_erasable()

int burn_disc_erasable ( struct burn_drive d)

Tells whether a disc can be erased or not

Parameters
dThe drive to inquire.
Returns
Non-zero means erasable

Definition at line 1135 of file drive.c.

References burn_drive::erasable.

Referenced by isoburn_disc_erasable(), Xorriso_atip(), and Xorriso_burn_track().

◆ burn_disc_erase_sync()

◆ burn_disc_format_sync()

◆ burn_disc_free_multi_caps()

int burn_disc_free_multi_caps ( struct burn_multi_caps **  caps)

Removes from memory a multi session info structure which was returned by burn_disc_get_multi_caps(). The pointer *caps gets set to NULL.

Parameters
capsthe info structure to dispose (note: pointer to pointer)
Returns
0 : *caps was already NULL, 1 : memory object was disposed
Since
0.3.2

Definition at line 3129 of file drive.c.

Referenced by isoburn_disc_erase(), isoburn_set_start_byte(), isoburn_welcome_media(), Xorriso_check_media(), Xorriso_check_multi(), Xorriso_toc(), and Xorriso_truncate_overwritable().

◆ burn_disc_get_bd_spare_info()

int burn_disc_get_bd_spare_info ( struct burn_drive d,
int *  alloc_blocks,
int *  free_blocks,
int  flag 
)

Read the current usage of the eventual BD Spare Area. This area gets reserved on BD media during formatting. During writing it is used to host replacements of blocks which failed the checkread immediately after writing. This call applies only to recordable BD media. I.e. profiles 0x41 to 0x43.

Parameters
dThe drive to query.
alloc_blocksReturns the number of blocks reserved as Spare Area
free_blocksReturns the number of yet unused blocks in that area
flagBitfield for control purposes (unused yet, submit 0)
Returns
1 = reply prarameters are valid, <=0 = reply is invalid (e.g. because no BD profile)
Since
0.8.8

Definition at line 3482 of file drive.c.

References burn_drive_get_drive_role(), and mmc_get_bd_spare_info().

Referenced by Xorriso_list_formats().

◆ burn_disc_get_cd_info()

int burn_disc_get_cd_info ( struct burn_drive d,
char  disc_type[80],
unsigned int *  disc_id,
char  bar_code[9],
int *  app_code,
int *  valid 
)
Parameters
validReplies bits which indicate the validity of other reply parameters or the state of certain CD info bits: bit0= disc_type valid bit1= disc_id valid bit2= bar_code valid bit3= disc_app_code valid bit4= Disc is unrestricted (URU bit) bit5= Disc is nominally erasable (Erasable bit) This will be set with overwritable media which libburn normally considers to be unerasable blank.

Definition at line 3459 of file drive.c.

References burn_drive::disc_app_code, burn_drive::disc_bar_code, burn_drive::disc_id, burn_drive::disc_info_valid, and burn_drive::disc_type.

◆ burn_disc_get_format_descr()

int burn_disc_get_format_descr ( struct burn_drive drive,
int  index,
int *  type,
off_t *  size,
unsigned *  tdp 
)

Inquire parameters of an available media format.

Parameters
driveThe drive with the disc to format.
indexThe index of the format item. Beginning with 0 up to reply parameter from burn_disc_get_formats() : num_formats - 1
typeThe format type. See mmc5r03c.pdf, 6.5, 04h FORMAT UNIT. 0x00=full, 0x10=CD-RW/DVD-RW full, 0x11=CD-RW/DVD-RW grow, 0x15=DVD-RW quick, 0x13=DVD-RW quick grow, 0x26=DVD+RW background, 0x30=BD-RE with spare areas, 0x31=BD-RE without spare areas
sizeThe maximum size in bytes achievable with this format.
tdpType Dependent Parameter. See mmc5r03c.pdf.
Returns
1 reply is valid , <=0 failure
Since
0.3.0

Definition at line 1104 of file drive.c.

References burn_drive::format_descriptors, burn_drive::num_format_descr, burn_format_descr::size, burn_format_descr::tdp, and burn_format_descr::type.

Referenced by burn_disc_get_multi_caps(), and Xorriso_list_formats().

◆ burn_disc_get_formats()

int burn_disc_get_formats ( struct burn_drive drive,
int *  status,
off_t *  size,
unsigned *  bl_sas,
int *  num_formats 
)

Inquire the formatting status, the associated sizes and the number of available formats. The info is media specific and stems from MMC command 23h READ FORMAT CAPACITY. See mmc5r03c.pdf 6.24 for background details. Media type can be determined via burn_disc_get_profile().

Parameters
driveThe drive with the disc to format.
statusThe current formatting status of the inserted media. See BURN_FORMAT_IS_* macros. Note: "unknown" is the legal status for quick formatted, yet unwritten DVD-RW.
sizeThe size in bytes associated with status. unformatted: the maximum achievable size of the media formatted: the currently formatted capacity unknown: maximum capacity of drive or of media
bl_sasAdditional info "Block Length/Spare Area Size". Expected to be constantly 2048 for non-BD media.
num_formatsThe number of available formats. To be used with burn_disc_get_format_descr() to obtain such a format and eventually with burn_disc_format() to select one.
Returns
1 reply is valid , <=0 failure
Since
0.3.0

Definition at line 1081 of file drive.c.

References burn_drive::drive_role, burn_drive::format_curr_blsas, burn_drive::format_curr_max_size, burn_drive::format_descr_type, burn_drive::num_format_descr, and burn_drive::read_format_capacities.

Referenced by burn_disc_get_multi_caps(), isoburn_is_intermediate_dvd_rw(), Xorriso_auto_format(), Xorriso_blank_as_needed(), Xorriso_format_media(), Xorriso_list_formats(), and Xorriso_toc().

◆ burn_disc_get_leadin_text()

int burn_disc_get_leadin_text ( struct burn_drive d,
unsigned char **  text_packs,
int *  num_packs,
int  flag 
)

Read the array of CD-TEXT packs from the Lead-in of an audio CD. Each pack consists of 18 bytes, of which 4 are header. 12 bytes are pieces of 0-terminated texts or binary data. 2 bytes hold a CRC. For a description of the format of the array, see file doc/cdtext.txt.

Parameters
dThe drive to query.
text_packsWill point to an allocated memory buffer with CD-TEXT. It will only contain text packs, and not be prepended by the TOC header of four bytes, which gets stored with file cdtext.dat by cdrecord -vv -toc. (The first two of these bytes are supposed to hold the number of CD-TEXT bytes + 2. The other two bytes are supposed to be 0.) Dispose this buffer by free(), when no longer needed.
num_packsWill tell the number of text packs, i.e. the number of bytes in text_packs divided by 18.
flagBitfield for control purposes, Unused yet. Submit 0.
Returns
1 success, 0= no CD-TEXT found, < 0 an error occurred
Since
1.2.0

Definition at line 3522 of file drive.c.

References mmc_get_leadin_text().

◆ burn_disc_get_media_id()

int burn_disc_get_media_id ( struct burn_drive d,
char **  product_id,
char **  media_code1,
char **  media_code2,
char **  book_type,
int  flag 
)

Obtain product id and standards defined media codes. The product id is a printable string which is supposed to be the same for identical media but should vary with non-identical media. Some media cannot provide such an id at all. The pair (profile_number, product_id) should be the best id to identify media with identical product specifications. The reply parameters media_code1 and media_code2 can be used with burn_guess_manufacturer() The reply parameters have to be disposed by free() when no longer needed.

Parameters
dThe drive where the media is inserted.
product_idReply: Printable text depicting manufacturer and eventually media id.
media_code1Reply: The eventual manufacturer identification as read from DVD/BD media or a text "XXmYYsZZf" from CD media ATIP lead-in.
media_code2The eventual media id as read from DVD+/BD media or a text "XXmYYsZZf" from CD ATIP lead-out.
book_typeBook type text for DVD and BD. Caution: is NULL with CD, even if return value says ok.
flagBitfield for control purposes bit0= do not escape " _/" (not suitable for burn_guess_manufacturer())
Returns
1= ok, product_id and media codes are valid, 0= no product id_available, reply parameters are NULL <0= error
Since
0.7.2

Definition at line 3430 of file drive.c.

References burn_drive_get_drive_role(), and mmc_get_media_product_id().

Referenced by Xorriso_atip(), and Xorriso_media_product().

◆ burn_disc_get_msc1()

int burn_disc_get_msc1 ( struct burn_drive d,
int *  start_lba 
)

Read start lba of the first track in the last complete session. This is the first parameter of mkisofs option -C. The second parameter is nwa as obtained by burn_disc_track_lba_nwa() with trackno 0.

Parameters
dThe drive to query.
start_lbareturns the start address of that track
Returns
<= 0 : failure, 1 = ok
Since
0.3.2

Definition at line 2682 of file drive.c.

References BURN_DRIVE_IDLE, burn_drive_is_released(), burn_drive::busy, burn_drive::drive_role, burn_drive::global_index, libdax_messenger, LIBDAX_MSGS_PRIO_HIGH, LIBDAX_MSGS_SEV_FATAL, libdax_msgs_submit(), and burn_drive::read_multi_session_c1.

Referenced by isoburn_disc_get_msc1().

◆ burn_disc_get_multi_caps()

int burn_disc_get_multi_caps ( struct burn_drive d,
enum burn_write_types  wt,
struct burn_multi_caps **  caps,
int  flag 
)

Allocates a struct burn_multi_caps (see above) and fills it with values which are appropriate for the drive and the loaded media. The drive must be grabbed for this call. The returned structure has to be disposed via burn_disc_free_multi_caps() when no longer needed.

Parameters
dThe drive to inquire
wtWith BURN_WRITE_NONE the best capabilities of all write modes get returned. If set to a write mode like BURN_WRITE_SAO the capabilities with that particular mode are returned and the return value is 0 if the desired mode is not possible.
capsreturns the info structure
flagBitfield for control purposes (unused yet, submit 0)
Returns
< 0 : error , 0 : writing seems impossible , 1 : writing possible
Since
0.3.2

Definition at line 2947 of file drive.c.

References burn_multi_caps::advised_write_mode, burn_drive::best_format_size, burn_drive::block_types, BURN_DISC_APPENDABLE, BURN_DISC_BLANK, burn_disc_get_format_descr(), burn_disc_get_formats(), burn_disc_get_status(), BURN_DISC_UNGRABBED, burn_drive_set_media_capacity_remaining(), BURN_FORMAT_IS_FORMATTED, burn_os_stdio_capacity(), BURN_WRITE_NONE, BURN_WRITE_RAW, BURN_WRITE_SAO, BURN_WRITE_TAO, burn_drive::current_has_feat21h, burn_multi_caps::current_is_cd_profile, burn_drive::current_is_cd_profile, burn_multi_caps::current_profile, burn_drive::current_profile, burn_drive::devname, burn_drive::drive_role, burn_drive::mdata, burn_drive::media_capacity_remaining, burn_multi_caps::might_do_raw, burn_multi_caps::might_do_sao, burn_multi_caps::might_do_tao, burn_multi_caps::might_simulate, burn_multi_caps::multi_session, burn_multi_caps::multi_track, scsi_mode_data::p2a_valid, burn_multi_caps::selected_write_mode, scsi_mode_data::simulate, burn_multi_caps::start_adr, burn_multi_caps::start_alignment, burn_multi_caps::start_range_high, and burn_multi_caps::start_range_low.

Referenced by isoburn_disc_erase(), isoburn_set_start_byte(), isoburn_welcome_media(), Xorriso_check_media(), Xorriso_check_multi(), Xorriso_toc(), and Xorriso_truncate_overwritable().

◆ burn_disc_get_phys_format_info()

int burn_disc_get_phys_format_info ( struct burn_drive d,
int *  disk_category,
char **  book_name,
int *  part_version,
int *  num_layers,
int *  num_blocks,
int  flag 
)

Retrieve some media information which is mainly specific to media of the DVD-R family: DVD-R , DVD-RW , DVD-R DL , HD DVD-R Currently the information cannot be retrieved from other media types.

Parameters
dThe drive to query.
disk_categoryreturns DVD Book to which the media complies
book_namereturns a pointer to the book name of disk_category. This memory is static. Do not alter or free it !
part_versionreturns the Media Version in the DVD Book
num_layersreturns the number of media layers
num_blocksreturns the number of blocks between pysical start and physical end of the media
flagBitfield for control purposes (unused yet, submit 0)
Returns
1 = reply prarameters are valid, <=0 = reply is invalid (e.g. because no DVD-R)
Since
1.1.4

Definition at line 3496 of file drive.c.

References burn_drive_get_drive_role(), and mmc_get_phys_format_info().

Referenced by Xorriso_toc().

◆ burn_disc_get_profile()

int burn_disc_get_profile ( struct burn_drive d,
int *  pno,
char  name[80] 
)

Tells the MMC Profile identifier of the loaded media. The drive must be grabbed in order to get a non-zero result. libburn currently writes only to profiles 0x09 "CD-R" 0x0a "CD-RW" 0x11 "DVD-R sequential recording" 0x12 "DVD-RAM" 0x13 "DVD-RW restricted overwrite" 0x14 "DVD-RW sequential recording", 0x15 "DVD-R/DL sequential recording", 0x1a "DVD+RW" 0x1b "DVD+R", 0x2b "DVD+R/DL", 0x41 "BD-R sequential recording", 0x43 "BD-RE", 0xffff "stdio file" Note: 0xffff is not a MMC profile but a libburn invention. Read-only are the profiles 0x08 "CD-ROM", 0x10 "DVD-ROM", 0x40 "BD-ROM", Read-only for now is this BD-R profile (testers wanted) 0x42 "BD-R random recording" Empty drives are supposed to report 0x00 ""

Parameters
dThe drive where the media is inserted.
pnoProfile Number. See also mmc5r03c.pdf, table 89
nameProfile Name (see above list, unknown profiles have empty name)
Returns
1 profile is valid, 0 no profile info available
Since
0.3.0

Definition at line 2750 of file drive.c.

References burn_drive::current_profile, and burn_drive::current_profile_text.

Referenced by isoburn_is_intermediate_dvd_rw(), isoburn_is_overwritable(), isoburn_welcome_media(), Xorriso_atip(), Xorriso_auto_format(), Xorriso_blank_as_needed(), Xorriso_blank_media(), Xorriso_check_interval(), Xorriso_check_media(), Xorriso_check_multi(), Xorriso_format_media(), Xorriso_get_profile(), Xorriso_list_formats(), Xorriso_make_write_options(), Xorriso_media_product(), Xorriso_sanitize_image_size(), Xorriso_set_speed(), and Xorriso_toc().

◆ burn_disc_get_status()

enum burn_disc_status burn_disc_get_status ( struct burn_drive drive)

Returns what kind of disc a drive is holding. This function may need to be called more than once to get a proper status from it. See burn_disc_status for details.

Parameters
driveThe drive to query for a disc.
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 1104 of file drive.c.

Referenced by burn_disc_get_multi_caps(), burn_disc_get_write_mode_demands(), isoburn_disc_erase(), isoburn_start_emulation(), isoburn_welcome_media(), Xorriso_atip(), Xorriso_burn_track(), Xorriso_msinfo(), and Xorriso_write_session().

◆ burn_disc_get_write_mode_demands()

◆ burn_disc_next_track_is_damaged()

int burn_disc_next_track_is_damaged ( struct burn_drive d,
int  flag 
)

Tells whether a previous attempt to determine the Next Writeable Address of the upcoming track reveiled that the READ TRACK INFORMATION Damage Bit is set for this track and that no valid writable address is available. See MMC-5 6.27.3.7 Damage Bit, 6.27.3.11 NWA_V (NWA valid)

Parameters
dThe drive to query.
flagBitfield for control purposes (unused yet, submit 0)
Returns
0= Looks ok: Damage Bit is not set, NWA_V is set 1= Damaged and theoretically writable (NWA_V is set) 2= Not writable: NWA_V is not set 3= Damaged and not writable (NWA_V is not set),
Since
1.1.0

Definition at line 3513 of file drive.c.

References burn_drive::next_track_damaged.

Referenced by Xorriso_toc().

◆ burn_disc_pretend_blank()

int burn_disc_pretend_blank ( struct burn_drive drive)

WARNING: This revives an old bug-like behavior that might be dangerous. Sets the drive status to BURN_DISC_BLANK if it is BURN_DISC_UNREADY or BURN_DISC_UNSUITABLE. Thus marking media as writable which actually failed to declare themselves either blank or (partially) filled.

Returns
1 drive status has been set , 0 = unsuitable drive status
Since
0.2.6

Definition at line 2585 of file drive.c.

References BURN_DISC_BLANK, BURN_DISC_UNREADY, BURN_DISC_UNSUITABLE, burn_drive::drive_role, and burn_drive::status.

◆ burn_disc_pretend_full()

int burn_disc_pretend_full ( struct burn_drive drive)

WARNING: This overrides the safety measures against unsuitable media. Sets the drive status to BURN_DISC_FULL if it is BURN_DISC_UNREADY or BURN_DISC_UNSUITABLE. Thus marking media as blankable which actually failed to declare themselves either blank or (partially) filled.

Since
0.2.6

Definition at line 2597 of file drive.c.

References BURN_DISC_FULL, BURN_DISC_UNREADY, BURN_DISC_UNSUITABLE, burn_drive::drive_role, and burn_drive::status.

◆ burn_disc_pretend_full_uncond()

int burn_disc_pretend_full_uncond ( struct burn_drive drive)

WARNING: This overrides the safety measures against unsuitable media. Sets the drive status to BURN_DISC_FULL unconditionally.

Since
1.3.4

Definition at line 2609 of file drive.c.

References BURN_DISC_FULL, and burn_drive::status.

Referenced by isoburn_disc_pretend_full_uncond().

◆ burn_disc_read_atip()

int burn_disc_read_atip ( struct burn_drive drive)

◆ burn_disc_track_lba_nwa()

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

Read start lba and Next Writeable Address of a track from media. Usually a track lba is obtained from the result of burn_track_get_entry(). This call retrieves an updated lba, eventual nwa, and can address the invisible track to come. The drive must be grabbed for this call. One may not issue this call during ongoing burn_disc_write() or burn_disc_erase().

Parameters
dThe drive to query.
oIf not NULL: write parameters to be set on drive before query
trackno0=next track to come, >0 number of existing track The first existing track on a CD may have a number higher than 1. Use burn_session_get_start_tno() to inquire this start number.
lbareturn value: start lba
nwareturn value: Next Writeable Address
Returns
1=nwa is valid , 0=nwa is not valid , -1=error
Since
0.2.6

Definition at line 2645 of file drive.c.

References BURN_DISC_APPENDABLE, BURN_DRIVE_IDLE, burn_drive_is_released(), burn_drive::busy, burn_drive::drive_role, burn_drive::get_nwa, burn_drive::global_index, libdax_messenger, LIBDAX_MSGS_PRIO_HIGH, LIBDAX_MSGS_SEV_FATAL, libdax_msgs_submit(), burn_drive::role_5_nwa, burn_drive::send_write_parameters, and burn_drive::status.

Referenced by isoburn_disc_track_lba_nwa(), isoburn_start_emulation(), isoburn_welcome_media(), and Xorriso_toc().

◆ burn_drive__fd_from_special_adr()

int burn_drive__fd_from_special_adr ( char *  adr)

◆ burn_drive__is_rdwr()

static int burn_drive__is_rdwr ( char *  fname,
int *  stat_ret,
struct stat *  stbuf_ret,
off_t *  read_size_ret,
int  flag 
)
static

◆ burn_drive_add_whitelist()

int burn_drive_add_whitelist ( char *  device_address)

Add a device to the list of permissible drives. As soon as some entry is in the whitelist all non-listed drives are banned from enumeration.

Returns
1 success, <=0 failure

Definition at line 1700 of file drive.c.

References BURN_DRIVE_WHITELIST_LEN, enumeration_whitelist, and enumeration_whitelist_top.

Referenced by burn_drive_scan_and_grab().

◆ burn_drive_adr_debug_msg()

int burn_drive_adr_debug_msg ( char *  fmt,
char *  arg 
)

Simple debug message frontend to libdax_msgs_submit(). If arg is not NULL, then fmt MUST contain exactly one s and no other sprintf() %-formatters.

Definition at line 1993 of file drive.c.

References BURN_ALLOC_MEM, BURN_FREE_MEM, libdax_messenger, LIBDAX_MSGS_PRIO_ZERO, LIBDAX_MSGS_SEV_DEBUG, and libdax_msgs_submit().

Referenced by burn_drive_convert_fs_adr_sub(), burn_drive_convert_scsi_adr(), burn_drive_find_devno(), burn_drive_find_scsi_equiv(), and burn_drive_resolve_link().

◆ burn_drive_cancel()

void burn_drive_cancel ( struct burn_drive drive)

Cancel an operation on a drive. This will only work when the drive's busy state is BURN_DRIVE_READING or BURN_DRIVE_WRITING.

Parameters
driveThe drive on which to cancel the current operation.

Definition at line 1227 of file drive.c.

References burn_drive::cancel, libdax_messenger, LIBDAX_MSGS_PRIO_ZERO, LIBDAX_MSGS_SEV_DEBUG, and libdax_msgs_submit().

Referenced by burn_abort_5(), isoburn_disc_erase(), isoburn_disc_write(), and Xorriso_check_burn_abort().

◆ burn_drive_clear_whitelist()

void burn_drive_clear_whitelist ( void  )

Remove all drives from whitelist. This enables all possible drives.

Definition at line 1715 of file drive.c.

References enumeration_whitelist, and enumeration_whitelist_top.

Referenced by burn_drive_scan_and_grab(), burn_finish(), and Xorriso_show_devices().

◆ burn_drive_convert_fs_adr()

int burn_drive_convert_fs_adr ( char *  path,
char  adr[] 
)

Try to convert a given existing filesystem address into a persistent drive address.

Definition at line 2338 of file drive.c.

References burn_drive_convert_fs_adr_sub().

Referenced by burn_drive_equals_adr(), burn_drive_is_listed(), isoburn_drive_aquire(), Xorriso_aquire_drive(), Xorriso_auto_driveadr(), and Xorriso_mount().

◆ burn_drive_convert_fs_adr_sub()

int burn_drive_convert_fs_adr_sub ( char *  path,
char  adr[],
int *  rec_count 
)

Try to convert a given existing filesystem address into a persistent drive address.

Definition at line 2291 of file drive.c.

References burn_drive_adr_debug_msg(), BURN_DRIVE_ADR_LEN, burn_drive_find_devno(), burn_drive_find_scsi_equiv(), burn_drive_is_enumerable_adr(), and burn_drive_resolve_link().

Referenced by burn_drive_convert_fs_adr(), and burn_drive_resolve_link().

◆ burn_drive_convert_scsi_adr()

int burn_drive_convert_scsi_adr ( int  bus_no,
int  host_no,
int  channel_no,
int  target_no,
int  lun_no,
char  adr[] 
)

Try to convert a given SCSI address of bus,host,channel,target,lun into a drive device file address. If a SCSI address component parameter is < 0 then it is not decisive and the first enumerated address which matches the >= 0 parameters is taken as result. Note: bus and (host,channel) are supposed to be redundant.

Parameters
bus_no"Bus Number" (something like a virtual controller)
host_no"Host Number" (something like half a virtual controller)
channel_no"Channel Number" (other half of "Host Number")
target_no"Target Number" or "SCSI Id" (a device)
lun_no"Logical Unit Number" (a sub device)
adrAn application provided array of at least BURN_DRIVE_ADR_LEN characters size. The device file address gets copied to it.
Returns
1 = success , 0 = failure , -1 = severe error
Since
0.2.6

Definition at line 2211 of file drive.c.

References BURN_ALLOC_MEM, burn_drive_adr_debug_msg(), BURN_DRIVE_ADR_LEN, burn_drive_obtain_scsi_adr(), BURN_FREE_MEM, and sg_give_next_adr().

Referenced by burn_drive_find_scsi_equiv().

◆ burn_drive_count()

unsigned int burn_drive_count ( void  )

Definition at line 243 of file drive.c.

References drivetop.

Referenced by burn_drive_scan_sync(), and burn_drives_are_clear().

◆ burn_drive_d_get_adr()

int burn_drive_d_get_adr ( struct burn_drive d,
char  adr[] 
)

◆ burn_drive_equals_adr()

int burn_drive_equals_adr ( struct burn_drive d1,
char *  adr2,
int  drive_role2 
)

Find out whether a given address string would lead to the given drive object. This should be done in advance for track source addresses with parameter drive_role set to 2. Although a real MMC drive should hardly exist as two drive objects at the same time, this can easily happen with stdio-drives. So if more than one drive is used by the application, then this gesture is advised: burn_drive_d_get_adr(d2, adr2); if (burn_drive_equals_adr(d1, adr2, burn_drive_get_drive_role(d2))) ... Both drive objects point to the same storage facility ...

Parameters
d1Existing drive object
adr2Address string to be tested. Prefix "stdio:" overrides parameter drive_role2 by either 0 or 2 as appropriate. The string must be shorter than BURN_DRIVE_ADR_LEN.
drive_role2Role as burn_drive_get_drive_role() would attribute to adr2 if it was a drive. Use value 2 for checking track sources or pseudo-drive addresses without "stdio:". Use 1 for checking drive addresses including those with prefix "stdio:".
Returns
1= adr2 leads to d1 , 0= adr2 seems not to lead to d1, -1 = adr2 is bad
Since
0.4.0

Definition at line 3231 of file drive.c.

References burn__split_path(), BURN_ALLOC_MEM, burn_drive__fd_from_special_adr(), burn_drive__is_rdwr(), BURN_DRIVE_ADR_LEN, burn_drive_convert_fs_adr(), burn_drive_d_get_adr(), burn_drive_get_drive_role(), burn_drive_role_4_allowed, BURN_FREE_MEM, burn_role_by_access(), and burn_drive::devname.

Referenced by Xorriso_aquire_drive().

◆ burn_drive_find_by_thread_pid()

int burn_drive_find_by_thread_pid ( struct burn_drive **  d,
pid_t  pid,
pthread_t  tid 
)

Definition at line 3386 of file drive.c.

References drive_array, and drivetop.

Referenced by burn_builtin_abort_handler().

◆ burn_drive_find_devno()

int burn_drive_find_devno ( dev_t  devno,
char  adr[] 
)

◆ burn_drive_find_scsi_equiv()

int burn_drive_find_scsi_equiv ( char *  path,
char  adr[] 
)

◆ burn_drive_finish_enum()

◆ burn_drive_force_idle()

int burn_drive_force_idle ( struct burn_drive d)

Definition at line 177 of file drive.c.

References BURN_DRIVE_IDLE, and burn_drive::busy.

Referenced by burn_drive_forget().

◆ burn_drive_forget()

int burn_drive_forget ( struct burn_drive d,
int  force 
)

◆ burn_drive_free()

◆ burn_drive_free_all()

void burn_drive_free_all ( void  )

Definition at line 155 of file drive.c.

References burn_drive_free(), drive_array, and drivetop.

Referenced by burn_drive_info_free(), burn_drive_scan_sync(), and burn_finish().

◆ burn_drive_free_speedlist()

int burn_drive_free_speedlist ( struct burn_speed_descriptor **  speed_list)

Dispose a speed descriptor list copy which was obtained by burn_drive_get_speedlist().

Parameters
speed_listThe list copy. *speed_list gets set to NULL.
Returns
1=list disposed , 0= *speedlist was already NULL
Since
0.3.0

Definition at line 2940 of file drive.c.

References burn_speed_descriptor_destroy().

Referenced by Xorriso_list_speeds_sub().

◆ burn_drive_free_subs()

◆ burn_drive_get_adr()

int burn_drive_get_adr ( struct burn_drive_info drive_info,
char  adr[] 
)

Inquire the persistent address of the given drive.

Definition at line 2032 of file drive.c.

References burn_drive_d_get_adr(), and burn_drive_info::drive.

Referenced by Xorriso_show_devices().

◆ burn_drive_get_all_profiles()

int burn_drive_get_all_profiles ( struct burn_drive d,
int *  num_profiles,
int  profiles[64],
char  is_current[64] 
)

Gets the list of profile codes supported by the drive. Profiles depict the feature sets which constitute media types. For known profile codes and names see burn_disc_get_profile().

Parameters
dis the drive to query
num_profilesreturns the number of supported profiles
profilesreturns the profile codes
is_currentreturns the status of the corresponding profile code: 1= current, i.e. the matching media is loaded 0= not current, i.e. the matching media is not loaded
Returns
always 1 for now
Since
0.7.0

Definition at line 2759 of file drive.c.

References burn_drive::all_profiles, and burn_drive::num_profiles.

Referenced by Xorriso_atip(), Xorriso_choose_speed_factor(), and Xorriso_list_profiles().

◆ burn_drive_get_bd_r_pow()

int burn_drive_get_bd_r_pow ( struct burn_drive drive)

Tells whether a BD-R medium with Pseudo Overwrite (POW) formatting is in the drive. Such a formatting may have been applied by dvd+rw-tools. It prevents sequential multi-session. libburn will refuse to write to such a medium.

Parameters
driveThe drive to query.
Returns
1 if BD-R Pseudo Overwrite , 0 if not BD-R or not POW
Since
1.4.8

Definition at line 3676 of file drive.c.

References burn_drive_has_feature(), burn_drive::current_profile, and burn_feature_descr::flags.

Referenced by burn_precheck_write(), Xorriso_atip(), Xorriso_msinfo(), Xorriso_toc(), and Xorriso_write_session().

◆ burn_drive_get_best_speed()

int burn_drive_get_best_speed ( struct burn_drive d,
int  speed_goal,
struct burn_speed_descriptor **  best_descr,
int  flag 
)

Look up the fastest speed descriptor which is not faster than the given speed_goal. If it is 0, then the fastest one is chosen among the descriptors with the highest end_lba. If it is -1 then the slowest speed descriptor is chosen regardless of end_lba. Parameter flag decides whether the speed goal means write speed or read speed.

Parameters
dDrive to query
speed_goalUpper limit for speed, 0=search for maximum speed , -1 search for minimum speed
best_descrResult of the search, NULL if no match
flagBitfield for control purposes bit0= look for best read speed rather than write speed bit1= look for any source type (else look for source==2 first and for any other source type only with CD media)
Returns
>0 indicates a valid best_descr, 0 = no valid best_descr
Since
0.3.8

Definition at line 2891 of file drive.c.

References burn_drive::current_is_cd_profile, burn_speed_descriptor::end_lba, burn_drive::mdata, burn_speed_descriptor::next, burn_speed_descriptor::read_speed, burn_speed_descriptor::source, scsi_mode_data::speed_descriptors, and burn_speed_descriptor::write_speed.

Referenced by mmc_set_speed(), and Xorriso_list_speeds_sub().

◆ burn_drive_get_disc()

struct burn_disc* burn_drive_get_disc ( struct burn_drive d)

Get the drive's disc struct - free when done

Parameters
ddrive to query
Returns
the disc struct or NULL on failure

Definition at line 1586 of file drive.c.

References burn_drive::disc, and burn_disc::refcnt.

Referenced by isoburn_toc_drive_get_disc(), and mmc_read_multi_session_c1().

◆ burn_drive_get_drive_role()

int burn_drive_get_drive_role ( struct burn_drive d)

Inquire whether the drive object is a real MMC drive or a pseudo-drive created by a stdio: address.

Parameters
dThe drive to inquire
Returns
0= null-drive 1= real MMC drive 2= stdio-drive, random access, read-write 3= stdio-drive, sequential, write-only 4= stdio-drive, random access, read-only (only if enabled by burn_allow_drive_role_4()) 5= stdio-drive, random access, write-only (only if enabled by burn_allow_drive_role_4())
Since
0.4.0

Definition at line 3203 of file drive.c.

References burn_drive::drive_role.

Referenced by burn_disc_get_bd_spare_info(), burn_disc_get_media_id(), burn_disc_get_phys_format_info(), burn_drive_equals_adr(), isoburn_activate_session(), isoburn_disc_erase(), isoburn_disc_track_lba_nwa(), isoburn_disc_write(), isoburn_emulate_toc(), isoburn_read_iso_head(), isoburn_start_emulation(), isoburn_welcome_media(), Xorriso_atip(), Xorriso_blank_media(), Xorriso_burn_track(), Xorriso_check_interval(), Xorriso_format_media(), Xorriso_get_drive_handles(), Xorriso_make_write_options(), Xorriso_toc(), Xorriso_update_iso_lba0(), and Xorriso_write_session().

◆ burn_drive_get_feature()

int burn_drive_get_feature ( struct burn_drive d,
unsigned int  feature_code,
unsigned char *  flags,
unsigned char *  additional_length,
unsigned char **  feature_data,
char **  feature_text 
)

Obtains the fields and data of a particular feature which were obtained from the drive when it was last acquired or re-assessed. See MMC specs for full detail.

Parameters
dDrive to query
feature_codeA number as learned by burn_drive_get_feature_codes()
flagsReturns byte 2 of the feature descriptor: bit0= Current bit1= Persistent bit2-5= Version
additional_lengthReturns byte 3 of descriptor. This is the size of feature_data.
feature_dataReturns further bytes of descriptor. If returned *feature_data is not NULL, dispose it by free() when it is no longer needed.
feature_textReturns text representation of the feature descriptor: Code +/- : Name : Version,P/N : Hex bytes : Parsed info Current features are marked by "+", others by "-". Persistent features are marked by "P", others by "N". feature_text may be submitted as NULL. In this case no text is generated and returned. If returned *feature_text is not NULL, dispose it by free() when it is no longer needed.
Returns
0 feature descriptor is not present -1 out of memory >0 success
Since
1.5.2

Definition at line 3702 of file drive.c.

References BURN_ALLOC_MEM, burn_drive_has_feature(), burn_make_feature_text(), burn_feature_descr::data, burn_feature_descr::data_lenght, burn_feature_descr::feature_code, and burn_feature_descr::flags.

◆ burn_drive_get_feature_codes()

void burn_drive_get_feature_codes ( struct burn_drive d,
int *  count,
unsigned int **  feature_codes 
)

Obtains the list of SCSI Feature Codes from feature descriptors which were obtained from the drive when it was most recently acquired or re-assessed.

Parameters
dDrive to query
countReturns the number of allocated elements in feature_codes
feature_codesReturns the allocated array of feature codes. If returned *feature_codes is not NULL, dispose it by free() when it is no longer needed.
Since
1.5.2

Definition at line 3739 of file drive.c.

References BURN_ALLOC_MEM_VOID, burn_feature_descr::feature_code, burn_drive::features, and burn_feature_descr::next.

◆ burn_drive_get_immed()

int burn_drive_get_immed ( struct burn_drive drive)

Inquire the current setting of usage of the Immed bit. Either the still set system dependent default or the value set by call burn_drive_set_immed().

Returns
The current value.
Since
1.4.6

Definition at line 3695 of file drive.c.

References burn_drive::do_no_immed.

Referenced by Xorriso_aquire_drive(), Xorriso_blank_media(), and Xorriso_format_media().

◆ burn_drive_get_media_sno()

int burn_drive_get_media_sno ( struct burn_drive d,
char **  sno,
int *  sno_len 
)

Returns the Media Serial Number as of MMC feature 109h and command ABh READ MEDIA SERIAL NUMBER.

Note: This call will return an empty result unless the macro Libburn_enable_scsi_cmd_ABh is defined at compile time. This is because the command READ MEDIA SERIAL NUMBER demands superuser authority on Linux, because no medium with serial number could be tested yet, and because this command made one of the test drives unusable until power cycle when it was executed despite feature 109h was not announced as "current".

Parameters
dThe drive to inquire.
snoReturns the bytes of the serial number. A trailing 0-byte is appended for convenience. There is no warranty that sno contains only non-zero printable bytes. Submit *sno as NULL or pointing to free()-able memory. Apply free() to *sno when no longer needed.
sno_lenReturns the number of valid bytes in returned *sno, not counting the appended trailing 0.
Returns
1= success (but maybe *sno_len is 0), <= 0 severe failure
Since
1.4.2

Definition at line 3631 of file drive.c.

References BURN_ALLOC_MEM, burn_drive_has_feature(), BURN_FREE_MEM, burn_feature_descr::flags, burn_drive::media_serial_number, and burn_drive::media_serial_number_len.

Referenced by Xorriso_toc().

◆ burn_drive_get_min_write_speed()

int burn_drive_get_min_write_speed ( struct burn_drive d)

Gets the minimum write speed for a drive and eventually loaded media. The return value might change by the media type of already loaded media, again by call burn_drive_grab() and again by call burn_disc_read_atip().

Parameters
dDrive to query
Returns
Minimum write speed in K/s
Since
0.2.6

Definition at line 1686 of file drive.c.

References burn_drive::mdata, and scsi_mode_data::min_write_speed.

Referenced by Xorriso_atip(), and Xorriso_list_speeds_sub().

◆ burn_drive_get_read_speed()

int burn_drive_get_read_speed ( struct burn_drive d)

Gets the maximum read speed for a drive

Parameters
dDrive to query
Returns
Maximum read speed in K/s

Definition at line 1675 of file drive.c.

References scsi_mode_data::max_read_speed, and burn_drive::mdata.

◆ burn_drive_get_serial_no()

int burn_drive_get_serial_no ( struct burn_drive d,
char **  sno,
int *  sno_len 
)

Returns the Drive Serial Number as of MMC feature 108h.

Parameters
dThe drive to inquire.
snoReturns the bytes of the serial number. A trailing 0-byte is appended for convenience. MMC specifies ASCII 0x20 to 0x7h as possible byte values. But given drive firmware habits there is no warranty that *sno contains no other byte values. Submit *sno as NULL or pointing to free()-able memory. Apply free() to *sno when no longer needed.
sno_lenReturns the number of valid bytes in returned *sno, not counting the appended trailing 0.
Returns
1= success (but maybe *sno_len is 0), <= 0 severe failure
Since
1.4.2

Definition at line 3610 of file drive.c.

References BURN_ALLOC_MEM, BURN_FREE_MEM, burn_drive::drive_serial_number, and burn_drive::drive_serial_number_len.

Referenced by Xorriso_toc().

◆ burn_drive_get_speedlist()

int burn_drive_get_speedlist ( struct burn_drive d,
struct burn_speed_descriptor **  speed_list 
)

Obtain a copy of the current speed descriptor list. The drive's list gets updated on various occasions such as burn_drive_grab() but the copy obtained here stays untouched. It has to be disposed via burn_drive_free_speedlist() when it is not longer needed. Speeds may appear several times in the list. The list content depends much on drive and media type. It seems that .source == 1 applies mostly to CD media whereas .source == 2 applies to any media.

Parameters
dDrive to query
speed_listThe copy. If empty, *speed_list gets returned as NULL.
Returns
1=success , 0=list empty , <0 severe error
Since
0.3.0

Definition at line 2872 of file drive.c.

References burn_speed_descriptor_copy(), burn_speed_descriptor_new(), burn_drive::mdata, burn_speed_descriptor::next, and scsi_mode_data::speed_descriptors.

Referenced by Xorriso_list_speeds_sub().

◆ burn_drive_get_start_end_lba()

int burn_drive_get_start_end_lba ( struct burn_drive drive,
int *  start_lba,
int *  end_lba,
int  flag 
)

Returns start and end lba of the media which is currently inserted in the given drive. The drive has to be grabbed to have hope for reply. Shortcoming (not a feature): unless burn_disc_read_atip() was called only blank media will return valid info.

Parameters
driveThe drive to query.
start_lbaReturns the start lba value
end_lbaReturns the end lba value
flagBitfield for control purposes (unused yet, submit 0)
Returns
1 if lba values are valid , 0 if invalid
Since
0.2.6

Definition at line 2573 of file drive.c.

References burn_drive::end_lba, and burn_drive::start_lba.

Referenced by mmc_get_media_product_id(), Xorriso_atip(), and Xorriso_toc().

◆ burn_drive_get_status()

enum burn_drive_status burn_drive_get_status ( struct burn_drive drive,
struct burn_progress p 
)

Returns the progress and status of a drive.

Parameters
driveThe drive to query busy state for.
pReturns the progress of the operation, NULL if you don't care
Returns
the current status of the drive. See also burn_drive_status.

Definition at line 1135 of file drive.c.

Referenced by Xorriso_blank_media(), Xorriso_format_media(), and Xorriso_pacifier_loop().

◆ burn_drive_get_write_speed()

int burn_drive_get_write_speed ( struct burn_drive d)

Gets the maximum write speed for a drive and eventually loaded media. The return value might change by the media type of already loaded media, again by call burn_drive_grab() and again by call burn_disc_read_atip().

Parameters
dDrive to query
Returns
Maximum write speed in K/s

Definition at line 1680 of file drive.c.

References scsi_mode_data::max_write_speed, and burn_drive::mdata.

Referenced by Xorriso_atip(), and Xorriso_list_speeds_sub().

◆ burn_drive_grab()

int burn_drive_grab ( struct burn_drive drive,
int  load 
)

Grab a drive. This must be done before the drive can be used (for reading, writing, etc).

Parameters
driveThe drive to grab. This is found in a returned burn_drive_info struct.
loadNonzero to make the drive attempt to load a disc (close its tray door, etc).
Returns
1 if it was possible to grab the drive, else 0

Definition at line 472 of file drive.c.

References BURN_DISC_UNREADY, burn_drive_grab_stdio(), BURN_DRIVE_GRABBING, BURN_DRIVE_IDLE, burn_drive_inquire_media(), burn_drive_send_default_page_05(), burn_grab_prepare_sig_action(), burn_grab_restore_sig_action(), burn_is_aborting(), burn_drive::busy, burn_drive::cancel, burn_drive::drive_role, burn_drive::global_index, burn_drive::grab, libdax_messenger, LIBDAX_MSGS_PRIO_LOW, LIBDAX_MSGS_SEV_FATAL, libdax_msgs_submit(), burn_drive::load, burn_drive::lock, burn_drive::release, burn_drive::released, burn_drive::silent_on_scsi_error, burn_drive::start_unit, burn_drive::status, and burn_drive::unlock.

Referenced by burn_drive_scan_and_grab(), and isoburn_drive_grab().

◆ burn_drive_grab_dummy()

◆ burn_drive_grab_stdio()

◆ burn_drive_has_feature()

int burn_drive_has_feature ( struct burn_drive d,
int  feature_code,
struct burn_feature_descr **  descr,
int  flag 
)

◆ burn_drive_info_forget()

int burn_drive_info_forget ( struct burn_drive_info drive_info,
int  force 
)

Release memory about a single drive and any exclusive lock on it. Become unable to inquire or grab it. Expect FATAL consequences if you try.

Parameters
drive_infopointer to a single element out of the array obtained from burn_drive_scan() : &(drive_infos[driveno])
forcecontrols degree of permissible drive usage at the moment this function is called, and the amount of automatically provided drive shutdown : 0= drive must be ungrabbed and BURN_DRIVE_IDLE 1= try to release drive even if in state BURN_DRIVE_GRABBING Use these two only. Further values are to be defined.
Returns
1 on success, 2 if drive was already forgotten, 0 if not permissible, <0 on other failures,
Since
0.2.2

Definition at line 1522 of file drive.c.

References burn_drive_forget(), and burn_drive_info::drive.

◆ burn_drive_info_free()

void burn_drive_info_free ( struct burn_drive_info  drive_infos[])

When no longer needed, free a whole burn_drive_info array which was returned by burn_drive_scan(). For freeing single drive array elements use burn_drive_info_forget().

Definition at line 1528 of file drive.c.

References burn_drive_free(), burn_drive_free_all(), burn_drive_info::drive, drivetop, and burn_drive::global_index.

Referenced by Xorriso_give_up_drive(), Xorriso_mount(), and Xorriso_show_devices().

◆ burn_drive_inquire_media()

◆ burn_drive_is_banned()

int burn_drive_is_banned ( char *  device_address)

◆ burn_drive_is_enumerable_adr()

int burn_drive_is_enumerable_adr ( char *  adr)

Evaluate whether the given address would be enumerated by libburn

Definition at line 2045 of file drive.c.

References sg_is_enumerable_adr().

Referenced by burn_drive_convert_fs_adr_sub().

◆ burn_drive_is_listed()

int burn_drive_is_listed ( char *  path,
struct burn_drive **  found,
int  flag 
)

◆ burn_drive_is_occupied()

int burn_drive_is_occupied ( struct burn_drive d)

Inquires drive status in respect to degree of app usage.

Parameters
return-2 = drive is forgotten -1 = drive is closed (i.e. released explicitly) 0 = drive is open, not grabbed (after scan, before 1st grab) 1 = drive is grabbed but BURN_DRIVE_IDLE 2 = drive is grabbed, synchronous read/write interrupted 10 = drive is grabbing (BURN_DRIVE_GRABBING) 100 = drive is busy in cancelable state 1000 = drive is in non-cancelable state Expect a monotonous sequence of usage severity to emerge in future.

Definition at line 203 of file drive.c.

References BURN_DRIVE_GRABBING, BURN_DRIVE_IDLE, burn_drive_is_open(), BURN_DRIVE_READING, BURN_DRIVE_READING_SYNC, BURN_DRIVE_WRITING, BURN_DRIVE_WRITING_LEADIN, BURN_DRIVE_WRITING_LEADOUT, BURN_DRIVE_WRITING_PREGAP, BURN_DRIVE_WRITING_SYNC, burn_drive::busy, burn_drive::global_index, and burn_drive::released.

Referenced by burn_abort_5(), and burn_drive_forget().

◆ burn_drive_is_open()

int burn_drive_is_open ( struct burn_drive d)

◆ burn_drive_is_released()

int burn_drive_is_released ( struct burn_drive d)

◆ burn_drive_leave_locked()

int burn_drive_leave_locked ( struct burn_drive d,
int  flag 
)

Like burn_drive_release() but keeping the drive tray closed and its eject button disabled. This physically locked drive state will last until the drive is grabbed again and released via burn_drive_release(). Programs like eject, cdrecord, growisofs will break that ban too.

Parameters
dThe drive to release and leave locked.
flagBitfield for control purposes (unused yet, submit 0)
Returns
1 means success, <=0 means failure
Since
0.4.0

Definition at line 802 of file drive.c.

References burn_drive_release_fl().

◆ burn_drive_mark_unready()

◆ burn_drive_obtain_scsi_adr()

int burn_drive_obtain_scsi_adr ( char *  path,
int *  bus_no,
int *  host_no,
int *  channel_no,
int *  target_no,
int *  lun_no 
)

Try to obtain host,channel,target,lun from path.

Returns
1 = success , 0 = failure , -1 = severe error

Definition at line 2172 of file drive.c.

References BURN_ALLOC_MEM, BURN_DRIVE_ADR_LEN, burn_drive_d_get_adr(), BURN_FREE_MEM, burn_drive::bus_no, burn_drive::channel, drive_array, drivetop, burn_drive::host, burn_drive::id, burn_drive::lun, and sg_obtain_scsi_adr().

Referenced by burn_drive_convert_scsi_adr(), and burn_drive_find_scsi_equiv().

◆ burn_drive_probe_cd_write_modes()

◆ burn_drive_re_assess()

int burn_drive_re_assess ( struct burn_drive d,
int  flag 
)

Re-assess drive and media status. This should be done after a drive underwent a status change and shall be further used without intermediate burn_drive_release(), burn_drive_grab(). E.g. after blanking or burning.

Parameters
dThe already grabbed drive to re-assess.
flagUnused yet. Submit 0.
Returns
1 success , <= 0 could not determine drive and media state
Since
1.1.8

Definition at line 770 of file drive.c.

References burn_drive_grab_stdio(), BURN_DRIVE_GRABBING, BURN_DRIVE_IDLE, burn_drive_inquire_media(), burn_drive_release_fl(), burn_drive_send_default_page_05(), burn_grab_prepare_sig_action(), burn_grab_restore_sig_action(), burn_drive::busy, burn_drive::drive_role, burn_drive::global_index, libdax_messenger, LIBDAX_MSGS_PRIO_HIGH, LIBDAX_MSGS_SEV_SORRY, libdax_msgs_submit(), and burn_drive::released.

Referenced by isoburn_drive_aquire(), and Xorriso_auto_format().

◆ burn_drive_register()

◆ burn_drive_release()

void burn_drive_release ( struct burn_drive drive,
int  eject 
)

Release a drive. This should not be done until the drive is no longer busy (see burn_drive_get_status).

Parameters
driveThe drive to release.
ejectNonzero to make the drive eject the disc in it.

Definition at line 762 of file drive.c.

References burn_drive_release_fl().

Referenced by burn_drive_forget(), isoburn_drive_aquire(), and isoburn_drive_release().

◆ burn_drive_release_fl()

◆ burn_drive_reset_simulate()

int burn_drive_reset_simulate ( struct burn_drive d,
int  simulate 
)

Control the write simulation mode before or after burn_write_opts get into effect. Beginning with version 1.4.8 a burn run by burn_disc_write() brings the burn_drive object in the simulation state as set to the burn_write_opts by burn_write_opts_set_simulate(). This state is respected by call burn_random_access_write() until a new call of burn_disc_write() happens or until burn_drive_reset_simulate() is called. This call may only be made when burn_drive_get_status() returns BURN_DRIVE_IDLE.

Parameters
dThe drive to control
simulate1 enables simulation, 0 enables real writing
Returns
1=success , 0=failure
Since
1.4.8

Definition at line 1649 of file drive.c.

References BURN_DRIVE_IDLE, burn_drive::busy, burn_drive::do_simulate, burn_drive::global_index, libdax_messenger, LIBDAX_MSGS_PRIO_HIGH, LIBDAX_MSGS_SEV_FATAL, and libdax_msgs_submit().

Referenced by Xorriso_overwrite_iso_head().

◆ burn_drive_resolve_link()

int burn_drive_resolve_link ( char *  path,
char  adr[],
int *  recursion_count,
int  flag 
)

◆ burn_drive_scan_and_grab()

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

◆ burn_drive_scan_sync()

int burn_drive_scan_sync ( struct burn_drive_info drives[],
unsigned int *  n_drives,
int  flag 
)

◆ burn_drive_send_default_page_05()

◆ burn_drive_set_buffer_waiting()

int burn_drive_set_buffer_waiting ( struct burn_drive d,
int  enable,
int  min_usec,
int  max_usec,
int  timeout_sec,
int  min_percent,
int  max_percent 
)

Controls the behavior with writing when the drive buffer is suspected to be full. To check and wait for enough free buffer space before writing will move the task of waiting from the operating system's device driver to libburn. While writing is going on and waiting is enabled, any write operation will be checked whether it will fill the drive buffer up to more than max_percent. If so, then waiting will happen until the buffer fill is predicted with at most min_percent. Thus: if min_percent < max_percent then transfer rate will oscillate. This may allow the driver to operate on other devices, e.g. a disk from which to read the input for writing. On the other hand, this checking might reduce maximum throughput to the drive or even get misled by faulty buffer fill replies from the drive. If a setting parameter is < 0, then this setting will stay unchanged by the call. Known burner or media specific pitfalls: To have max_percent larger than the burner's best reported buffer fill has the same effect as min_percent==max_percent. Some burners do not report their full buffer with all media types. Some are not suitable because they report their buffer fill with delay. Some do not go to full speed unless their buffer is full.

Parameters
dThe drive to control
enable0= disable , 1= enable waiting , (-1 = do not change setting)
min_usecShortest possible sleeping period (given in micro seconds)
max_usecLongest possible sleeping period (given in micro seconds)
timeout_secIf a single write has to wait longer than this number of seconds, then waiting gets disabled and mindless writing starts. A value of 0 disables this timeout.
min_percentMinimum of desired buffer oscillation: 25 to 100
max_percentMaximum of desired buffer oscillation: 25 to 100
Returns
1=success , 0=failure
Since
0.3.8

Definition at line 1622 of file drive.c.

References burn_drive::wait_for_buffer_free, burn_drive::wfb_max_percent, burn_drive::wfb_max_usec, burn_drive::wfb_min_percent, burn_drive::wfb_min_usec, and burn_drive::wfb_timeout_sec.

Referenced by Xorriso_make_write_options().

◆ burn_drive_set_immed()

int burn_drive_set_immed ( struct burn_drive drive,
int  enable 
)

Enable or disable use of the Immed bit with long running SCSI commands. If the Immed bit is used, then those SCSI commands end early and leave the drive in not-ready state. libburn then tries periodically whether the drive became ready again. Only then it assumes the command to be completely done. The default setting may depend on the operating system on which libburn was compiled.

Parameters
driveThe drive which will be affected.
enable1= use Immed bit. 0= use no Immed bit. Affected commands can last very long.
Returns
1=success , <=0 failure
Since
1.4.6

Definition at line 3688 of file drive.c.

References burn_drive::do_no_immed.

Referenced by Xorriso_aquire_drive(), and Xorriso_use_immed_bit().

◆ burn_drive_set_media_capacity_remaining()

int burn_drive_set_media_capacity_remaining ( struct burn_drive d,
off_t  value 
)

◆ burn_drive_set_speed()

void burn_drive_set_speed ( struct burn_drive d,
int  read,
int  write 
)

Sets drive read and write speed. Note: "k" is 1000, not 1024. 1xCD = 176.4 k/s, 1xDVD = 1385 k/s, 1xBD = 4496 k/s. Fractional speeds should be rounded up. Like 4xCD = 706.

Parameters
dThe drive to set speed for
readRead speed in k/s (0 is max, -1 is min).
writeWrite speed in k/s (0 is max, -1 is min).

Definition at line 1596 of file drive.c.

References burn_drive::drive_role, burn_drive::nominal_write_speed, and burn_drive::set_speed.

Referenced by Xorriso_make_write_options(), and Xorriso_set_speed().

◆ burn_drive_set_speed_exact()

int burn_drive_set_speed_exact ( struct burn_drive d,
int  read,
int  write 
)

Sets drive read and write speed using the "Exact" bit of SCSI command SET STREAMING. This command will be used even if a CD medium is present. MMC specifies that with the Exact bit the desired speed settings shall either be obeyed by the drive exactly, or that the drive shall indicate failure and not accept the settings. But many drives reply no error and nevertheless adjust their read speed only coarsly or ignore the setting after a few MB of fast read attempts.

The call parameters have the same meaning as with burn_drive_set_speed().

Parameters
dThe drive to set speed for. It must be a role 1 drive.
readRead speed in k/s (0 is max, -1 is min).
writeWrite speed in k/s (0 is max, -1 is min).
Returns
1=success , 0=failure
Since
1.5.4

Definition at line 1604 of file drive.c.

References burn_drive::drive_role, burn_drive::nominal_write_speed, burn_drive::set_speed, burn_drive::set_streaming_err, burn_drive::set_streaming_exact_bit, and burn_drive::silent_on_scsi_error.

Referenced by Xorriso_set_speed().

◆ burn_drive_set_stream_recording()

int burn_drive_set_stream_recording ( struct burn_drive drive,
int  recmode,
int  start,
int  flag 
)

Control stream recording during the write run and eventually set the start LBA for stream recording. Stream recording is set from struct burn_write_opts when the write run gets started. See burn_write_opts_set_stream_recording(). The call described here can be used later to override this setting and to program automatic switching at a given LBA. It also affects subsequent calls to burn_random_access_write().

Parameters
driveThe drive which performs the write operation.
recmode-1= disable stream recording 0= leave setting as is 1= enable stream recording
startThe LBA where actual stream recording shall start. (0 means unconditional stream recording)
flagBitfield for control purposes (unused yet, submit 0).
Returns
1=success , <=0 failure
Since
0.6.4

Definition at line 1178 of file drive.c.

References burn_drive_has_feature(), burn_drive::current_profile, burn_feature_descr::data, burn_drive::do_stream_recording, burn_feature_descr::flags, burn_drive::global_index, libdax_messenger, LIBDAX_MSGS_PRIO_HIGH, LIBDAX_MSGS_SEV_NOTE, libdax_msgs_submit(), and burn_drive::stream_recording_start.

Referenced by burn_disc_write_sync().

◆ burn_drive_snooze()

int burn_drive_snooze ( struct burn_drive d,
int  flag 
)

Calm down or alert a drive. Some drives stay alert after reading for quite some time. This saves time with the startup for the next read operation but also causes noise and consumes extra energy. It makes sense to calm down the drive if no read operation is expected for the next few seconds. The drive will get alert automatically if operations are required.

Parameters
dThe drive to influence.
flagBitfield for control purposes bit0= become alert (else start snoozing) This is not mandatory for further drive operations
Returns
1= success , 0= drive role not suitable for calming
Since
0.7.0

Definition at line 749 of file drive.c.

References burn_drive::drive_role, burn_drive::start_unit, and burn_drive::stop_unit.

Referenced by burn_drive_release_fl(), Xorriso_aquire_drive(), and Xorriso_drive_snooze().

◆ burn_drive_unregister()

int burn_drive_unregister ( struct burn_drive d)

Definition at line 600 of file drive.c.

References burn_drive_free(), drivetop, and burn_drive::global_index.

Referenced by burn_drive_finish_enum().

◆ burn_drive_was_feat21_failure()

int burn_drive_was_feat21_failure ( struct burn_drive d)

Inquire whether a write error occurred which is suspected to have happened due to a false report about DVD-RW capability to be written in write type BURN_WRITE_TAO.

Parameters
dThe drive to inquire.
Returns
1= it seems that BURN_WRITE_TAO on DVD-RW caused error, 0= it does not seem so
Since
1.3.4

Definition at line 3536 of file drive.c.

References burn_drive::was_feat21h_failure.

Referenced by Xorriso_burn_track(), and Xorriso_write_session().

◆ burn_drive_whitelist_count()

int burn_drive_whitelist_count ( void  )

Definition at line 1736 of file drive.c.

References enumeration_whitelist_top.

Referenced by single_enumerate().

◆ burn_drive_whitelist_item()

char* burn_drive_whitelist_item ( int  idx,
int  flag 
)

Definition at line 1741 of file drive.c.

References enumeration_whitelist, and enumeration_whitelist_top.

Referenced by single_enumerate().

◆ burn_drive_wrote_well()

int burn_drive_wrote_well ( struct burn_drive d)

Inquire whether the most recent asynchronous media job was successful. This applies to burn_disc_erase(), burn_disc_format(), burn_disc_write(). Reasons for non-success may be: rejection of burn parameters, abort due to fatal errors during write, blank or format, a call to burn_drive_cancel() by the application thread.

Parameters
dThe drive to inquire.
Returns
1=burn seems to have went well, 0=burn failed
Since
0.2.6

Definition at line 2783 of file drive.c.

References burn_drive::cancel.

Referenced by isoburn_drive_wrote_well(), Xorriso_blank_media(), Xorriso_burn_track(), and Xorriso_format_media().

◆ burn_drives_are_clear()

int burn_drives_are_clear ( int  flag)

Definition at line 810 of file drive.c.

References burn_drive_count(), drive_array, burn_drive::global_index, and burn_drive::released.

Referenced by burn_drive_scan(), and burn_finish().

◆ burn_feature_descr_free()

int burn_feature_descr_free ( struct burn_feature_descr **  descr,
int  flag 
)

◆ burn_feature_descr_new()

int burn_feature_descr_new ( struct burn_feature_descr **  new,
unsigned char *  descr,
int  descr_len,
int  flag 
)

◆ burn_get_read_capacity()

int burn_get_read_capacity ( struct burn_drive d,
int *  capacity,
int  flag 
)

Inquire the maximum amount of readable data. On DVD and BD it is supposed that all LBAs in the range from 0 to capacity - 1 can be read via burn_read_data() although some of them may never have been recorded. With multi-session CD there have to be expected unreadable TAO Run-out blocks. If tracks are recognizable then it is better to only read LBAs which are part of some track and on CD to be cautious about the last two blocks of each track which might be TAO Run-out blocks. If the drive is actually a large file or block device, then the capacity is curbed to a maximum of 0x7ffffff0 blocks = 4 TB - 32 KB.

Parameters
dThe drive from which to read
capacityWill return the result if valid
flagBitfield for control purposes: Unused yet, submit 0.
Returns
1=successful , <=0 an error occurred
Since
0.6.0

Definition at line 3421 of file drive.c.

References burn_drive::media_read_capacity.

Referenced by isoburn_emulate_toc(), isoburn_read_iso_head(), isoburn_start_emulation(), Xorriso_check_media(), Xorriso_obtain_indev_readsize(), Xorriso_toc(), and Xorriso_truncate_overwritable().

◆ burn_lookup_device_link()

int burn_lookup_device_link ( char *  dev_adr,
char  link_adr[],
char *  dir_adr,
char **  templ,
int  num_templ,
int  flag 
)

Try to convert a given drive device file address into the address of a symbolic link that points to this drive address. Modern GNU/Linux systems may shuffle drive addresses from boot to boot. The udev daemon is supposed to create links which always point to the same drive, regardless of its system address. This call tries to find such links.

Parameters
dev_adrShould contain a drive address as returned by burn_drive_scan().
link_adrAn application provided array of at least BURN_DRIVE_ADR_LEN characters size. The found link address gets copied to it.
dir_adrThe address of the directory where to look for links. Normally: "/dev"
templAn array of pointers to name templates, which links have to match. A symbolic link in dir_adr matches a name template if it begins by that text. E.g. link address "/dev/dvdrw1" matches template "dvdrw". If templ is NULL, then the default array gets used: {"dvdrw", "cdrw", "dvd", "cdrom", "cd"} If several links would match, then a link will win, which matches the template with the lowest array index. Among these candidates, the one with the lowest strcmp() rank will be chosen as link_adr.
num_templNumber of array elements in templ.
flagBitfield for control purposes. Unused yet. Submit 0.
Returns
<0 severe error, 0 failed to search, 2 nothing found 1 success, link_adr is valid
Since
1.1.4

Definition at line 2348 of file drive.c.

References BURN_ALLOC_MEM, BURN_DRIVE_ADR_LEN, burn_drive_resolve_link(), and BURN_FREE_MEM.

Referenced by Xorriso_show_devices().

◆ burn_mdata_free_subs()

int burn_mdata_free_subs ( struct scsi_mode_data m)

◆ burn_msf_to_sectors()

int burn_msf_to_sectors ( int  m,
int  s,
int  f 
)

Convert a minute-second-frame (MSF) value to sector count

Parameters
mMinute component
sSecond component
fFrame component
Returns
The sector count

Definition at line 1663 of file drive.c.

◆ burn_obtain_profile_name()

int burn_obtain_profile_name ( int  profile_code,
char  name[80] 
)

Obtains the profile name associated with a profile code.

Parameters
profile_codethe profile code to be translated
namereturns the profile name (e.g. "DVD+RW")
Returns
1= known profile code , 0= unknown profile code
Since
0.7.0

Definition at line 2775 of file drive.c.

References mmc_obtain_profile_name().

Referenced by Xorriso_list_profiles().

◆ burn_role_by_access()

static int burn_role_by_access ( char *  fname,
int  flag 
)
static

Definition at line 1749 of file drive.c.

References O_BINARY, and O_LARGEFILE.

Referenced by burn_drive_equals_adr(), and burn_drive_grab_dummy().

◆ burn_sectors_to_msf()

void burn_sectors_to_msf ( int  sectors,
int *  m,
int *  s,
int *  f 
)

Convert a sector count to minute-second-frame (MSF)

Parameters
sectorsThe sector count
mReturns the minute component
sReturns the second component
fReturns the frame component

Definition at line 1668 of file drive.c.

◆ burn_setup_drive()

◆ burn_speed_descriptor_copy()

◆ burn_speed_descriptor_destroy()

int burn_speed_descriptor_destroy ( struct burn_speed_descriptor **  s,
int  flag 
)

◆ burn_speed_descriptor_new()

◆ drive_getcaps()

static int drive_getcaps ( struct burn_drive d,
struct burn_drive_info out 
)
static

Definition at line 1262 of file drive.c.

References burn_drive::all_profiles, burn_drive::block_types, burn_drive_info::buffer_size, scsi_mode_data::buffer_size, BURN_BLOCK_MODE1, BURN_BLOCK_RAW0, BURN_BLOCK_SAO, burn_drive_has_feature(), BURN_WRITE_PACKET, BURN_WRITE_RAW, BURN_WRITE_SAO, BURN_WRITE_TAO, burn_drive_info::c2_errors, scsi_mode_data::c2_pointers, scsi_mode_data::cdr_read, scsi_mode_data::cdr_write, scsi_mode_data::cdrw_read, scsi_mode_data::cdrw_write, burn_feature_descr::data, burn_feature_descr::data_lenght, burn_drive::devname, burn_drive_info::drive, scsi_mode_data::dvdr_read, scsi_mode_data::dvdr_write, scsi_mode_data::dvdram_read, scsi_mode_data::dvdram_write, scsi_mode_data::dvdrom_read, burn_drive::idata, burn_drive_info::location, burn_drive::mdata, burn_drive::num_profiles, scsi_mode_data::p2a_valid, burn_drive_info::packet_block_types, burn_drive::probe_write_modes, burn_drive_info::product, burn_scsi_inquiry_data::product, burn_drive_info::raw_block_types, burn_drive_info::read_cdr, burn_drive_info::read_cdrw, burn_drive_info::read_dvdr, burn_drive_info::read_dvdram, burn_drive_info::read_dvdrom, burn_drive_info::revision, burn_scsi_inquiry_data::revision, burn_drive_info::sao_block_types, scsi_mode_data::simulate, strip_spaces(), burn_drive_info::tao_block_types, burn_scsi_inquiry_data::valid, burn_drive_info::vendor, burn_scsi_inquiry_data::vendor, burn_drive_info::write_cdr, burn_drive_info::write_cdrw, burn_drive_info::write_dvdr, burn_drive_info::write_dvdram, and burn_drive_info::write_simulate.

Referenced by burn_drive_scan_sync().

◆ strip_spaces()

static void strip_spaces ( char *  str,
size_t  len 
)
static

Definition at line 1244 of file drive.c.

Referenced by drive_getcaps().

Variable Documentation

◆ burn_drive_role_4_allowed

int burn_drive_role_4_allowed
extern

Definition at line 117 of file init.c.

Referenced by burn_allow_drive_role_4(), burn_drive_equals_adr(), and burn_drive_grab_dummy().

◆ burn_support_untested_profiles

int burn_support_untested_profiles
extern

Definition at line 102 of file init.c.

◆ drive_array

◆ drivetop

◆ enumeration_whitelist

char* enumeration_whitelist[255]
static

◆ enumeration_whitelist_top

int enumeration_whitelist_top = -1
static

◆ libdax_messenger