libisofs
1.5.4
About: libisofs is a library to create an ISO 9660 filesystem, supports extensions like RockRidge or Joliet, makes bootable ISO 9660, and records file attributes which are of interest for data backups.
![]() ![]() |
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/time.h>
#include "libiso_msgs.h"
Go to the source code of this file.
Macros | |
#define | LIBISO_MSGS_H_INTERNAL 1 |
Functions | |
static int | libiso_msgs_item_new (struct libiso_msgs_item **item, struct libiso_msgs_item *link, int flag) |
int | libiso_msgs_item_unlink (struct libiso_msgs_item *o, struct libiso_msgs_item **chain_start, struct libiso_msgs_item **chain_end, int flag) |
Detaches item from its queue and eventually readjusts start, end pointers of the queue. More... | |
int | libiso_msgs_item_destroy (struct libiso_msgs_item **item, int flag) |
int | libiso_msgs_item_get_msg (struct libiso_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 libiso_msgs_submit(). More... | |
int | libiso_msgs_item_get_origin (struct libiso_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 libiso_msgs_submit(). More... | |
int | libiso_msgs_item_get_rank (struct libiso_msgs_item *item, int *severity, int *priority, int flag) |
Obtain from a message item severity and priority as submitted with the originating call of libiso_msgs_submit(). More... | |
int | libiso_msgs_new (struct libiso_msgs **m, int flag) |
Create new empty message handling facility with queue and issue a first official reference to it. More... | |
static int | libiso_msgs_lock (struct libiso_msgs *m, int flag) |
static int | libiso_msgs_unlock (struct libiso_msgs *m, int flag) |
int | libiso_msgs_destroy (struct libiso_msgs **m, int flag) |
Destroy a message handling facility and all its eventual messages. More... | |
int | libiso_msgs_refer (struct libiso_msgs **pt, struct libiso_msgs *m, int flag) |
Create an official reference to an existing libiso_msgs object. More... | |
int | libiso_msgs_set_severities (struct libiso_msgs *m, int queue_severity, int print_severity, char *print_id, int flag) |
Set minimum severity for messages to be queued (default LIBISO_MSGS_SEV_ALL) and for messages to be printed directly to stderr (default LIBISO_MSGS_SEV_NEVER). More... | |
int | libiso_msgs__text_to_sev (char *severity_name, int *severity, int flag) |
Convert a severity name into a severity number,. More... | |
int | libiso_msgs__sev_to_text (int severity, char **severity_name, int flag) |
Convert a registered severity number into a severity name. More... | |
int | libiso_msgs_submit (struct libiso_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. More... | |
int | libiso_msgs_obtain (struct libiso_msgs *m, struct libiso_msgs_item **item, int severity, int priority, int flag) |
Obtain a message item that has at least the given severity and priority. More... | |
int | libiso_msgs_destroy_item (struct libiso_msgs *m, struct libiso_msgs_item **item, int flag) |
Destroy a message item obtained by libiso_msgs_obtain(). More... | |
#define LIBISO_MSGS_H_INTERNAL 1 |
Definition at line 21 of file libiso_msgs.c.
int libiso_msgs__sev_to_text | ( | int | severity, |
char ** | severity_name, | ||
int | flag | ||
) |
Convert a registered severity number into a severity name.
flag | Bitfield for control purposes: bit0= list all severity names in a blank separated string |
Definition at line 286 of file libiso_msgs.c.
References LIBISO_MSGS_SEV_ABORT, LIBISO_MSGS_SEV_ALL, LIBISO_MSGS_SEV_DEBUG, LIBISO_MSGS_SEV_ERRFILE, LIBISO_MSGS_SEV_FAILURE, LIBISO_MSGS_SEV_FATAL, LIBISO_MSGS_SEV_HINT, LIBISO_MSGS_SEV_MISHAP, LIBISO_MSGS_SEV_NEVER, LIBISO_MSGS_SEV_NOTE, LIBISO_MSGS_SEV_SORRY, LIBISO_MSGS_SEV_UPDATE, and LIBISO_MSGS_SEV_WARNING.
Referenced by iso_obtain_msgs(), iso_sev_to_text(), and libiso_msgs_submit().
int libiso_msgs__text_to_sev | ( | char * | severity_name, |
int * | severity, | ||
int | flag | ||
) |
Convert a severity name into a severity number,.
flag | Bitfield for control purposes (unused yet, submit 0) |
Definition at line 249 of file libiso_msgs.c.
References LIBISO_MSGS_SEV_ABORT, LIBISO_MSGS_SEV_ALL, LIBISO_MSGS_SEV_DEBUG, LIBISO_MSGS_SEV_ERRFILE, LIBISO_MSGS_SEV_FAILURE, LIBISO_MSGS_SEV_FATAL, LIBISO_MSGS_SEV_HINT, LIBISO_MSGS_SEV_MISHAP, LIBISO_MSGS_SEV_NEVER, LIBISO_MSGS_SEV_NOTE, LIBISO_MSGS_SEV_SORRY, LIBISO_MSGS_SEV_UPDATE, and LIBISO_MSGS_SEV_WARNING.
Referenced by iso_msgs_submit(), iso_obtain_msgs(), iso_set_abort_severity(), iso_set_msgs_severities(), and iso_text_to_sev().
int libiso_msgs_destroy | ( | struct libiso_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 libiso_msgs_new() or libiso_msgs_refer(), and only once per such pointer.
flag | Bitfield for control purposes (unused yet, submit 0) |
Definition at line 190 of file libiso_msgs.c.
References libiso_msgs_item_destroy(), libiso_msgs_lock(), and libiso_msgs_unlock().
Referenced by iso_finish().
int libiso_msgs_destroy_item | ( | struct libiso_msgs * | m, |
struct libiso_msgs_item ** | item, | ||
int | flag | ||
) |
Destroy a message item obtained by libiso_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.
flag | Bitfield for control purposes (unused yet, submit 0) |
Definition at line 430 of file libiso_msgs.c.
References libiso_msgs_item_destroy(), libiso_msgs_lock(), and libiso_msgs_unlock().
Referenced by iso_obtain_msgs().
int libiso_msgs_item_destroy | ( | struct libiso_msgs_item ** | item, |
int | flag | ||
) |
Definition at line 86 of file libiso_msgs.c.
References libiso_msgs_item_unlink().
Referenced by libiso_msgs_destroy(), libiso_msgs_destroy_item(), libiso_msgs_obtain(), and libiso_msgs_submit().
int libiso_msgs_item_get_msg | ( | struct libiso_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 libiso_msgs_submit().
Caution: msg_text becomes a pointer into item, not a copy.
flag | Bitfield for control purposes (unused yet, submit 0) |
Definition at line 103 of file libiso_msgs.c.
Referenced by iso_obtain_msgs().
int libiso_msgs_item_get_origin | ( | struct libiso_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 libiso_msgs_submit().
flag | Bitfield for control purposes (unused yet, submit 0) |
Definition at line 114 of file libiso_msgs.c.
Referenced by iso_obtain_msgs().
int libiso_msgs_item_get_rank | ( | struct libiso_msgs_item * | item, |
int * | severity, | ||
int * | priority, | ||
int | flag | ||
) |
Obtain from a message item severity and priority as submitted with the originating call of libiso_msgs_submit().
flag | Bitfield for control purposes (unused yet, submit 0) |
Definition at line 125 of file libiso_msgs.c.
Referenced by iso_obtain_msgs().
|
static |
Definition at line 30 of file libiso_msgs.c.
References LIBISO_MSGS_PRIO_ZERO, and LIBISO_MSGS_SEV_ALL.
Referenced by libiso_msgs_submit().
int libiso_msgs_item_unlink | ( | struct libiso_msgs_item * | o, |
struct libiso_msgs_item ** | chain_start, | ||
struct libiso_msgs_item ** | chain_end, | ||
int | flag | ||
) |
Detaches item from its queue and eventually readjusts start, end pointers of the queue.
Definition at line 67 of file libiso_msgs.c.
Referenced by libiso_msgs_item_destroy(), and libiso_msgs_obtain().
|
static |
Definition at line 160 of file libiso_msgs.c.
Referenced by libiso_msgs_destroy(), libiso_msgs_destroy_item(), libiso_msgs_obtain(), libiso_msgs_refer(), libiso_msgs_set_severities(), and libiso_msgs_submit().
int libiso_msgs_new | ( | struct libiso_msgs ** | m, |
int | flag | ||
) |
Create new empty message handling facility with queue and issue a first official reference to it.
flag | Bitfield for control purposes (unused yet, submit 0) |
Definition at line 137 of file libiso_msgs.c.
References LIBISO_MSGS_SEV_ALL, and LIBISO_MSGS_SEV_NEVER.
Referenced by iso_init_with_flag().
int libiso_msgs_obtain | ( | struct libiso_msgs * | m, |
struct libiso_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.
flag | Bitfield for control purposes (unused yet, submit 0) |
Definition at line 396 of file libiso_msgs.c.
References libiso_msgs_item_destroy(), libiso_msgs_item_unlink(), libiso_msgs_lock(), and libiso_msgs_unlock().
Referenced by iso_obtain_msgs().
int libiso_msgs_refer | ( | struct libiso_msgs ** | pt, |
struct libiso_msgs * | o, | ||
int | flag | ||
) |
Create an official reference to an existing libiso_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 libiso_msgs_destroy().
pt | The pointer to be set and registered |
m | A pointer to the existing object |
flag | Bitfield for control purposes (unused yet, submit 0) |
Definition at line 224 of file libiso_msgs.c.
References libiso_msgs_lock(), and libiso_msgs_unlock().
int libiso_msgs_set_severities | ( | struct libiso_msgs * | m, |
int | queue_severity, | ||
int | print_severity, | ||
char * | print_id, | ||
int | flag | ||
) |
Set minimum severity for messages to be queued (default LIBISO_MSGS_SEV_ALL) and for messages to be printed directly to stderr (default LIBISO_MSGS_SEV_NEVER).
print_id | A text of at most 80 characters to be printed before any eventually printed message (default is "libiso: "). |
flag | Bitfield for control purposes (unused yet, submit 0) |
Definition at line 235 of file libiso_msgs.c.
References libiso_msgs_lock(), and libiso_msgs_unlock().
Referenced by iso_init_with_flag(), and iso_set_msgs_severities().
int libiso_msgs_submit | ( | struct libiso_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.
origin | program specific identification number of the originator of a message. E.g. drive number. Programs should have an own range of origin numbers. See above LIBISO_MSGS_ORIGIN_*_BASE Use -1 if no number is known. |
error_code | Unique 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 libiso_msgs application. (E.g. "cannot open ATA drive" versus "cannot open SCSI drive" would be equivalent.) |
severity | The LIBISO_MSGS_SEV_* of the event. |
priority | The LIBISO_MSGS_PRIO_* number of the event. |
msg_text | Printable and human readable message text. |
os_errno | Eventual error code from operating system (0 if none) |
flag | Bitfield for control purposes (unused yet, submit 0) |
Definition at line 328 of file libiso_msgs.c.
References libiso_msgs__sev_to_text(), libiso_msgs_item_destroy(), libiso_msgs_item_new(), libiso_msgs_lock(), and libiso_msgs_unlock().
Referenced by iso_msg_debug(), iso_msg_submit(), iso_msgs_submit(), and iso_report_errfile().
|
static |
Definition at line 175 of file libiso_msgs.c.
Referenced by libiso_msgs_destroy(), libiso_msgs_destroy_item(), libiso_msgs_obtain(), libiso_msgs_refer(), libiso_msgs_set_severities(), and libiso_msgs_submit().