Change to use driver_return_t.

This commit is contained in:
rocky
2005-01-19 09:40:50 +00:00
parent 7796f6cce7
commit 9b8586d97f
3 changed files with 21 additions and 31 deletions

View File

@@ -1,5 +1,5 @@
/* /*
$Id: _cdio_linux.c,v 1.10 2005/01/19 09:23:24 rocky Exp $ $Id: _cdio_linux.c,v 1.11 2005/01/19 09:40:50 rocky Exp $
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2002, 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2002, 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -27,7 +27,7 @@
# include "config.h" # include "config.h"
#endif #endif
static const char _rcsid[] = "$Id: _cdio_linux.c,v 1.10 2005/01/19 09:23:24 rocky Exp $"; static const char _rcsid[] = "$Id: _cdio_linux.c,v 1.11 2005/01/19 09:40:50 rocky Exp $";
#include <string.h> #include <string.h>
@@ -951,7 +951,8 @@ stat_size_linux (void *p_user_data)
"source" sets the source device in I/O operations "source" sets the source device in I/O operations
"access-mode" sets the the method of CD access "access-mode" sets the the method of CD access
0 is returned if no error was found, and nonzero if there as an error. DRIVER_OP_SUCCESS is returned if no error was found,
and nonzero if there as an error.
*/ */
static driver_return_code_t static driver_return_code_t
set_arg_linux (void *p_user_data, const char key[], const char value[]) set_arg_linux (void *p_user_data, const char key[], const char value[])
@@ -961,9 +962,7 @@ set_arg_linux (void *p_user_data, const char key[], const char value[])
if (!strcmp (key, "source")) if (!strcmp (key, "source"))
{ {
if (!value) return DRIVER_OP_ERROR; if (!value) return DRIVER_OP_ERROR;
free (p_env->gen.source_name); free (p_env->gen.source_name);
p_env->gen.source_name = strdup (value); p_env->gen.source_name = strdup (value);
} }
else if (!strcmp (key, "access-mode")) else if (!strcmp (key, "access-mode"))

View File

@@ -1,5 +1,5 @@
/* /*
$Id: _cdio_sunos.c,v 1.7 2005/01/18 01:48:42 rocky Exp $ $Id: _cdio_sunos.c,v 1.8 2005/01/19 09:40:50 rocky Exp $
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2002, 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2002, 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -38,7 +38,7 @@
#ifdef HAVE_SOLARIS_CDROM #ifdef HAVE_SOLARIS_CDROM
static const char _rcsid[] = "$Id: _cdio_sunos.c,v 1.7 2005/01/18 01:48:42 rocky Exp $"; static const char _rcsid[] = "$Id: _cdio_sunos.c,v 1.8 2005/01/19 09:40:50 rocky Exp $";
#ifdef HAVE_GLOB_H #ifdef HAVE_GLOB_H
#include <glob.h> #include <glob.h>
@@ -377,30 +377,27 @@ _cdio_stat_size (void *p_user_data)
"source" sets the source device in I/O operations "source" sets the source device in I/O operations
"access-mode" sets the the method of CD access "access-mode" sets the the method of CD access
0 is returned if no error was found, and nonzero if there as an error. DRIVER_OP_SUCCESS is returned if no error was found,
and nonzero if there as an error.
*/ */
static int static driver_return_code_t
_set_arg_solaris (void *p_user_data, const char key[], const char value[]) _set_arg_solaris (void *p_user_data, const char key[], const char value[])
{ {
_img_private_t *p_env = p_user_data; _img_private_t *p_env = p_user_data;
if (!strcmp (key, "source")) if (!strcmp (key, "source"))
{ {
if (!value) if (!value) return DRIVER_OP_ERROR;
return -2;
free (p_env->gen.source_name); free (p_env->gen.source_name);
p_env->gen.source_name = strdup (value); p_env->gen.source_name = strdup (value);
} }
else if (!strcmp (key, "access-mode")) else if (!strcmp (key, "access-mode"))
{ {
p_env->access_mode = str_to_access_mode_sunos(key); p_env->access_mode = str_to_access_mode_sunos(key);
} }
else else return DRIVER_OP_ERROR;
return -1;
return 0; return DRIVER_OP_SUCCESS;
} }
/*! /*!
@@ -460,7 +457,7 @@ read_toc_solaris (void *p_user_data)
Eject media in CD drive. If successful, as a side effect we Eject media in CD drive. If successful, as a side effect we
also free obj. also free obj.
*/ */
static int static driver_return_code_t
eject_media_solaris (void *p_user_data) { eject_media_solaris (void *p_user_data) {
_img_private_t *p_env = p_user_data; _img_private_t *p_env = p_user_data;
@@ -472,12 +469,12 @@ eject_media_solaris (void *p_user_data) {
if ((ret = ioctl(p_env->gen.fd, CDROMEJECT)) != 0) { if ((ret = ioctl(p_env->gen.fd, CDROMEJECT)) != 0) {
cdio_generic_free((void *) p_env); cdio_generic_free((void *) p_env);
cdio_warn ("CDROMEJECT failed: %s\n", strerror(errno)); cdio_warn ("CDROMEJECT failed: %s\n", strerror(errno));
return 1; return DRIVER_OP_ERROR;
} else { } else {
return 0; return DRIVER_OP_SUCCESS;
} }
} }
return 2; return DRIVER_OP_ERROR;
} }
@@ -770,20 +767,20 @@ _cdio_get_track_msf(void *p_user_data, track_t i_track, msf_t *msf)
} }
/* Set read blocksize */ /* Set read blocksize */
static int static driver_return_code_t
set_blocksize_solaris (void *p_user_data, int i_blocksize) set_blocksize_solaris (void *p_user_data, int i_blocksize)
{ {
const _img_private_t *p_env = p_user_data; const _img_private_t *p_env = p_user_data;
return scsi_mmc_set_blocksize(p_env->gen.cdio, i_blocksize); return scsi_mmc_set_blocksize(p_env->gen.cdio, i_blocksize);
} }
/* Set operating speed */ /* Set CD-ROM drive speed */
static int static driver_return_code_t
set_speed_solaris (void *p_user_data, int i_speed) set_speed_solaris (void *p_user_data, int i_speed)
{ {
const _img_private_t *p_env = p_user_data; const _img_private_t *p_env = p_user_data;
if (!p_env) return -1; if (!p_env) return DRIVER_OP_ERROR;
return ioctl(p_env->gen.fd, CDROMSDRVSPEED, i_speed); return ioctl(p_env->gen.fd, CDROMSDRVSPEED, i_speed);
} }

View File

@@ -1,5 +1,5 @@
/* /*
$Id: image_common.c,v 1.5 2005/01/19 09:23:24 rocky Exp $ $Id: image_common.c,v 1.6 2005/01/19 09:40:50 rocky Exp $
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -243,25 +243,19 @@ _set_arg_image (void *p_user_data, const char key[], const char value[])
if (!strcmp (key, "source")) if (!strcmp (key, "source"))
{ {
free_if_notnull (p_env->gen.source_name); free_if_notnull (p_env->gen.source_name);
if (!value) return DRIVER_OP_ERROR; if (!value) return DRIVER_OP_ERROR;
p_env->gen.source_name = strdup (value); p_env->gen.source_name = strdup (value);
} }
else if (!strcmp (key, "cue")) else if (!strcmp (key, "cue"))
{ {
free_if_notnull (p_env->psz_cue_name); free_if_notnull (p_env->psz_cue_name);
if (!value) return DRIVER_OP_ERROR; if (!value) return DRIVER_OP_ERROR;
p_env->psz_cue_name = strdup (value); p_env->psz_cue_name = strdup (value);
} }
else if (!strcmp (key, "access-mode")) else if (!strcmp (key, "access-mode"))
{ {
free_if_notnull (p_env->psz_access_mode); free_if_notnull (p_env->psz_access_mode);
if (!value) return DRIVER_OP_ERROR; if (!value) return DRIVER_OP_ERROR;
p_env->psz_access_mode = strdup (value); p_env->psz_access_mode = strdup (value);
} }
else else