GVirStorageVol

## GVirStorageVol GVirStorageVol |

## Synopsis

    struct              GVirStorageVol;
    struct              GVirStorageVolClass;
    enum                GVirStorageVolType;
    enum                GVirStorageVolResizeFlags;
    struct              GVirStorageVolInfo;
    const gchar *       gvir_storage_vol_get_name           (GVirStorageVol *vol);
    const gchar *       gvir_storage_vol_get_path           (GVirStorageVol *vol,
                                                             GError **error);
    gboolean            gvir_storage_vol_delete             (GVirStorageVol *vol,
                                                             guint flags,
                                                             GError **err);
    GVirConfigStorageVol * gvir_storage_vol_get_config      (GVirStorageVol *vol,
                                                             guint flags,
                                                             GError **err);
    GVirStorageVolInfo * gvir_storage_vol_get_info          (GVirStorageVol *vol,
                                                             GError **err);
    gboolean            gvir_storage_vol_resize             (GVirStorageVol *vol,
                                                             guint64 capacity,
                                                             guint flags,
                                                             GError **err);
    gboolean            gvir_storage_vol_download           (GVirStorageVol *vol,
                                                             GVirStream *stream,
                                                             guint64 offset,
                                                             guint64 length,
                                                             guint flags,
                                                             GError **err);
    gboolean            gvir_storage_vol_upload             (GVirStorageVol *vol,
                                                             GVirStream *stream,
                                                             guint64 offset,
                                                             guint64 length,
                                                             guint flags,
                                                             GError **err);

## Object Hierarchy

      GObject
       +----GVirStorageVol

      GBoxed
       +----GVirStorageVolInfo

## Properties

      "handle"                   GVirStorageVolHandle*  : Read / Write / Construct Only
      "pool"                     GVirStoragePool*      : Read / Write / Construct Only

## Description

## Details

### struct GVirStorageVol

    struct GVirStorageVol;

### struct GVirStorageVolClass

    struct GVirStorageVolClass {
        GObjectClass parent_class;

        gpointer padding[20];
    };

### enum GVirStorageVolType

    typedef enum {
        GVIR_STORAGE_VOL_STATE_FILE  = 0, /* Regular file based volume */
        GVIR_STORAGE_VOL_STATE_BLOCK = 1, /* Block based volume */
        GVIR_STORAGE_VOL_STATE_DIR   = 2, /* Directory-passthrough based volume */
    } GVirStorageVolType;

`GVIR_STORAGE_VOL_STATE_FILE` |
`GVIR_STORAGE_VOL_STATE_BLOCK` |
`GVIR_STORAGE_VOL_STATE_DIR` |

### enum GVirStorageVolResizeFlags

    typedef enum {
        GVIR_STORAGE_VOL_RESIZE_NONE     = 0,
        GVIR_STORAGE_VOL_RESIZE_ALLOCATE = VIR_STORAGE_VOL_RESIZE_ALLOCATE,
        GVIR_STORAGE_VOL_RESIZE_DELTA    = VIR_STORAGE_VOL_RESIZE_DELTA,
        GVIR_STORAGE_VOL_RESIZE_SHRINK   = VIR_STORAGE_VOL_RESIZE_SHRINK,
    } GVirStorageVolResizeFlags;

`GVIR_STORAGE_VOL_RESIZE_NONE` | No flags
`GVIR_STORAGE_VOL_RESIZE_ALLOCATE` | force allocation of new size
`GVIR_STORAGE_VOL_RESIZE_DELTA` | size is relative to current
`GVIR_STORAGE_VOL_RESIZE_SHRINK` | allow decrease in capacity. This combined with GVIR_STORAGE_VOL_RESIZE_DELTA, implies a negative delta.

### struct GVirStorageVolInfo

    struct GVirStorageVolInfo {
        GVirStorageVolType type; /* Type flags */
        guint64 capacity;        /* Logical size bytes */
        guint64 allocation;      /* Current allocation bytes */
    };

### gvir_storage_vol_get_name ()

    const gchar *       gvir_storage_vol_get_name           (GVirStorageVol *vol);

### gvir_storage_vol_get_path ()

    const gchar *       gvir_storage_vol_get_path           (GVirStorageVol *vol,
                                                             GError **error);

### gvir_storage_vol_delete ()

    gboolean            gvir_storage_vol_delete             (GVirStorageVol *vol,
                                                             guint flags,
                                                             GError **err);

Deletes the storage volume `vol`.

`vol` : | the storage volume to delete
`flags` : | the flags
`err` : | Return location for errors, or NULL
Returns : | `TRUE` on success, `FALSE` otherwise

### gvir_storage_vol_get_config ()

    GVirConfigStorageVol * gvir_storage_vol_get_config      (GVirStorageVol *vol,
                                                             guint flags,
                                                             GError **err);

`vol` : | the storage_vol
`flags` : | the flags
`err` : | Place-holder for possible errors
Returns : | the config. The returned object should be unreffed with `g_object_unref()` when no longer needed. [transfer full]

### gvir_storage_vol_get_info ()

    GVirStorageVolInfo * gvir_storage_vol_get_info          (GVirStorageVol *vol,
                                                             GError **err);

`vol` : | the storage_vol
`err` : | Place-holder for possible errors
Returns : | the info. The returned object should be unreffed with `g_object_unref()` when no longer needed. [transfer full]

### gvir_storage_vol_resize ()

    gboolean            gvir_storage_vol_resize             (GVirStorageVol *vol,
                                                             guint64 capacity,
                                                             guint flags,
                                                             GError **err);

Changes the capacity of the storage volume `vol` to `capacity`.

`vol` : | the storage volume to resize
`capacity` : | the new capacity of the volume
`flags` : | the flags. [type GVirStorageVolResizeFlags]
`err` : | Return location for errors, or NULL
Returns : | TRUE success, FALSE otherwise

### gvir_storage_vol_download ()

    gboolean            gvir_storage_vol_download           (GVirStorageVol *vol,
                                                             GVirStream *stream,
                                                             guint64 offset,
                                                             guint64 length,
                                                             guint flags,
                                                             GError **err);

`vol` : | the storage volume to download from
`stream` : | stream to use as output
`offset` : | position in `vol` to start reading from
`length` : | limit on amount of data to download, or 0 for downloading all data
`flags` : | extra flags, not used yet, pass 0
Returns : | TRUE of success, FALSE otherwise

### gvir_storage_vol_upload ()

    gboolean            gvir_storage_vol_upload             (GVirStorageVol *vol,
                                                             GVirStream *stream,
                                                             guint64 offset,
                                                             guint64 length,
                                                             guint flags,
                                                             GError **err);

`vol` : | the storage volume to upload
`stream` : | stream to use as input
`offset` : | position in `vol` to start to write to
`length` : | limit on amount of data to upload, or 0 for uploading all data
`flags` : | the flags, not set yet, pass 0
Returns : | TRUE of success, FALSE otherwise

## Property Details

### The `"handle"` property

      "handle"                   GVirStorageVolHandle*  : Read / Write / Construct Only

The storage_vol handle.

### The `"pool"` property

      "pool"                     GVirStoragePool*      : Read / Write / Construct Only

The containing storage pool.