New option -assert_volid
This commit is contained in:
@ -469,6 +469,44 @@ int Xorriso_record_boot_info(struct XorrisO *xorriso, int flag)
|
||||
}
|
||||
|
||||
|
||||
int Xorriso_assert_volid(struct XorrisO *xorriso, int msc1, int flag)
|
||||
{
|
||||
int ret, image_blocks;
|
||||
char volid[33];
|
||||
struct burn_drive_info *dinfo;
|
||||
struct burn_drive *drive;
|
||||
|
||||
if(xorriso->assert_volid[0] == 0)
|
||||
return(1);
|
||||
ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
|
||||
"on attempt to perform -assert_volid", 0);
|
||||
if(ret<=0)
|
||||
return(0);
|
||||
ret= isoburn_read_iso_head(drive, msc1, &image_blocks, volid, 1);
|
||||
Xorriso_process_msg_queues(xorriso,0);
|
||||
if(ret <= 0) {
|
||||
sprintf(xorriso->info_text,
|
||||
"-assert_volid: Cannot determine Volume Id at LBA %d.", msc1);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0,
|
||||
xorriso->assert_volid_sev, 0);
|
||||
}
|
||||
ret= Sregex_match(xorriso->assert_volid, volid, 0);
|
||||
if(ret < 0)
|
||||
return(2);
|
||||
if(ret == 0) {
|
||||
strcpy(xorriso->info_text,
|
||||
"-assert_volid: Volume id does not match pattern: ");
|
||||
Text_shellsafe(xorriso->assert_volid, xorriso->info_text, 1);
|
||||
strcat(xorriso->info_text, " <> ");
|
||||
Text_shellsafe(xorriso->loaded_volid, xorriso->info_text, 1);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0,
|
||||
xorriso->assert_volid_sev, 0);
|
||||
return(0);
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
||||
/* @param flag bit0= aquire as isoburn input drive
|
||||
bit1= aquire as libburn output drive (as isoburn drive if bit0)
|
||||
bit2= regard overwriteable media as blank
|
||||
@ -647,6 +685,9 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag)
|
||||
"Loading ISO image tree from LBA %d", load_lba);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
|
||||
}
|
||||
ret= Xorriso_assert_volid(xorriso, load_lba, 0);
|
||||
if(ret <= 0)
|
||||
goto ex;
|
||||
}
|
||||
|
||||
/* <<< */
|
||||
@ -711,18 +752,6 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag)
|
||||
if(!(flag&32)) {
|
||||
Xorriso_toc(xorriso, 1 | 8);
|
||||
if(xorriso->loaded_volid[0]!=0) {
|
||||
|
||||
#ifdef NIX
|
||||
sprintf(xorriso->result_line,"Volume id : '%s'\n",
|
||||
xorriso->loaded_volid);
|
||||
Xorriso_result(xorriso,0);
|
||||
if(strcmp(xorriso->loaded_volid, xorriso->volid)!=0 &&
|
||||
!xorriso->volid_default) {
|
||||
sprintf(xorriso->result_line, "New volume id: '%s'\n", xorriso->volid);
|
||||
Xorriso_result(xorriso,0);
|
||||
}
|
||||
#else
|
||||
|
||||
sprintf(xorriso->info_text,"Volume id : '%s'\n",
|
||||
xorriso->loaded_volid);
|
||||
Xorriso_info(xorriso, 0);
|
||||
@ -731,9 +760,6 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag)
|
||||
sprintf(xorriso->info_text, "New volume id: '%s'\n", xorriso->volid);
|
||||
Xorriso_info(xorriso, 0);
|
||||
}
|
||||
|
||||
#endif /* ! NIX */
|
||||
|
||||
}
|
||||
}
|
||||
ret= 1+not_writeable;
|
||||
|
Reference in New Issue
Block a user