Skip to content
Merged
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ manifest.mf
opencode.json
fluxengine.iml
/nbproject/private/
images/
7 changes: 6 additions & 1 deletion java/com/cowlark/fluxengine/cli/AbstractVfsCommand.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.cowlark.fluxengine.cli;

import com.cowlark.fluxengine.config.ConfigBuilder;
import com.cowlark.fluxengine.core.LogMessage;
import com.cowlark.fluxengine.core.Logger;
import com.cowlark.fluxengine.core.flags.BoolFlag;
import com.cowlark.fluxengine.core.flags.FlagGroup;
Expand Down Expand Up @@ -48,8 +49,12 @@ protected void applyVfsFlags(ConfigBuilder builder)

if (!loggingFlag.get())
{
Logger.setLogger(Consumers.nop());
Logger.setLogger(AbstractVfsCommand::log);
System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", "ERROR");
}
}

private static void log(LogMessage message)
{
}
}
6 changes: 6 additions & 0 deletions java/com/cowlark/fluxengine/core/ByteReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ public Bytes read(int len)
return slice;
}

public Bytes readPadded(int len)
{
int remaining = Math.min(len, remaining());
return read(remaining).slice(0, len);
}

public void readInto(byte[] buffer, int length)
{
if (length > buffer.length)
Expand Down
5 changes: 3 additions & 2 deletions java/com/cowlark/fluxengine/vfs/BlockDevice.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,9 @@ public void putBlocks(int blockNumber, Bytes bytes) throws FileSystemException

while (!br.eof())
{
Bytes block = br.read(getBlockSize());
putBlock(blockNumber++, block);
Bytes block = br.readPadded(getBlockSize());
putBlock(blockNumber, block);
blockNumber++;
}
}

Expand Down
18 changes: 18 additions & 0 deletions java/com/cowlark/fluxengine/vfs/Filesystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import lombok.Builder;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.nio.file.FileSystemException;

public abstract class Filesystem implements AutoCloseable
{
Expand Down Expand Up @@ -199,4 +200,21 @@ public record Dirent(VfsPath path, String filename, int length, String mode, Fil
ImmutableMap<String, String> attributes)
{
}

protected class FluxEngineFileSystemException extends FileSystemException
{
private final Exception cause;

public FluxEngineFileSystemException(String file, Exception cause)
{
super(file);
this.cause = cause;
}

@Override
public Exception getCause()
{
return cause;
}
}
}
Loading
Loading