src/interface/intf_eject.c on non-linux systems suggestion

Steven M. Schultz sms at 2BSD.COM
Wed Jan 9 05:05:53 CET 2002


Greetings -

	I am not 100% sure if this is the correct forum for this - hopefully
	the developers hang out here too (so I don't have to join yet another
	mailing list ;))

	The new intf_eject.c module doesn't build on non-linux systems.  This
	is primarily due to the "SCSI command" method of ejecting (obviously
	a system specific thing).

	On some systems (those that use 'dvd.h' and libdvd to emulate some 
	of the linux ioctls)  the patch below enables intf_eject.c to
	compile.

	The largest part of the change is to 'ifdef SYS_LINUX' the EjectScsi
	function (some systems do not differentiate between IDE and SCSI - the
	same commands work for both transparently) and if NOT on linux 
	simply call 'EjectCdrom'.

	Of course if there are better ways to make the intf_eject.c "portable"
	feel free to alter the (suggested) patch as needed.

	Steven Schultz
	sms at 2bsd.com

--------------------------cut here-------------------------
*** intf_eject.c.dist	Tue Jan  8 18:01:14 2002
--- intf_eject.c	Tue Jan  8 19:56:36 2002
***************
*** 29,34 ****
--- 29,38 ----
  
  #include <videolan/vlc.h>
  
+ #ifdef	HAVE_DVD_H
+ #include <dvd.h>
+ #endif
+ 
  #ifdef SYS_LINUX
  
  /* This code could be extended to support CD/DVD-ROM chargers */
***************
*** 66,73 ****
  {
      int i_status;
    
!     i_status = ioctl( i_fd, CDROMEJECT );
!   
      return i_status;
  }
  
--- 70,76 ----
  {
      int i_status;
    
!     i_status = ioctl( i_fd, CDROMEJECT, 0);
      return i_status;
  }
  
***************
*** 79,84 ****
--- 82,88 ----
  {
      int i_status;
  
+ #ifdef SYS_LINUX
      struct sdata
      {
          int  inlen;
***************
*** 130,136 ****
    
      /* Force kernel to reread partition table when new disc inserted */
      i_status = ioctl( i_fd, BLKRRPART );
!   
      return i_status;
  }
  
--- 134,143 ----
    
      /* Force kernel to reread partition table when new disc inserted */
      i_status = ioctl( i_fd, BLKRRPART );
! #else
!     i_status = EjectCdrom(i_fd);
! #endif
! 
      return i_status;
  }
  




More information about the vlc mailing list