New parameter "leave" to command -calm_drive

This commit is contained in:
Thomas Schmitt 2024-09-20 18:36:45 +02:00
parent 37c8b3f9e7
commit b1d1edcf05
9 changed files with 124 additions and 85 deletions

View File

@ -803,7 +803,7 @@ ex:
*/
int Xorriso_give_up_drive(struct XorrisO *xorriso, int flag)
{
int in_is_out_too, ret, do_eject;
int in_is_out_too, ret, do_eject, no_calm= 0;
struct burn_drive_info *dinfo;
struct burn_drive *drive;
@ -816,7 +816,10 @@ int Xorriso_give_up_drive(struct XorrisO *xorriso, int flag)
}
flag|= 3; /* give up in/out drive to eject it */
}
if(xorriso->do_calm_drive & 2)
no_calm= 16;
if((flag&1) && xorriso->in_drive_handle != NULL) {
Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
"on attempt to give up drive", 0);
@ -830,7 +833,7 @@ int Xorriso_give_up_drive(struct XorrisO *xorriso, int flag)
do_eject= 0;
}
if(drive!=NULL)
isoburn_drive_release(drive, do_eject);
isoburn_drive_release_v2(drive, (do_eject << 1) | no_calm);
if(dinfo!=NULL)
burn_drive_info_free(dinfo);
}

View File

@ -1565,13 +1565,21 @@ int Xorriso_option_calm_drive(struct XorrisO *xorriso, char *which, int flag)
else if(strcmp(which,"out")==0)
gu_flag= 2;
else if(strcmp(which,"on")==0) {
xorriso->do_calm_drive&= ~2;
xorriso->do_calm_drive|= 1;
} else if(strcmp(which,"off")==0) {
xorriso->do_calm_drive&= ~1;
xorriso->do_calm_drive&= ~3;
} else if(strcmp(which,"revoke")==0) {
gu_flag= 7;
} else
} else if(strcmp(which, "leave") == 0) {
xorriso->do_calm_drive&= ~1;
xorriso->do_calm_drive|= 2;
} else {
/* "all" and any unrecognized which-parameter */
gu_flag= 3;
}
if((gu_flag & 3) == 0)
return(1);
ret= Xorriso_drive_snooze(xorriso, gu_flag);
return(ret);
}
@ -1835,8 +1843,9 @@ int Xorriso_option_chattri(struct XorrisO *xorriso, char *chattr_text,
/* Try out whether this file is suitable for chattr */
ret= Xorriso_set_lfa_flags(xorriso, NULL, optv[i], chattr_text,
lfa_flags, operator, 1 | 8);
if(ret <= 0 || ret == 2)
if(ret <= 0)
goto partial_failure;
ret= Findjob_new(&job, optv[i], 0);
if(ret<=0) {
Xorriso_no_findjob(xorriso, "-chattr_r", 0);

View File

@ -1952,7 +1952,7 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" [:\"emul_wide\"|\"emul_narrow\"]",
" Enable scanning for ISO sessions on read-only drives/media",
" and on overwritable media with emulated TOC.",
" -calm_drive \"in\"|\"out\"|\"all\"|\"on\"|\"off\"",
" -calm_drive \"in\"|\"out\"|\"all\"|\"on\"|\"off\"|\"leave\"",
" Reduce drive noise until it gets actually used again.",
" -assert_volid pattern severity",
" Accept input image only if its volume id matches pattern.",

View File

@ -3708,8 +3708,12 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
if(!(is_default && no_defaults))
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");
is_default= ((xorriso->do_calm_drive & 3) == 1);
if(xorriso->do_calm_drive & 2) {
sprintf(line, "-calm_drive leave\n");
} else {
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);

View File

@ -9,7 +9,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 "Version 1.5.7, Sep 07, 2024"
.TH XORRISO 1 "Version 1.5.7, Sep 18, 2024"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
@ -1336,17 +1336,24 @@ Setting "on:emul_wide" lets the scan continue up to the end of the medium.
This may be useful after copying a medium with \-check_media patch_lba0=on
when not the last session was loaded.
.TP
\fB\-calm_drive\fR "in"|"out"|"all"|"revoke"|"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
\fB\-calm_drive\fR "in"|"out"|"all"|"revoke"|"on"|"off"|"never"
Control reduction of drive noise until it is actually used again.
Some drives stay alert for substantial time after they have been used for
reading or writing. 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, or both,
respectively.
Mode "revoke" immediately alerts both.
Mode "on" causes \-calm_drive to be performed automatically after each \-dev,
\-indev, and \-outdev. Mode "off" disables this.
respectively. Mode "revoke" immediately alerts both drives.
.br
Mode "on" causes calming to be performed automatically after each \-dev,
\-indev, and \-outdev. Mode "off" disables this but still automatically calms
a drive when it is given up without ejecting.
Mode "leave" disables all automatic drive calming so that the drives might
stay alert even after the end of the xorriso program run.
.br
Drives will slow down on their own after some time of inactivity. This
usually happens in several steps.
.TP
\fB\-ban_stdio_write\fR
Allow for writing only the usage of MMC optical drives. Disallow

View File

@ -1185,16 +1185,22 @@ activate them only after image loading.
continue up to the end of the medium. This may be useful after
copying a medium with -check_media patch_lba0=on when not the last
session was loaded.
-calm_drive "in"|"out"|"all"|"revoke"|"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.
-calm_drive "in"|"out"|"all"|"revoke"|"on"|"off"|"never"
Control reduction of drive noise until it is actually used again.
Some drives stay alert for substantial time after they have been
used for reading or writing. 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.
Modes "in", "out", "all" immediately calm down -indev, -outdev, or
both, respectively. Mode "revoke" immediately alerts both. Mode
"on" causes -calm_drive to be performed automatically after each
-dev, -indev, and -outdev. Mode "off" disables this.
both, respectively. Mode "revoke" immediately alerts both drives.
Mode "on" causes calming to be performed automatically after each
-dev, -indev, and -outdev. Mode "off" disables this but still
automatically calms a drive when it is given up without ejecting.
Mode "leave" disables all automatic drive calming so that the
drives might stay alert even after the end of the xorriso program
run.
Drives will slow down on their own after some time of inactivity.
This usually happens in several steps.
-ban_stdio_write
Allow for writing only the usage of MMC optical drives. Disallow
to write the result into files of nearly arbitrary type. Once set,
@ -6033,7 +6039,7 @@ File: xorriso.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal, Up: Top
* -assess_indev_features shows filesystem features: Inquiry. (line 61)
* -auto_charset learns character set from image: Loading. (line 141)
* -backslash_codes enables backslash conversion: Scripting. (line 73)
* -ban_stdio_write demands real drive: Loading. (line 454)
* -ban_stdio_write demands real drive: Loading. (line 460)
* -biblio_file sets biblio file name: SetWrite. (line 277)
* -blank erases media: Writing. (line 57)
* -boot_image controls bootability: Bootable. (line 75)
@ -6073,7 +6079,7 @@ File: xorriso.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal, Up: Top
* -cp_rx copies file trees to disk: Restore. (line 131)
* -cp_rx copies file trees to disk <1>: Restore. (line 139)
* -cut_out inserts piece of data file or device: Insert. (line 139)
* -data_cache_size adjusts read cache size: Loading. (line 470)
* -data_cache_size adjusts read cache size: Loading. (line 476)
* -dev acquires one drive for input and output: AqDrive. (line 12)
* -devices gets list of drives: Inquiry. (line 7)
* -device_links gets list of drives: Inquiry. (line 17)
@ -6090,7 +6096,7 @@ File: xorriso.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal, Up: Top
* -dusx show directory size on disk: Navigate. (line 96)
* -dux show directory size on disk: Navigate. (line 92)
* -dvd_obs set write block size and end alignment: SetWrite. (line 421)
* -early_stdio_test classifies stdio drives: Loading. (line 458)
* -early_stdio_test classifies stdio drives: Loading. (line 464)
* -ecma119_map names w/o Rock Ridge, Joliet: Loading. (line 337)
* -eject ejects drive tray: Writing. (line 50)
* -end writes pending session and ends program: Scripting. (line 153)
@ -6335,8 +6341,8 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top
* Directory, delete, -rmdir: Manip. (line 29)
* disk_path, _definition: Insert. (line 6)
* Drive, accessability, -drive_class: AqDrive. (line 43)
* Drive, classify stdio, -early_stdio_test: Loading. (line 458)
* Drive, demand real MMC, -ban_stdio_write: Loading. (line 454)
* Drive, classify stdio, -early_stdio_test: Loading. (line 464)
* Drive, demand real MMC, -ban_stdio_write: Loading. (line 460)
* Drive, eject tray, -eject: Writing. (line 50)
* Drive, for input and output, -dev: AqDrive. (line 12)
* Drive, for input, -indev: AqDrive. (line 23)
@ -6390,7 +6396,7 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top
* HFS+ serial number: Bootable. (line 455)
* hidden, set in ISO image, -hide: Manip. (line 211)
* HP-PA boot sector, production: Bootable. (line 430)
* Image reading, cache size, -data_cache_size: Loading. (line 470)
* Image reading, cache size, -data_cache_size: Loading. (line 476)
* Image, demand volume ID, -assert_volid: Loading. (line 129)
* Image, discard pending changes, -rollback: Writing. (line 9)
* Image, filesystem to load, -read_fs: Loading. (line 120)
@ -6625,48 +6631,48 @@ Node: Commands26634
Node: ArgSort28311
Node: AqDrive29805
Node: Loading36962
Node: Insert65464
Node: SetInsert77659
Node: Manip87895
Node: CmdFind100015
Node: Filter121337
Node: Writing125959
Node: SetWrite138453
Node: Bootable169728
Node: Jigdo201010
Node: Charset206013
Node: Exception209342
Node: DialogCtl215531
Node: Inquiry218133
Node: Navigate230698
Node: Verify241915
Node: Restore253064
Node: Emulation265271
Node: Scripting276847
Node: Frontend284741
Node: Examples294367
Node: ExDevices295545
Node: ExCreate296206
Node: ExDialog297506
Node: ExGrowing298777
Node: ExModifying299586
Node: ExBootable300096
Node: ExCharset300651
Node: ExPseudo301547
Node: ExCdrecord302474
Node: ExMkisofs302794
Node: ExGrowisofs304691
Node: ExException305844
Node: ExTime306302
Node: ExIncBackup306760
Node: ExRestore310786
Node: ExRecovery311732
Node: Files312304
Node: Environ313638
Node: Seealso314386
Node: Bugreport315150
Node: Legal315741
Node: CommandIdx316753
Node: ConceptIdx335227
Node: Insert65841
Node: SetInsert78036
Node: Manip88272
Node: CmdFind100392
Node: Filter121714
Node: Writing126336
Node: SetWrite138830
Node: Bootable170105
Node: Jigdo201387
Node: Charset206390
Node: Exception209719
Node: DialogCtl215908
Node: Inquiry218510
Node: Navigate231075
Node: Verify242292
Node: Restore253441
Node: Emulation265648
Node: Scripting277224
Node: Frontend285118
Node: Examples294744
Node: ExDevices295922
Node: ExCreate296583
Node: ExDialog297883
Node: ExGrowing299154
Node: ExModifying299963
Node: ExBootable300473
Node: ExCharset301028
Node: ExPseudo301924
Node: ExCdrecord302851
Node: ExMkisofs303171
Node: ExGrowisofs305068
Node: ExException306221
Node: ExTime306679
Node: ExIncBackup307137
Node: ExRestore311163
Node: ExRecovery312109
Node: Files312681
Node: Environ314015
Node: Seealso314763
Node: Bugreport315527
Node: Legal316118
Node: CommandIdx317130
Node: ConceptIdx335604

End Tag Table

View File

@ -50,7 +50,7 @@
@c man .\" First parameter, NAME, should be all caps
@c man .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
@c man .\" other parameters are allowed: see man(7), man(1)
@c man .TH XORRISO 1 "Version 1.5.7, Sep 07, 2024"
@c man .TH XORRISO 1 "Version 1.5.7, Sep 18, 2024"
@c man .\" Please adjust this date whenever revising the manpage.
@c man .\"
@c man .\" Some roff macros, for reference:
@ -1604,19 +1604,26 @@ Setting "on:emul_wide" lets the scan continue up to the end of the medium.
This may be useful after copying a medium with -check_media patch_lba0=on
when not the last session was loaded.
@c man .TP
@item -calm_drive "in"|"out"|"all"|"revoke"|"on"|"off"
@item -calm_drive "in"|"out"|"all"|"revoke"|"on"|"off"|"never"
@kindex -calm_drive reduces drive activity
@cindex Drive, reduce activity, -calm_drive
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
Control reduction of drive noise until it is actually used again.
Some drives stay alert for substantial time after they have been used for
reading or writing. 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.
@*
Modes "in", "out", "all" immediately calm down -indev, -outdev, or both,
respectively.
Mode "revoke" immediately alerts both.
Mode "on" causes -calm_drive to be performed automatically after each -dev,
-indev, and -outdev. Mode "off" disables this.
respectively. Mode "revoke" immediately alerts both drives.
@*
Mode "on" causes calming to be performed automatically after each -dev,
-indev, and -outdev. Mode "off" disables this but still automatically calms
a drive when it is given up without ejecting.
Mode "leave" disables all automatic drive calming so that the drives might
stay alert even after the end of the xorriso program run.
@*
Drives will slow down on their own after some time of inactivity. This
usually happens in several steps.
@c man .TP
@item -ban_stdio_write
@kindex -ban_stdio_write demands real drive

View File

@ -381,7 +381,10 @@ struct XorrisO { /* the global context of xorriso */
int cache_tile_blocks;
int cache_default; /* bit0= cache_num_tiles, bit1= cache_tile_blocks */
int do_calm_drive; /* bit0= calm down drive after acquiring it */
int do_calm_drive; /* bit0= calm down drive after acquiring it
bit1= do not calm down drive when giving it up
(The combination of bit0 and bit1 is yet undefined)
*/
char indev[SfileadrL];
void *in_drive_handle; /* interpreted only by libburnia oriented modules */

View File

@ -1 +1 @@
#define Xorriso_timestamP "2024.09.20.162540"
#define Xorriso_timestamP "2024.09.20.163618"