Android-cuttlefish cvd tool
incremental_utils.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2020 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#pragma once
18
19#include "adb_unique_fd.h"
20
21#include <optional>
22#include <string>
23#include <string_view>
24#include <utility>
25#include <vector>
26
27#include <stdint.h>
28
30
31namespace incremental {
32
33using Size = int64_t;
34constexpr int kBlockSize = 4096;
35constexpr int kSha256DigestSize = 32;
37constexpr int kMaxSignatureSize = 8096; // incrementalfs.h
38
39constexpr std::string_view IDSIG = ".idsig";
40
41std::vector<int32_t> PriorityBlocksForFile(const std::string& filepath, borrowed_fd fd,
42 Size fileSize);
43
46
47std::optional<std::pair<std::vector<char>, int32_t>> read_id_sig_headers(borrowed_fd fd,
48 std::string* error);
49std::optional<std::pair<off64_t, ssize_t>> skip_id_sig_headers(borrowed_fd fd, std::string* error);
50
51} // namespace incremental
#define error(format, args...)
Definition: fec_private.h:201
Definition: incremental.cpp:46
std::vector< int32_t > PriorityBlocksForFile(const std::string &, borrowed_fd, Size)
Definition: incremental_utils.cpp:199
constexpr std::string_view IDSIG
Definition: incremental_utils.h:39
constexpr int kMaxSignatureSize
Definition: incremental_utils.h:37
constexpr int kDigestSize
Definition: incremental_utils.h:36
Size verity_tree_blocks_for_file(Size fileSize)
Definition: incremental_utils.cpp:42
constexpr int kSha256DigestSize
Definition: incremental_utils.h:35
std::optional< std::pair< off64_t, ssize_t > > skip_id_sig_headers(borrowed_fd fd, std::string *error)
Definition: incremental_utils.cpp:157
int64_t Size
Definition: incremental_utils.h:33
constexpr int kBlockSize
Definition: incremental_utils.h:34
Size verity_tree_size_for_file(Size fileSize)
Definition: incremental_utils.cpp:60
std::optional< std::pair< std::vector< char >, int32_t > > read_id_sig_headers(borrowed_fd fd, std::string *error)
Definition: incremental_utils.cpp:136
Definition: unique_fd.h:292