/usr/include/ploop/libploop.h is in libploop-dev 1.15-2+b1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 | /*
* Copyright (C) 2008-2015, Parallels, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _LIBPLOOP_H_
#define _LIBPLOOP_H_
#pragma GCC visibility push(default)
#include <sys/types.h>
#include <linux/types.h>
#define DISKDESCRIPTOR_XML "DiskDescriptor.xml"
#ifndef PLOOP_DEPRECATED
#define PLOOP_DEPRECATED __attribute__ ((deprecated))
#endif
enum ploop_image_mode {
PLOOP_EXPANDED_MODE = 0,
PLOOP_EXPANDED_PREALLOCATED_MODE = 1,
PLOOP_RAW_MODE = 2,
};
struct ploop_mount_param {
char device[64]; /* returns device name */
int ro; /* read-only mount */
int flags; /* flags such as MS_NOATIME */
int unused1;
char *fstype; /* filesystem type; default if not set*/
char *target; /* mount point */
char *guid; /* UUID; top if not set */
int quota; /* enable inner FS quota */
char *mount_data;
unsigned int blocksize; /* blocksize for raw image */
int fsck;
int fsck_rc; /* out: fsck return code */
char dummy[32];
};
/* Bit values for ploop_create_param.flags */
enum ploop_create_flags {
PLOOP_CREATE_NOLAZY = 1 << 0, /* do NOT use lazy init */
};
struct ploop_create_param {
unsigned long long size;
int mode;
char *image;
char *fstype;
int without_partition;
unsigned int blocksize;
unsigned int fsblocksize;
int fmt_version;
unsigned int flags;
char dummy[32];
};
/* Bit values for ploop_replace_param.flag */
enum ploop_replace_flags {
PLOOP_REPLACE_KEEP_NAME = 1 << 0,
};
struct ploop_replace_param {
char *file; /* A new image file name */
/* Image to be replaced is specified by
* either guid, level, or current delta file */
char *guid;
int level;
char *cur_file;
int flags;
char dummy[32];
};
struct ploop_image_data {
char *guid;
char *file;
};
struct ploop_snapshot_data {
char *guid;
char *parent_guid;
int temporary;
};
struct ploop_disk_images_runtime_data;
struct ploop_disk_images_data {
unsigned long long size;
unsigned int heads;
unsigned int cylinders;
unsigned int sectors;
int mode;
int nimages;
struct ploop_image_data **images;
char *top_guid;
int nsnapshots;
struct ploop_snapshot_data **snapshots;
struct ploop_disk_images_runtime_data *runtime;
unsigned int blocksize;
unsigned long long max_delta_size;
char dummy[32];
};
struct ploop_resize_param {
unsigned long long size;
int offline_resize;
pid_t mntns_pid;
char dummy[32];
};
struct ploop_snapshot_param {
char *guid; /* guid for new snapshot, autogenerated if NULL */
char *snap_dir; /* folder for new delta */
char dummy[32];
};
struct ploop_tsnapshot_param {
char *guid;
char *component_name;
char *target;
char device[64]; /* out: assigned device */
char *snap_dir; /* folder for new delta */
char dummy[32];
};
/* Values for ploop_snapshot_switch_param.flags field */
/* Do not remove old top delta */
#define PLOOP_SNAP_SKIP_TOPDELTA_DESTROY 0x01
/* Do not create a new delta after switching */
#define PLOOP_SNAP_SKIP_TOPDELTA_CREATE 0x02
struct ploop_snapshot_switch_param {
const char *guid;
/* guid for old top delta when SKIP_TOPDELTA_DESTROY is used */
const char *guid_old;
int flags;
char dummy[32];
};
struct ploop_merge_param {
int unused1;
int merge_all;
const char *guid;
const char *guid2; /* NULL, or an ancestor of above guid */
const char *new_delta;
char dummy[32];
};
struct ploop_discard_param {
__u64 minlen_b;
__u64 to_free;
int automount;
const int *stop;
int defrag;
char dummy[32];
};
struct ploop_info {
unsigned long long fs_bsize;
unsigned long long fs_blocks;
unsigned long long fs_bfree;
unsigned long long fs_inodes;
unsigned long long fs_ifree;
};
struct ploop_spec {
off_t size;
__u32 blocksize;
int fmt_version;
char dummy[32];
};
struct ploop_discard_stat {
off_t data_size;
off_t ploop_size;
off_t image_size;
off_t balloon_size;
};
struct ploop_copy_send_param {
const char *device; /* ploop device ("/dev/ploopNNNN") to read */
int ofd; /* File descriptor to write to */
const char *flush_cmd; /* command to run to stop disk activity */
int feedback_fd; /* File descriptor to read feedback
* from ploop_copy_receive()
*/
char dummy[32];
};
struct ploop_copy_receive_param {
const char *file; /* File name to write to */
int ifd; /* File descriptor to read from */
int feedback_fd; /* File descriptor to send feedback
* to ploop_copy_send()
*/
char dummy[32];
};
struct ploop_copy_param {
int ofd;
char dummy[32];
};
struct ploop_copy_stat {
__u64 xferred_total;
__u64 xferred;
};
/* Constants for ploop_set_verbose_level(): */
#define PLOOP_LOG_NOCONSOLE -2 /* disable all console logging */
#define PLOOP_LOG_NOSTDOUT -1 /* disable all but errors to stderr */
#define PLOOP_LOG_TIMESTAMPS 4 /* enable sub-second timestamps */
#ifdef __cplusplus
extern "C" {
#endif
int ploop_set_component_name(struct ploop_disk_images_data *di,
const char *component_name);
int ploop_get_top_delta_fname(struct ploop_disk_images_data *di, char *out, int len);
int ploop_get_base_delta_fname(struct ploop_disk_images_data *di, char *out, int len);
int ploop_find_dev(const char *component_name, const char *delta, char *buf, int size);
int ploop_get_dev_by_mnt(const char *path, char *buf, int size);
int ploop_get_mnt_by_dev(const char *dev, char *buf, int size);
int ploop_get_dev(struct ploop_disk_images_data *di, char *out, int len);
int ploop_get_devs(struct ploop_disk_images_data *di, char **out[]);
int ploop_is_mounted(struct ploop_disk_images_data *di);
void ploop_free_array(char *array[]);
int ploop_get_partition_by_mnt(const char *path, char *buf, int size);
int ploop_create_image(struct ploop_create_param *param);
int ploop_mount_image(struct ploop_disk_images_data *di, struct ploop_mount_param *param);
int ploop_mount_snapshot(struct ploop_disk_images_data *di, struct ploop_mount_param *param);
int ploop_umount(const char *device, struct ploop_disk_images_data *di);
int ploop_umount_image(struct ploop_disk_images_data *di);
int ploop_replace_image(struct ploop_disk_images_data *di, struct ploop_replace_param *param);
int ploop_resize_image(struct ploop_disk_images_data *di, struct ploop_resize_param *param);
int ploop_convert_image(struct ploop_disk_images_data *di, int mode, int flags);
int ploop_get_info_by_descr(const char *descr, struct ploop_info *info);
int ploop_create_snapshot(struct ploop_disk_images_data *di, struct ploop_snapshot_param *param);
int ploop_create_temporary_snapshot(struct ploop_disk_images_data *di,
struct ploop_tsnapshot_param *param, int *holder_fd);
int ploop_merge_snapshot(struct ploop_disk_images_data *di, struct ploop_merge_param *param);
int ploop_switch_snapshot_ex(struct ploop_disk_images_data *di, struct ploop_snapshot_switch_param *param);
int ploop_switch_snapshot(struct ploop_disk_images_data *di, const char *uuid, int flags);
int ploop_delete_snapshot(struct ploop_disk_images_data *di, const char *guid);
int ploop_delete_top_delta(struct ploop_disk_images_data *di);
int ploop_find_top_delta_name_and_format(
const char *device,
char *image,
size_t image_size,
char *format,
size_t format_size);
char *ploop_find_parent_by_guid(struct ploop_disk_images_data *di, const char *guid);
int ploop_uuid_generate(char *uuid, int len);
int ploop_is_large_disk_supported(void);
int ploop_get_spec(struct ploop_disk_images_data *di, struct ploop_spec *spec);
int ploop_get_max_size(unsigned int blocksize, unsigned long long *max);
int ploop_set_max_delta_size(struct ploop_disk_images_data *di, unsigned long long size);
const char *ploop_get_last_error(void);
int ploop_set_log_file(const char *fname);
/* set log file logging level */
void ploop_set_log_level(int level);
/* set console logging level */
void ploop_set_verbose_level(int level);
/* Cancelation API */
void ploop_cancel_operation(void);
/* pcopy routines */
int ploop_copy_send(struct ploop_copy_send_param *arg);
int ploop_copy_receive(struct ploop_copy_receive_param *arg);
int ploop_discard_get_stat(struct ploop_disk_images_data *di,
struct ploop_discard_stat *pd_stat);
int ploop_discard(struct ploop_disk_images_data *di,
struct ploop_discard_param *param);
int ploop_open_dd(struct ploop_disk_images_data **di, const char *fname);
void ploop_close_dd(struct ploop_disk_images_data *di);
int ploop_create_dd(const char *ddxml, struct ploop_create_param *param);
/* deprecated */
int ploop_store_diskdescriptor(const char *fname, struct ploop_disk_images_data *di);
void ploop_free_diskdescriptor(struct ploop_disk_images_data *di);
int ploop_read_disk_descr(struct ploop_disk_images_data **di, const char *file);
PLOOP_DEPRECATED char *ploop_get_base_delta_uuid(struct ploop_disk_images_data *di);
PLOOP_DEPRECATED int ploop_send(const char *device, int ofd, const char *flush_cmd, int is_pipe);
PLOOP_DEPRECATED int ploop_receive(const char *dst);
PLOOP_DEPRECATED int ploop_complete_running_operation(const char *device);
#ifdef __cplusplus
}
#endif
enum
{
SYSEXIT_CREAT = 1,
SYSEXIT_DEVICE,
SYSEXIT_DEVIOC,
SYSEXIT_OPEN,
SYSEXIT_MALLOC,
SYSEXIT_READ,
SYSEXIT_WRITE,
SYSEXIT_RESERVED_8,
SYSEXIT_SYSFS,
SYSEXIT_RESERVED_10,
SYSEXIT_PLOOPFMT,
SYSEXIT_SYS,
SYSEXIT_PROTOCOL,
SYSEXIT_LOOP,
SYSEXIT_FSTAT,
SYSEXIT_FSYNC,
SYSEXIT_EBUSY,
SYSEXIT_FLOCK,
SYSEXIT_FTRUNCATE,
SYSEXIT_FALLOCATE,
SYSEXIT_MOUNT,
SYSEXIT_UMOUNT,
SYSEXIT_LOCK,
SYSEXIT_MKFS,
SYSEXIT_RESERVED_25,
SYSEXIT_RESIZE_FS,
SYSEXIT_MKDIR,
SYSEXIT_RENAME,
SYSEXIT_ABORT,
SYSEXIT_RELOC,
SYSEXIT_RESERVED_31,
SYSEXIT_RESERVED_32,
SYSEXIT_CHANGE_GPT,
SYSEXIT_RESERVED_34,
SYSEXIT_UNLINK,
SYSEXIT_MKNOD,
SYSEXIT_PLOOPINUSE,
SYSEXIT_PARAM,
SYSEXIT_DISKDESCR,
SYSEXIT_DEV_NOT_MOUNTED,
SYSEXIT_FSCK,
SYSEXIT_RESERVED_42,
SYSEXIT_NOSNAP,
};
#pragma GCC visibility pop
#endif
|