Skip to main content

arcbox_oci/config/
mount.rs

1//! Root filesystem and mount configuration types.
2
3use serde::{Deserialize, Serialize};
4
5/// Root filesystem configuration.
6#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7pub struct Root {
8    /// Path to the root filesystem (relative to bundle path).
9    /// REQUIRED field.
10    pub path: String,
11
12    /// Whether the root filesystem is read-only.
13    #[serde(default)]
14    pub readonly: bool,
15}
16
17/// Mount configuration.
18#[derive(Debug, Clone, Default, Serialize, Deserialize)]
19#[serde(rename_all = "camelCase")]
20pub struct Mount {
21    /// Mount destination (absolute path in container).
22    /// REQUIRED field.
23    pub destination: String,
24
25    /// Mount source (path or device).
26    #[serde(skip_serializing_if = "Option::is_none")]
27    pub source: Option<String>,
28
29    /// Filesystem type.
30    #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
31    pub mount_type: Option<String>,
32
33    /// Mount options.
34    #[serde(skip_serializing_if = "Option::is_none")]
35    pub options: Option<Vec<String>>,
36
37    /// UID mappings for idmapped mounts.
38    #[serde(default, skip_serializing_if = "Vec::is_empty")]
39    pub uid_mappings: Vec<IdMapping>,
40
41    /// GID mappings for idmapped mounts.
42    #[serde(default, skip_serializing_if = "Vec::is_empty")]
43    pub gid_mappings: Vec<IdMapping>,
44}
45
46/// ID mapping for user namespace or idmapped mounts.
47#[derive(Debug, Clone, Default, Serialize, Deserialize)]
48#[serde(rename_all = "camelCase")]
49pub struct IdMapping {
50    /// Starting ID in container.
51    pub container_id: u32,
52    /// Starting ID on host.
53    pub host_id: u32,
54    /// Number of IDs to map.
55    pub size: u32,
56}