New option -calm_drive

This commit is contained in:
Thomas Schmitt 2009-08-24 18:36:49 +00:00
parent e146eccd5c
commit 543df52274
5 changed files with 91 additions and 6 deletions

View File

@ -2,7 +2,7 @@
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
.TH XORRISO 1 "Aug 22, 2009"
.TH XORRISO 1 "Aug 24, 2009"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
@ -800,6 +800,16 @@ the elsewise trustworthy table-of-content scan for those media.
To be in effect, the -rom_toc_scan setting has to be made before the -*dev
command which aquires drive and media.
.TP
\fB\-calm_drive\fR "in"|"out"|"all"|"on"|"off"
Reduce drive noise until it is actually used again. Some drives stay alert
for substantial time after they have been used for reading. This reduces
the startup time for the next drive operation but can be loud and waste
energy if no i/o with the drive is expected to happen soon.
.br
Modes "in", "out", "all" immediately calm down -indev, -outdev, resp. both.
Mode "on" causes -calm_drive to be performed automatically after each -dev,
-indev, and -outdev. Mode "off" disables this.
.TP
\fB\-ban_stdio_write\fR
Allow for writing only the usage of MMC optical drives. Disallow
to write the result into files of nearly arbitrary type.
@ -1498,7 +1508,7 @@ Discard the manipulated ISO image and reload it from -indev.
\fB\-rollback_end\fR
Discard the manipulated ISO image. End program without loading a new image.
.TP
.B Writing the result:
.B Writing the result, drive control:
(see also paragraph about settings below)
.TP
\fB\-commit\fR

View File

@ -4726,6 +4726,7 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
m->toc_emulation_flag= 0;
m->image_start_mode= 0;
m->image_start_value[0]= 0;
m->do_calm_drive= 1;
m->indev[0]= 0;
m->in_drive_handle= NULL;
m->in_volset_handle= NULL;
@ -7036,6 +7037,11 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
Xorriso_status_result(xorriso,filter,fp,flag&2);
}
is_default= (xorriso->do_calm_drive & 1);
sprintf(line,"-calm_drive %s\n", xorriso->do_calm_drive & 1 ? "on" : "off");
if(!(is_default && no_defaults))
Xorriso_status_result(xorriso,filter,fp,flag&2);
is_default= (xorriso->grow_blindly_msc2<0);
sprintf(sfe, "%d", xorriso->grow_blindly_msc2);
sprintf(line,"-grow_blindly %s\n",
@ -10521,7 +10527,7 @@ no_volunteer:;
sprintf(xorriso->info_text, "xorriso: Option -waiti pausing is done.\n");
}
if(dev_adr[0]) {
hflag= 2|32;
hflag= 2 | 32 | 64;
if(!do_grow)
hflag|= 8; /* consider overwriteables as blank */
ret= Xorriso_option_dev(xorriso, dev_adr, hflag);
@ -13254,6 +13260,27 @@ show_status:;
}
/* Option -calm_drive */
int Xorriso_option_calm_drive(struct XorrisO *xorriso, char *which, int flag)
{
int gu_flag= 4, ret;
if(strncmp(which,"in",2)==0)
gu_flag|= 1;
else if(strncmp(which,"out",3)==0)
gu_flag|= 2;
else if(strncmp(which,"on",2)==0) {
xorriso->do_calm_drive|= 1;
} else if(strncmp(which,"off",3)==0) {
xorriso->do_calm_drive&= ~1;
} else if(strncmp(which,"off",3)==0) {
} else
gu_flag|= 3;
ret= Xorriso_drive_snooze(xorriso, gu_flag);
return(ret);
}
/* Option -cd alias -cdi */
int Xorriso_option_cdi(struct XorrisO *xorriso, char *iso_rr_path, int flag)
{
@ -14320,6 +14347,7 @@ int Xorriso_option_cut_out(struct XorrisO *xorriso, char *disk_path,
bit4= if the drive is a regular disk file: truncate it to
the write start address
bit5= do not print toc of aquired drive
bit6= do not calm down drive after aquiring it
@return <=0 error , 1 success, 2 revoked by -reassure
*/
int Xorriso_option_dev(struct XorrisO *xorriso, char *in_adr, int flag)
@ -14373,7 +14401,8 @@ int Xorriso_option_dev(struct XorrisO *xorriso, char *in_adr, int flag)
}
ret= Xorriso_give_up_drive(xorriso, (flag&3)|((flag&32)>>2));
} else
ret= Xorriso_aquire_drive(xorriso, adr, (flag&(3|32))|(((flag&(8|16))>>1)));
ret= Xorriso_aquire_drive(xorriso, adr,
(flag & (3 | 32 | 64)) | (((flag & (8 | 16)) >> 1)));
if(ret<=0)
return(ret);
if(xorriso->in_drive_handle == NULL)
@ -15523,6 +15552,8 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" -rom_toc_scan \"on\"|\"off\"[:\"emul_on\"|\"emul_off\"]",
" Enable scanning for ISO sessions on read-only drives/media",
" resp. on overwriteable media with emulated TOC.",
" -calm_drive \"in\"|\"out\"|\"all\"|\"on\"|\"off\"",
" Reduce drive noise until it gets actually used again.",
" -assert_volid pattern severity",
" Accept input image only if its volume id matches pattern.",
" -charset name Set the character set name to be used for file name",
@ -18757,7 +18788,8 @@ int Xorriso_count_args(struct XorrisO *xorriso, int argc, char **argv,
static char arg1_commands[][40]= {
"abort_on","acl","add_plainly","application_id","auto_charset",
"backslash_codes","blank",
"cd","cdi","cdx","charset","close","commit_eject","compliance",
"calm_drive","cd","cdi","cdx","charset","close",
"commit_eject","compliance",
"dev","dialog","disk_dev_ino","disk_pattern","dummy","eject",
"iso_rr_pattern","follow","format","fs","gid","grow_blindly","hardlinks",
"history","indev","in_charset","joliet","list_delimiter","local_charset",
@ -18969,6 +19001,10 @@ next_command:;
(*idx)+= 2;
ret= Xorriso_option_boot_image(xorriso, arg1, arg2, 0);
} else if(strcmp(cmd,"calm_drive")==0) {
(*idx)++;
ret= Xorriso_option_calm_drive(xorriso, arg1, 0);
} else if(strcmp(cmd,"cd")==0 || strcmp(cmd,"cdi")==0) {
(*idx)++;
ret= Xorriso_option_cdi(xorriso, arg1, 0);

View File

@ -1 +1 @@
#define Xorriso_timestamP "2009.08.24.182839"
#define Xorriso_timestamP "2009.08.24.183750"

View File

@ -931,6 +931,7 @@ int Xorriso_assert_volid(struct XorrisO *xorriso, int msc1, int flag)
bit3= if the drive is a regular disk file: truncate it to
the write start address
bit5= do not print toc
bit6= do not calm down drive after aquiring it
@return <=0 failure , 1= ok
2=success, but not writeable with bit1
3=success, but not blank and not ISO with bit0
@ -1248,6 +1249,9 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag)
}
}
}
if((xorriso->do_calm_drive & 1) && !(flag & 64))
burn_drive_snooze(drive, 0); /* No need to make noise from start */
ret= 1+not_writeable;
ex:
Xorriso_process_msg_queues(xorriso,0);
@ -12552,3 +12556,33 @@ int Xorriso_md5_end(struct XorrisO *xorriso, void **ctx, char md5[16],
return(1);
}
/* @param flag bit0=input drive
bit1=output drive
*/
int Xorriso_drive_snooze(struct XorrisO *xorriso, int flag)
{
int in_is_out_too, ret;
struct burn_drive_info *dinfo;
struct burn_drive *drive;
in_is_out_too= (xorriso->in_drive_handle == xorriso->out_drive_handle);
if((flag & 1) && xorriso->in_drive_handle != NULL) {
Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
"on attempt to calm drive", 0);
burn_drive_snooze(drive, 0);
if(in_is_out_too)
{ret= 1; goto ex;}
}
if((flag&2) && xorriso->out_drive_handle!=NULL) {
Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
"on attempt to calm drive", 2);
burn_drive_snooze(drive, 0);
}
ret= 1;
ex:;
Xorriso_process_msg_queues(xorriso,0);
return(ret);
}

View File

@ -470,6 +470,11 @@ int Xorriso_md5_compute(struct XorrisO *xorriso, void *ctx,
int Xorriso_md5_end(struct XorrisO *xorriso, void **ctx, char md5[16],
int flag);
/* @param flag bit0=input drive
bit1=output drive
*/
int Xorriso_drive_snooze(struct XorrisO *xorriso, int flag);
/* A pseudo file type for El-Torito bootsectors as in man 2 stat :
For now take the highest possible value.