Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions DiscUtils.Ebs/Disk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
using DiscUtils.Streams;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DiscUtils.Ebs {
public class Disk : VirtualDisk {
Expand Down Expand Up @@ -33,7 +30,7 @@ public Disk(string snapshotId, string region, AWSCredentials credentials) {
Size = ebsMappedStream.SnapshotBlocks.Count * BlockSize;
}

public override Geometry Geometry => Geometry.FromCapacity(sparseStream.Length);
public override Geometry? Geometry => DiscUtils.Geometry.FromCapacity(sparseStream.Length);

public override VirtualDiskClass DiskClass => VirtualDiskClass.HardDisk;

Expand All @@ -50,17 +47,19 @@ public override VirtualDiskTypeInfo DiskTypeInfo {
CanBeHardDisk = true,
DeterministicGeometry = true,
PreservesBiosGeometry = false,
CalcGeometry = c => Geometry.FromCapacity(c)
CalcGeometry = c => DiscUtils.Geometry.FromCapacity(c)
};
}
}

}

public override bool CanWrite => throw new NotImplementedException();

public override VirtualDisk CreateDifferencingDisk(DiscFileSystem fileSystem, string path) {
throw new NotImplementedException();

}

public override VirtualDisk CreateDifferencingDisk(string path) {
public override VirtualDisk CreateDifferencingDisk(string path, bool useAsync) {
throw new NotImplementedException();
}
}
Expand Down
16 changes: 6 additions & 10 deletions DiscUtils.Ebs/DiskImageFile.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
using System;
using System.Collections.Generic;
using System.Net;
using Amazon;
using Amazon;
using Amazon.EBS;
using Amazon.EBS.Model;
using Amazon.Runtime;
using DiscUtils.Internal;
using DiscUtils.Streams;
using System;
using System.Collections.Generic;
using System.Net;

namespace DiscUtils.Ebs {

Expand Down Expand Up @@ -52,10 +51,6 @@ public DiskImageFile(string snapshotId, AWSCredentials credentials, RegionEndpoi

public override FileLocator RelativeFileLocator => throw new NotImplementedException();

public override string[] GetParentLocations() {
throw new NotImplementedException();
}

public override SparseStream OpenContent(SparseStream parent, Ownership ownsParent) {

SparseStream theParent = parent;
Expand All @@ -77,6 +72,7 @@ public override IList<VirtualDiskExtent> Extents { get {
return result;
}
}


public override bool CanWrite => throw new NotImplementedException();
}
}
9 changes: 2 additions & 7 deletions DiscUtils.Ebs/DiskLayer.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
using DiscUtils.Streams;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DiscUtils.Ebs {
public class DiskLayer : VirtualDiskLayer {
Expand All @@ -20,13 +16,12 @@ public class DiskLayer : VirtualDiskLayer {

public override FileLocator RelativeFileLocator => throw new NotImplementedException();

public override bool CanWrite => throw new NotImplementedException();

public DiskLayer(SparseStream sparseStream) {
this.sparseStream = sparseStream;
}

public override string[] GetParentLocations() {
throw new NotImplementedException();
}

public override SparseStream OpenContent(SparseStream parent, Ownership ownsParent) {
throw new NotImplementedException();
Expand Down
13 changes: 9 additions & 4 deletions DiscUtils.Ebs/EbsMappedStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;

namespace DiscUtils.Ebs {
public class EbsMappedStream : SparseStream {
Expand Down Expand Up @@ -104,7 +101,7 @@ void GetBlockData(Block block, byte[] buffer, int offset) {
throw new IOException($"Failed to read EBS block {block.Index} with HTTP error {result.HttpStatusCode}");
}

StreamUtilities.ReadExact(result.BlockData, buffer, offset, BlockSize);
StreamUtilities.ReadExactly(result.BlockData, buffer, offset, BlockSize);
}

public override long Seek(long offset, SeekOrigin origin) {
Expand Down Expand Up @@ -135,5 +132,13 @@ public override void SetLength(long value) {
public override void Write(byte[] buffer, int offset, int count) {
throw new NotImplementedException();
}

public override int Read(Span<byte> buffer) {
throw new NotImplementedException();
}

public override void Write(ReadOnlySpan<byte> buffer) {
throw new NotImplementedException();
}
}
}
17 changes: 6 additions & 11 deletions DiscUtils.RawDisk/Disk.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
using DiscUtils;
using DiscUtils.Streams;
using DiscUtils.Streams;
using Microsoft.Win32.SafeHandles;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace DiscUtils.RawDisk {
public class Disk : VirtualDisk {
Expand Down Expand Up @@ -103,7 +99,7 @@ public Disk(string path) {
}


public override Geometry Geometry => geometry;
public override Geometry? Geometry => geometry;

public override VirtualDiskClass DiskClass => VirtualDiskClass.HardDisk;

Expand All @@ -120,20 +116,19 @@ public override VirtualDiskTypeInfo DiskTypeInfo {
CanBeHardDisk = true,
DeterministicGeometry = true,
PreservesBiosGeometry = false,
CalcGeometry = c => Geometry.FromCapacity(c)
CalcGeometry = c => DiscUtils.Geometry.FromCapacity(c)
};
}
}

public override bool CanWrite => throw new NotImplementedException();

public override VirtualDisk CreateDifferencingDisk(DiscFileSystem fileSystem, string path) {
throw new NotImplementedException();
}

public override VirtualDisk CreateDifferencingDisk(string path) {
public override VirtualDisk CreateDifferencingDisk(string path, bool useAsync) {
throw new NotImplementedException();
}



}
}
18 changes: 9 additions & 9 deletions DiscUtils.RawDisk/RawDiskStream.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
using Amazon;
using Amazon.EBS;
using Amazon.EBS.Model;
using Amazon.Runtime;
using DiscUtils.Streams;
using DiscUtils.Streams;
using Microsoft.Win32.SafeHandles;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace DiscUtils.RawDisk {
public class RawDiskStream : SparseStream {
Expand Down Expand Up @@ -91,5 +83,13 @@ public override void SetLength(long value) {
public override void Write(byte[] buffer, int offset, int count) {
throw new NotImplementedException();
}

public override int Read(Span<byte> buffer) {
throw new NotImplementedException();
}

public override void Write(ReadOnlySpan<byte> buffer) {
throw new NotImplementedException();
}
}
}
Loading