// /*************************************************************************** // Aaru Data Preservation Suite // ---------------------------------------------------------------------------- // // Filename : Enums.cs // Author(s) : Natalia Portillo // // Component : Linux direct device access. // // --[ Description ] ---------------------------------------------------------- // // Contains enumerations necessary for directly interfacing devices under // Linux. // // --[ License ] -------------------------------------------------------------- // // This library is free software; you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as // published by the Free Software Foundation; either version 2.1 of the // License, or (at your option) any later version. // // This library 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 // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, see . // // ---------------------------------------------------------------------------- // Copyright © 2011-2025 Natalia Portillo // ****************************************************************************/ using System; using System.Diagnostics.CodeAnalysis; namespace Aaru.Devices.Linux; [Flags] [SuppressMessage("ReSharper", "UnusedMember.Global")] enum FileFlags : uint { /// O_RDONLY Readonly = 0x0, /// O_WRONLY Writeonly = 0x1, /// O_RDWR ReadWrite = 0x2, /// O_CREAT OpenOrCreate = 0x40, /// O_EXCL CreateNew = 0x80, /// O_NOCTTY NoControlTty = 0x100, /// O_TRUNC Truncate = 0x200, /// O_APPEND Append = 0x400, /// O_NONBLOCK NonBlocking = 0x800, /// O_DSYNC Synchronous = 0x1000, /// O_ASYNC Async = 0x2000, /// O_DIRECT Direct = 0x4000, /// O_LARGEFILE LargeFile = 0x8000, /// O_DIRECTORY Directory = 0x10000, /// O_NOFOLLOW NoFollowSymlink = 0x20000, /// O_NOATIME NoAccessTime = 0x40000, /// O_CLOEXEC CloseOnExec = 0x80000 } /// Direction of SCSI transfer enum ScsiIoctlDirection { /// No data transfer happens SG_DXFER_NONE None = -1, /// From host to device SG_DXFER_TO_DEV Out = -2, /// From device to host SG_DXFER_FROM_DEV In = -3, /// Bidirectional device/host SG_DXFER_TO_FROM_DEV Unspecified = -4, /// Unspecified SG_DXFER_UNKNOWN Unknown = -5 } [SuppressMessage("ReSharper", "UnusedMember.Global")] enum LinuxIoctl : uint { // SCSI IOCtls SgGetVersionNum = 0x2282, SgIo = 0x2285, // MMC IOCtl MmcIocCmd = 0xC048B300, MmcIocMultiCmd = 0xC008B301 } [Flags] [SuppressMessage("ReSharper", "UnusedMember.Global")] enum SgInfo : uint { /// Mask to check OK OkMask = 0x01, /// No sense or driver noise Ok = 0x00, /// Check Condition CheckCondition = 0x01, /// Direct I/O mask DirectIoMask = 0x06, /// Transfer via kernel buffers (or no transfer) IndirectIo = 0x00, /// Direct I/O performed DirectIo = 0x02, /// Partial direct and partial indirect I/O MixedIo = 0x04 } [Flags] [SuppressMessage("ReSharper", "UnusedMember.Global")] enum SgFlags : uint { DirectIo = 1, UnusedLunInhibit = 2, MmapIo = 4, NoDxfer = 0x10000, QAtTail = 0x10, QAtHead = 0x20 } [SuppressMessage("ReSharper", "UnusedMember.Global")] enum SeekWhence { Begin = 0, Current = 1, End = 2, Data = 3, Hole = 4 }