Wrote into API the imperative not to use drive.location but burn_drive_get_adr
This commit is contained in:
parent
08b877cfc9
commit
a660d0050c
@ -152,6 +152,10 @@ or
|
|||||||
#define Cdrskin_libburn_largefilE 1
|
#define Cdrskin_libburn_largefilE 1
|
||||||
#define Cdrskin_libburn_padding_does_worK 1
|
#define Cdrskin_libburn_padding_does_worK 1
|
||||||
|
|
||||||
|
#ifdef Cdrskin_new_api_tesT
|
||||||
|
#define Cdrskin_libburn_has_drive_get_adR 1
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* Cdrskin_libburn_0_2_1 */
|
#endif /* Cdrskin_libburn_0_2_1 */
|
||||||
|
|
||||||
#ifndef Cdrskin_libburn_versioN
|
#ifndef Cdrskin_libburn_versioN
|
||||||
@ -2327,10 +2331,21 @@ int Cdrskin_abort_handler(struct CdrskiN *skin, int signum, int flag)
|
|||||||
int Cdrskin_driveno_of_location(struct CdrskiN *skin, char *devicename,
|
int Cdrskin_driveno_of_location(struct CdrskiN *skin, char *devicename,
|
||||||
int *driveno, int flag)
|
int *driveno, int flag)
|
||||||
{
|
{
|
||||||
int i;
|
int i,ret;
|
||||||
|
char adr[Cdrskin_adrleN];
|
||||||
|
|
||||||
for(i=0;i<skin->n_drives;i++) {
|
for(i=0;i<skin->n_drives;i++) {
|
||||||
if(strcmp(skin->drives[i].location,devicename)==0) {
|
|
||||||
|
#ifdef Cdrskin_libburn_has_drive_get_adR
|
||||||
|
ret= burn_drive_get_adr(&(skin->drives[skin->driveno]), adr);
|
||||||
|
if(ret<=0)
|
||||||
|
continue;
|
||||||
|
#else
|
||||||
|
ret= 1; /* to please gcc -Wall */
|
||||||
|
strcpy(adr,skin->drives[i].location);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if(strcmp(adr,devicename)==0) {
|
||||||
*driveno= i;
|
*driveno= i;
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
@ -2422,11 +2437,21 @@ int Cdrskin_driveno_to_btldev(struct CdrskiN *skin, int driveno,
|
|||||||
char btldev[Cdrskin_adrleN], int flag)
|
char btldev[Cdrskin_adrleN], int flag)
|
||||||
{
|
{
|
||||||
int k,ret,still_untranslated= 1,hret;
|
int k,ret,still_untranslated= 1,hret;
|
||||||
char *loc= NULL,buf[Cdrskin_adrleN];
|
char *loc= NULL,buf[Cdrskin_adrleN],adr[Cdrskin_adrleN];
|
||||||
|
|
||||||
if(driveno<0 || driveno>skin->n_drives)
|
if(driveno<0 || driveno>skin->n_drives)
|
||||||
goto fallback;
|
goto fallback;
|
||||||
|
|
||||||
|
#ifdef Cdrskin_libburn_has_drive_get_adR
|
||||||
|
ret= burn_drive_get_adr(&(skin->drives[driveno]), adr);
|
||||||
|
if(ret<=0)
|
||||||
|
goto fallback;
|
||||||
|
loc= adr;
|
||||||
|
#else
|
||||||
|
adr[0]= 0; /* to please gcc -Wall */
|
||||||
loc= skin->drives[driveno].location;
|
loc= skin->drives[driveno].location;
|
||||||
|
#endif
|
||||||
|
|
||||||
if(loc==NULL)
|
if(loc==NULL)
|
||||||
goto fallback;
|
goto fallback;
|
||||||
if(strncmp(loc,"/dev/sg",7)==0) {
|
if(strncmp(loc,"/dev/sg",7)==0) {
|
||||||
@ -2499,6 +2524,7 @@ int Cdrskin_scanbus(struct CdrskiN *skin, int flag)
|
|||||||
{
|
{
|
||||||
int ret,i,busno,first_on_bus;
|
int ret,i,busno,first_on_bus;
|
||||||
char shellsafe[5*Cdrskin_strleN+2],perms[40],btldev[Cdrskin_adrleN];
|
char shellsafe[5*Cdrskin_strleN+2],perms[40],btldev[Cdrskin_adrleN];
|
||||||
|
char adr[Cdrskin_adrleN];
|
||||||
struct stat stbuf;
|
struct stat stbuf;
|
||||||
|
|
||||||
if(flag&1) {
|
if(flag&1) {
|
||||||
@ -2506,7 +2532,18 @@ int Cdrskin_scanbus(struct CdrskiN *skin, int flag)
|
|||||||
skin->n_drives);
|
skin->n_drives);
|
||||||
printf("-----------------------------------------------------------------------------\n");
|
printf("-----------------------------------------------------------------------------\n");
|
||||||
for(i=0;i<skin->n_drives;i++) {
|
for(i=0;i<skin->n_drives;i++) {
|
||||||
if(stat(skin->drives[i].location,&stbuf)==-1) {
|
|
||||||
|
#ifdef Cdrskin_libburn_has_drive_get_adR
|
||||||
|
ret= burn_drive_get_adr(&(skin->drives[i]), adr);
|
||||||
|
if(ret<=0) {
|
||||||
|
/* >>> one should massively complain */;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
strcpy(adr,skin->drives[i].location);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if(stat(adr,&stbuf)==-1) {
|
||||||
sprintf(perms,"errno=%d",errno);
|
sprintf(perms,"errno=%d",errno);
|
||||||
} else {
|
} else {
|
||||||
strcpy(perms,"------");
|
strcpy(perms,"------");
|
||||||
@ -2517,10 +2554,10 @@ int Cdrskin_scanbus(struct CdrskiN *skin, int flag)
|
|||||||
if(stbuf.st_mode&S_IROTH) perms[4]= 'r';
|
if(stbuf.st_mode&S_IROTH) perms[4]= 'r';
|
||||||
if(stbuf.st_mode&S_IWOTH) perms[5]= 'w';
|
if(stbuf.st_mode&S_IWOTH) perms[5]= 'w';
|
||||||
}
|
}
|
||||||
if(strlen(skin->drives[i].location)>=Cdrskin_strleN)
|
if(strlen(adr)>=Cdrskin_strleN)
|
||||||
Text_shellsafe("failure:oversized string",shellsafe,0);
|
Text_shellsafe("failure:oversized string",shellsafe,0);
|
||||||
else
|
else
|
||||||
Text_shellsafe(skin->drives[i].location,shellsafe,0);
|
Text_shellsafe(adr,shellsafe,0);
|
||||||
printf("%d dev=%s %s : '%s' '%s'\n",
|
printf("%d dev=%s %s : '%s' '%s'\n",
|
||||||
i,shellsafe,perms,skin->drives[i].vendor,skin->drives[i].product);
|
i,shellsafe,perms,skin->drives[i].vendor,skin->drives[i].product);
|
||||||
}
|
}
|
||||||
@ -3383,6 +3420,7 @@ ex:;
|
|||||||
int Cdrskin_eject(struct CdrskiN *skin, int flag)
|
int Cdrskin_eject(struct CdrskiN *skin, int flag)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
char adr[Cdrskin_adrleN];
|
||||||
|
|
||||||
#ifndef Cdrskin_burn_drive_eject_brokeN
|
#ifndef Cdrskin_burn_drive_eject_brokeN
|
||||||
|
|
||||||
@ -3407,13 +3445,21 @@ int Cdrskin_eject(struct CdrskiN *skin, int flag)
|
|||||||
"cdrskin: HINT : to run cdrskin under your normal user identity.\n");
|
"cdrskin: HINT : to run cdrskin under your normal user identity.\n");
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef Cdrskin_libburn_has_drive_get_adR
|
||||||
|
ret= burn_drive_get_adr(&(skin->drives[skin->driveno]), adr);
|
||||||
|
if(ret<=0)
|
||||||
|
adr[0]= 0;
|
||||||
|
#else
|
||||||
|
strcpy(adr,skin->drives[skin->driveno].location);
|
||||||
|
#endif
|
||||||
|
|
||||||
if(strlen(skin->eject_device)>0)
|
if(strlen(skin->eject_device)>0)
|
||||||
sprintf(cmd,"eject %s",Text_shellsafe(skin->eject_device,shellsafe,0));
|
sprintf(cmd,"eject %s",Text_shellsafe(skin->eject_device,shellsafe,0));
|
||||||
else if(strcmp(skin->drives[skin->driveno].location,"/dev/sg0")==0)
|
else if(strcmp(adr,"/dev/sg0")==0)
|
||||||
sprintf(cmd,"eject /dev/sr0");
|
sprintf(cmd,"eject /dev/sr0");
|
||||||
else
|
else
|
||||||
sprintf(cmd,"eject %s",Text_shellsafe(skin->drives[skin->driveno].location,
|
sprintf(cmd,"eject %s",Text_shellsafe(adr,shellsafe,0));
|
||||||
shellsafe,0));
|
|
||||||
ret= system(cmd);
|
ret= system(cmd);
|
||||||
if(ret==0)
|
if(ret==0)
|
||||||
return(1);
|
return(1);
|
||||||
@ -3436,7 +3482,7 @@ int Cdrskin_setup(struct CdrskiN *skin, int argc, char **argv, int flag)
|
|||||||
{
|
{
|
||||||
int i,k,ret;
|
int i,k,ret;
|
||||||
double value,grab_and_wait_value= -1.0;
|
double value,grab_and_wait_value= -1.0;
|
||||||
char *cpt,*value_pt;
|
char *cpt,*value_pt,adr[Cdrskin_adrleN];
|
||||||
|
|
||||||
/* cdrecord 2.01 options which are not scheduled for implementation, yet */
|
/* cdrecord 2.01 options which are not scheduled for implementation, yet */
|
||||||
static char ignored_partial_options[][41]= {
|
static char ignored_partial_options[][41]= {
|
||||||
@ -3877,6 +3923,12 @@ track_too_large:;
|
|||||||
printf(
|
printf(
|
||||||
"cdrskin: NOTE : augmenting non-tao write mode by tao_to_sao_tsize\n");
|
"cdrskin: NOTE : augmenting non-tao write mode by tao_to_sao_tsize\n");
|
||||||
printf("cdrskin: NOTE : fixed size : %.f\n",skin->fixed_size);
|
printf("cdrskin: NOTE : fixed size : %.f\n",skin->fixed_size);
|
||||||
|
/* >>> upcoming problem fix
|
||||||
|
} else if(skin->fixed_size<=0) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"cdrskin: FATAL : \"-\" (stdin) needs a fixed tsize= or tao_to_sao_tsize=\n");
|
||||||
|
return(0);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
} else if(skin->preskin->allow_fd_source==0 &&
|
} else if(skin->preskin->allow_fd_source==0 &&
|
||||||
argv[i][0]=='#' && (argv[i][1]>='0' && argv[i][1]<='9')) {
|
argv[i][0]=='#' && (argv[i][1]>='0' && argv[i][1]<='9')) {
|
||||||
@ -3945,9 +3997,19 @@ ignore_unknown:;
|
|||||||
&(skin->driveno),0);
|
&(skin->driveno),0);
|
||||||
if(ret<=0)
|
if(ret<=0)
|
||||||
return(ret);
|
return(ret);
|
||||||
if(skin->verbosity>=Cdrskin_verbose_cmD)
|
if(skin->verbosity>=Cdrskin_verbose_cmD) {
|
||||||
|
|
||||||
|
#ifdef Cdrskin_libburn_has_drive_get_adR
|
||||||
|
ret= burn_drive_get_adr(&(skin->drives[skin->driveno]), adr);
|
||||||
|
if(ret<=0)
|
||||||
|
adr[0]= 0;
|
||||||
|
#else
|
||||||
|
strcpy(adr,skin->drives[skin->driveno].location);
|
||||||
|
#endif
|
||||||
|
|
||||||
printf("cdrskin: active drive number : %d '%s'\n",
|
printf("cdrskin: active drive number : %d '%s'\n",
|
||||||
skin->driveno,skin->drives[skin->driveno].location);
|
skin->driveno,adr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(grab_and_wait_value>0) {
|
if(grab_and_wait_value>0) {
|
||||||
Cdrskin_grab_drive(skin,0);
|
Cdrskin_grab_drive(skin,0);
|
||||||
|
@ -314,6 +314,10 @@ struct burn_drive_info
|
|||||||
char revision[5];
|
char revision[5];
|
||||||
/** Location of the drive in the filesystem. */
|
/** Location of the drive in the filesystem. */
|
||||||
char location[17];
|
char location[17];
|
||||||
|
/** This is currently the string which is used as persistent
|
||||||
|
drive address. But be warned: there is NO GUARANTEE that this
|
||||||
|
will stay so. Always use function burn_drive_get_adr() to
|
||||||
|
inquire a persisten address. ^^^^^^ ALWAYS ^^^^^^ */
|
||||||
|
|
||||||
/** Can the drive read DVD-RAM discs */
|
/** Can the drive read DVD-RAM discs */
|
||||||
unsigned int read_dvdram:1;
|
unsigned int read_dvdram:1;
|
||||||
|
Loading…
Reference in New Issue
Block a user