|
libhd
5.0
|
#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <stdint.h>#include <sys/stat.h>#include <fcntl.h>#include <sys/ioctl.h>#include <linux/cdrom.h>#include <errno.h>#include <string.h>#include <mntent.h>#include <sys/wait.h>#include <sys/utsname.h>#include <scsi/scsi.h>#include <scsi/sg.h>#include <poll.h>#include <sys/time.h>#include "dvd.h"Data Structures | |
| struct | ScsiCommand |
Defines | |
| #define | CREAM_ON_ERRNO(s) |
| #define | ERRCODE(s) ((((s)[2]&0x0F)<<16)|((s)[12]<<8)|((s)[13])) |
| #define | SK(errcode) (((errcode)>>16)&0xF) |
| #define | ASC(errcode) (((errcode)>>8)&0xFF) |
| #define | ASCQ(errcode) ((errcode)&0xFF) |
| #define | _LARGEFILE_SOURCE |
| #define | _LARGEFILE64_SOURCE |
| #define | _FILE_OFFSET_BITS 64 |
| #define | _GNU_SOURCE |
| #define | SG_FLAG_LUN_INHIBIT 0 |
| #define | DIRECTION(i) (Dir_xlate[i]); |
Typedefs | |
| typedef struct ScsiCommand | ScsiCommand |
Enumerations | |
| enum | Direction { NONE = CGC_DATA_NONE, READ = CGC_DATA_READ, WRITE = CGC_DATA_WRITE } |
Functions | |
| static ScsiCommand * | scsi_command_new (void) |
| static ScsiCommand * | scsi_command_new_from_fd (int f) |
| static void | scsi_command_free (ScsiCommand *cmd) |
| static int | scsi_command_transport (ScsiCommand *cmd, Direction dir, void *buf, size_t sz) |
| static void | scsi_command_init (ScsiCommand *cmd, size_t i, int arg) |
| int | get_dvd_profile (int fd) |
Variables | |
| const int | Dir_xlate [4] |
| #define _FILE_OFFSET_BITS 64 |
| #define _GNU_SOURCE |
| #define _LARGEFILE64_SOURCE |
| #define _LARGEFILE_SOURCE |
| #define ASC | ( | errcode | ) | (((errcode)>>8)&0xFF) |
| #define ASCQ | ( | errcode | ) | ((errcode)&0xFF) |
| #define CREAM_ON_ERRNO | ( | s | ) |
do { \ switch ((s)[2]&0x0F) \ { case 2: if ((s)[12]==4) errno=EAGAIN; break; \ case 5: errno=EINVAL; \ if ((s)[13]==0) \ { if ((s)[12]==0x21) errno=ENOSPC; \ else if ((s)[12]==0x20) errno=ENODEV; \ } \ break; \ } \ } while(0)
Referenced by scsi_command_transport().
Referenced by scsi_command_transport().
| #define ERRCODE | ( | s | ) | ((((s)[2]&0x0F)<<16)|((s)[12]<<8)|((s)[13])) |
Referenced by scsi_command_transport().
| #define SG_FLAG_LUN_INHIBIT 0 |
Referenced by scsi_command_init().
| #define SK | ( | errcode | ) | (((errcode)>>16)&0xF) |
| typedef struct ScsiCommand ScsiCommand |
| enum Direction |
| int get_dvd_profile | ( | int | fd | ) |
References DRIVE_CDROM_CAPS_BDR, DRIVE_CDROM_CAPS_BDRE, DRIVE_CDROM_CAPS_BDROM, DRIVE_CDROM_CAPS_DVDPLUSR, DRIVE_CDROM_CAPS_DVDPLUSRDL, DRIVE_CDROM_CAPS_DVDPLUSRW, DRIVE_CDROM_CAPS_DVDPLUSRWDL, DRIVE_CDROM_CAPS_DVDRDL, DRIVE_CDROM_CAPS_DVDRW, DRIVE_CDROM_CAPS_HDDVDR, DRIVE_CDROM_CAPS_HDDVDROM, DRIVE_CDROM_CAPS_HDDVDRW, READ, scsi_command_free(), scsi_command_init(), scsi_command_new_from_fd(), and scsi_command_transport().
Referenced by add_cdrom_info().
| static void scsi_command_free | ( | ScsiCommand * | cmd | ) | [static] |
References ScsiCommand::autoclose, ScsiCommand::fd, and ScsiCommand::filename.
Referenced by get_dvd_profile().
| static void scsi_command_init | ( | ScsiCommand * | cmd, |
| size_t | i, | ||
| int | arg | ||
| ) | [static] |
References ScsiCommand::_sense, ScsiCommand::cgc, ScsiCommand::s, SG_FLAG_LUN_INHIBIT, ScsiCommand::sg_io, and ScsiCommand::u.
Referenced by get_dvd_profile().
| static ScsiCommand* scsi_command_new | ( | void | ) | [static] |
References ScsiCommand::autoclose, ScsiCommand::fd, and ScsiCommand::filename.
Referenced by scsi_command_new_from_fd().
| static ScsiCommand* scsi_command_new_from_fd | ( | int | f | ) | [static] |
References ScsiCommand::autoclose, ScsiCommand::fd, and scsi_command_new().
Referenced by get_dvd_profile().
| static int scsi_command_transport | ( | ScsiCommand * | cmd, |
| Direction | dir, | ||
| void * | buf, | ||
| size_t | sz | ||
| ) | [static] |
References CREAM_ON_ERRNO, DIRECTION, ERRCODE, ScsiCommand::fd, and ScsiCommand::sg_io.
Referenced by get_dvd_profile().
| const int Dir_xlate[4] |
{
0,
SG_DXFER_TO_DEV,
SG_DXFER_FROM_DEV,
SG_DXFER_NONE
}