From f399a30e65e5ecc5c8902df01c17872b8f063d92 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Fri, 19 Oct 2007 15:13:16 +0000 Subject: [PATCH] Implemented -print-size --- test/xorriso.c | 28 +++++++++++++++++++++++----- test/xorriso.txt | 15 ++++++++++----- test/xorriso_timestamp.h | 2 +- test/xorrisoburn.c | 10 ++++++++-- 4 files changed, 42 insertions(+), 13 deletions(-) diff --git a/test/xorriso.c b/test/xorriso.c index 780ebdef..f6c8d80f 100644 --- a/test/xorriso.c +++ b/test/xorriso.c @@ -4126,7 +4126,26 @@ int Xorriso_option_print(struct XorrisO *xorriso, char *text, int flag) /* Option -print-size */ int Xorriso_option_print_size(struct XorrisO *xorriso, int flag) { - fprintf(stderr, ">>> LIBISOFS : -print-size\n"); + int ret; + + if(!xorriso->volset_change_pending) { + sprintf(xorriso->info_text,"-print-size: No image modifications pending"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); + sprintf(xorriso->result_line,"Image size : 0\n"); + Xorriso_result(xorriso,0); + return(2); + } + + /* >>> care for modifying */ + + ret= Xorriso_write_growing(xorriso, 1); + if(ret<=0) { + sprintf(xorriso->info_text,"-print-size: Failed to set up virtual -commit"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + return(0); + } + sprintf(xorriso->result_line,"Image size : %d\n", ret); + Xorriso_result(xorriso,0); return(1); } @@ -4580,7 +4599,7 @@ next_command:; (*idx)++; ret= Xorriso_option_gid(xorriso,arg1,0); - } else if(strcmp(cmd,"-graft-points")==0) { + } else if(strcmp(cmd,"-graft-points")==0 || strcmp(cmd,"-graft_points")==0) { ret= Xorriso_option_graft_points(xorriso, 0); } else if(strcmp(cmd,"-help")==0) { @@ -4650,7 +4669,7 @@ next_command:; num2= 80; ret= Xorriso_option_page(xorriso, num1, num2, 0); - } else if(strcmp(cmd,"-path-list")==0) { + } else if(strcmp(cmd,"-path-list")==0 || strcmp(cmd,"-path_list")==0) { (*idx)++; ret= Xorriso_option_path_list(xorriso, arg1, 0); @@ -4662,7 +4681,7 @@ next_command:; (*idx)++; ret= Xorriso_option_print(xorriso, arg1, 0); - } else if(strcmp(cmd,"-print-size")==0) { + } else if(strcmp(cmd,"-print-size")==0 || strcmp(cmd,"-print_size")==0) { Xorriso_option_print_size(xorriso, 0); } else if(strcmp(cmd,"-prompt")==0) { @@ -4961,7 +4980,6 @@ int Xorriso_main(int argc, char **argv) #endif /* Xorriso_with_maiN */ - int ret,i; struct XorrisO *xorriso= NULL; diff --git a/test/xorriso.txt b/test/xorriso.txt index 78884193..0b054824 100644 --- a/test/xorriso.txt +++ b/test/xorriso.txt @@ -415,16 +415,21 @@ Dialog mode control: Drive and media related inquiry actions: --toc Show media specific table of content. (MMC toc, not ISO.) +-toc Show media specific table of content. This is the media + structure, not the ISO image directory tree. In case of + overwriteable media holding a valid ISO image, a single + session gets fabricated from the ISO image size info. --devices Show list of available MMC drives. This is only possible as +-devices Show list of available MMC drives. This is only possible when no ISO image changes are pending. After this option was executed, there is no drive current and no image loaded. - Eventually one has to aquire any drive again. + Eventually one has to aquire a drive again. -> -print-size Print the foreseeable consumption by next -commit. +-print-size Print the foreseeable consumption of 2048 byte blocks + by next -commit. This can last a while as a -commit gets + prepared and only in last moment is revoked by this option. -> -tell_media_space Print available space on output media (minus already +-tell_media_space Print available space on output media (minus already foreseeable consumption by next -commit.) diff --git a/test/xorriso_timestamp.h b/test/xorriso_timestamp.h index f17f2e72..7c7ae61a 100644 --- a/test/xorriso_timestamp.h +++ b/test/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2007.10.19.140031" +#define Xorriso_timestamP "2007.10.19.151339" diff --git a/test/xorrisoburn.c b/test/xorrisoburn.c index de4835d1..22756e71 100644 --- a/test/xorrisoburn.c +++ b/test/xorrisoburn.c @@ -254,6 +254,8 @@ int Xorriso_make_write_options( } +/* @param flag bit0= do not write but only prepare and return size in sectors +*/ int Xorriso_write_growing(struct XorrisO *xorriso, int flag) { int ret; @@ -297,10 +299,15 @@ int Xorriso_write_growing(struct XorrisO *xorriso, int flag) {ret= 0; goto ex;} } + if(flag&1) { + ret= burn_disc_get_sectors(disc); + goto ex; + } + ret= Xorriso_make_write_options(xorriso, drive, &burn_options, 0); if(ret<=0) goto ex; - + isoburn_disc_write(burn_options, disc); burn_write_opts_free(burn_options); @@ -748,4 +755,3 @@ int Xorriso_tell_media_space(struct XorrisO *xorriso, int flag) return(free_space); } -