Files
Aaru/DiscImageChef.Devices/Linux/Enums.cs

190 lines
4.9 KiB
C#
Raw Normal View History

2015-10-12 06:39:31 +01:00
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Enums.cs
// Version : 1.0
// Author(s) : Natalia Portillo
//
// Component : Linux direct device access
//
// Revision : $Revision$
// Last change by : $Author$
// Date : $Date$
//
// --[ Description ] ----------------------------------------------------------
//
// Contains enumerations necessary for directly interfacing devices under Linux
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright (C) 2011-2015 Claunia.com
// ****************************************************************************/
// //$Id$
using System;
2015-10-05 21:20:25 +01:00
namespace DiscImageChef.Devices.Linux
{
[Flags]
enum FileFlags : int
2015-10-05 21:20:25 +01:00
{
/// <summary>
/// O_RDONLY
/// </summary>
Readonly = 00000000,
/// <summary>
/// O_WRONLY
/// </summary>
Writeonly = 00000001,
/// <summary>
/// O_RDWR
/// </summary>
ReadWrite = 00000002,
/// <summary>
/// O_CREAT
/// </summary>
OpenOrCreate = 00000100,
/// <summary>
/// O_EXCL
/// </summary>
CreateNew = 00000200,
/// <summary>
/// O_NOCTTY
/// </summary>
NoControlTTY = 00000400,
/// <summary>
/// O_TRUNC
/// </summary>
Truncate = 00001000,
/// <summary>
/// O_APPEND
/// </summary>
Append = 00002000,
/// <summary>
/// O_NONBLOCK
/// </summary>
NonBlocking = 00004000,
/// <summary>
/// O_DSYNC
/// </summary>
Synchronous = 00010000,
/// <summary>
/// O_ASYNC
/// </summary>
Async = 00020000,
/// <summary>
/// O_DIRECT
/// </summary>
Direct = 00040000,
/// <summary>
/// O_LARGEFILE
/// </summary>
LargeFile = 00100000,
/// <summary>
/// O_DIRECTORY
/// </summary>
Directory = 00200000,
/// <summary>
/// O_NOFOLLOW
/// </summary>
NoFollowSymlink = 00400000,
/// <summary>
/// O_NOATIME
/// </summary>
NoAccessTime = 01000000,
/// <summary>
/// O_CLOEXEC
/// </summary>
CloseOnExec = 02000000
}
2015-10-05 21:20:25 +01:00
/// <summary>
/// Direction of SCSI transfer
/// </summary>
enum ScsiIoctlDirection : int
{
/// <summary>
/// No data transfer happens
/// SG_DXFER_NONE
/// </summary>
None = -1,
/// <summary>
/// From host to device
/// SG_DXFER_TO_DEV
/// </summary>
Out = -2,
/// <summary>
/// From device to host
/// SG_DXFER_FROM_DEV
/// </summary>
In = -3,
/// <summary>
/// Bidirectional device/host
/// SG_DXFER_TO_FROM_DEV
/// </summary>
Unspecified = -4,
/// <summary>
/// Unspecified
/// SG_DXFER_UNKNOWN
/// </summary>
Unknown = -5
}
2015-10-05 21:20:25 +01:00
* DiscImageChef.CommonTypes/MediaTypeFromSCSI.cs: * DiscImageChef.CommonTypes/DiscImageChef.CommonTypes.csproj: Added method to calculate MediaType from SCSI parameters (mode, density, medium type, device type, etc). * DiscImageChef.Metadata/DeviceReport.cs: Added command to guess drive and media parameters and output an XML report of them. * DiscImageChef/Commands/DeviceReport.cs: * DiscImageChef.Metadata/DiscImageChef.Metadata.csproj: Added command to guess drive and media parameters and output an XML report of them. * DiscImageChef/Commands/DumpMedia.cs: Added preliminary command to dump media. Only SCSI for now. CDs and tapes are not supported. Errors are blalanty ignored. Options are incomplete. Not yet usable. * DiscImageChef/Core/Checksum.cs: * DiscImageChef/Commands/CreateSidecar.cs: Moved checksum generation to a separate class. * CICMMetadata: Added support for ADIP. * DiscImageChef.CommonTypes/MediaType.cs: Added parameters of UDO media. Moved DataPlay outside of Iomega, as it's not from that manufacturer. Added missing Exatape media and corrected 160m XL one. Added SyJet media. Added all ECMA defined magneto-optical (sectors calculated from specifications, unchecked). Added PD media. Added Imation 320Gb RDX. Added generic USB flash drives. * DiscImageChef.Decoders/SCSI/Enums.cs: Make enumerations public. * DiscImageChef.Decoders/SCSI/Inquiry.cs: * DiscImageChef.Devices/Device/Constructor.cs: Trim space padded strings on SCSI INQUIRY. * DiscImageChef.Devices/Device/ScsiCommands/MMC.cs: Added PREVENT ALLOW MEDIUM REMOVAL. Added START STOP UNIT. * DiscImageChef.Devices/Device/ScsiCommands/NEC.cs: Rename NEC methods. * DiscImageChef.Devices/Device/ScsiCommands/Pioneer.cs: Corrected Pioneer transfer length calculation. * DiscImageChef.Devices/Device/ScsiCommands/Plextor.cs: Renamed Plextor methods. * DiscImageChef.Devices/Device/ScsiCommands/SPC.cs: Renamed SSC PREVENT ALLOW MEDIUM REMOVAL to uncollide with MMC same name but different command. * DiscImageChef.Devices/DiscImageChef.Devices.csproj: Set platform target to x86 (does it really matter?). * DiscImageChef.Devices/Linux/Command.cs: Reduced allocation for readlink() to current kernel MAX_PATH. * DiscImageChef.Devices/Linux/Enums.cs: Modified Linux ioctl to 32-bit. Works on 64-bit also. Solves commands not working on 32-bit environments. * DiscImageChef.DiscImages/ZZZRawImage.cs: Changed ECMA-184 and ECMA-183 enums. * DiscImageChef.Metadata/Dimensions.cs: Added all ECMA defined magneto-opticals. Added PD media. Added 320Gb RDX. Corrected Exatape 160m XL. Added Exatape 22m and 28m. * DiscImageChef.Metadata/MediaType.cs: Added 356mm magneto-optical media. Changed ECMA-184 and ECMA-183 enums. Added USB generic flash drive. * DiscImageChef/Commands/DeviceInfo.cs: Corrected SCSI INQUIRY naming. Corrected SCSI MODE SENSE (6) parameters. Reduced SCSI MODE SENSE timeout, some devices just get stuck with unsupported MODE SENSE commanda and must be left to timeout. Changed FUJITSU vendor string comparison. * DiscImageChef/Commands/MediaInfo.cs: Added method to calculate MediaType from SCSI parameters (mode, density, medium type, device type, etc). Changed some error WriteLine() to debug ones. Too much verbosity. Added DVD media type decoding from PFI. Found a drive that dumps ADIP, enabling it again (not decoded). * DiscImageChef/Commands/MediaScan.cs: Added option to generate ImgBurn compatible log to media-scan command. * DiscImageChef/DiscImageChef.csproj: Moved checksum generation to a separate class. Added command to guess drive and media parameters and output an XML report of them. Added preliminary command to dump media. Only SCSI for now. CDs and tapes are not supported. Errors are blalanty ignored. Options are incomplete. Not yet usable. * DiscImageChef/Main.cs: Added command to guess drive and media parameters and output an XML report of them. Added preliminary command to dump media. Only SCSI for now. CDs and tapes are not supported. Errors are blalanty ignored. Options are incomplete. Not yet usable. * DiscImageChef/Options.cs: Added command to guess drive and media parameters and output an XML report of them. Added preliminary command to dump media. Only SCSI for now. CDs and tapes are not supported. Errors are blalanty ignored. Options are incomplete. Not yet usable. Added option to generate ImgBurn compatible log to media-scan command.
2016-01-31 08:05:56 +00:00
enum LinuxIoctl : uint
{
2015-10-07 02:15:31 +01:00
// SCSI IOCtls
SG_GET_VERSION_NUM = 0x2282,
SG_IO = 0x2285,
}
[Flags]
enum SgInfo : uint
{
/// <summary>
/// Mask to check OK
/// </summary>
OkMask = 0x01,
/// <summary>
/// No sense or driver noise
/// </summary>
Ok = 0x00,
/// <summary>
/// Check Condition
/// </summary>
CheckCondition = 0x01,
2015-10-05 21:20:25 +01:00
/// <summary>
/// Direct I/O mask
/// </summary>
DirectIoMask = 0x06,
/// <summary>
/// Transfer via kernel buffers (or no transfer)
/// </summary>
IndirectIo = 0x00,
/// <summary>
/// Direct I/O performed
/// </summary>
DirectIo = 0x02,
/// <summary>
/// Partial direct and partial indirect I/O
/// </summary>
MixedIo = 0x04
2015-10-05 21:20:25 +01:00
}
}