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)  

iso_img.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define Xorriso_pvt_iso_img_includeD   yes
 

Functions

int Xorriso_update_volid (struct XorrisO *xorriso, int flag)
 
int Xorriso_record_boot_info (struct XorrisO *xorriso, int flag)
 
int Xorriso_assert_volid (struct XorrisO *xorriso, int msc1, int flag)
 
int Xorriso_is_isohybrid (struct XorrisO *xorriso, IsoFile *bootimg_node, int flag)
 
int Xorriso_boot_item_status (struct XorrisO *xorriso, char *cat_path, char *bin_path, int platform_id, int patch_isolinux, int emul, off_t load_size, unsigned char *id_string, unsigned char *selection_crit, char *form, char *filter, FILE *fp, int flag)
 
int Xorriso__append_boot_params (char *line, ElToritoBootImage *bootimg, int flag)
 
int Xorriso_get_volume (struct XorrisO *xorriso, IsoImage **volume, int flag)
 
int Xorriso_record_cmd_line (struct XorrisO *xorriso, char *buf, char **cmds, int *cmd_count, int flag)
 

Macro Definition Documentation

◆ Xorriso_pvt_iso_img_includeD

#define Xorriso_pvt_iso_img_includeD   yes

Definition at line 14 of file iso_img.h.

Function Documentation

◆ Xorriso__append_boot_params()

int Xorriso__append_boot_params ( char *  line,
ElToritoBootImage *  bootimg,
int  flag 
)

Definition at line 814 of file iso_img.c.

816 {
817  unsigned int platform_id;
818 
819  platform_id= el_torito_get_boot_platform_id(bootimg);
820  if(platform_id != 0)
821  sprintf(line + strlen(line),
822  " , platform_id=0x%-2.2X ", (unsigned int) platform_id);
823  if(el_torito_seems_boot_info_table(bootimg, 0))
824  sprintf(line + strlen(line), " , boot_info_table=on");
825  if(el_torito_seems_boot_info_table(bootimg, 1))
826  sprintf(line + strlen(line), " , grub2_boot_info=on");
827  return(1);
828 }

Referenced by Xorriso_show_boot_info().

◆ Xorriso_assert_volid()

int Xorriso_assert_volid ( struct XorrisO xorriso,
int  msc1,
int  flag 
)

Definition at line 159 of file iso_img.c.

160 {
161  int ret, image_blocks;
162  char volid[33];
163  struct burn_drive_info *dinfo;
164  struct burn_drive *drive;
165 
166  if(xorriso->assert_volid[0] == 0)
167  return(1);
168  ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
169  "on attempt to perform -assert_volid", 0);
170  if(ret<=0)
171  return(0);
172  ret= isoburn_read_iso_head(drive, msc1, &image_blocks, volid, 1);
173  Xorriso_process_msg_queues(xorriso,0);
174  if(ret <= 0) {
175  sprintf(xorriso->info_text,
176  "-assert_volid: Cannot determine Volume Id at LBA %d.", msc1);
177  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0,
178  xorriso->assert_volid_sev, 0);
179  return(0);
180  }
181  ret= Sregex_match(xorriso->assert_volid, volid, 0);
182  if(ret < 0)
183  return(2);
184  if(ret == 0) {
185  strcpy(xorriso->info_text,
186  "-assert_volid: Volume id does not match pattern: ");
187  Text_shellsafe(xorriso->assert_volid, xorriso->info_text, 1);
188  strcat(xorriso->info_text, " <> ");
189  Text_shellsafe(volid, xorriso->info_text, 1);
190  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0,
191  xorriso->assert_volid_sev, 0);
192  return(0);
193  }
194  return(ret);
195 }
int isoburn_read_iso_head(struct burn_drive *d, int lba, int *image_blocks, char *info, int flag)
Try whether the data at the given address look like a ISO 9660 image header and obtain its alleged si...
Definition: burn_wrap.c:1301
int Xorriso_get_drive_handles(struct XorrisO *xorriso, struct burn_drive_info **dinfo, struct burn_drive **drive, char *attempt, int flag)
Definition: drive_mgt.c:3511
int Xorriso_process_msg_queues(struct XorrisO *xorriso, int flag)
Forward any pending messages from the library message queues to the xorriso message system which puts...
Definition: lib_mgt.c:519
int Sregex_match(char *pattern, char *text, int flag)
Definition: misc_funct.c:1006
char * Text_shellsafe(char *in_text, char *out_text, int flag)
Definition: misc_funct.c:1044
char info_text[10 *4096]
char assert_volid[4096]
char assert_volid_sev[80]
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

References XorrisO::assert_volid, XorrisO::assert_volid_sev, XorrisO::info_text, isoburn_read_iso_head(), Sregex_match(), Text_shellsafe(), Xorriso_get_drive_handles(), Xorriso_msgs_submit(), and Xorriso_process_msg_queues().

Referenced by Xorriso_aquire_drive().

◆ Xorriso_boot_item_status()

int Xorriso_boot_item_status ( struct XorrisO xorriso,
char *  cat_path,
char *  bin_path,
int  platform_id,
int  patch_isolinux,
int  emul,
off_t  load_size,
unsigned char *  id_string,
unsigned char *  selection_crit,
char *  form,
char *  filter,
FILE *  fp,
int  flag 
)

Definition at line 379 of file iso_img.c.

385 {
386  int is_default, no_defaults, i, is_default_id= 0, ret;
387  char *line, *bspec= NULL, zeros[28], *partition_entry;
388  off_t file_size;
389  struct stat stbuf;
390 
391  Xorriso_alloc_meM(bspec, char, SfileadrL + 80);
392 
393  no_defaults= flag & 1;
394  line= xorriso->result_line;
395  if(flag & 32)
396  load_size= -1;
397 
398  if((flag & 16) && bin_path[0] != 0) {
399  /* Concentrate boot options. */
400  memset(zeros, 0, 28);
401  if(memcmp(id_string, zeros, 28) == 0 &&
402  memcmp(selection_crit, zeros, 20) == 0)
403  is_default_id= 1;
404 
405  /* -boot_image isolinux dir= ... */
406  bspec[0]= 0;
407  if(strcmp(form, "isolinux") != 0 && strcmp(form, "any") != 0)
408  ;
409  else if(strcmp(bin_path, "/isolinux.bin") == 0 &&
410  strcmp(cat_path, "/boot.cat") == 0)
411  strcpy(bspec, "dir=/");
412  else if(strcmp(bin_path, "/isolinux/isolinux.bin") == 0 &&
413  strcmp(cat_path, "/isolinux/boot.cat") == 0)
414  strcpy(bspec, "dir=/isolinux");
415  else if(strcmp(xorriso->boot_image_bin_path,
416  "/boot/isolinux/isolinux.bin") == 0
417  && strcmp(xorriso->boot_image_cat_path,
418  "/boot/isolinux/boot.cat") == 0)
419  strcpy(bspec, "dir=/boot/isolinux");
420  memset(zeros, 0, 28);
421  if(bspec[0] && platform_id == 0 && (patch_isolinux & 0x3ff) == 1 &&
422  load_size == 2048 && is_default_id && emul == 0) {
423  sprintf(line, "-boot_image isolinux %s\n", bspec);
424  Xorriso_status_result(xorriso,filter,fp,flag&2);
425  {ret= 1; goto ex;};
426  }
427 
428  file_size= 0;
429  ret= Xorriso_iso_lstat(xorriso, bin_path, &stbuf, 2 | 4);
430  if(ret == 0) {
431  file_size= ((stbuf.st_size / (off_t) 512) +
432  !!(stbuf.st_size % (off_t) 512)) * 512;
433  if(flag & 32)
434  load_size= file_size * 512;
435  }
436  if(platform_id == 0xef && (patch_isolinux & 0x3ff) == 0 &&
437  load_size / 512 == file_size && is_default_id && emul == 0) {
438  sprintf(line, "-boot_image any efi_path=");
439  Text_shellsafe(bin_path, line, 1);
440  strcat(line, "\n");
441  Xorriso_status_result(xorriso,filter,fp,flag&2);
442  {ret= 1; goto ex;};
443  }
444  }
445 
446  is_default= (bin_path[0] == 0) || (flag & 4);
447  sprintf(line, "-boot_image %s bin_path=", form);
448  Text_shellsafe(bin_path, line, 1);
449  strcat(line, "\n");
450  if(!(is_default && no_defaults))
451  Xorriso_status_result(xorriso,filter,fp,flag&2);
452 
453  is_default= (emul == 0);
454  sprintf(line, "-boot_image %s emul_type=%s\n",
455  form, emul == 2 ? "diskette" : emul == 1 ? "hard_disk" : "no_emulation");
456  if(!(is_default && no_defaults))
457  Xorriso_status_result(xorriso,filter,fp,flag&2);
458 
459  is_default= (platform_id == 0 || (flag & 4));
460  sprintf(line, "-boot_image %s platform_id=0x%-2.2x\n", form, platform_id);
461  if(!(is_default && no_defaults))
462  Xorriso_status_result(xorriso,filter,fp,flag&2);
463 
464  is_default= ((patch_isolinux & 1) == 0 || bin_path[0] == 0 || (flag & 4));
465  sprintf(line, "-boot_image %s boot_info_table=%s\n",
466  (patch_isolinux & 2) ? "grub" : form,
467  (patch_isolinux & 1) ? "on" : "off");
468  if(!(is_default && no_defaults))
469  Xorriso_status_result(xorriso,filter,fp,flag&2);
470 
471  is_default= ((patch_isolinux & 512) == 0 || bin_path[0] == 0 || (flag & 4));
472  sprintf(line, "-boot_image grub grub2_boot_info=%s\n",
473  (patch_isolinux & 512) ? "on" : "off");
474  if(!(is_default && no_defaults))
475  Xorriso_status_result(xorriso,filter,fp,flag&2);
476 
477  if(flag & 32) {
478  is_default= 0;
479  sprintf(line, "-boot_image %s load_size=full", form);
480  } else {
481  is_default= (load_size == 2048 || (flag & 4));
482  sprintf(line, "-boot_image %s load_size=%lu\n",
483  form, (unsigned long) load_size);
484  }
485  if(!(is_default && no_defaults))
486  Xorriso_status_result(xorriso,filter,fp,flag&2);
487 
488  is_default= 1;
489  if(!(flag & 4))
490  for(i= 0; i < 20; i++)
491  if(selection_crit[i])
492  is_default= 0;
493  sprintf(line, "-boot_image %s sel_crit=", form);
494  for(i= 0; i < 20; i++)
495  sprintf(line + strlen(line), "%-2.2X", (unsigned int) selection_crit[i]);
496  strcat(line, "\n");
497  if(!(is_default && no_defaults))
498  Xorriso_status_result(xorriso,filter,fp,flag&2);
499 
500  is_default= 1;
501  if(!(flag & 4))
502  for(i= 0; i < 28; i++)
503  if(id_string[i])
504  is_default= 0;
505  sprintf(line, "-boot_image %s id_string=", form);
506  for(i= 0; i < 28; i++)
507  sprintf(line + strlen(line), "%-2.2X", (unsigned int) id_string[i]);
508  strcat(line, "\n");
509  if(!(is_default && no_defaults))
510  Xorriso_status_result(xorriso,filter,fp,flag&2);
511 
512  is_default= 1;
513  partition_entry= "";
514  if((patch_isolinux & 0x0fc) == (1 << 2))
515  partition_entry= "gpt_basdat";
516  else if((patch_isolinux & 0x0fc) == (2 << 2))
517  partition_entry= "gpt_hfsplus";
518  if(partition_entry[0]) {
519  sprintf(line, "-boot_image isolinux partition_entry=%s\n", partition_entry);
520  Xorriso_status_result(xorriso, filter, fp, flag & 2);
521  is_default= 0;
522  }
523  if(patch_isolinux & (1 << 8)) {
524  sprintf(line, "-boot_image isolinux partition_entry=apm_hfsplus\n");
525  Xorriso_status_result(xorriso, filter, fp, flag & 2);
526  is_default= 0;
527  }
528  if(is_default && !no_defaults) {
529  sprintf(line, "-boot_image isolinux partition_entry=off\n");
530  Xorriso_status_result(xorriso, filter, fp, flag & 2);
531  }
532 
533  ret= 1;
534 ex:;
535  Xorriso_free_meM(bspec);
536  return(ret);
537 }
#define SfileadrL
int Xorriso_iso_lstat(struct XorrisO *xorriso, char *path, struct stat *stbuf, int flag)
Definition: iso_tree.c:363
#define Xorriso_free_meM(pt)
Definition: sfile.h:27
#define Xorriso_alloc_meM(pt, typ, count)
Definition: sfile.h:19
char boot_image_cat_path[4096]
char result_line[10 *4096]
char boot_image_bin_path[4096]
int Xorriso_status_result(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
Definition: text_io.c:2687

References XorrisO::boot_image_bin_path, XorrisO::boot_image_cat_path, XorrisO::result_line, SfileadrL, Text_shellsafe(), Xorriso_alloc_meM, Xorriso_free_meM, Xorriso_iso_lstat(), and Xorriso_status_result().

Referenced by Xorriso_boot_image_status().

◆ Xorriso_get_volume()

int Xorriso_get_volume ( struct XorrisO xorriso,
IsoImage **  volume,
int  flag 
)

Definition at line 966 of file iso_img.c.

968 {
969  *volume= NULL;
970  if(xorriso->in_volset_handle==NULL) {
971  if(flag & 1)
972  return(0);
973  Xorriso_process_msg_queues(xorriso,0);
974  sprintf(xorriso->info_text,"No ISO image present.");
975  if(xorriso->indev[0]==0 && xorriso->outdev[0]==0)
976  sprintf(xorriso->info_text+strlen(xorriso->info_text),
977  " No -dev, -indev, or -outdev selected.");
978  else
979  sprintf(xorriso->info_text+strlen(xorriso->info_text),
980  " Possible program error with drive '%s'.", xorriso->indev);
981 
982  if(!xorriso->no_volset_present)
983  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
984  xorriso->no_volset_present= 1;
985  return(0);
986  }
987  *volume= (IsoImage *) xorriso->in_volset_handle;
988  xorriso->no_volset_present= 0;
989  return(*volume != NULL);
990 }
char indev[4096]
int no_volset_present
void * in_volset_handle
char outdev[4096]

References XorrisO::in_volset_handle, XorrisO::indev, XorrisO::info_text, XorrisO::no_volset_present, XorrisO::outdev, Xorriso_msgs_submit(), and Xorriso_process_msg_queues().

Referenced by Xorriso_add_mips_boot_file(), Xorriso_add_symlink(), Xorriso_add_tree(), Xorriso_apply_sort_file(), Xorriso_check_md5(), Xorriso_check_session_md5(), Xorriso_clone_tree(), Xorriso_clone_under(), Xorriso_dir_from_path(), Xorriso_expand_pattern(), Xorriso_extract_cut(), Xorriso_fake_stbuf(), Xorriso_findi(), Xorriso_get_md5(), Xorriso_get_node_by_path(), Xorriso_get_volid(), Xorriso_graft_in(), Xorriso_hfsplus_bless(), Xorriso_identify_split(), Xorriso_image_has_md5(), Xorriso_list_boot_images(), Xorriso_ls_filev(), Xorriso_node_from_path(), Xorriso_normalize_img_path(), Xorriso_pvd_info(), Xorriso_rename(), Xorriso_rename_suffix(), Xorriso_report_system_area(), Xorriso_restore(), Xorriso_restore_disk_object(), Xorriso_restore_is_identical(), Xorriso_restore_tree(), Xorriso_rmi(), Xorriso_scan_report_lines(), Xorriso_set_alpha_boot(), Xorriso_set_change_pending(), Xorriso_set_file_name_limit(), Xorriso_set_filter(), Xorriso_set_hppa_boot_parm(), Xorriso_set_ignore_aclea(), Xorriso_set_volid(), Xorriso_tree_restore_node(), and Xorriso_truncate_uniquely().

◆ Xorriso_is_isohybrid()

int Xorriso_is_isohybrid ( struct XorrisO xorriso,
IsoFile *  bootimg_node,
int  flag 
)

Definition at line 199 of file iso_img.c.

201 {
202  int ret;
203  unsigned char buf[68];
204  void *data_stream= NULL;
205 
206  ret= Xorriso_iso_file_open(xorriso, "", (void *) bootimg_node,
207  &data_stream, 1);
208  if(ret <= 0)
209  return(-1);
210  ret= Xorriso_iso_file_read(xorriso, data_stream, (char *) buf, 68, 0);
211  Xorriso_iso_file_close(xorriso, &data_stream, 0);
212  if(ret <= 0)
213  return(0);
214  if(buf[64] == 0xfb && buf[65] == 0xc0 && buf[66] == 0x78 && buf[67] == 0x70)
215  return(1);
216  return(0);
217 }
int Xorriso_iso_file_open(struct XorrisO *xorriso, char *pathname, void *node_pt, void **stream, int flag)
Definition: read_run.c:66
int Xorriso_iso_file_close(struct XorrisO *xorriso, void **stream, int flag)
Definition: read_run.c:169
int Xorriso_iso_file_read(struct XorrisO *xorriso, void *stream, char *buf, int count, int flag)
Definition: read_run.c:145

References Xorriso_iso_file_close(), Xorriso_iso_file_open(), and Xorriso_iso_file_read().

Referenced by Xorriso_set_isolinux_options().

◆ Xorriso_record_boot_info()

int Xorriso_record_boot_info ( struct XorrisO xorriso,
int  flag 
)

Definition at line 125 of file iso_img.c.

126 {
127  int ret;
128  struct burn_drive_info *dinfo;
129  struct burn_drive *drive;
130  IsoImage *image;
131  ElToritoBootImage *bootimg;
132  IsoFile *bootimg_node;
133  IsoBoot *bootcat_node;
134 
135  xorriso->loaded_boot_bin_lba= -1;
136  xorriso->loaded_boot_cat_path[0]= 0;
137  ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
138  "on attempt to record boot LBAs", 0);
139  if(ret<=0)
140  return(0);
141  image= isoburn_get_attached_image(drive);
142  if(image == NULL)
143  return(0);
144  ret= iso_image_get_boot_image(image, &bootimg,
145  &bootimg_node, &bootcat_node);
146  iso_image_unref(image); /* release obtained reference */
147  if(ret != 1)
148  return(0);
149  if(bootimg_node != NULL)
150  Xorriso__file_start_lba((IsoNode *) bootimg_node,
151  &(xorriso->loaded_boot_bin_lba), 0);
152  if(bootcat_node != NULL)
153  Xorriso_path_from_lba(xorriso, (IsoNode *) bootcat_node, 0,
154  xorriso->loaded_boot_cat_path, 0);
155  return(1);
156 }
int Xorriso__file_start_lba(IsoNode *node, int *lba, int flag)
Definition: iso_tree.c:2259
int Xorriso_path_from_lba(struct XorrisO *xorriso, IsoNode *node, int lba, char path[4096], int flag)
Definition: iso_tree.c:459
IsoImage * isoburn_get_attached_image(struct burn_drive *d)
Get the image attached to a drive, if any.
Definition: isofs_wrap.c:92
char loaded_boot_cat_path[4096]
int loaded_boot_bin_lba

References isoburn_get_attached_image(), XorrisO::loaded_boot_bin_lba, XorrisO::loaded_boot_cat_path, Xorriso__file_start_lba(), Xorriso_get_drive_handles(), and Xorriso_path_from_lba().

Referenced by Xorriso_aquire_drive().

◆ Xorriso_record_cmd_line()

int Xorriso_record_cmd_line ( struct XorrisO xorriso,
char *  buf,
char **  cmds,
int *  cmd_count,
int  flag 
)

Definition at line 1492 of file iso_img.c.

1494 {
1495  int ret;
1496 
1497  if(flag & 1) {
1498  (*cmd_count)++;
1499  ret= 1; goto ex;
1500  }
1501  Xorriso_alloc_meM(cmds[*cmd_count], char, strlen(buf) + 1);
1502  strcpy(cmds[*cmd_count], buf);
1503  (*cmd_count)++;
1504  ret= 1;
1505 ex:;
1506  return(ret);
1507 }

References Xorriso_alloc_meM.

Referenced by Xorriso_findi_action().

◆ Xorriso_update_volid()

int Xorriso_update_volid ( struct XorrisO xorriso,
int  flag 
)

Definition at line 57 of file iso_img.c.

58 {
59  int gret, sret= 1;
60 
61  gret= Xorriso_get_volid(xorriso, xorriso->loaded_volid, 0);
62  if(gret<=0 || (!xorriso->volid_default) || xorriso->loaded_volid[0]==0)
63  sret= Xorriso_set_volid(xorriso, xorriso->volid, 1);
64  return(gret>0 && sret>0);
65 }
int Xorriso_set_volid(struct XorrisO *xorriso, char *volid, int flag)
Definition: iso_img.c:335
int Xorriso_get_volid(struct XorrisO *xorriso, char volid[33], int flag)
Definition: iso_img.c:357
char volid[33]
int volid_default
char loaded_volid[33]

References XorrisO::loaded_volid, XorrisO::volid, XorrisO::volid_default, Xorriso_get_volid(), and Xorriso_set_volid().

Referenced by Xorriso_aquire_drive(), and Xorriso_create_empty_iso().