Skip to content

Commit 9dd12d9

Browse files
committed
add filesystem operation to linux container
1 parent 3d94d4c commit 9dd12d9

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
@@ -1013,6 +1013,19 @@ extension LinuxContainer {
10131013
}
10141014
}
10151015

1016+
// Perform filesystem operations in the container.
1017+
public func filesystemOperation(operation: FilesystemOperation, path: String) async throws {
1018+
try await self.state.withLock {
1019+
let state = try $0.startedState("filesystemOperation")
1020+
try await state.vm.withAgent { agent in
1021+
guard let vminitd = agent as? Vminitd else {
1022+
throw ContainerizationError(.unsupported, message: "filesystemOperation requires Vminitd agent")
1023+
}
1024+
try await vminitd.filesystemOperation(operation: operation, path: path)
1025+
}
1026+
}
1027+
}
1028+
10161029
private func relayUnixSocket(
10171030
socket: UnixSocketConfiguration,
10181031
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)