Skip to content

Commit a132341

Browse files
authored
Make EXT4Unpacker configurable for journal mode. (#775)
- Closes #774. - Adds a default journal configuration parameter to the EXT4Unpacker init function, defaulting to nil (no journal) to preserve source compatibility.
1 parent 6b7b42c commit a132341

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

Sources/Containerization/Image/Unpacker/EXT4Unpacker.swift

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,15 @@ import SystemPackage
2525
public struct EXT4Unpacker: Unpacker {
2626
let blockSizeInBytes: UInt64
2727

28-
public init(blockSizeInBytes: UInt64) {
28+
let journal: EXT4.JournalConfig?
29+
30+
/// Creates an unpacker that extracts images into EXT4 filesystems.
31+
/// - Parameters:
32+
/// - blockSizeInBytes: The filesystem block size.
33+
/// - journal: The journal configuration to use, or nil for no journaling.
34+
public init(blockSizeInBytes: UInt64, journal: EXT4.JournalConfig? = nil) {
2935
self.blockSizeInBytes = blockSizeInBytes
36+
self.journal = journal
3037
}
3138

3239
/// Performs the unpacking of a tar archive into a filesystem.
@@ -42,7 +49,8 @@ public struct EXT4Unpacker: Unpacker {
4249
let cleanedPath = try prepareUnpackPath(path: path)
4350
let filesystem = try EXT4.Formatter(
4451
FilePath(cleanedPath),
45-
minDiskSize: blockSizeInBytes
52+
minDiskSize: blockSizeInBytes,
53+
journal: journal
4654
)
4755
defer { try? filesystem.close() }
4856

0 commit comments

Comments
 (0)