Search
lxdream.org :: lxdream/src/gdrom/linux.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/gdrom/linux.c
changeset 422:61a0598e07ff
prev353:b8569afb53fc
next464:8e099fad42a6
author nkeynes
date Tue Oct 16 12:28:42 2007 +0000 (16 years ago)
permissions -rw-r--r--
last change Change command line handling to not require -d
file annotate diff log raw
1.1 --- a/src/gdrom/linux.c Sun Feb 11 10:11:05 2007 +0000
1.2 +++ b/src/gdrom/linux.c Tue Oct 16 12:28:42 2007 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: linux.c,v 1.4 2007-02-11 10:11:05 nkeynes Exp $
1.6 + * $Id: linux.c,v 1.5 2007-10-06 08:58:00 nkeynes Exp $
1.7 *
1.8 * Linux cd-rom device driver.
1.9 *
1.10 @@ -50,8 +50,8 @@
1.11 static gdrom_disc_t linux_open_device( const gchar *filename, FILE *f );
1.12 static gdrom_error_t linux_read_disc_toc( gdrom_image_t disc );
1.13 static gdrom_error_t linux_read_sector( gdrom_disc_t disc, uint32_t sector,
1.14 - int mode, char *buf, uint32_t *length );
1.15 -static gdrom_error_t linux_send_command( int fd, char *cmd, char *buffer, size_t *buflen,
1.16 + int mode, unsigned char *buf, uint32_t *length );
1.17 +static gdrom_error_t linux_send_command( int fd, char *cmd, unsigned char *buffer, size_t *buflen,
1.18 int direction );
1.19 static int linux_drive_status( gdrom_disc_t disc );
1.20
1.21 @@ -81,7 +81,6 @@
1.22 static gdrom_disc_t linux_open_device( const gchar *filename, FILE *f )
1.23 {
1.24 gdrom_disc_t disc;
1.25 - int fd = fileno(f);
1.26
1.27 disc = gdrom_image_new(f);
1.28 if( disc == NULL ) {
1.29 @@ -113,7 +112,7 @@
1.30 if( status == CDS_DISC_OK ) {
1.31 status = ioctl(fd, CDROM_MEDIA_CHANGED, CDSL_CURRENT);
1.32 if( status != 0 ) {
1.33 - linux_read_disc_toc(disc);
1.34 + linux_read_disc_toc( (gdrom_image_t)disc);
1.35 }
1.36 return ((gdrom_image_t)disc)->disc_type | IDE_DISC_READY;
1.37 } else {
1.38 @@ -127,7 +126,7 @@
1.39 {
1.40 int fd = fileno(disc->file);
1.41 unsigned char buf[MAXTOCSIZE];
1.42 - int buflen = sizeof(buf);
1.43 + size_t buflen = sizeof(buf);
1.44 char cmd[12] = { 0x43, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
1.45
1.46 cmd[7] = (sizeof(buf))>>8;
1.47 @@ -188,13 +187,12 @@
1.48 }
1.49
1.50 static gdrom_error_t linux_read_sector( gdrom_disc_t disc, uint32_t sector,
1.51 - int mode, char *buf, uint32_t *length )
1.52 + int mode, unsigned char *buf, uint32_t *length )
1.53 {
1.54 gdrom_image_t image = (gdrom_image_t)disc;
1.55 int fd = fileno(image->file);
1.56 uint32_t real_sector = sector - CD_MSF_OFFSET;
1.57 uint32_t sector_size = MAX_SECTOR_SIZE;
1.58 - int i;
1.59 char cmd[12] = { 0xBE, 0x10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
1.60
1.61 cmd[1] = (mode & 0x0E) << 1;
1.62 @@ -220,7 +218,7 @@
1.63 * @return 0 on success, -1 on an operating system error, or a sense error
1.64 * code on a device error.
1.65 */
1.66 -static gdrom_error_t linux_send_command( int fd, char *cmd, char *buffer, size_t *buflen,
1.67 +static gdrom_error_t linux_send_command( int fd, char *cmd, unsigned char *buffer, size_t *buflen,
1.68 int direction )
1.69 {
1.70 struct request_sense sense;
.