|
Packit Service |
ea0369 |
/*
|
|
Packit Service |
ea0369 |
* libvirt-gobject-storage_vol.c: libvirt gobject integration
|
|
Packit Service |
ea0369 |
*
|
|
Packit Service |
ea0369 |
* Copyright (C) 2010-2011 Red Hat, Inc.
|
|
Packit Service |
ea0369 |
*
|
|
Packit Service |
ea0369 |
* This library is free software; you can redistribute it and/or
|
|
Packit Service |
ea0369 |
* modify it under the terms of the GNU Lesser General Public
|
|
Packit Service |
ea0369 |
* License as published by the Free Software Foundation; either
|
|
Packit Service |
ea0369 |
* version 2.1 of the License, or (at your option) any later version.
|
|
Packit Service |
ea0369 |
*
|
|
Packit Service |
ea0369 |
* This library is distributed in the hope that it will be useful,
|
|
Packit Service |
ea0369 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
ea0369 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
ea0369 |
* Lesser General Public License for more details.
|
|
Packit Service |
ea0369 |
*
|
|
Packit Service |
ea0369 |
* You should have received a copy of the GNU Lesser General Public
|
|
Packit Service |
ea0369 |
* License along with this library. If not, see
|
|
Packit Service |
ea0369 |
* <http://www.gnu.org/licenses/>.
|
|
Packit Service |
ea0369 |
*
|
|
Packit Service |
ea0369 |
* Author: Daniel P. Berrange <berrange@redhat.com>
|
|
Packit Service |
ea0369 |
*/
|
|
Packit Service |
ea0369 |
|
|
Packit Service |
ea0369 |
#if !defined(__LIBVIRT_GOBJECT_H__) && !defined(LIBVIRT_GOBJECT_BUILD)
|
|
Packit Service |
ea0369 |
#error "Only <libvirt-gobject/libvirt-gobject.h> can be included directly."
|
|
Packit Service |
ea0369 |
#endif
|
|
Packit Service |
ea0369 |
#include <libvirt/libvirt.h>
|
|
Packit Service |
ea0369 |
|
|
Packit Service |
ea0369 |
#ifndef __LIBVIRT_GOBJECT_STORAGE_VOL_H__
|
|
Packit Service |
ea0369 |
#define __LIBVIRT_GOBJECT_STORAGE_VOL_H__
|
|
Packit Service |
ea0369 |
|
|
Packit Service |
ea0369 |
G_BEGIN_DECLS
|
|
Packit Service |
ea0369 |
|
|
Packit Service |
ea0369 |
#define GVIR_TYPE_STORAGE_VOL (gvir_storage_vol_get_type ())
|
|
Packit Service |
ea0369 |
#define GVIR_STORAGE_VOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_TYPE_STORAGE_VOL, GVirStorageVol))
|
|
Packit Service |
ea0369 |
#define GVIR_STORAGE_VOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_TYPE_STORAGE_VOL, GVirStorageVolClass))
|
|
Packit Service |
ea0369 |
#define GVIR_IS_STORAGE_VOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_TYPE_STORAGE_VOL))
|
|
Packit Service |
ea0369 |
#define GVIR_IS_STORAGE_VOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_TYPE_STORAGE_VOL))
|
|
Packit Service |
ea0369 |
#define GVIR_STORAGE_VOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_TYPE_STORAGE_VOL, GVirStorageVolClass))
|
|
Packit Service |
ea0369 |
|
|
Packit Service |
ea0369 |
#define GVIR_TYPE_STORAGE_VOL_INFO (gvir_storage_vol_info_get_type())
|
|
Packit Service |
ea0369 |
#define GVIR_TYPE_STORAGE_VOL_HANDLE (gvir_storage_vol_handle_get_type())
|
|
Packit Service |
ea0369 |
|
|
Packit Service |
ea0369 |
typedef struct _GVirStorageVol GVirStorageVol;
|
|
Packit Service |
ea0369 |
typedef struct _GVirStorageVolPrivate GVirStorageVolPrivate;
|
|
Packit Service |
ea0369 |
typedef struct _GVirStorageVolClass GVirStorageVolClass;
|
|
Packit Service |
ea0369 |
|
|
Packit Service |
ea0369 |
struct _GVirStorageVol
|
|
Packit Service |
ea0369 |
{
|
|
Packit Service |
ea0369 |
GObject parent;
|
|
Packit Service |
ea0369 |
|
|
Packit Service |
ea0369 |
GVirStorageVolPrivate *priv;
|
|
Packit Service |
ea0369 |
|
|
Packit Service |
ea0369 |
/* Do not add fields to this struct */
|
|
Packit Service |
ea0369 |
};
|
|
Packit Service |
ea0369 |
|
|
Packit Service |
ea0369 |
struct _GVirStorageVolClass
|
|
Packit Service |
ea0369 |
{
|
|
Packit Service |
ea0369 |
GObjectClass parent_class;
|
|
Packit Service |
ea0369 |
|
|
Packit Service |
ea0369 |
gpointer padding[20];
|
|
Packit Service |
ea0369 |
};
|
|
Packit Service |
ea0369 |
|
|
Packit Service |
ea0369 |
typedef enum {
|
|
Packit Service |
ea0369 |
GVIR_STORAGE_VOL_STATE_FILE = 0, /* Regular file based volume */
|
|
Packit Service |
ea0369 |
GVIR_STORAGE_VOL_STATE_BLOCK = 1, /* Block based volume */
|
|
Packit Service |
ea0369 |
GVIR_STORAGE_VOL_STATE_DIR = 2, /* Directory-passthrough based volume */
|
|
Packit Service |
ea0369 |
} GVirStorageVolType;
|
|
Packit Service |
ea0369 |
|
|
Packit Service |
ea0369 |
/**
|
|
Packit Service |
ea0369 |
* GVirStorageVolResizeFlags:
|
|
Packit Service |
ea0369 |
* @GVIR_STORAGE_VOL_RESIZE_NONE: No flags
|
|
Packit Service |
ea0369 |
* @GVIR_STORAGE_VOL_RESIZE_ALLOCATE: force allocation of new size
|
|
Packit Service |
ea0369 |
* @GVIR_STORAGE_VOL_RESIZE_DELTA: size is relative to current
|
|
Packit Service |
ea0369 |
* @GVIR_STORAGE_VOL_RESIZE_SHRINK: allow decrease in capacity. This combined
|
|
Packit Service |
ea0369 |
* with #GVIR_STORAGE_VOL_RESIZE_DELTA, implies a negative delta.
|
|
Packit Service |
ea0369 |
*/
|
|
Packit Service |
ea0369 |
typedef enum {
|
|
Packit Service |
ea0369 |
GVIR_STORAGE_VOL_RESIZE_NONE = 0,
|
|
Packit Service |
ea0369 |
GVIR_STORAGE_VOL_RESIZE_ALLOCATE = VIR_STORAGE_VOL_RESIZE_ALLOCATE,
|
|
Packit Service |
ea0369 |
GVIR_STORAGE_VOL_RESIZE_DELTA = VIR_STORAGE_VOL_RESIZE_DELTA,
|
|
Packit Service |
ea0369 |
GVIR_STORAGE_VOL_RESIZE_SHRINK = VIR_STORAGE_VOL_RESIZE_SHRINK,
|
|
Packit Service |
ea0369 |
} GVirStorageVolResizeFlags;
|
|
Packit Service |
ea0369 |
|
|
Packit Service |
ea0369 |
typedef struct _GVirStorageVolInfo GVirStorageVolInfo;
|
|
Packit Service |
ea0369 |
struct _GVirStorageVolInfo
|
|
Packit Service |
ea0369 |
{
|
|
Packit Service |
ea0369 |
GVirStorageVolType type; /* Type flags */
|
|
Packit Service |
ea0369 |
guint64 capacity; /* Logical size bytes */
|
|
Packit Service |
ea0369 |
guint64 allocation; /* Current allocation bytes */
|
|
Packit Service |
ea0369 |
};
|
|
Packit Service |
ea0369 |
|
|
Packit Service |
ea0369 |
GType gvir_storage_vol_get_type(void);
|
|
Packit Service |
ea0369 |
GType gvir_storage_vol_info_get_type(void);
|
|
Packit Service |
ea0369 |
GType gvir_storage_vol_handle_get_type(void);
|
|
Packit Service |
ea0369 |
|
|
Packit Service |
ea0369 |
const gchar *gvir_storage_vol_get_name(GVirStorageVol *vol);
|
|
Packit Service |
ea0369 |
const gchar *gvir_storage_vol_get_path(GVirStorageVol *vol, GError **error);
|
|
Packit Service |
ea0369 |
|
|
Packit Service |
ea0369 |
gboolean gvir_storage_vol_delete(GVirStorageVol *vol,
|
|
Packit Service |
ea0369 |
guint flags,
|
|
Packit Service |
ea0369 |
GError **err);
|
|
Packit Service |
ea0369 |
|
|
Packit Service |
ea0369 |
GVirConfigStorageVol *gvir_storage_vol_get_config(GVirStorageVol *vol,
|
|
Packit Service |
ea0369 |
guint flags,
|
|
Packit Service |
ea0369 |
GError **err);
|
|
Packit Service |
ea0369 |
GVirStorageVolInfo *gvir_storage_vol_get_info(GVirStorageVol *vol,
|
|
Packit Service |
ea0369 |
GError **err);
|
|
Packit Service |
ea0369 |
gboolean gvir_storage_vol_resize(GVirStorageVol *vol,
|
|
Packit Service |
ea0369 |
guint64 capacity,
|
|
Packit Service |
ea0369 |
guint flags,
|
|
Packit Service |
ea0369 |
GError **err);
|
|
Packit Service |
ea0369 |
|
|
Packit Service |
ea0369 |
gboolean gvir_storage_vol_download(GVirStorageVol *vol,
|
|
Packit Service |
ea0369 |
GVirStream *stream,
|
|
Packit Service |
ea0369 |
guint64 offset,
|
|
Packit Service |
ea0369 |
guint64 length,
|
|
Packit Service |
ea0369 |
guint flags,
|
|
Packit Service |
ea0369 |
GError **err);
|
|
Packit Service |
ea0369 |
|
|
Packit Service |
ea0369 |
gboolean gvir_storage_vol_upload(GVirStorageVol *vol,
|
|
Packit Service |
ea0369 |
GVirStream *stream,
|
|
Packit Service |
ea0369 |
guint64 offset,
|
|
Packit Service |
ea0369 |
guint64 length,
|
|
Packit Service |
ea0369 |
guint flags,
|
|
Packit Service |
ea0369 |
GError **err);
|
|
Packit Service |
ea0369 |
|
|
Packit Service |
ea0369 |
G_END_DECLS
|
|
Packit Service |
ea0369 |
|
|
Packit Service |
ea0369 |
#endif /* __LIBVIRT_GOBJECT_STORAGE_VOL_H__ */
|