• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2018 The Chromium OS Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include <stdint.h>
6 
7 // Exported interface to basic qcow functionality to be used from C.
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 // Create a basic, empty qcow2 file that can grow to `virtual_size` at `path`.
14 int create_qcow_with_size(const char *path, uint64_t virtual_size);
15 
16 // Attempt to resize the disk image at `path` to `virtual_size` bytes if
17 // the disk image is currently smaller than the requested size.
18 int expand_disk_image(const char *path, uint64_t virtual_size);
19 
20 // Copy the source disk image from `src_fd` into `dst_fd` as a qcow2 image file.
21 // Returns 0 on success or a negated errno value on failure.
22 int convert_to_qcow2(int src_fd, int dst_fd);
23 
24 // Copy the source disk image from `src_fd` into `dst_fd` as a raw image file.
25 // Returns 0 on success or a negated errno value on failure.
26 int convert_to_raw(int src_fd, int dst_fd);
27 
28 #ifdef __cplusplus
29 };
30 #endif
31