mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
Added support for list-devices on FreeBSD.
This commit is contained in:
@@ -35,10 +35,11 @@ using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using path_id_t = System.UInt32;
|
||||
using target_id_t = System.UInt32;
|
||||
using lun_id_t = System.UInt64;
|
||||
using lun_id_t = System.UInt32;
|
||||
|
||||
namespace DiscImageChef.Devices.FreeBSD
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct ata_cmd
|
||||
{
|
||||
public CamAtaIoFlags flags;
|
||||
@@ -57,6 +58,7 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
public byte control;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct ata_res
|
||||
{
|
||||
public CamAtaIoFlags flags;
|
||||
@@ -73,6 +75,7 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
public byte sector_count_exp;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct cam_pinfo
|
||||
{
|
||||
public uint priority;
|
||||
@@ -80,7 +83,7 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
public int index;
|
||||
}
|
||||
|
||||
struct camq_entry
|
||||
struct LIST_ENTRY
|
||||
{
|
||||
/// <summary>
|
||||
/// LIST_ENTRY(ccb_hdr)=le->*le_next
|
||||
@@ -90,10 +93,18 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
/// LIST_ENTRY(ccb_hdr)=le->**le_prev
|
||||
/// </summary>
|
||||
public IntPtr le_prev;
|
||||
}
|
||||
|
||||
struct SLIST_ENTRY
|
||||
{
|
||||
/// <summary>
|
||||
/// SLIST_ENTRY(ccb_hdr)=sle->*sle_next
|
||||
/// </summary>
|
||||
public IntPtr sle_next;
|
||||
}
|
||||
|
||||
struct TAILQ_ENTRY
|
||||
{
|
||||
/// <summary>
|
||||
/// TAILQ_ENTRY(ccb_hdr)=tqe->*tqe_next
|
||||
/// </summary>
|
||||
@@ -102,12 +113,26 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
/// TAILQ_ENTRY(ccb_hdr)=tqe->**tqe_prev
|
||||
/// </summary>
|
||||
public IntPtr tqe_prev;
|
||||
}
|
||||
|
||||
struct STAILQ_ENTRY
|
||||
{
|
||||
/// <summary>
|
||||
/// STAILQ_ENTRY(ccb_hdr)=stqe->*stqe_next
|
||||
/// </summary>
|
||||
public IntPtr stqe_next;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
struct camq_entry
|
||||
{
|
||||
[FieldOffset(0)] public LIST_ENTRY le;
|
||||
[FieldOffset(0)] public SLIST_ENTRY sle;
|
||||
[FieldOffset(0)] public TAILQ_ENTRY tqe;
|
||||
[FieldOffset(0)] public STAILQ_ENTRY stqe;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct timeval
|
||||
{
|
||||
public long tv_sec;
|
||||
@@ -115,6 +140,7 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
public IntPtr tv_usec;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct ccb_qos_area
|
||||
{
|
||||
public timeval etime;
|
||||
@@ -122,6 +148,7 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
public UIntPtr periph_data;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct ccb_hdr
|
||||
{
|
||||
public cam_pinfo pinfo;
|
||||
@@ -147,6 +174,7 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
public timeval softtimeout;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct scsi_sense_data
|
||||
{
|
||||
public byte error_code;
|
||||
@@ -157,6 +185,7 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
/// <summary>
|
||||
/// SCSI I/O Request CCB used for the XPT_SCSI_IO and XPT_CONT_TARGET_IO function codes.
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct cdb_scsiio
|
||||
{
|
||||
public ccb_hdr ccb_h;
|
||||
@@ -199,6 +228,7 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
/// <summary>
|
||||
/// ATA I/O Request CCB used for the XPT_ATA_IO function code.
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct ccb_ataio
|
||||
{
|
||||
public ccb_hdr ccb_h;
|
||||
@@ -222,6 +252,7 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
public uint init_id;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct nvme_command
|
||||
{
|
||||
private ushort opc_fuse_rsvd1;
|
||||
@@ -292,6 +323,7 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
public byte rsvd1 => (byte)(opc_fuse_rsvd1 & 0x3F);
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct nvme_status
|
||||
{
|
||||
private ushort status;
|
||||
@@ -327,6 +359,7 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
public byte dnr => (byte)(status & 0x1);
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct nvme_completion
|
||||
{
|
||||
/// <summary>
|
||||
@@ -360,6 +393,7 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
/// <summary>
|
||||
/// NVMe I/O Request CCB used for the XPT_NVME_IO and XPT_NVME_ADMIN function codes.
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct ccb_nvmeio
|
||||
{
|
||||
public ccb_hdr ccb_h;
|
||||
@@ -379,6 +413,7 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
public ushort unused;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct periph_match_pattern
|
||||
{
|
||||
private const int DEV_IDLEN = 16;
|
||||
@@ -391,12 +426,14 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
public periph_pattern_flags flags;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct device_id_match_pattern
|
||||
{
|
||||
public byte id_len;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] public byte[] id;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct scsi_static_inquiry_pattern
|
||||
{
|
||||
private const int SID_VENDOR_SIZE = 8;
|
||||
@@ -409,12 +446,14 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = SID_REVISION_SIZE + 1)] public byte[] revision;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
struct device_match_pattern_data
|
||||
{
|
||||
[FieldOffset(0)] public scsi_static_inquiry_pattern inq_pat;
|
||||
[FieldOffset(0)] public device_id_match_pattern devid_pat;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct device_match_pattern
|
||||
{
|
||||
public path_id_t path_id;
|
||||
@@ -424,6 +463,7 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
public device_match_pattern_data data;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct bus_match_pattern
|
||||
{
|
||||
private const int DEV_IDLEN = 16;
|
||||
@@ -443,22 +483,24 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
[FieldOffset(0)] public bus_match_pattern bus_pattern;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct dev_match_pattern
|
||||
{
|
||||
public dev_match_type type;
|
||||
public match_pattern pattern;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct periph_match_result
|
||||
{
|
||||
private const int DEV_IDLEN = 16;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = DEV_IDLEN)] public byte[] periph_name;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] periph_name;
|
||||
public uint unit_number;
|
||||
public path_id_t path_id;
|
||||
public target_id_t target_id;
|
||||
public lun_id_t target_lun;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct mmc_cid
|
||||
{
|
||||
public uint mid;
|
||||
@@ -471,6 +513,7 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
public byte fwrev;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct mmc_params
|
||||
{
|
||||
/// <summary>
|
||||
@@ -516,6 +559,7 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
public byte sdio_func_count;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct device_match_result
|
||||
{
|
||||
public path_id_t path_id;
|
||||
@@ -527,13 +571,17 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
public dev_result_flags flags;
|
||||
public mmc_params mmc_ident_data;
|
||||
}
|
||||
struct bus_match_result {
|
||||
public path_id_t path_id;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct bus_match_result
|
||||
{
|
||||
public path_id_t path_id;
|
||||
private const int DEV_IDLEN = 16;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = DEV_IDLEN)] public byte[] dev_name;
|
||||
public uint unit_number;
|
||||
public uint bus_id;
|
||||
public uint unit_number;
|
||||
public uint bus_id;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
struct match_result
|
||||
{
|
||||
@@ -542,12 +590,14 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
[FieldOffset(0)] public bus_match_result bus_result;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct dev_match_result
|
||||
{
|
||||
public dev_match_type type;
|
||||
public match_result result;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct ccb_dm_cookie
|
||||
{
|
||||
public IntPtr bus;
|
||||
@@ -557,6 +607,7 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
public IntPtr pdrv;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct ccb_dev_position
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public cam_generations[] generations;
|
||||
@@ -564,6 +615,7 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
public ccb_dm_cookie cookie;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct ccb_dev_match
|
||||
{
|
||||
public ccb_hdr ccb_h;
|
||||
|
||||
Reference in New Issue
Block a user