libvirt/src/vbox/vbox_snapshot_conf.h
Michal Privoznik c8238579fb lib: Drop internal virXXXPtr typedefs
Historically, we declared pointer type to our types:

  typedef struct _virXXX virXXX;
  typedef virXXX *virXXXPtr;

But usefulness of such declaration is questionable, at best.
Unfortunately, we can't drop every such declaration - we have to
carry some over, because they are part of public API (e.g.
virDomainPtr). But for internal types - we can do drop them and
use what every other C project uses 'virXXX *'.

This change was generated by a very ugly shell script that
generated sed script which was then called over each file in the
repository. For the shell script refer to the cover letter:

https://listman.redhat.com/archives/libvir-list/2021-March/msg00537.html

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-04-13 17:00:38 +02:00

135 lines
5.1 KiB
C

/*
* Copyright 2014, diateam (www.diateam.net)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "internal.h"
#define VBOX_UUID_REGEX "([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})"
/*Stores VirtualBox xml hard disk information
A hard disk can have a parent and children*/
typedef struct _virVBoxSnapshotConfHardDisk virVBoxSnapshotConfHardDisk;
struct _virVBoxSnapshotConfHardDisk {
virVBoxSnapshotConfHardDisk *parent;
char *uuid;
char *location;
char *format;
char *type;
size_t nchildren;
virVBoxSnapshotConfHardDisk **children;
};
/*Stores Virtualbox xml media registry information
We separate disks from other media to manipulate them*/
typedef struct _virVBoxSnapshotConfMediaRegistry virVBoxSnapshotConfMediaRegistry;
struct _virVBoxSnapshotConfMediaRegistry {
size_t ndisks;
virVBoxSnapshotConfHardDisk **disks;
size_t notherMedia;
char **otherMedia;
};
/*Stores VirtualBox xml snapshot information
A snapshot can have a parent and children*/
typedef struct _virVBoxSnapshotConfSnapshot virVBoxSnapshotConfSnapshot;
struct _virVBoxSnapshotConfSnapshot {
virVBoxSnapshotConfSnapshot *parent;
char *uuid;
char *name;
char *timeStamp;
char *description;
char *hardware;
char *storageController;
size_t nchildren;
virVBoxSnapshotConfSnapshot **children;
};
/*Stores VirtualBox xml Machine information*/
typedef struct _virVBoxSnapshotConfMachine virVBoxSnapshotConfMachine;
struct _virVBoxSnapshotConfMachine {
char *uuid;
char *name;
char *currentSnapshot;
char *snapshotFolder;
int currentStateModified;
char *lastStateChange;
virVBoxSnapshotConfMediaRegistry *mediaRegistry;
char *hardware;
char *extraData;
virVBoxSnapshotConfSnapshot *snapshot;
char *storageController;
};
void
virVboxSnapshotConfHardDiskFree(virVBoxSnapshotConfHardDisk *disk);
void
virVBoxSnapshotConfMediaRegistryFree(virVBoxSnapshotConfMediaRegistry *mediaRegistry);
void
virVBoxSnapshotConfSnapshotFree(virVBoxSnapshotConfSnapshot *snapshot);
void
virVBoxSnapshotConfMachineFree(virVBoxSnapshotConfMachine *machine);
virVBoxSnapshotConfMachine *
virVBoxSnapshotConfLoadVboxFile(const char *filePath,
const char *machineLocation);
int
virVBoxSnapshotConfAddSnapshotToXmlMachine(virVBoxSnapshotConfSnapshot *snapshot,
virVBoxSnapshotConfMachine *machine,
const char *snapshotParentName);
int
virVBoxSnapshotConfAddHardDiskToMediaRegistry(virVBoxSnapshotConfHardDisk *hardDisk,
virVBoxSnapshotConfMediaRegistry *mediaRegistry,
const char *parentHardDiskId);
int
virVBoxSnapshotConfRemoveSnapshot(virVBoxSnapshotConfMachine *machine,
const char *snapshotName);
int
virVBoxSnapshotConfRemoveHardDisk(virVBoxSnapshotConfMediaRegistry *mediaRegistry,
const char *uuid);
int
virVBoxSnapshotConfSaveVboxFile(virVBoxSnapshotConfMachine *machine,
const char *filePath);
int
virVBoxSnapshotConfIsCurrentSnapshot(virVBoxSnapshotConfMachine *machine,
const char *snapshotName);
int
virVBoxSnapshotConfGetRWDisksPathsFromLibvirtXML(const char *filePath,
char ***realReadWriteDisksPath);
int
virVBoxSnapshotConfGetRODisksPathsFromLibvirtXML(const char *filePath,
char ***realReadOnlyDisksPath);
const char *
virVBoxSnapshotConfHardDiskUuidByLocation(virVBoxSnapshotConfMachine *machine,
const char *location);
size_t
virVBoxSnapshotConfDiskListToOpen(virVBoxSnapshotConfMachine *machine,
virVBoxSnapshotConfHardDisk ***hardDiskToOpen,
const char *location);
int
virVBoxSnapshotConfRemoveFakeDisks(virVBoxSnapshotConfMachine *machine);
int
virVBoxSnapshotConfDiskIsInMediaRegistry(virVBoxSnapshotConfMachine *machine,
const char *location);
virVBoxSnapshotConfHardDisk *
virVBoxSnapshotConfHardDiskPtrByLocation(virVBoxSnapshotConfMachine *machine,
const char *location);
virVBoxSnapshotConfSnapshot *
virVBoxSnapshotConfSnapshotByName(virVBoxSnapshotConfSnapshot *snapshot,
const char *snapshotName);