blob: dc199e45f5cba8a6fb08be808eb67849ea04ca25 [file] [log] [blame]
Andrew Walbranf5fbb7d2021-05-12 17:15:48 +00001// Copyright 2021, The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
Andrew Walbran0c4d3df2021-05-27 14:00:42 +000015//! JSON configuration for composite disks, as used for running `mk_cdisk` and by the `vm` tool.
Andrew Walbranf5fbb7d2021-05-12 17:15:48 +000016
Andrew Walbranf5fbb7d2021-05-12 17:15:48 +000017use serde::{Deserialize, Serialize};
Andrew Walbranf5fbb7d2021-05-12 17:15:48 +000018use std::path::PathBuf;
19
Andrew Walbran0c4d3df2021-05-27 14:00:42 +000020/// Configuration for running `mk_cdisk`.
Andrew Walbranf5fbb7d2021-05-12 17:15:48 +000021#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
22pub struct Config {
23 /// The set of partitions to be assembled into a composite image.
24 pub partitions: Vec<Partition>,
25}
26
27/// A partition to be assembled into a composite image.
28#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
29pub struct Partition {
30 /// A label for the partition.
31 pub label: String,
32 /// The filename of the partition image.
33 pub path: PathBuf,
34 /// Whether the partition should be writable.
35 #[serde(default)]
36 pub writable: bool,
37}