Skip to content

Commit 50e7f83

Browse files
committed
add filesystem operation to linux container
1 parent c362654 commit 50e7f83

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

Sources/Containerization/LinuxContainer.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -968,6 +968,19 @@ extension LinuxContainer {
968968
}
969969
}
970970

971+
// Perform filesystem operations in the container.
972+
public func filesystemOperation(operation: FilesystemOperation, path: String) async throws {
973+
try await self.state.withLock {
974+
let state = try $0.startedState("filesystemOperation")
975+
try await state.vm.withAgent { agent in
976+
guard let vminitd = agent as? Vminitd else {
977+
throw ContainerizationError(.unsupported, message: "filesystemOperation requires Vminitd agent")
978+
}
979+
try await vminitd.filesystemOperation(operation: operation, path: path)
980+
}
981+
}
982+
}
983+
971984
private func relayUnixSocket(
972985
socket: UnixSocketConfiguration,
973986
relayManager: UnixSocketRelayManager,

Sources/Containerization/VirtualMachineAgent.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public struct WriteFileFlags {
2525
public var create = false
2626
}
2727

28-
public enum FilesystemOperation {
28+
public enum FilesystemOperation : Sendable {
2929
case freeze
3030
case thaw
3131
}

0 commit comments

Comments
 (0)