Lorenz Brun | 6b13bf1 | 2021-01-26 19:54:24 +0100 | [diff] [blame] | 1 | // Copyright 2020 The Monogon Project Authors. |
| 2 | // |
| 3 | // SPDX-License-Identifier: Apache-2.0 |
| 4 | // |
| 5 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | // you may not use this file except in compliance with the License. |
| 7 | // You may obtain a copy of the License at |
| 8 | // |
| 9 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | // |
| 11 | // Unless required by applicable law or agreed to in writing, software |
| 12 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | // See the License for the specific language governing permissions and |
| 15 | // limitations under the License. |
| 16 | |
| 17 | syntax = "proto3"; |
| 18 | |
Lorenz Brun | 4c32602 | 2022-01-25 13:42:45 +0100 | [diff] [blame] | 19 | package metropolis.node.build.fsspec; |
| 20 | option go_package = "source.monogon.dev/metropolis/node/build/fsspec"; |
Lorenz Brun | 6b13bf1 | 2021-01-26 19:54:24 +0100 | [diff] [blame] | 21 | |
| 22 | // FSSpec is the spec from which a filesystem is generated. It consists of files, directories and symbolic |
| 23 | // links. Directories are also automatically inferred when required for the placement of files or symbolic |
| 24 | // links. Inferred directories always have uid 0, gid 0 and permissions 0555. This can be overridden by |
| 25 | // explicitly specifying a directory at a given path. |
| 26 | message FSSpec { |
| 27 | repeated File file = 1; |
| 28 | repeated Directory directory = 2; |
| 29 | repeated SymbolicLink symbolic_link = 3; |
Lorenz Brun | 4c32602 | 2022-01-25 13:42:45 +0100 | [diff] [blame] | 30 | repeated SpecialFile special_file = 4; |
Lorenz Brun | 6b13bf1 | 2021-01-26 19:54:24 +0100 | [diff] [blame] | 31 | } |
| 32 | |
| 33 | // For internal use only. Represents all supported inodes in a oneof. |
| 34 | message Inode { |
| 35 | oneof type { |
| 36 | File file = 1; |
| 37 | Directory directory = 2; |
| 38 | SymbolicLink symbolic_link = 3; |
Lorenz Brun | 4c32602 | 2022-01-25 13:42:45 +0100 | [diff] [blame] | 39 | SpecialFile special_file = 4; |
Lorenz Brun | 6b13bf1 | 2021-01-26 19:54:24 +0100 | [diff] [blame] | 40 | } |
| 41 | } |
| 42 | |
| 43 | message File { |
| 44 | // The path where the file ends up in the filesystem. |
| 45 | string path = 1; |
| 46 | // The path on the host filesystem where the file contents should be taken from. |
| 47 | string source_path = 2; |
| 48 | // Unix permission bits |
| 49 | uint32 mode = 3; |
| 50 | // Owner uid |
| 51 | uint32 uid = 4; |
| 52 | // Owner gid |
| 53 | uint32 gid = 5; |
| 54 | } |
| 55 | |
| 56 | message Directory { |
| 57 | // The path where the directory ends up in the filesystem. |
| 58 | string path = 1; |
| 59 | // Unix permission bits |
| 60 | uint32 mode = 2; |
| 61 | // Owner uid |
| 62 | uint32 uid = 3; |
| 63 | // Owner gid |
| 64 | uint32 gid = 4; |
| 65 | } |
| 66 | |
| 67 | message SymbolicLink { |
| 68 | // The path where the symbolic link ends up in the filesystem. |
| 69 | string path = 1; |
| 70 | // The path to which the symbolic link resolves to. |
| 71 | string target_path = 2; |
Lorenz Brun | 4c32602 | 2022-01-25 13:42:45 +0100 | [diff] [blame] | 72 | } |
| 73 | |
| 74 | message SpecialFile { |
| 75 | // The path where the special file ends up in the filesystem. |
| 76 | string path = 1; |
| 77 | |
| 78 | enum Type { |
| 79 | CHARACTER_DEV = 0; |
| 80 | BLOCK_DEV = 1; |
| 81 | FIFO = 2; |
| 82 | } |
| 83 | |
| 84 | // Type of special file. |
| 85 | Type type = 2; |
| 86 | |
| 87 | // The major device number of the special file. |
| 88 | uint32 major = 3; |
| 89 | // The minor number of the special file. Ignored for FIFO-type special files. |
| 90 | uint32 minor = 4; |
| 91 | |
| 92 | // Unix permission bits |
| 93 | uint32 mode = 5; |
| 94 | // Owner uid |
| 95 | uint32 uid = 6; |
| 96 | // Owner gid |
| 97 | uint32 gid = 7; |
Lorenz Brun | 6b13bf1 | 2021-01-26 19:54:24 +0100 | [diff] [blame] | 98 | } |