Removed all references to isoburn.treatment from burn_wrap.c
This commit is contained in:
parent
bff450da12
commit
9788b0d0b4
@ -89,95 +89,30 @@ ex:
|
||||
int isoburn_drive_scan_and_grab(struct burn_drive_info *drive_infos[],
|
||||
char *adr, int load)
|
||||
{
|
||||
int ret, treatment= 0, conv_ret;
|
||||
struct stat stbuf;
|
||||
char libburn_drive_adr[BURN_DRIVE_ADR_LEN], *adrpt, *stdio_adr= NULL;
|
||||
int ret, conv_ret;
|
||||
char libburn_drive_adr[BURN_DRIVE_ADR_LEN];
|
||||
struct isoburn *o= NULL;
|
||||
char msg[BURN_MSGS_MESSAGE_LEN+4096];
|
||||
|
||||
/* Treatment decision criteria
|
||||
Prefixes "grow:" leads to: treatment 1, image growing
|
||||
Prefix "modify:" leads to: treatment 2, image modification
|
||||
Anything else is decided automatically
|
||||
If suitable as libburn drive address: treatment 1 ("stdio:" fits here)
|
||||
else if non-existent or regular file: treatment 2
|
||||
else if block device : treatment 1
|
||||
else : unsuitable target
|
||||
*/
|
||||
|
||||
adrpt= adr;
|
||||
if(strncmp(adr, "grow:", 5)==0) {
|
||||
treatment= 1;
|
||||
adrpt+= 5;
|
||||
if(stat(adrpt,&stbuf)!=-1) {
|
||||
if(S_ISREG(stbuf.st_mode) || S_ISBLK(stbuf.st_mode)) {
|
||||
stdio_adr= calloc(strlen(adrpt)+6+1, 1);
|
||||
if(stdio_adr==NULL)
|
||||
{ret= -1; goto ex;}
|
||||
sprintf(stdio_adr, "stdio:%s", adrpt); /* use pseudo-drive */
|
||||
adrpt= stdio_adr;
|
||||
}
|
||||
}
|
||||
} else if(strncmp(adr, "modify:", 7)==0) {
|
||||
adrpt+= 7;
|
||||
treatment= 2;
|
||||
if(stat(adrpt,&stbuf)!=-1) {
|
||||
if(! S_ISREG(stbuf.st_mode)) {
|
||||
sprintf(msg, "Unsuitable target for modify: '%s'\n",adr);
|
||||
msg[BURN_MSGS_MESSAGE_LEN]= 0;
|
||||
burn_msgs_submit(0, msg, 0, "SORRY", NULL);
|
||||
ret= 0; goto ex;
|
||||
}
|
||||
}
|
||||
sprintf(stdio_adr, "stdio:%s", adrpt); /* use pseudo-drive */
|
||||
adrpt= stdio_adr;
|
||||
} else {
|
||||
|
||||
/* >>> interpret "read:" , "write:" for modification on MMC drives */;
|
||||
|
||||
}
|
||||
|
||||
conv_ret= burn_drive_convert_fs_adr(adrpt, libburn_drive_adr);
|
||||
if(treatment==0) { /* undecided yet, make a decision or declare failure */
|
||||
if(conv_ret>0)
|
||||
treatment= 1; /* Device file leading to MMC drive or "stdio:" address */
|
||||
else {
|
||||
if(stat(adrpt,&stbuf)==-1) {
|
||||
/* burn_drive_scan_and_grab() will check whether the directory exists */
|
||||
treatment= 2;
|
||||
} else if(S_ISREG(stbuf.st_mode))
|
||||
treatment= 2;
|
||||
else if(S_ISBLK(stbuf.st_mode))
|
||||
treatment= 1;
|
||||
if(treatment>=0) {
|
||||
sprintf(stdio_adr, "stdio:%s", adrpt); /* use pseudo-drive */
|
||||
adrpt= stdio_adr;
|
||||
conv_ret= 1; /* All "stdio:" addresses are ok for now */
|
||||
}
|
||||
}
|
||||
}
|
||||
if(conv_ret<=0 || treatment<=0) {
|
||||
sprintf(msg, "Unsuitable drive address: '%s'\n",adrpt);
|
||||
msg[BURN_MSGS_MESSAGE_LEN]= 0;
|
||||
conv_ret= burn_drive_convert_fs_adr(adr, libburn_drive_adr);
|
||||
if(conv_ret<=0) {
|
||||
sprintf(msg, "Unsuitable drive address: '%s'\n",adr);
|
||||
msg[BURN_MSGS_MESSAGE_LEN-1]= 0;
|
||||
burn_msgs_submit(0, msg, 0, "SORRY", NULL);
|
||||
ret= 0; goto ex;
|
||||
}
|
||||
|
||||
ret= burn_drive_scan_and_grab(drive_infos, adrpt, load);
|
||||
ret= burn_drive_scan_and_grab(drive_infos, libburn_drive_adr, load);
|
||||
if(ret<=0)
|
||||
goto ex;
|
||||
ret= isoburn_welcome_media(&o, (*drive_infos)[0].drive, 0);
|
||||
if(ret<=0)
|
||||
goto ex;
|
||||
if(o!=NULL)
|
||||
o->treatment= treatment;
|
||||
|
||||
ret= 1;
|
||||
ex:
|
||||
if(ret<=0)
|
||||
isoburn_destroy(&o,0);
|
||||
if(stdio_adr!=NULL)
|
||||
free(stdio_adr);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user