Exemplo n.º 1
0
int
DMesaGetIntegerv (GLenum pname, GLint *params)
{
    switch (pname) {
	case DMESA_GET_SCREEN_SIZE:
	    vl_get(VL_GET_SCREEN_SIZE, params);
	    break;
	case DMESA_GET_DRIVER_CAPS:
	    params[0] = 0;
	    break;
	case DMESA_GET_VIDEO_MODES:
	    return vl_get(VL_GET_VIDEO_MODES, params);
	case DMESA_GET_BUFFER_ADDR: {
	    const DMesaContext dmesa = DMesaGetCurrentContext();
	    if (dmesa != NULL) {
		DMesaBuffer b = dmesa->buffer;
		if (b != NULL) {
		    params[0] = (GLint)b->the_window;
		}
	    }
	    break;
	}
	default:
	    return -1;
    }

    return 0;
}
Exemplo n.º 2
0
static int
libvirt_hostlist(hostlist_callback callback, void *arg, void *priv)
{
	struct libvirt_info *info = (struct libvirt_info *)priv;
	int i;

	dbg_printf(5, "ENTER %s\n", __FUNCTION__);
	VALIDATE(info);

	for (i = 0 ; i < info->vp_count ; i++) {
		int x;
		virt_list_t *vl;

		vl = vl_get(info->vp[i], 1);
		if (!vl)
			continue;

		for (x = 0; x < vl->vm_count; x++) {
			callback(vl->vm_states[x].v_name,
					 vl->vm_states[x].v_uuid,
					 vl->vm_states[x].v_state.s_state, arg);

			dbg_printf(10, "[libvirt:HOSTLIST] Sent %s %s %d\n",
				vl->vm_states[x].v_name,
				vl->vm_states[x].v_uuid,
				vl->vm_states[x].v_state.s_state);
		}

		vl_free(vl);
	}

	return 0;
}
Exemplo n.º 3
0
static int
libvirt_hostlist(hostlist_callback callback, void *arg, void *priv)
{
	struct libvirt_info *info = (struct libvirt_info *)priv;
	virt_list_t *vl;
	int x;

	dbg_printf(5, "%s\n", __FUNCTION__);
	VALIDATE(info);

	vl = vl_get(info->vp, 1);
	if (!vl)
		return 1;

	for (x = 0; x < vl->vm_count; x++) {
		dbg_printf(10, "Sending %s\n", vl->vm_states[x].v_uuid);
		callback(vl->vm_states[x].v_name,
			 vl->vm_states[x].v_uuid,
			 vl->vm_states[x].v_state.s_state, arg);
	}

	vl_free(vl);

	return 0;
}
Exemplo n.º 4
0
static int
virt_list_update(struct cpg_info *info, virt_list_t **vl, int my_id)
{
	virt_list_t *list = NULL;

	if (*vl)
		vl_free(*vl);

	list = vl_get(info->vp, info->vp_count, my_id);
	if (!list && (errno == EPIPE || errno == EINVAL)) {
		do {
			cpg_virt_init_libvirt(info);
		} while (info->vp_count == 0);
		list = vl_get(info->vp, info->vp_count, my_id);
	}

	*vl = list;
	if (!list)
		return -1;

	return 0;
}