Android-cuttlefish cvd tool
qcow2.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2019 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#pragma once
17
18#include <stdint.h>
19
20#include <memory>
21#include <string>
22
25
26namespace cuttlefish {
27
35class Qcow2Image : public DiskImage {
36 public:
44 static Result<Qcow2Image> Create(const std::string& crosvm_path,
45 const std::string& backing_file,
46 std::string output_overlay_path);
47 static Result<Qcow2Image> OpenExisting(std::string path);
48
50 ~Qcow2Image() override;
52
59 static std::string MagicString();
60
61 Result<uint64_t> VirtualSizeBytes() const override;
62
63 private:
64 struct Impl;
65
66 Qcow2Image(std::unique_ptr<Impl>);
67
68 std::unique_ptr<Impl> impl_;
69};
70
71} // namespace cuttlefish
Definition: expected.h:86
Definition: disk_image.h:24
Definition: qcow2.h:35
static std::string MagicString()
Definition: qcow2.cc:86
Qcow2Image(Qcow2Image &&)
Definition: qcow2.cc:88
Qcow2Image & operator=(Qcow2Image &&)
Definition: qcow2.cc:92
std::unique_ptr< Impl > impl_
Definition: qcow2.h:68
static Result< Qcow2Image > OpenExisting(std::string path)
Definition: qcow2.cc:70
static Result< Qcow2Image > Create(const std::string &crosvm_path, const std::string &backing_file, std::string output_overlay_path)
Definition: qcow2.cc:56
Result< uint64_t > VirtualSizeBytes() const override
Definition: qcow2.cc:97
Definition: alloc_utils.cpp:23
Definition: qcow2.cc:52