| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
#ifdef HAVE_CONFIG_H |
| 32 |
# include <config.h> |
| 33 |
#endif |
| 34 |
|
| 35 |
#include <glib.h> |
| 36 |
|
| 37 |
#include "scsi-sbc.h" |
| 38 |
|
| 39 |
#include "scsi-error.h" |
| 40 |
#include "scsi-utils.h" |
| 41 |
#include "scsi-base.h" |
| 42 |
#include "scsi-command.h" |
| 43 |
#include "scsi-opcodes.h" |
| 44 |
|
| 45 |
#if G_BYTE_ORDER == G_LITTLE_ENDIAN |
| 46 |
|
| 47 |
struct _BraseroScsiPreventAllowMediumRemovalUnitCDB { |
| 48 |
uchar opcode; |
| 49 |
|
| 50 |
uchar res1 [3]; |
| 51 |
|
| 52 |
uchar prevent :2; |
| 53 |
uchar res4 :6; |
| 54 |
|
| 55 |
uchar ctl; |
| 56 |
}; |
| 57 |
|
| 58 |
#else |
| 59 |
|
| 60 |
struct _BraseroScsiPreventAllowMediumRemovalUnitCDB { |
| 61 |
uchar opcode; |
| 62 |
|
| 63 |
uchar res1 [3]; |
| 64 |
|
| 65 |
uchar res4 :6; |
| 66 |
uchar prevent :2; |
| 67 |
|
| 68 |
uchar ctl; |
| 69 |
}; |
| 70 |
|
| 71 |
#endif |
| 72 |
|
| 73 |
typedef struct _BraseroScsiPreventAllowMediumRemovalUnitCDB BraseroScsiPreventAllowMediumRemovalUnitCDB; |
| 74 |
|
| 75 |
BRASERO_SCSI_COMMAND_DEFINE (BraseroScsiPreventAllowMediumRemovalUnitCDB, |
| 76 |
PREVENT_ALLOW_MEDIUM_REMOVAL, |
| 77 |
BRASERO_SCSI_READ); |
| 78 |
|
| 79 |
BraseroScsiResult |
| 80 |
brasero_sbc_medium_removal (BraseroDeviceHandle *handle, |
| 81 |
int prevent_removal, |
| 82 |
BraseroScsiErrCode *error) |
| 83 |
{ |
| 84 |
BraseroScsiPreventAllowMediumRemovalUnitCDB *cdb; |
| 85 |
BraseroScsiResult res; |
| 86 |
|
| 87 |
g_return_val_if_fail (handle != NULL, BRASERO_SCSI_FAILURE); |
| 88 |
|
| 89 |
cdb = brasero_scsi_command_new (&info, handle); |
| 90 |
cdb->prevent = prevent_removal; |
| 91 |
res = brasero_scsi_command_issue_sync (cdb, |
| 92 |
NULL, |
| 93 |
0, |
| 94 |
error); |
| 95 |
brasero_scsi_command_free (cdb); |
| 96 |
return res; |
| 97 |
} |