xref: /aosp_15_r20/external/sandboxed-api/sandboxed_api/sandbox2/mount_tree.proto (revision ec63e07ab9515d95e79c211197c445ef84cefa6a)
1// Copyright 2019 Google LLC
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//     https://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
15// A proto for serializing the sandbox2::MountTree class
16
17syntax = "proto3";
18
19package sandbox2;
20
21// The MountTree maps path components to mount operations (bind/tmpfs). The path
22// is encoded in the key of the entries map, with the root node representing /.
23// To get the full path of a node, you will need to assemble the keys starting
24// at the root node.
25message MountTree {
26  // FileNode represents a bind mount for a regular file using "outside" as the
27  // source.
28  message FileNode {
29    optional string outside = 2;
30    optional bool writable = 3;
31  }
32
33  // DirNode is like FileNode but for directories.
34  message DirNode {
35    optional string outside = 2;
36    optional bool writable = 3;
37  }
38
39  // TmpfsNode mounts a tmpfs with given options.
40  message TmpfsNode {
41    optional string tmpfs_options = 1;
42  }
43
44  // RootNode is as special node for root of the MountTree
45  message RootNode {
46    optional bool writable = 3;
47  }
48
49  message Node {
50    oneof node {
51      FileNode file_node = 1;
52      DirNode dir_node = 2;
53      TmpfsNode tmpfs_node = 3;
54      RootNode root_node = 4;
55    }
56  }
57
58  // The entries are mappings from the next path component to the subtree.
59  map<string, MountTree> entries = 1;
60
61  // The node of the current path. If not set, we'll just create a directory at
62  // this position.
63  optional Node node = 2;
64}
65