New bit1 with API call Xorriso_change_is_pending() issues a note if return is 0 and indev and outdev point to different drives

This commit is contained in:
Thomas Schmitt 2023-08-08 13:43:51 +02:00
parent 0b7e4f934e
commit ab0bfdb04f
8 changed files with 43 additions and 5 deletions

View File

@ -238,6 +238,10 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
m->indev_off_adr[0]= 0; m->indev_off_adr[0]= 0;
m->isofs_st_in= 0; m->isofs_st_in= 0;
m->volset_change_pending= 0; m->volset_change_pending= 0;
m->commit_attempts= 0;
m->print_size_attempts= 0;
m->write_session_counter= 0;
m->print_size_counter= 0;
m->no_volset_present= 0; m->no_volset_present= 0;
m->in_sector_map= NULL; m->in_sector_map= NULL;
m->check_media_default= NULL; m->check_media_default= NULL;

View File

@ -995,12 +995,32 @@ int Xorriso_get_volume(struct XorrisO *xorriso, IsoImage **volume,
/* @param flag bit0= do not return 1 on volset_change_pending != 1 /* @param flag bit0= do not return 1 on volset_change_pending != 1
bit1= issue NOTE if return is 0,
indev and outdev point to different drives,
and no write run or size run has happened
*/ */
int Xorriso_change_is_pending(struct XorrisO *xorriso, int flag) int Xorriso_change_is_pending(struct XorrisO *xorriso, int flag)
{ {
int ret;
if(flag & 1) if(flag & 1)
return(xorriso->volset_change_pending == 1); ret= (xorriso->volset_change_pending == 1);
return(!!xorriso->volset_change_pending); else
ret= !!xorriso->volset_change_pending;
if((flag & 2) && xorriso->volset_change_pending == 0 &&
xorriso->commit_attempts <= 0 &&
xorriso->print_size_attempts <= 0 &&
xorriso->write_session_counter <= 0 &&
xorriso->print_size_counter <= 0) {
if(xorriso->indev[0] != 0 && xorriso->outdev[0] != 0 &&
strcmp(xorriso->indev, xorriso->outdev) != 0) {
Xorriso_msgs_submit(xorriso, 0,
"-indev and -outdev differ. But no pending image modifications.",
0, "NOTE", 0);
}
}
return(ret);
} }

View File

@ -2343,6 +2343,7 @@ int Xorriso_option_commit(struct XorrisO *xorriso, int flag)
int ret; int ret;
char eternal_problem_status_text_mem[80]; char eternal_problem_status_text_mem[80];
xorriso->commit_attempts++;
if(!Xorriso_change_is_pending(xorriso, 0)) { if(!Xorriso_change_is_pending(xorriso, 0)) {
sprintf(xorriso->info_text, "-commit: No image modifications pending"); sprintf(xorriso->info_text, "-commit: No image modifications pending");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);

View File

@ -335,6 +335,7 @@ int Xorriso_option_print_size(struct XorrisO *xorriso, int flag)
{ {
int ret, fd; int ret, fd;
xorriso->print_size_attempts++;
if(!Xorriso_change_is_pending(xorriso, 0)) { if(!Xorriso_change_is_pending(xorriso, 0)) {
sprintf(xorriso->info_text,"-print_size: No image modifications pending"); sprintf(xorriso->info_text,"-print_size: No image modifications pending");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);

View File

@ -1488,6 +1488,8 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
Xorriso_set_image_severities(xorriso, 2); Xorriso_set_image_severities(xorriso, 2);
if(flag&1) /* reset queue severity */ if(flag&1) /* reset queue severity */
Xorriso_set_image_severities(xorriso, 0); Xorriso_set_image_severities(xorriso, 0);
if(flag & 1)
xorriso->print_size_counter++;
goto cancel_iso; goto cancel_iso;
} }
@ -1571,6 +1573,7 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
sprintf(xorriso->info_text, "Writing to %s completed successfully.\n\n", sprintf(xorriso->info_text, "Writing to %s completed successfully.\n\n",
Text_shellsafe(xorriso->outdev,sfe,0)); Text_shellsafe(xorriso->outdev,sfe,0));
Xorriso_info(xorriso, 0); Xorriso_info(xorriso, 0);
xorriso->write_session_counter++;
ret= 1; ret= 1;
ex:; ex:;
xorriso->run_state= 0; /* Indicate that burning has ended */ xorriso->run_state= 0; /* Indicate that burning has ended */

View File

@ -214,9 +214,13 @@ int Xorriso_startup_libraries(struct XorrisO *xorriso, int flag);
/* Inquire whether option -commit would make sense. /* Inquire whether option -commit would make sense.
@param xorriso The context object to inquire. @param xorriso The context object to inquire.
@param flag @since 0.6.6 @param flag bit0= do not return 1 if -as mkisofs -print-size was
bit0= do not return 1 if -as mkisofs -print-size was
performed on the current image. performed on the current image.
@since 0.6.6
bit1= issue NOTE if return is 0,
indev and outdev point to different drives,
and no write run has happened
@since 1.5.8
@return 0= -commit would have nothing to do @return 0= -commit would have nothing to do
1= a new image session would emerge at -commit 1= a new image session would emerge at -commit
*/ */

View File

@ -357,6 +357,11 @@ struct XorrisO { /* the global context of xorriso */
3= change pending, but the attempt to write it 3= change pending, but the attempt to write it
failed failed
*/ */
int commit_attempts; /* For Xorriso_change_is_pending bit1 */
int print_size_attempts; /* For Xorriso_change_is_pending bit1 */
int write_session_counter; /* For Xorriso_change_is_pending bit1 */
int print_size_counter; /* For Xorriso_change_is_pending bit1 */
int no_volset_present; /* set to 1 on first failure */ int no_volset_present; /* set to 1 on first failure */
struct CheckmediajoB *check_media_default; struct CheckmediajoB *check_media_default;

View File

@ -1 +1 @@
#define Xorriso_timestamP "2023.08.07.132608" #define Xorriso_timestamP "2023.08.08.114313"