Search
lxdream.org :: lxdream/src/drivers/cdrom/cdrom.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/drivers/cdrom/cdrom.c
changeset 1109:700c5ab26a63
prev1108:305ef2082079
next1177:bd5893522efc
author nkeynes
date Thu Jun 10 22:13:16 2010 +1000 (12 years ago)
permissions -rw-r--r--
last change Integrate executable wrapping into the user interface
- command-line now loads wrapped by default, -e <bin> to run binary
- add support for .bin executables
- Add useful (internal) error codes
file annotate diff log raw
1.1 --- a/src/drivers/cdrom/cdrom.c Fri Jun 04 09:13:40 2010 +1000
1.2 +++ b/src/drivers/cdrom/cdrom.c Thu Jun 10 22:13:16 2010 +1000
1.3 @@ -116,7 +116,7 @@
1.4 if( disc != NULL ) {
1.5 cdrom_disc_init( disc, name );
1.6 } else {
1.7 - SET_ERROR(err, ENOMEM, "Unable to allocate memory for cdrom disc");
1.8 + SET_ERROR(err, LX_ERR_NOMEM, "Unable to allocate memory for cdrom disc");
1.9 }
1.10 return disc;
1.11 }
1.12 @@ -131,7 +131,7 @@
1.13 if( disc != NULL && filename != NULL ) {
1.14 disc->base_source = file_sector_source_new_filename( filename, SECTOR_UNKNOWN, 0, FILE_SECTOR_FULL_FILE );
1.15 if( disc->base_source == NULL ) {
1.16 - SET_ERROR( err, errno, "Unable to open cdrom file '%s': %s", filename, strerror(errno) );
1.17 + SET_ERROR( err, LX_ERR_FILE_NOOPEN, "Unable to open cdrom file '%s': %s", filename, strerror(errno) );
1.18 cdrom_disc_unref(disc);
1.19 disc = NULL;
1.20 } else {
1.21 @@ -272,7 +272,7 @@
1.22 } else {
1.23 /* No handler found for file */
1.24 cdrom_disc_unref( disc );
1.25 - SET_ERROR( err, EINVAL, "File '%s' could not be recognized as any known image file or device type" );
1.26 + SET_ERROR( err, LX_ERR_FILE_UNKNOWN, "File '%s' could not be recognized as any known image file or device type", filename );
1.27 return NULL;
1.28 }
1.29 }
1.30 @@ -284,7 +284,7 @@
1.31 * @param lba The position on disc of the main track. If non-zero,
1.32 * a filler track is added before it, in 2 separate sessions.
1.33 */
1.34 -cdrom_disc_t cdrom_disc_new_from_track( cdrom_disc_type_t type, sector_source_t track, cdrom_lba_t lba )
1.35 +cdrom_disc_t cdrom_disc_new_from_track( cdrom_disc_type_t type, sector_source_t track, cdrom_lba_t lba, ERROR *err )
1.36 {
1.37 cdrom_disc_t disc = cdrom_disc_new( NULL, NULL );
1.38 if( disc != NULL ) {
1.39 @@ -312,6 +312,8 @@
1.40 disc->track_count = trackno+1;
1.41 disc->session_count = trackno+1;
1.42 cdrom_disc_compute_leadout(disc);
1.43 + } else {
1.44 + SET_ERROR(err, LX_ERR_NOMEM, "Unable to allocate memory for cdrom disc");
1.45 }
1.46 return disc;
1.47 }
1.48 @@ -325,7 +327,7 @@
1.49 sector_mode_t mode = (type == CDROM_DISC_NONXA ? SECTOR_MODE1 : SECTOR_MODE2_FORM1 );
1.50 sector_source_t source = iso_sector_source_new( iso, mode, lba, bootstrap, err );
1.51 if( source != NULL ) {
1.52 - cdrom_disc_t disc = cdrom_disc_new_from_track(type, source, lba);
1.53 + cdrom_disc_t disc = cdrom_disc_new_from_track(type, source, lba, err);
1.54 if( disc == NULL ) {
1.55 sector_source_unref( source );
1.56 } else {
.