aboutsummaryrefslogtreecommitdiff
path: root/miscutils/eject.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2016-03-14 18:23:33 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2016-03-14 18:23:33 +0100
commitdbb58a3879c2daa3e286a8cd9da7935e264f3072 (patch)
treedd79ea5de5b85926f4bea7298a44238f1c221f18 /miscutils/eject.c
parent1b7c17391de66502dd7a97c866e0a33681edbb1f (diff)
downloadbusybox-w32-dbb58a3879c2daa3e286a8cd9da7935e264f3072.tar.gz
busybox-w32-dbb58a3879c2daa3e286a8cd9da7935e264f3072.tar.bz2
busybox-w32-dbb58a3879c2daa3e286a8cd9da7935e264f3072.zip
fixes for problems found by bionic build
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'miscutils/eject.c')
-rw-r--r--miscutils/eject.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/miscutils/eject.c b/miscutils/eject.c
index a20e04b7f..15eaf556d 100644
--- a/miscutils/eject.c
+++ b/miscutils/eject.c
@@ -25,23 +25,19 @@
25 25
26#include <sys/mount.h> 26#include <sys/mount.h>
27#include "libbb.h" 27#include "libbb.h"
28#if ENABLE_FEATURE_EJECT_SCSI
28/* Must be after libbb.h: they need size_t */ 29/* Must be after libbb.h: they need size_t */
29#include "fix_u32.h" 30# include "fix_u32.h"
30#include <scsi/sg.h> 31# include <scsi/sg.h>
31#include <scsi/scsi.h> 32# include <scsi/scsi.h>
32 33#endif
33/* various defines swiped from linux/cdrom.h */
34#define CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */
35#define CDROMEJECT 0x5309 /* Ejects the cdrom media */
36#define CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */
37/* drive status possibilities returned by CDROM_DRIVE_STATUS ioctl */
38#define CDS_TRAY_OPEN 2
39 34
40#define dev_fd 3 35#define dev_fd 3
41 36
42/* Code taken from the original eject (http://eject.sourceforge.net/), 37/* Code taken from the original eject (http://eject.sourceforge.net/),
43 * refactored it a bit for busybox (ne-bb@nicoerfurth.de) */ 38 * refactored it a bit for busybox (ne-bb@nicoerfurth.de) */
44 39
40#if ENABLE_FEATURE_EJECT_SCSI
45static void eject_scsi(const char *dev) 41static void eject_scsi(const char *dev)
46{ 42{
47 static const char sg_commands[3][6] = { 43 static const char sg_commands[3][6] = {
@@ -76,6 +72,16 @@ static void eject_scsi(const char *dev)
76 /* force kernel to reread partition table when new disc is inserted */ 72 /* force kernel to reread partition table when new disc is inserted */
77 ioctl(dev_fd, BLKRRPART); 73 ioctl(dev_fd, BLKRRPART);
78} 74}
75#else
76# define eject_scsi() ((void)0)
77#endif
78
79/* various defines swiped from linux/cdrom.h */
80#define CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */
81#define CDROMEJECT 0x5309 /* Ejects the cdrom media */
82#define CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */
83/* drive status possibilities returned by CDROM_DRIVE_STATUS ioctl */
84#define CDS_TRAY_OPEN 2
79 85
80#define FLAG_CLOSE 1 86#define FLAG_CLOSE 1
81#define FLAG_SMART 2 87#define FLAG_SMART 2