From d9b8a5b479e956dcfd5bfca06472b26ec782bc3d Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Mon, 7 Jun 2010 17:16:40 +0000 Subject: [PATCH] Avoiding to resolve /dev/rdsk/cXtYdZs2 drive addresses on Solaris libcdio --- libburn/trunk/cdrskin/cdrskin_timestamp.h | 2 +- libburn/trunk/libburn/sg-libcdio.c | 43 ++++++++++++++++++++--- 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/libburn/trunk/cdrskin/cdrskin_timestamp.h b/libburn/trunk/cdrskin/cdrskin_timestamp.h index 5ccf71dd..d9e73d9d 100644 --- a/libburn/trunk/cdrskin/cdrskin_timestamp.h +++ b/libburn/trunk/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2010.05.29.074318" +#define Cdrskin_timestamP "2010.06.07.171552" diff --git a/libburn/trunk/libburn/sg-libcdio.c b/libburn/trunk/libburn/sg-libcdio.c index 3234b137..53736e37 100644 --- a/libburn/trunk/libburn/sg-libcdio.c +++ b/libburn/trunk/libburn/sg-libcdio.c @@ -135,6 +135,13 @@ Send feedback to libburn-hackers@pykix.org . #define Libburn_guess_freebsd_atapi_devicE 1 +#ifdef sun +#define Libburn_is_on_solariS 1 +#endif +#ifdef __sun +#define Libburn_is_on_solariS 1 +#endif + #include #include #include @@ -422,7 +429,7 @@ int sg_dispose_drive(struct burn_drive *d, int flag) int sg_give_next_adr(burn_drive_enumerator_t *idx, char adr[], int adr_size, int initialize) { - int ret, recursion_count = 0; + int ret, recursion_count = 0, l; char path[4096]; ret = sg_give_next_adr_raw(idx, adr, adr_size, initialize); @@ -430,8 +437,19 @@ int sg_give_next_adr(burn_drive_enumerator_t *idx, return ret; if (strlen(adr) >= sizeof(path)) return ret; - strcpy(path, adr); - ret = burn_drive_resolve_link(path, adr, &recursion_count, 2); + +#ifdef Libburn_is_on_solariS + /* >>> provisory : preserve Solaris /dev/rdsk/cXtYdZs2 addresses */ + l = strlen(adr); + if (l >= 18) + if (strncmp(adr, "/dev/rdsk/c", 11) == 0 && adr[11] >= '0' && + adr[11] <= '9' && strcmp(adr + (l - 2), "s2") == 0) + return 1; +#endif /* Libburn_is_on_solariS */ + + ret = burn_drive_resolve_link(adr, path, &recursion_count, 2); + if(ret > 0 && strlen(path) < adr_size) + strcpy(path, adr); return (ret >= 0); } @@ -442,7 +460,7 @@ int sg_give_next_adr(burn_drive_enumerator_t *idx, int scsi_enumerate_drives(void) { burn_drive_enumerator_t idx; - int initialize = 1, ret, i_bus_no = -1, recursion_count = 0; + int initialize = 1, ret, i_bus_no = -1, recursion_count = 0, l; int i_host_no = -1, i_channel_no = -1, i_target_no = -1, i_lun_no = -1; char buf[4096], target[4096]; @@ -451,7 +469,22 @@ int scsi_enumerate_drives(void) initialize = 0; if (ret <= 0) break; - ret = burn_drive_resolve_link(buf, target, &recursion_count,2); + ret = 1; + +#ifdef Libburn_is_on_solariS + /* >>> provisory : preserve Solaris /dev/rdsk/cXtYdZs2 */ + l = strlen(buf); + if (l >= 18) + if (strncmp(buf, "/dev/rdsk/c", 11) == 0 && + buf[11] >= '0' && buf[11] <= '9' && + strcmp(buf + (l - 2), "s2") == 0) + ret = 0; +#endif /* Libburn_is_on_solariS */ + + if (ret == 1) { + ret = burn_drive_resolve_link(buf, target, + &recursion_count,2); + } if (ret <= 0) strcpy(target, buf); if (burn_drive_is_banned(target))