priv: WriteNspawnFlags takes Vec<BindMount> instead of raw flag strings

This commit is contained in:
damocles 2026-06-01 17:22:09 +02:00 committed by mara
commit c9eb520e7c
3 changed files with 38 additions and 24 deletions

View file

@ -7,7 +7,7 @@
//! a persistent connection.
use anyhow::{Context as _, Result, bail};
use hive_sh4re::priv_proto::{PRIV_SOCK, PrivRequest, PrivResponse};
use hive_sh4re::priv_proto::{PRIV_SOCK, BindMount, PrivRequest, PrivResponse};
use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufReader};
use tokio::net::UnixStream;
@ -59,13 +59,15 @@ pub async fn list_containers() -> Result<String> {
Ok(stdout)
}
pub async fn write_nspawn_flags(container: &str, extra_nspawn_flags: &[&str]) -> Result<()> {
pub async fn write_nspawn_flags(container: &str, binds: &[BindMount]) -> Result<()> {
ok(call(&PrivRequest::WriteNspawnFlags {
container: container.to_owned(),
extra_nspawn_flags: extra_nspawn_flags.iter().map(|s| s.to_string()).collect(),
binds: binds.to_vec(),
}).await?)
}
pub use hive_sh4re::priv_proto::BindMount;
pub async fn write_resource_limits(
container: &str,
memory_max: &str,