From b517db6b617ee4c009005b8d615ee81ab4545cb8 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sat, 8 Sep 2007 16:49:19 +0000 Subject: [PATCH] New option --allow_emulated_drives --- libburn/trunk/cdrskin/cdrskin.1 | 25 +++++++++- libburn/trunk/cdrskin/cdrskin.c | 51 +++++++++++++++++--- libburn/trunk/cdrskin/cdrskin_timestamp.h | 2 +- libburn/trunk/cdrskin/convert_man_to_html.sh | 9 ++-- 4 files changed, 74 insertions(+), 13 deletions(-) diff --git a/libburn/trunk/cdrskin/cdrskin.1 b/libburn/trunk/cdrskin/cdrskin.1 index c2d3efe2..a1aa95c3 100644 --- a/libburn/trunk/cdrskin/cdrskin.1 +++ b/libburn/trunk/cdrskin/cdrskin.1 @@ -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 CDRSKIN 1 "August 27, 2007" +.TH CDRSKIN 1 "September 8, 2007" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -48,7 +48,9 @@ or on DVD-R[W] (in Incremental mode) or on DVD+R. .br Single session on DVD-RW or DVD-R (Disk-at-once) .br -or on overwriteable DVD+RW, DVD-RW, DVD-RAM. +or on overwriteable DVD+RW, DVD-RW, DVD-RAM, +.br +or on data file or block device. .br Bus scan, burnfree, speed options, retrieving media info, padding, fifo. .br @@ -257,6 +259,21 @@ Further are accepted on Linux: links to libburn-suitable device files, device files which have the same major and minor device number, and device files which have the same SCSI address parameters (e.g. /dev/sg0). .br +.PP +Option --allow_emulated_drives enables addressing of pseudo-drives +which get emulated on top of a regular data file or a block device. +The target file address is given after prefix "stdio:". +.br +E.g.: dev=stdio:/tmp/my_pseudo_drive +.br +Warning: Superusers must take care not to spoil their hard disk via its raw +block device (like /dev/hda or /dev/sd0). +.br +Pseudo-drives behave much like DVD-RAM. They allow -dummy, nevertheless, and +their reply with --tell_media_space is utopic. If the given address does +not exist yet, then it gets created as regular file. +Note: -dummy runs touch the file. +.br .SH OPTIONS .TP .BI \-\-help @@ -624,6 +641,10 @@ drive for the loaded media. By default, such an adjustment is only made with pseudo-speeds 0 and -1 whereas speed settings > 0 are sent unchanged to the drive which will then choose an appropriate speed on its own. .TP +.BI \--allow_emulated_drives +Enable drive addresses of the form dev=stdio:. See above, paragraph +"Drive preparation and addressing". +.TP .BI \--allow_setuid Disable the loud warning about insecure discrepance between login user and effective user which indicates application of chmod u+s to the program binary. diff --git a/libburn/trunk/cdrskin/cdrskin.c b/libburn/trunk/cdrskin/cdrskin.c index c1521f49..9b5a147c 100644 --- a/libburn/trunk/cdrskin/cdrskin.c +++ b/libburn/trunk/cdrskin/cdrskin.c @@ -1641,6 +1641,9 @@ struct CdrpreskiN { /** Wether to support media types which are implemented but yet untested */ int allow_untested_media; + /** Wether to allow libburn pseudo-drives "stdio:" */ + int allow_emulated_drives; + /** Wether an option is given which needs a full bus scan */ int no_whitelist; @@ -1721,6 +1724,7 @@ int Cdrpreskin_new(struct CdrpreskiN **preskin, int flag) o->allow_setuid= 0; o->allow_fd_source= 0; o->allow_untested_media= 0; + o->allow_emulated_drives= 0; o->no_whitelist= 0; o->no_convert_fs_adr= 0; #ifdef Cdrskin_libburn_has_convert_scsi_adR @@ -2055,6 +2059,9 @@ return: if(strcmp(argv[i],"--abort_handler")==0) { o->abort_handler= 3; + } else if(strcmp(argv[i],"--allow_emulated_drives")==0) { + o->allow_emulated_drives= 1; + } else if(strcmp(argv[i],"--allow_setuid")==0) { o->allow_setuid= 1; @@ -2157,7 +2164,7 @@ set_dev:; #ifndef Cdrskin_extra_leaN - printf("Supported SCSI transports for this platform:\n"); + printf("\nSupported SCSI transports for this platform:\n"); fflush(stdout); if(o->old_pseudo_scsi_adr) { fprintf(stderr,"\nTransport name:\t\tlibburn OLD_PSEUDO\n"); @@ -2183,6 +2190,18 @@ set_dev:; fprintf(stderr,"SCSI Bus scanning:\tsupported\n"); fprintf(stderr,"Open via UNIX device:\tsupported\n"); } + if(o->allow_emulated_drives) { + fprintf(stderr,"\nTransport name:\t\tlibburn on standard i/o\n"); + fprintf(stderr, + "Transport descr.:\twrite into data files and block devices\n"); + fprintf(stderr,"Transp. layer ind.:\tstdio:\n"); + fprintf(stderr,"Target specifier:\tpath\n"); + fprintf(stderr,"Target example:\t\tstdio:/tmp/pseudo_drive\n"); + fprintf(stderr,"SCSI Bus scanning:\tnot supported\n"); + fprintf(stderr,"Open via UNIX device:\tsupported\n"); + } else { + printf("\ncdrskin: NOTE : Option --allow_emulated_drives would allow dev=stdio:\n"); + } #else /* ! Cdrskin_extra_leaN */ @@ -2262,6 +2281,8 @@ set_dev:; printf( " --adjust_speed_to_drive set only speeds offered by drive and media\n"); #endif + printf( + " --allow_emulated_drives dev=stdio: on files and block devices\n"); printf( " --allow_setuid disable setuid warning (setuid is insecure !)\n"); printf( @@ -3620,7 +3641,7 @@ wrong_devno:; @return <0 error, pseudo transport groups: 0 volatile drive number, - 1 /dev/sgN, 2 /dev/hdX, + 1 /dev/sgN, 2 /dev/hdX, 3 stdio, 1000000+busno = non-pseudo SCSI bus 2000000+busno = pseudo-ATA|ATAPI SCSI bus (currently busno==2) */ @@ -3645,6 +3666,14 @@ int Cdrskin_driveno_to_btldev(struct CdrskiN *skin, int driveno, goto fallback; #endif +#ifdef Cdrskin_libburn_has_get_drive_rolE + ret= burn_drive_get_drive_role(skin->drives[driveno].drive); + if(ret!=1) { + sprintf(btldev,"stdio:%s",adr); + {ret= 2; goto adr_translation;} + } +#endif + #ifdef Cdrskin_libburn_has_convert_scsi_adR if(!skin->preskin->old_pseudo_scsi_adr) { int host_no= -1,channel_no= -1,target_no= -1,lun_no= -1, bus_no= -1; @@ -3840,7 +3869,7 @@ int Cdrskin_report_disc_status(struct CdrskiN *skin, enum burn_disc_status s, } else printf("-unknown status code-\n"); - if(flag&1) + if(flag&2) return(1); #ifdef Cdrskin_libburn_has_get_profilE @@ -4682,7 +4711,8 @@ blanking_done:; ret= !!(wrote_well); ex:; skin->drive_is_busy= 0; - Cdrskin_release_drive(skin,0); + if(skin->drive_is_grabbed) + Cdrskin_release_drive(skin,0); return(ret); } @@ -6408,6 +6438,9 @@ set_abort_max_wait:; skin->adjust_speed_to_drive= 1; #endif + } else if(strcmp(argv[i],"--allow_emulated_drives")==0) { + /* is handled in Cdrpreskin_setup() */; + } else if(strcmp(argv[i],"--allow_setuid")==0) { /* is handled in Cdrpreskin_setup() */; @@ -7174,8 +7207,14 @@ int Cdrskin_create(struct CdrskiN **o, struct CdrpreskiN **preskin, "cdrskin: NOTE : greying out all drives besides given dev='%s'\n", (*preskin)->device_adr)); burn_drive_add_whitelist((*preskin)->device_adr); - if(strncmp((*preskin)->device_adr, "stdio:", 6)==0) - stdio_drive= 1; + if(strncmp((*preskin)->device_adr, "stdio:", 6)==0) { + if((*preskin)->allow_emulated_drives) + stdio_drive= 1; + else { + fprintf(stderr,"cdrskin: SORRY : dev=stdio:... works only with option --allow_emulated_drives\n"); + {*exit_value= 2; goto ex;} + } + } } ret= Cdrskin_new(&skin,*preskin,1); diff --git a/libburn/trunk/cdrskin/cdrskin_timestamp.h b/libburn/trunk/cdrskin/cdrskin_timestamp.h index 6b05e092..154edf4e 100644 --- a/libburn/trunk/cdrskin/cdrskin_timestamp.h +++ b/libburn/trunk/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2007.09.08.132206" +#define Cdrskin_timestamP "2007.09.08.164924" diff --git a/libburn/trunk/cdrskin/convert_man_to_html.sh b/libburn/trunk/cdrskin/convert_man_to_html.sh index 942ec067..29ab7d7d 100755 --- a/libburn/trunk/cdrskin/convert_man_to_html.sh +++ b/libburn/trunk/cdrskin/convert_man_to_html.sh @@ -45,15 +45,16 @@ then -e 's/Overview of features:<\/b>/\ 
Overview of features:<\/b>/' \ -e 's/General information paragraphs:<\/b>/\ 
General information paragraphs:<\/b>/' \ -e 's/Track recording model:<\/b>/\ 
Track recording model:<\/b>/' \ - -e 's/In general there are two types of tracks: data and audio./\ 
In general there are two types of tracks: data and audio./' \ - -e 's/While audio tracks just contain a given/\ 
While audio tracks just contain a given/' \ + -e 's/^In general there are two types of tracks: data and audio./\ 
In general there are two types of tracks: data and audio./' \ + -e 's/^While audio tracks just contain a given/\ 
While audio tracks just contain a given/' \ -e 's/Write mode selection:<\/b>/\ 
Write mode selection:<\/b>/' \ -e 's/Recordable CD Media:<\/b>/\ 
Recordable CD Media:<\/b>/' \ -e 's/Overwriteable DVD Media:<\/b>/\ 
Overwriteable DVD Media:<\/b>/' \ -e 's/Sequentially Recordable DVD Media:<\/b>/\ 
Sequentially Recordable DVD Media:<\/b>/' \ - -e 's/The write modes for DVD+R/\ 
The write modes for DVD+R/' \ + -e 's/^The write modes for DVD+R/\ 
The write modes for DVD+R/' \ -e 's/Drive preparation and addressing:<\/b>/\ 
Drive preparation and addressing:<\/b>/' \ - -e 's/If you only got one CD capable drive/\ 
If you only got one CD capable drive/' \ + -e 's/^If you only got one CD capable drive/\ 
If you only got one CD capable drive/' \ + -e 's/^Option --allow_emulated_drives enables/\ 
Option --allow_emulated_drives enables/' \ -e 's/^Alphabetical list of options/\ 
Alphabetical list of options/' \ -e 's/and for all others\.<\/td><\/table>/and for all others.<\/td><\/table>

(HTML generated from '"$manpage"'.1 on '"$(date)"' by '$(basename "$0")' )<\/CENTER><\/FONT>/' \ -e 's/See section EXAMPLES/See section EXAMPLES<\/A>/' \