Ejemplo n.º 1
0
static GVariant *
list_volume_groups (void)
{
  lvm_t lvm;
  struct dm_list *vg_names;
  struct lvm_str_list *vg_name;
  GVariantBuilder result;

  lvm = init_lvm ();

  g_variant_builder_init (&result, G_VARIANT_TYPE ("as"));
  vg_names = lvm_list_vg_names (lvm);
  dm_list_iterate_items (vg_name, vg_names)
    {
      g_variant_builder_add (&result, "s", vg_name->str);
    }
Ejemplo n.º 2
0
int main(int argc, char *argv[])
{
    lvm_str_list_t *str;
    int i = 0;
    struct dm_list *vgnames;
    struct dm_list *vgids;

    if (argc != 3)
        abort();

    start();
    vgnames = lvm_list_vg_names(handle);
    dm_list_iterate_items(str, vgnames) {
        assert(++i <= 1);
        assert(!strcmp(str->str, argv[1]));
    }
Ejemplo n.º 3
0
static PyObject *_liblvm_lvm_list_vg_names(void)
{
	struct dm_list *vgnames;
	struct lvm_str_list *strl;
	PyObject * pytuple;
	int i = 0;

	LVM_VALID(NULL);

	if (!(vgnames = lvm_list_vg_names(_libh))) {
		PyErr_SetObject(_LibLVMError, _liblvm_get_last_error());
		return NULL;
	}

	if (!(pytuple = PyTuple_New(dm_list_size(vgnames))))
		return NULL;

	dm_list_iterate_items(strl, vgnames) {
		PyTuple_SET_ITEM(pytuple, i, PYSTRTYPE_FROMSTRING(strl->str));
		i++;
	}
Ejemplo n.º 4
0
Archivo: liblvm.c Proyecto: Jajcus/lvm2
static PyObject *
liblvm_lvm_list_vg_names(void)
{
	struct dm_list *vgnames;
	struct lvm_str_list *strl;
	PyObject * pytuple;
	int i = 0;

	LVM_VALID();

	vgnames = lvm_list_vg_names(libh);
	if (!vgnames) {
		PyErr_SetObject(LibLVMError, liblvm_get_last_error());
		return NULL;
	}

	pytuple = PyTuple_New(dm_list_size(vgnames));
	if (!pytuple)
		return NULL;

	dm_list_iterate_items(strl, vgnames) {
		PyTuple_SET_ITEM(pytuple, i, PyString_FromString(strl->str));
		i++;
	}