libisoburn  1.5.4
About: libisoburn is a frontend for the libraries libburn and libisofs which enables creation and expansion of ISO-9660 filesystems on all media and file types supported by libburn. It implements the API and command interpreter of program xorriso, and installs this program as small dynamically linked binary. xorriso is suitable for incremental data backup and for production of bootable ISO 9660 images. A statically linked version is available as GNU xorriso.
  Fossies Dox: libisoburn-1.5.4.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

lib_mgt.h File Reference
#include <libisofs/libisofs.h>
#include <libburn/libburn.h>
#include <libisoburn/libisoburn.h>
#include "xorriso.h"
#include "xorriso_private.h"
#include "xorrisoburn.h"
Include dependency graph for lib_mgt.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define Xorriso_pvt_x_includeD   yes
 

Functions

int Xorriso_abort (struct XorrisO *xorriso, int flag)
 
int Xorriso_set_image_severities (struct XorrisO *xorriso, int flag)
 
int Xorriso__sev_to_text (int severity, char **severity_name, int flag)
 
int Xorriso_report_iso_error (struct XorrisO *xorriso, char *victim, int iso_error_code, char msg_text[], int os_errno, char min_severity[], int flag)
 
int Xorriso_process_msg_queues (struct XorrisO *xorriso, int flag)
 

Macro Definition Documentation

◆ Xorriso_pvt_x_includeD

#define Xorriso_pvt_x_includeD   yes

Definition at line 14 of file lib_mgt.h.

Function Documentation

◆ Xorriso__sev_to_text()

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

Definition at line 371 of file lib_mgt.c.

373 {
374  int ret;
375 
376  ret= iso_sev_to_text(severity, severity_name);
377  if(ret>0)
378  return(ret);
379  ret= burn_sev_to_text(severity, severity_name, 0);
380  if(ret>0)
381  return(ret);
382  *severity_name= "";
383  return(0);
384 }

◆ Xorriso_abort()

int Xorriso_abort ( struct XorrisO xorriso,
int  flag 
)

Definition at line 62 of file lib_mgt.c.

63 {
64  int ret;
65 
66  ret= burn_abort(4440, burn_abort_pacifier, "xorriso : ");
67  if(ret<=0) {
68  fprintf(stderr,
69  "\nxorriso : ABORT : Cannot cancel burn session and release drive.\n");
70  return(0);
71  }
72  fprintf(stderr,
73  "xorriso : ABORT : Drive is released and library is shut down now.\n");
74  fprintf(stderr,
75  "xorriso : ABORT : Program done. Even if you do not see a shell prompt.\n");
76  fprintf(stderr, "\n");
77  exit(1);
78 }

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

◆ Xorriso_process_msg_queues()

int Xorriso_process_msg_queues ( struct XorrisO xorriso,
int  flag 
)

Definition at line 519 of file lib_mgt.c.

520 {
521  int ret, error_code= 0, os_errno= 0, count= 0, pass, imgid, tunneled;
522  int name_prefix_code;
523  char severity[80], *text= NULL;
524 
525 #ifdef Xorriso_fetch_with_msg_queueS
526  int locked= 0, uret;
527 #endif
528 
529 #ifdef Xorriso_with_libjtE
530  char *msg;
531 #endif
532 
533  if(!xorriso->libs_are_started) {
534  ret= 1; goto ex;
535  }
536 
537 #ifdef Xorriso_fetch_with_msg_queueS
538 
539  Xorriso_alloc_meM(text, char, sizeof(xorriso->info_text));
540 
541  ret= pthread_mutex_lock(&(xorriso->lib_msg_queue_lock));
542  if(ret != 0) {
543  Xorriso_msgs_submit(xorriso, 0,
544  "Cannot acquire mutex lock for processing library message queues",
545  ret, "FATAL", 0);
546  } else
547  locked= 1;
548 
549 #else /* Xorriso_fetch_with_msg_queueS */
550 
551  text= xorriso->info_text;
552 
553 #endif /* ! Xorriso_fetch_with_msg_queueS */
554 
555 
556  for(pass= 0; pass< 3; pass++) {
557  while(1) {
558  tunneled= 0;
559  if(pass==0) {
560 #ifdef Xorriso_with_libjtE
561  ret= 0;
562  if(xorriso->libjte_handle != NULL) {
563  msg= libjte_get_next_message(xorriso->libjte_handle);
564  if(msg != NULL) {
565  sprintf(text, "%1.4095s", msg);
566  free(msg);
567  strcpy(severity, "NOTE");
568  error_code= 0;
569  os_errno= 0;
570  ret= 1;
571  }
572  }
573 #else
574  break;
575 #endif /* ! Xorriso_with_libjtE */
576 
577  } else if(pass==1)
578  ret= iso_obtain_msgs("ALL", &error_code, &imgid, text, severity);
579  else {
580  ret= burn_msgs_obtain("ALL", &error_code, text, &os_errno, severity);
581  if((error_code>=0x00030000 && error_code<0x00040000) ||
582  (error_code>=0x00050000 && error_code<0x00060000))
583  tunneled= -1; /* "libisofs:" */
584  else if(error_code>=0x00060000 && error_code<0x00070000)
585  tunneled= 1; /* "libisoburn:" */
586  }
587  if(ret<=0)
588  break;
589 
590  /* <<< tunneled MISHAP from libisoburn through libburn
591  or well known error codes of MISHAP events
592  With libburn-0.4.4 this is not necessary */
593  if(error_code==0x5ff73 || error_code==0x3ff73 ||
594  error_code==0x3feb9 || error_code==0x3feb2)
595  strcpy(severity, "MISHAP");
596  else if(error_code==0x51001)
597  strcpy(severity, "ERRFILE");
598 
599 #ifdef Xorriso_with_libjtE
600  if(pass == 0)
601  name_prefix_code= 0;
602  else
603  name_prefix_code= pass + tunneled;
604 #else
605  name_prefix_code= pass + tunneled;
606 #endif /* Xorriso_with_libjtE */
607  Xorriso_msgs_submit(xorriso, error_code, text, os_errno,
608  severity, name_prefix_code << 2);
609  count++;
610  }
611  }
612  if(xorriso->library_msg_direct_print && count>0) {
613  sprintf(text," (%d library messages repeated by xorriso)\n", count);
614 
615 #ifdef Xorriso_fetch_with_msg_queueS
616 
617  Xorriso_msgs_submit(xorriso, 0, text, 0, "NOTE", 256);
618 
619 #else /* Xorriso_fetch_with_msg_queueS */
620 
621  Xorriso_info(xorriso, 0);
622 
623 #endif /* Xorriso_fetch_with_msg_queueS */
624 
625  }
626  ret= 1;
627 ex:;
628 
629 #ifdef Xorriso_fetch_with_msg_queueS
630 
631  if(locked) {
632  uret= pthread_mutex_unlock(&(xorriso->lib_msg_queue_lock));
633  if(uret != 0) {
634  Xorriso_msgs_submit(xorriso, 0,
635  "Cannot release mutex lock for processing library message queues",
636  uret, "FATAL", 0);
637  ret= -1;
638  }
639  }
640  Xorriso_free_meM(text);
641 
642 #endif /* Xorriso_fetch_with_msg_queueS */
643 
644  return(ret);
645 }
#define Xorriso_free_meM(pt)
Definition: sfile.h:27
#define Xorriso_alloc_meM(pt, typ, count)
Definition: sfile.h:19
int libs_are_started
int library_msg_direct_print
char info_text[10 *4096]
pthread_mutex_t lib_msg_queue_lock
int Xorriso_msgs_submit(struct XorrisO *xorriso, int error_code, char msg_text[], int os_errno, char severity[], int flag)
Submit a problem message to the xorriso problem reporting and handling system.
Definition: text_io.c:2504
int Xorriso_info(struct XorrisO *xorriso, int flag)
Definition: text_io.c:2367

◆ Xorriso_report_iso_error()

int Xorriso_report_iso_error ( struct XorrisO xorriso,
char *  victim,
int  iso_error_code,
char  msg_text[],
int  os_errno,
char  min_severity[],
int  flag 
)

Definition at line 430 of file lib_mgt.c.

433 {
434  int error_code, iso_sev, min_sev, ret;
435  char *sev_text_pt, *msg_text_pt= NULL;
436  char *sfe= NULL;
437  static int sorry_sev= -1;
438 
439  Xorriso_alloc_meM(sfe, char, 6 * SfileadrL);
440 
441  if(sorry_sev<0)
442  Xorriso__text_to_sev("SORRY", &sorry_sev, 0);
443 
444  if(flag&4) {
445  error_code= 0x00050000;
446  Xorriso__text_to_sev(min_severity, &iso_sev, 0);
447  } else {
448  error_code= iso_error_get_code(iso_error_code);
449  if(error_code < 0x00030000 || error_code >= 0x00040000)
450  error_code= (error_code & 0xffff) | 0x00050000;
451  if(flag&1)
452  msg_text_pt= (char *) iso_error_to_msg(iso_error_code);
453  iso_sev= iso_error_get_severity(iso_error_code);
454  }
455  if(msg_text_pt==NULL)
456  msg_text_pt= msg_text;
457 
458  if(iso_sev >= sorry_sev && (flag & 2) && victim[0])
459  Xorriso_msgs_submit(xorriso, 0, victim, 0, "ERRFILE", 0);
460  sev_text_pt= min_severity;
461  Xorriso__text_to_sev(min_severity, &min_sev, 0);
462  if(min_sev < iso_sev && !(flag&4))
463  Xorriso__sev_to_text(iso_sev, &sev_text_pt, 0);
464  strcpy(sfe, msg_text_pt);
465  if(victim[0]) {
466  strcat(sfe, ": ");
467  Text_shellsafe(victim, sfe+strlen(sfe), 0);
468  }
469  ret= Xorriso_msgs_submit(xorriso, error_code, sfe, os_errno, sev_text_pt, 4);
470 ex:;
471  Xorriso_free_meM(sfe);
472  return(ret);
473 }
#define SfileadrL
int Xorriso__text_to_sev(char *severity_name, int *severity_number, int flag)
Definition: lib_mgt.c:387
int Xorriso__sev_to_text(int severity, char **severity_name, int flag)
Definition: lib_mgt.c:371
char * Text_shellsafe(char *in_text, char *out_text, int flag)
Definition: misc_funct.c:1044

References SfileadrL, Text_shellsafe(), Xorriso__sev_to_text(), Xorriso__text_to_sev(), Xorriso_alloc_meM, Xorriso_free_meM, and Xorriso_msgs_submit().

Referenced by Xorriso_add_mips_boot_file(), Xorriso_add_symlink(), Xorriso_attach_boot_image(), Xorriso_cannot_clone(), Xorriso_cannot_create_iter(), Xorriso_create_empty_iso(), Xorriso_dir_disk_path(), Xorriso_get_attrs(), Xorriso_get_blessing(), Xorriso_graft_in(), Xorriso_hfsplus_bless(), Xorriso_iso_file_read(), Xorriso_make_iso_write_opts(), Xorriso_make_md5(), Xorriso_mark_update_merge(), Xorriso_remove_hfsplus_crtp(), Xorriso_rename(), Xorriso_rename_suffix(), Xorriso_restore_properties(), Xorriso_rmi(), Xorriso_set_alpha_boot(), Xorriso_set_filter(), Xorriso_set_hfsplus_crtp(), Xorriso_set_hppa_boot_parm(), Xorriso_set_isolinux_options(), Xorriso_set_system_area(), Xorriso_set_zisofs_params(), Xorriso_setfacl(), Xorriso_setfattr(), Xorriso_show_stream(), Xorriso_transfer_properties(), Xorriso_tree_graft_node(), Xorriso_truncate_uniquely(), and Xorriso_write_session().

◆ Xorriso_set_image_severities()

int Xorriso_set_image_severities ( struct XorrisO xorriso,
int  flag 
)

Definition at line 286 of file lib_mgt.c.

287 {
288  char *queue_sev, *print_sev;
289 
290  if(flag&2)
291  queue_sev= "FAILURE";
292  else if(flag&1)
293  queue_sev= "UPDATE";
294  else
295  queue_sev= "ALL";
296  if(xorriso->library_msg_direct_print)
297  print_sev= xorriso->report_about_text;
298  else
299  print_sev= "NEVER";
300  iso_set_msgs_severities(queue_sev, print_sev, "libisofs : ");
301  return(1);
302 }
char report_about_text[20]

References XorrisO::library_msg_direct_print, and XorrisO::report_about_text.

Referenced by Xorriso_aquire_drive(), and Xorriso_write_session().