Enabled unused SCSI part of struct burn_drive. Switched persistent address to burn_drive.devname
This commit is contained in:
parent
faaefaa4b8
commit
8e73ee88e9
@ -656,15 +656,27 @@ int burn_drive_scan_and_grab(struct burn_drive_info *drive_infos[], char* adr,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ts A60823 */
|
/* ts A60923 */
|
||||||
|
/** Inquire the persistent address of the given drive. */
|
||||||
|
int burn_drive_raw_get_adr(struct burn_drive *d, char adr[])
|
||||||
|
{
|
||||||
|
assert(strlen(d->devname) < BURN_DRIVE_ADR_LEN);
|
||||||
|
strcpy(adr,d->devname);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ts A60823 - A60923 */
|
||||||
/** Inquire the persistent address of the given drive. */
|
/** Inquire the persistent address of the given drive. */
|
||||||
int burn_drive_get_adr(struct burn_drive_info *drive_info, char adr[])
|
int burn_drive_get_adr(struct burn_drive_info *drive_info, char adr[])
|
||||||
{
|
{
|
||||||
assert(strlen(drive_info->location) < BURN_DRIVE_ADR_LEN);
|
int ret;
|
||||||
strcpy(adr,drive_info->location);
|
|
||||||
return 1;
|
assert(drive_info->drive!=NULL);
|
||||||
|
ret = burn_drive_raw_get_adr(drive_info->drive, adr);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ts A60922 ticket 33 */
|
/* ts A60922 ticket 33 */
|
||||||
/** Evaluate wether the given address would be enumerated by libburn */
|
/** Evaluate wether the given address would be enumerated by libburn */
|
||||||
int burn_drive_is_enumerable_adr(char *adr)
|
int burn_drive_is_enumerable_adr(char *adr)
|
||||||
@ -849,7 +861,24 @@ fprintf(stderr,"libburn experimental: Nothing found for %s \n",path);
|
|||||||
int burn_drive_obtain_scsi_adr(char *path, int *host_no, int *channel_no,
|
int burn_drive_obtain_scsi_adr(char *path, int *host_no, int *channel_no,
|
||||||
int *target_no, int *lun_no)
|
int *target_no, int *lun_no)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret, i;
|
||||||
|
char adr[BURN_DRIVE_ADR_LEN];
|
||||||
|
|
||||||
|
/* open drives cannot be inquired by sg_obtain_scsi_adr() */
|
||||||
|
for (i = 0; i < drivetop + 1; i++) {
|
||||||
|
if (drive_array[i].global_index < 0)
|
||||||
|
continue;
|
||||||
|
ret = burn_drive_raw_get_adr(&(drive_array[i]),adr);
|
||||||
|
if (ret <= 0)
|
||||||
|
continue;
|
||||||
|
if (strcmp(adr, path) == 0) {
|
||||||
|
*host_no = drive_array[i].host;
|
||||||
|
*channel_no = drive_array[i].channel;
|
||||||
|
*target_no = drive_array[i].id;
|
||||||
|
*lun_no = drive_array[i].lun;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ret = sg_obtain_scsi_adr(path, host_no, channel_no, target_no, lun_no);
|
ret = sg_obtain_scsi_adr(path, host_no, channel_no, target_no, lun_no);
|
||||||
return ret;
|
return ret;
|
||||||
|
21
libburn/sg.c
21
libburn/sg.c
@ -23,7 +23,8 @@
|
|||||||
#include "toc.h"
|
#include "toc.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
static void enumerate_common(char *fname);
|
static void enumerate_common(char *fname, int host_no, int channel_no,
|
||||||
|
int target_no, int lun_no);
|
||||||
|
|
||||||
/* ts A51221 */
|
/* ts A51221 */
|
||||||
int burn_drive_is_banned(char *device_address);
|
int burn_drive_is_banned(char *device_address);
|
||||||
@ -177,7 +178,7 @@ void ata_enumerate(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
close(fd);
|
close(fd);
|
||||||
enumerate_common(fname);
|
enumerate_common(fname, -1, -1, -1, -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,15 +249,23 @@ void sg_enumerate(void)
|
|||||||
fprintf(stderr,"libburn experimental: SCSI triple: %d,%d,%d\n",sid.host_no,sid.scsi_id,sid.lun);
|
fprintf(stderr,"libburn experimental: SCSI triple: %d,%d,%d\n",sid.host_no,sid.scsi_id,sid.lun);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
enumerate_common(fname);
|
enumerate_common(fname, sid.host_no, sid.channel,
|
||||||
|
sid.scsi_id, sid.lun);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* ts A60923 : introduced new SCSI parameters */
|
||||||
static void enumerate_common(char *fname)
|
static void enumerate_common(char *fname, int host_no, int channel_no,
|
||||||
|
int target_no, int lun_no)
|
||||||
{
|
{
|
||||||
struct burn_drive *t;
|
struct burn_drive *t;
|
||||||
struct burn_drive out;
|
struct burn_drive out;
|
||||||
|
|
||||||
|
/* ts A60923 */
|
||||||
|
out.host = host_no;
|
||||||
|
out.id = target_no;
|
||||||
|
out.channel = channel_no;
|
||||||
|
out.lun = lun_no;
|
||||||
|
|
||||||
out.devname = burn_strdup(fname);
|
out.devname = burn_strdup(fname);
|
||||||
out.fd = -1337;
|
out.fd = -1337;
|
||||||
|
|
||||||
@ -321,7 +330,7 @@ static void enumerate_common(char *fname)
|
|||||||
if refcount is not one, drive is open somewhere else.
|
if refcount is not one, drive is open somewhere else.
|
||||||
|
|
||||||
ts A60813: this test is too late. O_EXCL is the stronger solution.
|
ts A60813: this test is too late. O_EXCL is the stronger solution.
|
||||||
After all the test was diabled already in icculus.org/burn CVS.
|
After all the test was disabled already in icculus.org/burn CVS.
|
||||||
*/
|
*/
|
||||||
int sg_grab(struct burn_drive *d)
|
int sg_grab(struct burn_drive *d)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user