New internal sg-API function sg_initialize()
This commit is contained in:
parent
d3988dd74b
commit
e13b6369ba
@ -1 +1 @@
|
|||||||
#define Cdrskin_timestamP "2009.12.25.205704"
|
#define Cdrskin_timestamP "2009.12.25.223915"
|
||||||
|
@ -59,6 +59,12 @@ int burn_sg_open_o_nonblock = 1;
|
|||||||
to unconditional abort of the process */
|
to unconditional abort of the process */
|
||||||
int burn_sg_open_abort_busy = 0;
|
int burn_sg_open_abort_busy = 0;
|
||||||
|
|
||||||
|
|
||||||
|
/* The message returned from sg_initialize()
|
||||||
|
*/
|
||||||
|
char sg_initialize_msg[1024] = {""};
|
||||||
|
|
||||||
|
|
||||||
/* ts A61002 */
|
/* ts A61002 */
|
||||||
|
|
||||||
#include "cleanup.h"
|
#include "cleanup.h"
|
||||||
@ -110,6 +116,14 @@ int burn_initialize(void)
|
|||||||
ret = burn_msgs_initialize();
|
ret = burn_msgs_initialize();
|
||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
ret = sg_initialize(sg_initialize_msg, 0);
|
||||||
|
if (ret <= 0) {
|
||||||
|
libdax_msgs_submit(libdax_messenger, -1,
|
||||||
|
0x00020175,
|
||||||
|
LIBDAX_MSGS_SEV_FATAL, LIBDAX_MSGS_PRIO_HIGH,
|
||||||
|
sg_initialize_msg, 0, 0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
burn_running = 1;
|
burn_running = 1;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,11 @@ and of deriving the following system specific files from existing examples:
|
|||||||
Said sg-*.c operations are defined by a public function interface, which has
|
Said sg-*.c operations are defined by a public function interface, which has
|
||||||
to be implemented in a way that provides libburn with the desired services:
|
to be implemented in a way that provides libburn with the desired services:
|
||||||
|
|
||||||
|
sg_initialize() performs global initialization of the SCSI transport
|
||||||
|
adapter and eventually needed operating system
|
||||||
|
facilities. Checks for compatibility of supporting
|
||||||
|
software components.
|
||||||
|
|
||||||
sg_give_next_adr() iterates over the set of potentially useful drive
|
sg_give_next_adr() iterates over the set of potentially useful drive
|
||||||
address strings.
|
address strings.
|
||||||
|
|
||||||
@ -230,6 +235,20 @@ static void enumerate_common(char *fname, int bus_no, int host_no,
|
|||||||
/* ------------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------------ */
|
||||||
|
|
||||||
|
|
||||||
|
/** Performs global initialization of the SCSI transport adapter and eventually
|
||||||
|
needed operating system facilities. Checks for compatibility supporting
|
||||||
|
software components.
|
||||||
|
@param msg returns ids and/or error messages of eventual helpers
|
||||||
|
@param flag unused yet, submit 0
|
||||||
|
@return 1 = success, <=0 = failure
|
||||||
|
*/
|
||||||
|
int sg_initialize(char msg[1024], int flag)
|
||||||
|
{
|
||||||
|
/* nothing to be done */
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Returns the next index number and the next enumerated drive address.
|
/** Returns the next index number and the next enumerated drive address.
|
||||||
The enumeration has to cover all available and accessible drives. It is
|
The enumeration has to cover all available and accessible drives. It is
|
||||||
allowed to return addresses of drives which are not available but under
|
allowed to return addresses of drives which are not available but under
|
||||||
|
@ -54,6 +54,21 @@ int burn_drive_is_banned(char *device_address);
|
|||||||
int mmc_function_spy(struct burn_drive *d, char * text);
|
int mmc_function_spy(struct burn_drive *d, char * text);
|
||||||
|
|
||||||
|
|
||||||
|
/* ts A91225 */
|
||||||
|
/** Performs global initialization of the SCSI transport adapter and eventually
|
||||||
|
needed operating system facilities. Checks for compatibility supporting
|
||||||
|
software components.
|
||||||
|
@param msg returns ids and/or error messages of eventual helpers
|
||||||
|
@param flag unused yet, submit 0
|
||||||
|
@return 1 = success, <=0 = failure
|
||||||
|
*/
|
||||||
|
int sg_initialize(char msg[1024], int flag)
|
||||||
|
{
|
||||||
|
/* nothing to be done */
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ts A61021 : Moved most code from scsi_enumerate_drives under
|
/* ts A61021 : Moved most code from scsi_enumerate_drives under
|
||||||
sg_give_next_adr() */
|
sg_give_next_adr() */
|
||||||
/* Some helper functions for scsi_give_next_adr() */
|
/* Some helper functions for scsi_give_next_adr() */
|
||||||
|
@ -29,6 +29,11 @@ and of deriving the following system specific files from existing examples:
|
|||||||
Said sg-*.c operations are defined by a public function interface, which has
|
Said sg-*.c operations are defined by a public function interface, which has
|
||||||
to be implemented in a way that provides libburn with the desired services:
|
to be implemented in a way that provides libburn with the desired services:
|
||||||
|
|
||||||
|
sg_initialize() performs global initialization of the SCSI transport
|
||||||
|
adapter and eventually needed operating system
|
||||||
|
facilities. Checks for compatibility of supporting
|
||||||
|
software components.
|
||||||
|
|
||||||
sg_give_next_adr() iterates over the set of potentially useful drive
|
sg_give_next_adr() iterates over the set of potentially useful drive
|
||||||
address strings.
|
address strings.
|
||||||
|
|
||||||
@ -206,6 +211,54 @@ static void enumerate_common(char *fname, int bus_no, int host_no,
|
|||||||
/* ------------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------------ */
|
||||||
|
|
||||||
|
|
||||||
|
/** Performs global initialization of the SCSI transport adapter and eventually
|
||||||
|
needed operating system facilities. Checks for compatibility of supporting
|
||||||
|
software components.
|
||||||
|
@param msg returns ids and/or error messages of eventual helpers
|
||||||
|
@param flag unused yet, submit 0
|
||||||
|
@return 1 = success, <=0 = failure
|
||||||
|
*/
|
||||||
|
int sg_initialize(char msg[1024], int flag)
|
||||||
|
{
|
||||||
|
char *version_text, *msg_pt;
|
||||||
|
int cdio_ver;
|
||||||
|
|
||||||
|
sprintf(msg, "Using sg-libcdio-%d with libcdio version ",
|
||||||
|
LIBCDIO_VERSION_NUM );
|
||||||
|
|
||||||
|
#if LIBCDIO_VERSION_NUM < 83
|
||||||
|
|
||||||
|
LIBBURN_MISCONFIGURATION = 0;
|
||||||
|
INTENTIONAL_ABORT_OF_COMPILATION__HEADERFILE_cdio_version_dot_h_TOO_OLD__NEED_LIBCDIO_VERSION_NUM_83 = 0;
|
||||||
|
LIBBURN_MISCONFIGURATION_ = 0;
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
cdio_ver = libcdio_version_num;
|
||||||
|
version_text = (char *) cdio_version_string;
|
||||||
|
|
||||||
|
#endif /* ! LIBCDIO_VERSION_NUM < 83 */
|
||||||
|
|
||||||
|
strncat(msg, version_text, 800);
|
||||||
|
libdax_msgs_submit(libdax_messenger, -1, 0x00000002,
|
||||||
|
LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_HIGH,
|
||||||
|
msg , 0, 0);
|
||||||
|
if (cdio_ver < LIBCDIO_VERSION_NUM) {
|
||||||
|
strcat(msg, " ---> ");
|
||||||
|
msg_pt = msg + strlen(msg);
|
||||||
|
sprintf(msg_pt,
|
||||||
|
"libcdio TOO OLD: numeric version %d , need at least %d",
|
||||||
|
cdio_ver, LIBCDIO_VERSION_NUM);
|
||||||
|
libdax_msgs_submit(libdax_messenger, -1,
|
||||||
|
0x00000002,
|
||||||
|
LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_HIGH,
|
||||||
|
msg_pt, 0, 0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Returns the next index number and the next enumerated drive address.
|
/** Returns the next index number and the next enumerated drive address.
|
||||||
The enumeration has to cover all available and accessible drives. It is
|
The enumeration has to cover all available and accessible drives. It is
|
||||||
allowed to return addresses of drives which are not available but under
|
allowed to return addresses of drives which are not available but under
|
||||||
@ -318,46 +371,13 @@ int sg_drive_is_open(struct burn_drive * d)
|
|||||||
int sg_grab(struct burn_drive *d)
|
int sg_grab(struct burn_drive *d)
|
||||||
{
|
{
|
||||||
CdIo_t *p_cdio;
|
CdIo_t *p_cdio;
|
||||||
char *am, *version_text;
|
char *am;
|
||||||
char msg[160];
|
|
||||||
int cdio_ver = 82;
|
|
||||||
|
|
||||||
if (d->p_cdio != NULL) {
|
if (d->p_cdio != NULL) {
|
||||||
d->released = 0;
|
d->released = 0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(msg, "Using sg-libcdio-%d with libcdio version ",
|
|
||||||
LIBCDIO_VERSION_NUM );
|
|
||||||
|
|
||||||
#if LIBCDIO_VERSION_NUM < 83
|
|
||||||
|
|
||||||
LIBBURN_MISCONFIGURATION = 0;
|
|
||||||
INTENTIONAL_ABORT_OF_COMPILATION__HEADERFILE_cdio_version_dot_h_TOO_OLD__NEED_LIBCDIO_VERSION_NUM_83 = 0;
|
|
||||||
LIBBURN_MISCONFIGURATION_ = 0;
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
cdio_ver = libcdio_version_num;
|
|
||||||
version_text = (char *) cdio_version_string;
|
|
||||||
|
|
||||||
#endif /* ! LIBCDIO_VERSION_NUM < 83 */
|
|
||||||
|
|
||||||
strncat(msg, version_text, 80);
|
|
||||||
libdax_msgs_submit(libdax_messenger, -1, 0x00000002,
|
|
||||||
LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_HIGH,
|
|
||||||
msg , 0, 0);
|
|
||||||
if (cdio_ver < LIBCDIO_VERSION_NUM) {
|
|
||||||
sprintf(msg,
|
|
||||||
"libcdio TOO OLD: numeric version %d , need at least %d",
|
|
||||||
cdio_ver, LIBCDIO_VERSION_NUM);
|
|
||||||
libdax_msgs_submit(libdax_messenger, d->global_index,
|
|
||||||
0x00020175,
|
|
||||||
LIBDAX_MSGS_SEV_FATAL, LIBDAX_MSGS_PRIO_HIGH,
|
|
||||||
msg, 0, 0);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
p_cdio = cdio_open_am(d->devname, DRIVER_DEVICE,
|
p_cdio = cdio_open_am(d->devname, DRIVER_DEVICE,
|
||||||
burn_sg_open_o_excl ? "MMC_RDWR_EXCL" : "MMC_RDWR");
|
burn_sg_open_o_excl ? "MMC_RDWR_EXCL" : "MMC_RDWR");
|
||||||
|
|
||||||
|
@ -35,6 +35,11 @@ and of deriving the following system specific files from existing examples:
|
|||||||
Said sg-*.c operations are defined by a public function interface, which has
|
Said sg-*.c operations are defined by a public function interface, which has
|
||||||
to be implemented in a way that provides libburn with the desired services:
|
to be implemented in a way that provides libburn with the desired services:
|
||||||
|
|
||||||
|
sg_initialize() performs global initialization of the SCSI transport
|
||||||
|
adapter and eventually needed operating system
|
||||||
|
facilities. Checks for compatibility of supporting
|
||||||
|
software components.
|
||||||
|
|
||||||
sg_give_next_adr() iterates over the set of potentially useful drive
|
sg_give_next_adr() iterates over the set of potentially useful drive
|
||||||
address strings.
|
address strings.
|
||||||
|
|
||||||
@ -1407,6 +1412,20 @@ static void enumerate_common(char *fname, int bus_no, int host_no,
|
|||||||
/* ------------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------------ */
|
||||||
|
|
||||||
|
|
||||||
|
/** Performs global initialization of the SCSI transport adapter and eventually
|
||||||
|
needed operating system facilities. Checks for compatibility supporting
|
||||||
|
software components.
|
||||||
|
@param msg returns ids and/or error messages of eventual helpers
|
||||||
|
@param flag unused yet, submit 0
|
||||||
|
@return 1 = success, <=0 = failure
|
||||||
|
*/
|
||||||
|
int sg_initialize(char msg[1024], int flag)
|
||||||
|
{
|
||||||
|
/* nothing to be done */
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/** PORTING:
|
/** PORTING:
|
||||||
In this Linux implementation, this function mirrors the enumeration
|
In this Linux implementation, this function mirrors the enumeration
|
||||||
done in sg_enumerate and ata_enumerate(). It would be better to base those
|
done in sg_enumerate and ata_enumerate(). It would be better to base those
|
||||||
|
11
libburn/sg.h
11
libburn/sg.h
@ -33,4 +33,15 @@ int sg_drive_is_open(struct burn_drive * d);
|
|||||||
|
|
||||||
int burn_os_stdio_capacity(char *path, off_t *bytes);
|
int burn_os_stdio_capacity(char *path, off_t *bytes);
|
||||||
|
|
||||||
|
/* ts A91225 */
|
||||||
|
/** Performs global initialization of the SCSI transport adapter and eventually
|
||||||
|
needed operating system facilities. Checks for compatibility supporting
|
||||||
|
software components.
|
||||||
|
@param msg returns ids and/or error messages of eventual helpers
|
||||||
|
@param flag unused yet, submit 0
|
||||||
|
@return 1 = success, <=0 = failure
|
||||||
|
*/
|
||||||
|
int sg_initialize(char msg[1024], int flag);
|
||||||
|
|
||||||
|
|
||||||
#endif /* __SG */
|
#endif /* __SG */
|
||||||
|
Loading…
Reference in New Issue
Block a user