Add get_media_changed method on FreeBSD for drives accessed via CAM (SCSI or ATAPICAM).

Patch thanks to Andriy Gapon.
This commit is contained in:
rocky
2007-12-28 01:01:05 +00:00
parent ddf569dbea
commit d9469c2d77
2 changed files with 27 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
/*
$Id: freebsd.c,v 1.35 2006/03/03 09:50:30 flameeyes Exp $
$Id: freebsd.c,v 1.36 2007/12/28 01:01:05 rocky Exp $
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -27,7 +27,7 @@
# include "config.h"
#endif
static const char _rcsid[] = "$Id: freebsd.c,v 1.35 2006/03/03 09:50:30 flameeyes Exp $";
static const char _rcsid[] = "$Id: freebsd.c,v 1.36 2007/12/28 01:01:05 rocky Exp $";
#include "freebsd.h"
@@ -743,6 +743,27 @@ close_tray_freebsd (const char *psz_device)
#endif /*HAVE_FREEBSD_CDROM*/
}
/*! Find out if media has changed since the last call. @param
p_user_data the environment of the CD object to be acted upon.
@return 1 if media has changed since last call, 0 if not. Error
return codes are the same as driver_return_code_t
*/
int
get_media_changed_freebsd (const void *p_user_data)
{
#ifdef HAVE_FREEBSD_CDROM
const _img_private_t *p_env = p_user_data;
if ( p_env->access_mode == _AM_CAM ) {
return mmc_get_media_changed( p_env->gen.cdio );
}
else
return DRIVER_OP_UNSUPPORTED;
#else
return DRIVER_OP_NO_DRIVER;
#endif /*HAVE_FREEBSD_CDROM*/
}
/*!
Initialization routine. This is the only thing that doesn't
get called via a function pointer. In fact *we* are the
@@ -790,6 +811,7 @@ cdio_open_am_freebsd (const char *psz_orig_source_name,
.get_discmode = get_discmode_generic,
.get_drive_cap = get_drive_cap_freebsd,
.get_first_track_num = get_first_track_num_generic,
.get_media_changed = get_media_changed_freebsd,
.get_mcn = get_mcn_freebsd,
.get_num_tracks = get_num_tracks_generic,
.get_track_channels = get_track_channels_generic,

View File

@@ -1,5 +1,5 @@
/*
$Id: freebsd.h,v 1.7 2007/12/15 22:36:35 rocky Exp $
$Id: freebsd.h,v 1.8 2007/12/28 01:01:06 rocky Exp $
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
@@ -158,6 +158,8 @@ void get_drive_cap_freebsd_cam (const _img_private_t *p_env,
cdio_drive_write_cap_t *p_write_cap,
cdio_drive_misc_cap_t *p_misc_cap);
int get_media_changed_freebsd (const void *p_user_data);
char *get_mcn_freebsd_ioctl (const _img_private_t *p_env);
void free_freebsd_cam (void *obj);