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)  

libdax_msgs.c File Reference
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/time.h>
#include <pthread.h>
#include "libdax_msgs.h"
Include dependency graph for libdax_msgs.c:

Go to the source code of this file.

Macros

#define LIBDAX_MSGS_H_INTERNAL   1
 

Functions

static int libdax_msgs_item_new (struct libdax_msgs_item **item, struct libdax_msgs_item *link, int flag)
 
int libdax_msgs_item_unlink (struct libdax_msgs_item *o, struct libdax_msgs_item **chain_start, struct libdax_msgs_item **chain_end, int flag)
 
int libdax_msgs_item_destroy (struct libdax_msgs_item **item, int flag)
 
int libdax_msgs_item_get_msg (struct libdax_msgs_item *item, int *error_code, char **msg_text, int *os_errno, int flag)
 
int libdax_msgs_item_get_origin (struct libdax_msgs_item *item, double *timestamp, pid_t *process_id, int *origin, int flag)
 
int libdax_msgs_item_get_rank (struct libdax_msgs_item *item, int *severity, int *priority, int flag)
 
int libdax_msgs_new (struct libdax_msgs **m, int flag)
 
static int libdax_msgs_lock (struct libdax_msgs *m, int flag)
 
static int libdax_msgs_unlock (struct libdax_msgs *m, int flag)
 
int libdax_msgs_destroy (struct libdax_msgs **m, int flag)
 
int libdax_msgs_refer (struct libdax_msgs **pt, struct libdax_msgs *m, int flag)
 
int libdax_msgs_set_severities (struct libdax_msgs *m, int queue_severity, int print_severity, char *print_id, int flag)
 
int libdax_msgs__text_to_sev (char *severity_name, int *severity, int flag)
 
int libdax_msgs__sev_to_text (int severity, char **severity_name, int flag)
 
int libdax_msgs_submit (struct libdax_msgs *m, int origin, int error_code, int severity, int priority, char *msg_text, int os_errno, int flag)
 
int libdax_msgs_obtain (struct libdax_msgs *m, struct libdax_msgs_item **item, int severity, int priority, int flag)
 
int libdax_msgs_destroy_item (struct libdax_msgs *m, struct libdax_msgs_item **item, int flag)
 

Macro Definition Documentation

◆ LIBDAX_MSGS_H_INTERNAL

#define LIBDAX_MSGS_H_INTERNAL   1

Definition at line 22 of file libdax_msgs.c.

Function Documentation

◆ libdax_msgs__sev_to_text()

int libdax_msgs__sev_to_text ( int  severity,
char **  severity_name,
int  flag 
)

Convert a registered severity number into a severity name

Parameters
flagBitfield for control purposes: bit0= list all severity names in a blank separated string
Returns
>0 success, <=0 failure

Definition at line 287 of file libdax_msgs.c.

References LIBDAX_MSGS_SEV_ABORT, LIBDAX_MSGS_SEV_ALL, LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_SEV_ERRFILE, LIBDAX_MSGS_SEV_FAILURE, LIBDAX_MSGS_SEV_FATAL, LIBDAX_MSGS_SEV_HINT, LIBDAX_MSGS_SEV_MISHAP, LIBDAX_MSGS_SEV_NEVER, LIBDAX_MSGS_SEV_NOTE, LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_SEV_UPDATE, and LIBDAX_MSGS_SEV_WARNING.

Referenced by burn_list_sev_texts(), burn_msgs_obtain(), burn_sev_to_text(), and libdax_msgs_submit().

◆ libdax_msgs__text_to_sev()

int libdax_msgs__text_to_sev ( char *  severity_name,
int *  severity,
int  flag 
)

◆ libdax_msgs_destroy()

int libdax_msgs_destroy ( struct libdax_msgs **  m,
int  flag 
)

Destroy a message handling facility and all its eventual messages. The submitted pointer gets set to NULL. Actually only the last destroy call of all official references to the object will really dispose it. All others just decrement the reference counter. Call this function only with official reference pointers obtained by libdax_msgs_new() or libdax_msgs_refer(), and only once per such pointer.

Parameters
flagBitfield for control purposes (unused yet, submit 0)
Returns
1 for success, 0 for pointer to NULL, -1 for fatal error

Definition at line 191 of file libdax_msgs.c.

References libdax_msgs_item_destroy(), libdax_msgs_lock(), and libdax_msgs_unlock().

Referenced by burn_finish(), and burn_set_messenger().

◆ libdax_msgs_destroy_item()

int libdax_msgs_destroy_item ( struct libdax_msgs *  m,
struct libdax_msgs_item **  item,
int  flag 
)

Destroy a message item obtained by libdax_msgs_obtain(). The submitted pointer gets set to NULL. Caution: Copy eventually obtained msg_text before destroying the item, if you want to use it further.

Parameters
flagBitfield for control purposes (unused yet, submit 0)
Returns
1 for success, 0 for pointer to NULL, <0 for severe errors

Definition at line 437 of file libdax_msgs.c.

References libdax_msgs_item_destroy(), libdax_msgs_lock(), and libdax_msgs_unlock().

Referenced by burn_msgs_obtain().

◆ libdax_msgs_item_destroy()

int libdax_msgs_item_destroy ( struct libdax_msgs_item **  item,
int  flag 
)

◆ libdax_msgs_item_get_msg()

int libdax_msgs_item_get_msg ( struct libdax_msgs_item *  item,
int *  error_code,
char **  msg_text,
int *  os_errno,
int  flag 
)

Obtain from a message item the three application oriented components as submitted with the originating call of libdax_msgs_submit(). Caution: msg_text becomes a pointer into item, not a copy.

Parameters
flagBitfield for control purposes (unused yet, submit 0)
Returns
1 on success, 0 on invalid item, <0 for servere errors

Definition at line 104 of file libdax_msgs.c.

Referenced by burn_msgs_obtain().

◆ libdax_msgs_item_get_origin()

int libdax_msgs_item_get_origin ( struct libdax_msgs_item *  item,
double *  timestamp,
pid_t *  process_id,
int *  origin,
int  flag 
)

Obtain from a message item the submitter identification submitted with the originating call of libdax_msgs_submit().

Parameters
flagBitfield for control purposes (unused yet, submit 0)
Returns
1 on success, 0 on invalid item, <0 for servere errors

Definition at line 115 of file libdax_msgs.c.

◆ libdax_msgs_item_get_rank()

int libdax_msgs_item_get_rank ( struct libdax_msgs_item *  item,
int *  severity,
int *  priority,
int  flag 
)

Obtain from a message item severity and priority as submitted with the originating call of libdax_msgs_submit().

Parameters
flagBitfield for control purposes (unused yet, submit 0)
Returns
1 on success, 0 on invalid item, <0 for servere errors

Definition at line 126 of file libdax_msgs.c.

Referenced by burn_msgs_obtain().

◆ libdax_msgs_item_new()

static int libdax_msgs_item_new ( struct libdax_msgs_item **  item,
struct libdax_msgs_item *  link,
int  flag 
)
static

Definition at line 31 of file libdax_msgs.c.

References LIBDAX_MSGS_PRIO_ZERO, and LIBDAX_MSGS_SEV_ALL.

Referenced by libdax_msgs_submit().

◆ libdax_msgs_item_unlink()

int libdax_msgs_item_unlink ( struct libdax_msgs_item *  o,
struct libdax_msgs_item **  chain_start,
struct libdax_msgs_item **  chain_end,
int  flag 
)

Detaches item from its queue and eventually readjusts start, end pointers of the queue

Definition at line 68 of file libdax_msgs.c.

Referenced by libdax_msgs_item_destroy(), and libdax_msgs_obtain().

◆ libdax_msgs_lock()

static int libdax_msgs_lock ( struct libdax_msgs *  m,
int  flag 
)
static

◆ libdax_msgs_new()

int libdax_msgs_new ( struct libdax_msgs **  m,
int  flag 
)

Create new empty message handling facility with queue and issue a first official reference to it.

Parameters
flagBitfield for control purposes (unused yet, submit 0)
Returns
>0 success, <=0 failure

Definition at line 138 of file libdax_msgs.c.

References LIBDAX_MSGS_SEV_ALL, and LIBDAX_MSGS_SEV_NEVER.

Referenced by burn_msgs_initialize().

◆ libdax_msgs_obtain()

int libdax_msgs_obtain ( struct libdax_msgs *  m,
struct libdax_msgs_item **  item,
int  severity,
int  priority,
int  flag 
)

Obtain a message item that has at least the given severity and priority. Usually all older messages of lower severity are discarded then. If no item of sufficient severity was found, all others are discarded from the queue.

Parameters
flagBitfield for control purposes (unused yet, submit 0)
Returns
1 if a matching item was found, 0 if not, <0 for severe errors

Definition at line 403 of file libdax_msgs.c.

References libdax_msgs_item_destroy(), libdax_msgs_item_unlink(), libdax_msgs_lock(), and libdax_msgs_unlock().

Referenced by burn_msgs_obtain().

◆ libdax_msgs_refer()

int libdax_msgs_refer ( struct libdax_msgs **  pt,
struct libdax_msgs *  o,
int  flag 
)

Create an official reference to an existing libdax_msgs object. The references keep the object alive at least until it is released by a matching number of destroy calls. So each reference MUST be revoked by exactly one call to libdax_msgs_destroy().

Parameters
ptThe pointer to be set and registered
mA pointer to the existing object
flagBitfield for control purposes (unused yet, submit 0)
Returns
1 for success, 0 for failure

Definition at line 225 of file libdax_msgs.c.

References libdax_msgs_lock(), and libdax_msgs_unlock().

Referenced by burn_set_messenger().

◆ libdax_msgs_set_severities()

int libdax_msgs_set_severities ( struct libdax_msgs *  m,
int  queue_severity,
int  print_severity,
char *  print_id,
int  flag 
)

Set minimum severity for messages to be queued (default LIBDAX_MSGS_SEV_ALL) and for messages to be printed directly to stderr (default LIBDAX_MSGS_SEV_NEVER).

Parameters
print_idA text of at most 80 characters to be printed before any eventually printed message (default is "libdax: ").
flagBitfield for control purposes (unused yet, submit 0)
Returns
always 1 for now

Definition at line 236 of file libdax_msgs.c.

References libdax_msgs_lock(), and libdax_msgs_unlock().

Referenced by burn_msgs_initialize(), and burn_msgs_set_severities().

◆ libdax_msgs_submit()

int libdax_msgs_submit ( struct libdax_msgs *  m,
int  origin,
int  error_code,
int  severity,
int  priority,
char *  msg_text,
int  os_errno,
int  flag 
)

Submit a message to a message handling facility.

Parameters
originprogram specific identification number of the originator of a message. E.g. drive number. Programs should have an own range of origin numbers. See above LIBDAX_MSGS_ORIGIN_*_BASE Use -1 if no number is known.
error_codeUnique error code. Use only registered codes. See below. The same unique error_code may be issued at different occasions but those should be equivalent out of the view of a libdax_msgs application. (E.g. "cannot open ATA drive" versus "cannot open SCSI drive" would be equivalent.)
severityThe LIBDAX_MSGS_SEV_* of the event.
priorityThe LIBDAX_MSGS_PRIO_* number of the event.
msg_textPrintable and human readable message text.
os_errnoEventual error code from operating system (0 if none)
flagBitfield for control purposes bit0= If direct output to stderr: CarriageReturn rather than LineFeed
Returns
1 on success, 0 on rejection, <0 for severe errors

Definition at line 334 of file libdax_msgs.c.

References libdax_msgs__sev_to_text(), libdax_msgs_item_destroy(), libdax_msgs_item_new(), libdax_msgs_lock(), and libdax_msgs_unlock().

Referenced by burn_alloc_mem(), burn_builtin_abort_handler(), burn_cdtext_check_blockno(), burn_cdtext_from_packfile(), burn_cdtext_get(), burn_cdtext_set(), burn_create_new_pack(), burn_create_toc_entries(), burn_disc_cd_toc_extensions(), burn_disc_close_damaged(), burn_disc_close_session_dvd_minus_r(), burn_disc_close_track_dvd_minus_r(), burn_disc_close_track_dvd_plus_r(), burn_disc_erase(), burn_disc_erase_sync(), burn_disc_finalize_dvd_plus_r(), burn_disc_format(), burn_disc_format_sync(), burn_disc_get_msc1(), burn_disc_open_track_dvd_minus_r(), burn_disc_open_track_dvd_plus_r(), burn_disc_read_atip(), burn_disc_setup_dvd_minus_rw(), burn_disc_track_lba_nwa(), burn_disc_write(), burn_disc_write_is_ok(), burn_disc_write_sync(), burn_drive_adr_debug_msg(), burn_drive_cancel(), burn_drive_d_get_adr(), burn_drive_extract_audio(), burn_drive_extract_audio_track(), burn_drive_finish_enum(), burn_drive_grab(), burn_drive_grab_dummy(), burn_drive_re_assess(), burn_drive_release_fl(), burn_drive_reset_simulate(), burn_drive_scan(), burn_drive_scan_and_grab(), burn_drive_scan_sync(), burn_drive_set_stream_recording(), burn_dvd_write_session(), burn_dvd_write_sync(), burn_fifo_fill_data(), burn_fifo_inquire_status(), burn_fifo_source_new(), burn_fifo_source_shoveller(), burn_finish(), burn_initialize(), burn_make_v07t(), burn_msgs_submit(), burn_offst_source_new(), burn_os_alloc_buffer(), burn_os_open_track_src(), burn_precheck_write(), burn_random_access_write(), burn_read_audio(), burn_read_data(), burn_scsi_setup_drive(), burn_session_by_cue_file(), burn_session_input_sheet_v07t(), burn_session_set_start_tno(), burn_stdio_mmc_write(), burn_stdio_open_write(), burn_stdio_read(), burn_stdio_seek(), burn_stdio_sync_cache(), burn_stdio_write(), burn_structure_print_disc(), burn_structure_print_session(), burn_structure_print_track(), burn_track_apply_fillup(), burn_track_define_data(), burn_track_set_index(), burn_track_set_isrc(), burn_track_set_isrc_string(), burn_write_close_session(), burn_write_close_track(), burn_write_leadin_cdtext(), burn_write_opts_clone(), burn_write_opts_new(), burn_write_opts_set_leadin_text(), burn_write_opts_set_write_type(), burn_write_track(), burn_write_track_minsize(), cue_attach_track(), cue_check_for_track(), cue_create_file_source(), cue_interpret_line(), cue_open_audioxtr(), cue_read_number(), cue_read_timepoint_lba(), cue_set_cdtext(), evaluate_transport_success(), fifo_free(), fifo_read(), fname_enumerate(), get_bytes(), libdax_audioxtr_open(), mmc_close(), mmc_close_disc(), mmc_close_session(), mmc_compose_mode_page_5(), mmc_eval_read_error(), mmc_fake_toc(), mmc_format_unit(), mmc_function_spy(), mmc_get_configuration_al(), mmc_get_nwa(), mmc_get_phys_format_info(), mmc_read_10(), mmc_read_disc_info_al(), mmc_read_disc_structure(), mmc_read_toc_al(), mmc_read_toc_fmt0_al(), mmc_reserve_track(), mmc_set_streaming(), mmc_sync_cache(), mmc_wait_for_buffer_free(), mmc_write(), new_cue(), next_enum_cXtYdZs2(), offst_auth(), proc_sys_dev_cdrom_info(), react_on_drive_loss(), remove_worker(), report_block(), scsi_enumerate_drives(), scsi_eval_cmd_outcome(), scsi_notify_error(), sector_headers(), sg_close_drive_fd(), sg_exchange_scd_for_sr(), sg_fcntl_lock(), sg_grab(), sg_handle_busy_device(), sg_initialize(), sg_issue_command(), sg_lock(), sg_obtain_scsi_adr(), sg_open_drive_fd(), sg_open_scsi_siblings(), sg_os_revalidate_disc(), sg_release_siblings(), sg_solaris_convert_devname(), sgio_inquiry_cd_drive(), single_enumerate(), spc_confirm_cd_drive(), spc_report_async_error(), spc_sense_caps_al(), spc_wait_unit_attention(), start_enum_cXtYdZs2(), v07t_cdtext_char_code(), v07t_cdtext_genre_code(), v07t_cdtext_lang_code(), and write_disc_worker_func().

◆ libdax_msgs_unlock()

static int libdax_msgs_unlock ( struct libdax_msgs *  m,
int  flag 
)
static