// /*************************************************************************** // The Disc Image Chef // ---------------------------------------------------------------------------- // // Filename : Structs.cs // Author(s) : Natalia Portillo // // Component : Linux direct device access. // // --[ Description ] ---------------------------------------------------------- // // Contains structures 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-2018 Natalia Portillo // ****************************************************************************/ using System; using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; namespace DiscImageChef.Devices.Linux { [StructLayout(LayoutKind.Sequential)] [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct SgIoHdrT { /// /// Always 'S' for SG v3 /// public int interface_id; /* [i] 'S' (required) */ public ScsiIoctlDirection dxfer_direction; /* [i] */ public byte cmd_len; /* [i] */ public byte mx_sb_len; /* [i] */ public ushort iovec_count; /* [i] */ public uint dxfer_len; /* [i] */ public IntPtr dxferp; /* [i], [*io] */ public IntPtr cmdp; /* [i], [*i] */ public IntPtr sbp; /* [i], [*o] */ public uint timeout; /* [i] unit: millisecs */ public uint flags; /* [i] */ public int pack_id; /* [i->o] */ public IntPtr usr_ptr; /* [i->o] */ public byte status; /* [o] */ public byte masked_status; /* [o] */ public byte msg_status; /* [o] */ public byte sb_len_wr; /* [o] */ public ushort host_status; /* [o] */ public ushort driver_status; /* [o] */ public int resid; /* [o] */ public uint duration; /* [o] */ public SgInfo info; /* [o] */ } [StructLayout(LayoutKind.Sequential)] [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] struct MmcIocCmd { /// /// Implies direction of data. true = write, false = read /// public bool write_flag; /// /// Application-specific command. true = precede with CMD55 /// public bool is_ascmd; public uint opcode; public uint arg; /// /// CMD response /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public uint[] response; public MmcFlags flags; public uint blksz; public uint blocks; /// /// Sleep at least useconds, and at most /// useconds *after* issuing command.Needed for /// some read commands for which cards have no other way of indicating /// they're ready for the next command (i.e. there is no equivalent of /// a "busy" indicator for read operations). /// public uint postsleep_min_us; /// /// Sleep at least useconds, and at most /// useconds *after* issuing command.Needed for /// some read commands for which cards have no other way of indicating /// they're ready for the next command (i.e. there is no equivalent of /// a "busy" indicator for read operations). /// public uint postsleep_max_us; /// /// Override driver-computed timeouts. /// public uint data_timeout_ns; /// /// Override driver-computed timeouts. /// public uint cmd_timeout_ms; /// /// For 64-bit machines , wants to /// be 8-byte aligned.Make sure this struct is the same size when /// built for 32-bit. /// public uint __pad; /// /// DAT buffer /// public ulong data_ptr; } }