Enhanced Cdrpreskin__cdrecord_to_dev so it warns of invisible SCSI drive

This commit is contained in:
Thomas Schmitt 2006-10-01 10:43:02 +00:00
parent b5f0f271cc
commit f31c3291c1
3 changed files with 21 additions and 11 deletions

View File

@ -1408,7 +1408,8 @@ int Cdrpreskin_queue_msgs(struct CdrpreskiN *o, int flag)
(This call intentionally has no CdrpreskiN argument) (This call intentionally has no CdrpreskiN argument)
@param flag Bitfield for control purposes: @param flag Bitfield for control purposes:
bit0= old_pseudo_scsi_adr bit0= old_pseudo_scsi_adr
@return <=0 error, 1 success @return 1 success, 0=no recognizable format, -1=severe error,
-2 could not find scsi device
*/ */
int Cdrpreskin__cdrecord_to_dev(char *adr, char device_adr[Cdrskin_adrleN], int Cdrpreskin__cdrecord_to_dev(char *adr, char device_adr[Cdrskin_adrleN],
int *driveno, int flag) int *driveno, int flag)
@ -1443,7 +1444,6 @@ int Cdrpreskin__cdrecord_to_dev(char *adr, char device_adr[Cdrskin_adrleN],
} }
sscanf(adr+k+1,"%d",driveno); sscanf(adr+k+1,"%d",driveno);
/* look for symbolic bus : 1=/dev/sgN 2=/dev/hdX */
digit_seen= 0; digit_seen= 0;
if(k>0) if(adr[k]==',') { if(k>0) if(adr[k]==',') {
for(k--;k>=0;k--) { for(k--;k>=0;k--) {
@ -1454,6 +1454,7 @@ int Cdrpreskin__cdrecord_to_dev(char *adr, char device_adr[Cdrskin_adrleN],
if(digit_seen) { if(digit_seen) {
sscanf(adr+k+1,"%d",&busno); sscanf(adr+k+1,"%d",&busno);
if(flag&1) { if(flag&1) {
/* look for symbolic bus : 1=/dev/sgN 2=/dev/hdX */
if(busno==1) { if(busno==1) {
sprintf(device_adr,"/dev/sg%d",*driveno); sprintf(device_adr,"/dev/sg%d",*driveno);
} else if(busno==2) { } else if(busno==2) {
@ -1480,8 +1481,18 @@ int Cdrpreskin__cdrecord_to_dev(char *adr, char device_adr[Cdrskin_adrleN],
int ret; int ret;
ret= burn_drive_convert_scsi_adr(busno,-1,*driveno,lun_no,device_adr); ret= burn_drive_convert_scsi_adr(busno,-1,*driveno,lun_no,device_adr);
return(ret); if(ret==0) {
#endif fprintf(stderr,
"cdrskin: FATAL : Cannot find /dev/sgN with Bus,Target,Lun = %d,%d,%d\n",
busno,*driveno,lun_no);
fprintf(stderr,
"cdrskin: HINT : This drive may be in use by another program currently\n");
return(-2);
} else if(ret<0)
return(-1);
return(1);
#endif /* Cdrskin_libburn_has_convert_scsi_adR */
} }
} }
} }
@ -1947,12 +1958,11 @@ dev_too_long:;
} else { } else {
ret= Cdrpreskin__cdrecord_to_dev(adr,o->device_adr,&driveno, ret= Cdrpreskin__cdrecord_to_dev(adr,o->device_adr,&driveno,
!!o->old_pseudo_scsi_adr); !!o->old_pseudo_scsi_adr);
if(ret<=0) { if(ret==-2)
/*
fprintf(stderr,
"cdrskin: FATAL : dev= expects /dev/xyz, Bus,Target,0 or a number\n");
{ret= 0; goto ex;} {ret= 0; goto ex;}
*/ if(ret<0)
goto ex;
if(ret==0) {
strcpy(o->device_adr,adr); strcpy(o->device_adr,adr);
ret= 1; ret= 1;
} }

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2006.09.28.115734" #define Cdrskin_timestamP "2006.10.01.104140"

View File

@ -889,7 +889,7 @@ int burn_drive_find_scsi_equiv(char *path, char adr[])
burn_drive_adr_debug_msg(msg, NULL); burn_drive_adr_debug_msg(msg, NULL);
return 0; return 0;
} }
sprintf(msg, "burn_drive_find_scsi_equiv( %s ) : %d,%d,%d,%d\n", sprintf(msg, "burn_drive_find_scsi_equiv( %s ) : %d,%d,%d,%d",
path, host_no, channel_no, target_no, lun_no); path, host_no, channel_no, target_no, lun_no);
burn_drive_adr_debug_msg(msg, NULL); burn_drive_adr_debug_msg(msg, NULL);