New option -grow_blindly

This commit is contained in:
Thomas Schmitt 2008-07-05 13:36:48 +00:00
parent 161bf5748c
commit 0a8a066a96
5 changed files with 119 additions and 26 deletions

View File

@ -72,7 +72,7 @@ Session model
.br
Media types and states
.br
Creating, Growing, Modifying
Creating, Growing, Modifying, Blind Growing
.br
Libburn drives
.br
@ -121,7 +121,8 @@ filesystems. This expansion method is referred as emulated growing.
.PP
xorriso provides both ways of growing as well as an own method named
\fBmodifying\fR which produces a completely new ISO image from the old
one and the modifications. See paragraph Creating, Growing, Modifying below.
one and the modifications.
See paragraph Creating, Growing, Modifying, Blind Growing below.
.PP
xorriso adopts the concept of multi-session by loading an eventual image
directory tree, allowing to manipulate it by several actions, and to write
@ -196,7 +197,7 @@ contain unrecognizable data in the first 32 data blocks.
media. Often only the first and the last session are visible. Sometimes
not even that. Option -rom_toc_scan might or might not help in such cases.
.SS
.B Creating, Growing, Modifying:
.B Creating, Growing, Modifying, Blind Growing:
.br
A new empty ISO image gets \fBcreated\fR
if there is no input drive with a valid
@ -229,11 +230,25 @@ named pipes, character devices, sockets.
On the other hand modified sessions cannot be written to appendable media
but to blank media only.
.br
Modifying takes place whenever input drive and output drive are not the same.
This is achieved by options -indev and -outdev.
.br
So for this method one needs either two optical drives or has to work with
filesystem objects as source and/or target media.
.br
Modifying takes place if input drive and output drive are not the same and
if option -grow_blindly is set to its default "off".
This is achieved by options -indev and -outdev.
.PP
If option -grow_blindly is set to a non-negative number and if -indev and
-outdev are both set to different drives, then \fBblind growing\fR is
performed. It produces an add-on session which is ready for being written
to the given block address. This is the usage model of
.br
mkisofs -M $indev -C $msc1,$msc2 -o $outdev
.br
which gives much room for wrong parameter combinations and should thus only be
employed if a strict distinction between ISO formatter xorriso and the burn
program is desired. -C $msc1,$msc2 is equivalent to:
.br
-load sbsector $msc1 -grow_blindly $msc2
.SS
.B Libburn drives:
.br
@ -245,8 +260,8 @@ Rock Ridge info must be present in existing ISO images and it will be generated
by the program unconditionally.
.PP
Output drive, i.e. target for writing, can be any libburn drive.
Some drive types do not support the method of growing but only the method
of modifying. They all are suitable for newly created images.
Some drive types do not support the method of growing but only the methods
of modifying and blind growing. They all are suitable for newly created images.
.br
All drive file objects have to offer rw-permission to the user of xorriso.
Even those which will not be useable for reading an ISO image.
@ -277,7 +292,8 @@ their path in the filesystem. E.g.:
If path leads to a regular file or to a block device then the emulated drive
is random access readable and can be used for the method of growing if it
already contains a valid ISO 9660 image. Any other file type is not readable
via "stdio:" and can only be used as target for the method of modifying.
via "stdio:" and can only be used as target for the method of modifying or
blind growing.
Non existing paths in existing directories are handled as empty regular files.
.PP
A very special kind of pseudo drive are open file descriptors. They are
@ -427,13 +443,15 @@ without aquiring a new one.
.TP
\fB\-indev\fR address
Set input drive and load an eventual ISO image. If the new input drive differs
from -outdev then switch from growing to modifying. The same rules and
restrictions apply as with -dev.
from -outdev then switch from growing to modifying or to blind growing.
It depends on the setting of -grow_blindly which of both gets activated.
The same rules and restrictions apply as with -dev.
.TP
\fB\-outdev\fR address
Set output drive and if it differs from the input drive then switch from
growing to modifying. Unlike -dev and -indev this action does not load a
new ISO image. So it can be performed even if there are pending changes.
growing to modifying or to blind growing. Unlike -dev and -indev this action
does not load a new ISO image. So it can be performed even if there are pending
changes.
.br
-outdev can be performed without previous -dev or -indev. In that case an
empty ISO image with no changes pending is created. It can either be populated
@ -446,6 +464,17 @@ apply. See above paragraph "Libburn drives".
An empty address string "" gives up the current output drive
without aquiring a new one. No writing is possible without an output drive.
.TP
\fB\-grow_blindly\fR "off"|predicted_nwa
If predicted_nwa is a non-negative number then perform blind growing rather
than modifying if -indev and -outdev are set to different drives.
"off" or "-1" switch to modifying, which is the default.
.br
predicted_nwa is the block address where the add-on session of blind
growing will finally end up. It is the responsibility of the user to ensure
this final position and the presence of the older sessions. Else the
overall ISO image will not be mountable or will produce read errors when
accessing file content.
.TP
\fB\-load\fR entity id
Load a particular (possibly outdated) ISO image from a -dev or -indev which
hosts more than one session. Usually all available sessions are shown with
@ -908,8 +937,8 @@ Discard the manipulated ISO image. End program without loading a new image.
\fB\-commit\fR
Perform the write operation. Afterwards eventually make the
-outdev the new -dev and load the image from there.
Switch from eventual modifiying mode to growing mode.
(A subsequent -outdev will activate modification mode.)
Switch to growing mode.
(A subsequent -outdev will activate modification mode or blind growing.)
-commit is performed automatically at end of program if there
are uncommitted manipulations pending.
So, to perform a final write operation with no new -dev

View File

@ -2849,6 +2849,7 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
m->outdev[0]= 0;
m->out_drive_handle= NULL;
m->dev_fd_1= -1;
m->grow_blindly_msc2= -1;
m->ban_stdio_write= 0;
m->do_dummy= 0;
m->do_close= 0;
@ -4242,6 +4243,13 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
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",
xorriso->grow_blindly_msc2 < 0 ? "off" : sfe);
if(!(is_default && no_defaults))
Xorriso_status_result(xorriso,filter,fp,flag&2);
if(strcmp(xorriso->indev,xorriso->outdev)==0) {
sprintf(line,"-dev %s\n", Text_shellsafe(xorriso->indev,sfe,0));
Xorriso_status_result(xorriso,filter,fp,flag&2);
@ -8716,7 +8724,10 @@ int Xorriso_option_commit(struct XorrisO *xorriso, int flag)
if(flag&1)
return(1);
strcpy(newdev, xorriso->outdev);
ret= Xorriso_option_dev(xorriso, newdev, 3|4);
if(xorriso->grow_blindly_msc2>=0)
ret= Xorriso_option_dev(xorriso, "", 3|4);
else
ret= Xorriso_option_dev(xorriso, newdev, 3|4);
return(ret);
}
@ -9715,6 +9726,25 @@ int Xorriso_option_gid(struct XorrisO *xorriso, char *gid, int flag)
}
/* Option -grow_blindly */
int Xorriso_option_grow_blindly(struct XorrisO *xorriso, char *msc2, int flag)
{
double num;
int l;
if(msc2[0]==0 || strcmp(msc2,"-")==0 || strcmp(msc2, "off")==0) {
xorriso->grow_blindly_msc2= -1;
return(1);
}
num= Scanf_io_size(msc2, 0);
l= strlen(msc2);
if(msc2[l-1]<'0' || msc2[l-1]>'9')
num/= 2048.0;
xorriso->grow_blindly_msc2= num;
return(1);
}
/* Option -help and part of -prog_help */
int Xorriso_option_help(struct XorrisO *xorriso, int flag)
{
@ -9736,10 +9766,12 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
"disk files with prefix \"stdio:\", e.g. stdio:/tmp/pseudo_drive .",
" -dev address Set input and output drive and load eventual ISO image.",
" Set the image expansion method to growing.",
" -indev address Set input drive and load eventual ISO image. Switch from",
" growing to modifying.",
" -indev address Set input drive and load eventual ISO image. Use expansion",
" methods modifying or blind growing.",
" -outdev address",
" Set output drive and switch from growing to modifying.",
" Set output drive and use modifying or blind growing.",
" -grow_blindly \"off\"|predicted_nwa",
" Switch between modifying and blind growing.",
" -load \"session\"|\"track\"|\"lba\"|\"sbsector\"|\"volid\"|\"auto\" id",
" Load a particular (outdated) ISO image from a -dev or",
" -indev which hosts more than one session.",
@ -11986,7 +12018,8 @@ int Xorriso_count_args(struct XorrisO *xorriso, int argc, char **argv,
static char arg1_commands[][40]= {
"abort_on","add_plainly","blank","cd","cdi","cdx","close","dev",
"dummy","dialog","disk_pattern","eject","iso_rr_pattern","follow",
"format","fs","gid","history","indev","joliet","mark","not_leaf",
"format","fs","gid","grow_blindly",
"history","indev","joliet","mark","not_leaf",
"not_list","not_mgt","options_from_file","osirrox","outdev","overwrite",
"padding","path_list","pathspecs","pkt_output","print","prompt",
"prog","publisher","reassure","report_about","rom_toc_scan",
@ -12302,6 +12335,10 @@ next_command:;
(*idx)++;
ret= Xorriso_option_gid(xorriso,arg1,0);
} else if(strcmp(cmd,"grow_blindly")==0) {
(*idx)++;
ret= Xorriso_option_grow_blindly(xorriso,arg1,0);
} else if(strcmp(cmd,"help")==0) {
Xorriso_option_help(xorriso,0);

View File

@ -145,6 +145,11 @@ struct XorrisO { /* the global context of xorriso */
connected to externaly perveived stdout.
*/
int grow_blindly_msc2; /* if >= 0 this causes growing from drive to drive.
The value is used as block address offset for
image generation. Like in: mkisofs -C msc1,msc2
*/
int ban_stdio_write;
int do_dummy;
int do_close;

View File

@ -1 +1 @@
#define Xorriso_timestamP "2008.07.05.132528"
#define Xorriso_timestamP "2008.07.05.133721"

View File

@ -955,15 +955,26 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
if(xorriso->out_drive_handle == xorriso->in_drive_handle ||
xorriso->in_drive_handle == NULL) {
ret= isoburn_prepare_disc(source_drive, &disc, sopts);
} else if (xorriso->grow_blindly_msc2 >= 0) {
ret= isoburn_prepare_blind_grow(source_drive, &disc, sopts, drive,
xorriso->grow_blindly_msc2);
if(ret>0) {
/* Allow the consumer of output to access the input drive */
source_drive= NULL;
ret= Xorriso_give_up_drive(xorriso, 1);
if(ret<=0)
goto ex;
}
} else {
ret= isoburn_prepare_new_image(source_drive, &disc, sopts, drive);
}
if (ret <= 0) {
if(ret <= 0) {
Xorriso_process_msg_queues(xorriso,0);
sprintf(xorriso->info_text,"Failed to prepare session write run");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
{ret= 0; goto ex;}
}
isoburn_igopt_get_effective_lba(sopts, &(xorriso->session_lba));
ret= Xorriso_make_write_options(xorriso, drive, &burn_options, 0);
@ -1010,7 +1021,6 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
Xorriso_info(xorriso, 0);
}
}
ret= isoburn_activate_session(drive);
Xorriso_process_msg_queues(xorriso,0);
if(ret<=0) {
@ -3606,7 +3616,7 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
int Xorriso_show_devices(struct XorrisO *xorriso, int flag)
{
char adr[BURN_DRIVE_ADR_LEN];
int i;
int i, j, max_dev_len= 1, pad;
struct burn_drive_info *drive_list= NULL;
unsigned int drive_count;
char *respt, perms[8];
@ -3634,6 +3644,13 @@ int Xorriso_show_devices(struct XorrisO *xorriso, int flag)
Xorriso_info(xorriso,0);
respt= xorriso->result_line;
for(i= 0; i < drive_count && !(xorriso->request_to_abort); i++) {
if(burn_drive_get_adr(&(drive_list[i]), adr)<=0)
strcpy(adr, "-get_adr_failed-");
Xorriso_process_msg_queues(xorriso,0);
if(strlen(adr)>max_dev_len)
max_dev_len= strlen(adr);
}
for(i= 0; i < drive_count && !(xorriso->request_to_abort); i++) {
if(burn_drive_get_adr(&(drive_list[i]), adr)<=0)
strcpy(adr, "-get_adr_failed-");
@ -3649,8 +3666,13 @@ int Xorriso_show_devices(struct XorrisO *xorriso, int flag)
if(stbuf.st_mode&S_IROTH) perms[4]= 'r';
if(stbuf.st_mode&S_IWOTH) perms[5]= 'w';
}
sprintf(respt, "%d -dev '%s' %s : '%-8.8s' '%s' \n",
i, adr, perms, drive_list[i].vendor, drive_list[i].product);
sprintf(respt, "%d -dev '%s' ", i, adr);
pad= max_dev_len-strlen(adr);
if(pad>0)
for(j= 0; j<pad; j++)
strcat(respt, " ");
sprintf(respt+strlen(respt), "%s : '%-8.8s' '%s' \n",
perms, drive_list[i].vendor, drive_list[i].product);
Xorriso_result(xorriso,0);
}
burn_drive_info_free(drive_list);