2015-10-12 06:39:31 +01:00
|
|
|
|
// /***************************************************************************
|
|
|
|
|
|
// The Disc Image Chef
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// Filename : Extern.cs
|
|
|
|
|
|
// Version : 1.0
|
|
|
|
|
|
// Author(s) : Natalia Portillo
|
|
|
|
|
|
//
|
|
|
|
|
|
// Component : Linux direct device access
|
|
|
|
|
|
//
|
|
|
|
|
|
// Revision : $Revision$
|
|
|
|
|
|
// Last change by : $Author$
|
|
|
|
|
|
// Date : $Date$
|
|
|
|
|
|
//
|
|
|
|
|
|
// --[ Description ] ----------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// Contains the P/Invoke definitions of Linux syscalls used to directly interface devices
|
|
|
|
|
|
//
|
|
|
|
|
|
// --[ 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.Runtime.InteropServices;
|
2015-10-05 21:20:25 +01:00
|
|
|
|
|
|
|
|
|
|
namespace DiscImageChef.Devices.Linux
|
|
|
|
|
|
{
|
|
|
|
|
|
static class Extern
|
|
|
|
|
|
{
|
|
|
|
|
|
[DllImport("libc", CharSet = CharSet.Ansi, SetLastError = true)]
|
2015-10-06 21:18:02 +01:00
|
|
|
|
internal static extern int open(
|
|
|
|
|
|
string pathname,
|
|
|
|
|
|
[MarshalAs(UnmanagedType.U4)]
|
|
|
|
|
|
FileFlags flags);
|
2015-10-05 21:20:25 +01:00
|
|
|
|
|
|
|
|
|
|
[DllImport("libc")]
|
|
|
|
|
|
internal static extern int close(int fd);
|
|
|
|
|
|
|
2016-04-19 02:11:47 +01:00
|
|
|
|
[DllImport("libc", EntryPoint = "ioctl", SetLastError = true)]
|
2015-10-12 06:25:49 +01:00
|
|
|
|
internal static extern int ioctlInt(int fd, LinuxIoctl request, out int value);
|
2015-10-05 21:20:25 +01:00
|
|
|
|
|
2016-04-19 02:11:47 +01:00
|
|
|
|
[DllImport("libc", EntryPoint = "ioctl", SetLastError = true)]
|
2015-10-12 06:25:49 +01:00
|
|
|
|
internal static extern int ioctlSg(int fd, LinuxIoctl request, ref sg_io_hdr_t value);
|
2015-12-31 16:12:22 +00:00
|
|
|
|
|
|
|
|
|
|
[DllImport("libc", CharSet = CharSet.Ansi, SetLastError = true)]
|
2016-04-19 02:11:47 +01:00
|
|
|
|
internal static extern int readlink(string path, System.IntPtr buf, int bufsize);
|
2015-12-31 16:12:22 +00:00
|
|
|
|
|
2016-04-19 02:11:47 +01:00
|
|
|
|
[DllImport("libc", CharSet = CharSet.Ansi, EntryPoint = "readlink", SetLastError = true)]
|
|
|
|
|
|
internal static extern long readlink64(string path, System.IntPtr buf, long bufsize);
|
2015-10-05 21:20:25 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|