Exemplo n.º 1
0
static int
cont_open(struct rdb_tx *tx, struct ds_pool_hdl *pool_hdl, struct cont *cont,
	  crt_rpc_t *rpc)
{
	struct cont_open_in    *in = crt_req_get(rpc);
	daos_iov_t		key;
	daos_iov_t		value;
	struct container_hdl	chdl;
	int			rc;

	D_DEBUG(DF_DSMS, DF_CONT": processing rpc %p: hdl="DF_UUID" capas="******"\n",
		DP_CONT(pool_hdl->sph_pool->sp_uuid, in->coi_op.ci_uuid), rpc,
		DP_UUID(in->coi_op.ci_hdl), in->coi_capas);

	/* Verify the pool handle capabilities. */
	if ((in->coi_capas & DAOS_COO_RW) &&
	    !(pool_hdl->sph_capas & DAOS_PC_RW) &&
	    !(pool_hdl->sph_capas & DAOS_PC_EX))
		D_GOTO(out, rc = -DER_NO_PERM);

	/* See if this container handle already exists. */
	daos_iov_set(&key, in->coi_op.ci_hdl, sizeof(uuid_t));
	daos_iov_set(&value, &chdl, sizeof(chdl));
	rc = rdb_tx_lookup(tx, &cont->c_svc->cs_hdls, &key, &value);
	if (rc != -DER_NONEXIST) {
		if (rc == 0 && chdl.ch_capas != in->coi_capas) {
			D_ERROR(DF_CONT": found conflicting container handle\n",
				DP_CONT(cont->c_svc->cs_pool_uuid,
					cont->c_uuid));
			rc = -DER_EXIST;
		}
		D_GOTO(out, rc);
	}

	rc = cont_open_bcast(rpc->cr_ctx, cont, in->coi_op.ci_pool_hdl,
			     in->coi_op.ci_hdl, in->coi_capas);
	if (rc != 0)
		D_GOTO(out, rc);

	/* TODO: Rollback cont_open_bcast() on errors from now on. */

	uuid_copy(chdl.ch_pool_hdl, pool_hdl->sph_uuid);
	uuid_copy(chdl.ch_cont, cont->c_uuid);
	chdl.ch_capas = in->coi_capas;

	rc = ds_cont_epoch_init_hdl(tx, cont, in->coi_op.ci_hdl, &chdl);
	if (rc != 0)
		D_GOTO(out, rc);

	rc = rdb_tx_update(tx, &cont->c_svc->cs_hdls, &key, &value);

out:
	D_DEBUG(DF_DSMS, DF_CONT": replying rpc %p: %d\n",
		DP_CONT(pool_hdl->sph_pool->sp_uuid, in->coi_op.ci_uuid), rpc,
		rc);
	return rc;
}
Exemplo n.º 2
0
static DFBResult
dfb_rtd_set_video_mode_handler( CoreLayerRegionConfig *config )
{
#if 0
     int argc = 0;
     char** argv = NULL;

     D_DEBUG( "DirectFB/RTD: layer config properties\n");

     if(rfb_screen) /*!!! FIXME*/
         return DFB_OK;

     fusion_skirmish_prevail( &dfb_rtd->lock );

     /* Set video mode */
     rfb_screen = rfbGetScreen(&argc, argv, config->width, config->height, DFB_BITS_PER_PIXEL(config->format)/3, 3, 4);
     
     D_DEBUG( "DirectFB/RTD: rfbGetScreen parameters: width %d height %d bitspersample %d samplesperpixel %d bytesperpixel %d\n", config->width, config->height, DFB_BITS_PER_PIXEL(config->format)/3, 3, 4);
     
     /*screen = rfbGetScreen(&argc, argv, config->width, config->height, 8, 3, 4);*/

     if ( rfb_screen == NULL )
     {
             D_ERROR( "DirectFB/RTD: Couldn't set %dx%dx%d video mode\n",
                      config->width, config->height,
                      DFB_COLOR_BITS_PER_PIXEL(config->format) );

             fusion_skirmish_dismiss( &dfb_rtd->lock );

             return DFB_FAILURE;
     }

     if(DFB_COLOR_BITS_PER_PIXEL(config->format) == DSPF_RGB16)
     {
        rfb_screen->serverFormat.redShift = 11;
        rfb_screen->serverFormat.greenShift = 5;
        rfb_screen->serverFormat.blueShift = 0;
        rfb_screen->serverFormat.redMax = 31;
        rfb_screen->serverFormat.greenMax = 63;
        rfb_screen->serverFormat.blueMax = 31;
     }
    
     /* screen->serverFormat.trueColour=FALSE; */

     rfb_screen->frameBuffer = malloc(rfb_screen->width * rfb_screen->height * rfb_screen->depth / 8) ;
     
     if ( ! rfb_screen->frameBuffer )
     {
             fusion_skirmish_dismiss( &dfb_rtd->lock );

             return DFB_NOSYSTEMMEMORY;
     }

     fusion_skirmish_dismiss( &dfb_rtd->lock );
#endif
     return DFB_OK;
}
Exemplo n.º 3
0
static int handle_client(int cfd, int opmode)
{
	struct sockaddr_in sa;
	socklen_t salen;
	char buf[8192];
	int bufsize = sizeof(buf);
	int retval;

	memset(&sa, 0, sizeof(sa));
	salen = sizeof(sa);
	getpeername(cfd, (struct sockaddr *)&sa, &salen);

	D_DEBUG("opmode = %d", opmode);

	for (;;)
	{
		retval = read(cfd, buf, bufsize);
		if (retval == 0) {
			D_DEBUG("client [%08x:%d] disconnected.\n",
					sa.sin_addr.s_addr, ntohs(sa.sin_port));
			break;
		}

		if (retval == -1) {
			if (errno == EINTR)
				continue;
			perror("read socket failed");
			break;
		}
		// printf("read ok\n");

		if (opmode == OPMODE_DISCARD)
			continue;
		else if (opmode == OPMODE_ECHO) {
			retval = write(cfd, buf, retval);
			if (retval == -1) {
				perror("write socket failed");
				break;
			}
			// printf("write ok\n");
		}
		else if (opmode == OPMODE_WRITE_STDOUT) {
			retval = write(STDOUT_FILENO, buf, retval);
			if (retval == -1) {
				if (errno == EINTR)
					continue;
				perror("write stdout failed");
				exit(1);
			}
		}
	}

	return 0;
}
Exemplo n.º 4
0
static void
driver_close_device( CoreGraphicsDevice *device,
                     void               *driver_data,
                     void               *device_data )
{
     ATI128DeviceData *adev = (ATI128DeviceData*) device_data;
     ATI128DriverData *adrv = (ATI128DriverData*) driver_data;
     volatile u8      *mmio = adrv->mmio_base;

     D_DEBUG( "DirectFB/ATI128: FIFO Performance Monitoring:\n" );
     D_DEBUG( "DirectFB/ATI128:  %9d ati128_waitfifo calls\n",
               adev->waitfifo_calls );
     D_DEBUG( "DirectFB/ATI128:  %9d register writes (ati128_waitfifo sum)\n",
               adev->waitfifo_sum );
     D_DEBUG( "DirectFB/ATI128:  %9d FIFO wait cycles (depends on CPU)\n",
               adev->fifo_waitcycles );
     D_DEBUG( "DirectFB/ATI128:  %9d IDLE wait cycles (depends on CPU)\n",
               adev->idle_waitcycles );
     D_DEBUG( "DirectFB/ATI128:  %9d FIFO space cache hits(depends on CPU)\n",
               adev->fifo_cache_hits );
     D_DEBUG( "DirectFB/ATI128: Conclusion:\n" );
     D_DEBUG( "DirectFB/ATI128:  Average register writes/ati128_waitfifo"
               "call:%.2f\n",
               adev->waitfifo_sum/(float)(adev->waitfifo_calls) );
     D_DEBUG( "DirectFB/ATI128:  Average wait cycles/ati128_waitfifo call:"
               " %.2f\n",
               adev->fifo_waitcycles/(float)(adev->waitfifo_calls) );
     D_DEBUG( "DirectFB/ATI128:  Average fifo space cache hits: %02d%%\n",
               (int)(100 * adev->fifo_cache_hits/
               (float)(adev->waitfifo_calls)) );

     /* clean up, make sure that aty128fb does not hang in kernel space
        afterwards  */
     ati128_waitfifo( adrv, adev, 3 );

     ati128_out32( mmio, DP_GUI_MASTER_CNTL,
                         GMC_SRC_PITCH_OFFSET_DEFAULT |
                         GMC_DST_PITCH_OFFSET_DEFAULT |
                         GMC_SRC_CLIP_DEFAULT         |
                         GMC_DST_CLIP_DEFAULT         |
                         GMC_BRUSH_SOLIDCOLOR         |
                         GMC_SRC_DSTCOLOR             |
                         GMC_BYTE_ORDER_MSB_TO_LSB    |
                         GMC_DP_CONVERSION_TEMP_6500  |
                         ROP3_PATCOPY                 |
                         GMC_DP_SRC_RECT              |
                         GMC_3D_FCN_EN_CLR            |
                         GMC_DST_CLR_CMP_FCN_CLEAR    |
                         GMC_AUX_CLIP_CLEAR           |
                         GMC_WRITE_MASK_SET);

     ati128_out32( mmio, SCALE_3D_CNTL, 0x00000000 );
     ati128_out32( mmio, TEX_CNTL, 0x00000000 );
}
Exemplo n.º 5
0
/* Look up the pool handle and the matching container service. */
void
ds_cont_op_handler(crt_rpc_t *rpc)
{
	struct cont_op_in      *in = crt_req_get(rpc);
	struct cont_op_out     *out = crt_reply_get(rpc);
	struct ds_pool_hdl     *pool_hdl;
	crt_opcode_t		opc = opc_get(rpc->cr_opc);
	daos_prop_t	       *prop = NULL;
	struct cont_svc	       *svc;
	int			rc;

	pool_hdl = ds_pool_hdl_lookup(in->ci_pool_hdl);
	if (pool_hdl == NULL)
		D_GOTO(out, rc = -DER_NO_HDL);

	D_DEBUG(DF_DSMS, DF_CONT": processing rpc %p: hdl="DF_UUID" opc=%u\n",
		DP_CONT(pool_hdl->sph_pool->sp_uuid, in->ci_uuid), rpc,
		DP_UUID(in->ci_hdl), opc);

	/*
	 * TODO: How to map to the correct container service among those
	 * running of this storage node? (Currently, there is only one, with ID
	 * 0, colocated with the pool service.)
	 */
	rc = cont_svc_lookup_leader(pool_hdl->sph_pool->sp_uuid, 0 /* id */,
				    &svc, &out->co_hint);
	if (rc != 0)
		D_GOTO(out_pool_hdl, rc);

	rc = cont_op_with_svc(pool_hdl, svc, rpc);

	ds_rsvc_set_hint(svc->cs_rsvc, &out->co_hint);
	cont_svc_put_leader(svc);
out_pool_hdl:
	D_DEBUG(DF_DSMS, DF_CONT": replying rpc %p: hdl="DF_UUID
		" opc=%u rc=%d\n",
		DP_CONT(pool_hdl->sph_pool->sp_uuid, in->ci_uuid), rpc,
		DP_UUID(in->ci_hdl), opc, rc);
	ds_pool_hdl_put(pool_hdl);
out:
	/* cleanup the properties for cont_query */
	if (opc == CONT_QUERY) {
		struct cont_query_out  *cqo = crt_reply_get(rpc);

		prop = cqo->cqo_prop;
	}
	out->co_rc = rc;
	crt_reply_send(rpc);
	daos_prop_free(prop);

	return;
}
Exemplo n.º 6
0
/* Close an array of handles, possibly belonging to different containers. */
static int
cont_close_hdls(struct cont_svc *svc, struct cont_tgt_close_rec *recs,
		int nrecs, crt_context_t ctx)
{
	int	i;
	int	rc;

	D_ASSERTF(nrecs > 0, "%d\n", nrecs);
	D_DEBUG(DF_DSMS, DF_CONT": closing %d recs: recs[0].hdl="DF_UUID
		" recs[0].hce="DF_U64"\n", DP_CONT(svc->cs_pool_uuid, NULL),
		nrecs, DP_UUID(recs[0].tcr_hdl), recs[0].tcr_hce);

	rc = cont_close_bcast(ctx, svc, recs, nrecs);
	if (rc != 0)
		D_GOTO(out, rc);

	/*
	 * Use one TX per handle to avoid calling ds_cont_epoch_fini_hdl() more
	 * than once in a TX, in which case we would be attempting to query
	 * uncommitted updates. This could be optimized by adding container
	 * UUIDs into recs[i] and sorting recs[] by container UUIDs. Then we
	 * could maintain a list of deleted LREs and a list of deleted LHEs for
	 * each container while looping, and use the lists to update the GHCE
	 * once for each container. This approach enables us to commit only
	 * once (or when a TX becomes too big).
	 */
	for (i = 0; i < nrecs; i++) {
		struct rdb_tx tx;

		rc = rdb_tx_begin(svc->cs_rsvc->s_db, svc->cs_rsvc->s_term,
				  &tx);
		if (rc != 0)
			break;
		rc = cont_close_one_hdl(&tx, svc, ctx, recs[i].tcr_hdl);
		if (rc != 0) {
			rdb_tx_end(&tx);
			break;
		}
		rc = rdb_tx_commit(&tx);
		rdb_tx_end(&tx);
		if (rc != 0)
			break;
	}

out:
	D_DEBUG(DF_DSMS, DF_CONT": leaving: %d\n",
		DP_CONT(svc->cs_pool_uuid, NULL), rc);
	return rc;
}
Exemplo n.º 7
0
static int
cont_close(struct rdb_tx *tx, struct ds_pool_hdl *pool_hdl, struct cont *cont,
	   crt_rpc_t *rpc)
{
	struct cont_close_in	       *in = crt_req_get(rpc);
	daos_iov_t			key;
	daos_iov_t			value;
	struct container_hdl		chdl;
	struct cont_tgt_close_rec	rec;
	int				rc;

	D_DEBUG(DF_DSMS, DF_CONT": processing rpc %p: hdl="DF_UUID"\n",
		DP_CONT(pool_hdl->sph_pool->sp_uuid, in->cci_op.ci_uuid), rpc,
		DP_UUID(in->cci_op.ci_hdl));

	/* See if this container handle is already closed. */
	daos_iov_set(&key, in->cci_op.ci_hdl, sizeof(uuid_t));
	daos_iov_set(&value, &chdl, sizeof(chdl));
	rc = rdb_tx_lookup(tx, &cont->c_svc->cs_hdls, &key, &value);
	if (rc != 0) {
		if (rc == -DER_NONEXIST) {
			D_DEBUG(DF_DSMS, DF_CONT": already closed: "DF_UUID"\n",
				DP_CONT(cont->c_svc->cs_pool->sp_uuid,
					cont->c_uuid),
				DP_UUID(in->cci_op.ci_hdl));
			rc = 0;
		}
		D_GOTO(out, rc);
	}

	uuid_copy(rec.tcr_hdl, in->cci_op.ci_hdl);
	rec.tcr_hce = chdl.ch_hce;

	D_DEBUG(DF_DSMS, DF_CONT": closing: hdl="DF_UUID" hce="DF_U64"\n",
		DP_CONT(cont->c_svc->cs_pool_uuid, in->cci_op.ci_uuid),
		DP_UUID(rec.tcr_hdl), rec.tcr_hce);

	rc = cont_close_bcast(rpc->cr_ctx, cont->c_svc, &rec, 1 /* nrecs */);
	if (rc != 0)
		D_GOTO(out, rc);

	rc = cont_close_one_hdl(tx, cont->c_svc, rpc->cr_ctx, rec.tcr_hdl);

out:
	D_DEBUG(DF_DSMS, DF_CONT": replying rpc %p: %d\n",
		DP_CONT(pool_hdl->sph_pool->sp_uuid, in->cci_op.ci_uuid), rpc,
		rc);
	return rc;
}
Exemplo n.º 8
0
static int
cont_query(struct rdb_tx *tx, struct ds_pool_hdl *pool_hdl, struct cont *cont,
	   struct container_hdl *hdl, crt_rpc_t *rpc)
{
	struct cont_query_in   *in  = crt_req_get(rpc);
	struct cont_query_out  *out = crt_reply_get(rpc);
	daos_prop_t	       *prop = NULL;
	int			rc = 0;

	D_DEBUG(DF_DSMS, DF_CONT": processing rpc %p: hdl="DF_UUID"\n",
		DP_CONT(pool_hdl->sph_pool->sp_uuid, in->cqi_op.ci_uuid), rpc,
		DP_UUID(in->cqi_op.ci_hdl));

	rc = cont_query_bcast(rpc->cr_ctx, cont, in->cqi_op.ci_pool_hdl,
			      in->cqi_op.ci_hdl, out);
	if (rc)
		return rc;

	/* the allocated prop will be freed after rpc replied in
	 * ds_cont_op_handler.
	 */
	rc = cont_prop_read(tx, cont, in->cqi_bits, &prop);
	out->cqo_prop = prop;

	return rc;
}
Exemplo n.º 9
0
static DFBResult
uc_ovl_set_region( CoreLayer                  *layer,
                   void                       *driver_data,
                   void                       *layer_data,
                   void                       *region_data,
                   CoreLayerRegionConfig      *config,
                   CoreLayerRegionConfigFlags  updated,
                   CoreSurface                *surface,
                   CorePalette                *palette )
{
    UcDriverData*  ucdrv = (UcDriverData*) driver_data;
    UcOverlayData* ucovl = (UcOverlayData*) layer_data;

    /* get new destination rectangle */
    DFBRectangle win = config->dest;;

    // Bounds checking
    if ((win.x < -8192) || (win.x > 8192) ||
        (win.y < -8192) || (win.y > 8192) ||
        (win.w < 32) || (win.w > 4096) ||
        (win.h < 32) || (win.h > 4096))
    {
        D_DEBUG("Layer size or position is out of bounds.");
        return DFB_INVAREA;
    }

    ucovl->v1.isenabled = true;
    ucovl->v1.win = win;

    ucovl->deinterlace = config->options & DLOP_DEINTERLACING;
    ucovl->surface     = surface;

    return uc_ovl_update(ucdrv, ucovl, UC_OVL_CHANGE, surface);
}
Exemplo n.º 10
0
static int
ds_mgmt_fini()
{
	ds_mgmt_tgt_fini();
	D_DEBUG(DB_MGMT, "successfull fini call\n");
	return 0;
}
Exemplo n.º 11
0
static DFBResult
crtc1GetScreenSize( CoreScreen *screen,
                    void       *driver_data,
                    void       *screen_data,
                    int        *ret_width,
                    int        *ret_height )
{
     NVidiaDriverData *nvdrv = (NVidiaDriverData*) driver_data;
     volatile u8      *mmio  = nvdrv->mmio_base;
     int               w, h;
     int               val;

     /* stolen from RivaTV */
     
	w   = nv_incrtc( mmio, CRTC_HORIZ_DISPLAY_END );
	w  |= (nv_incrtc( mmio, CRTC_HORIZ_EXTRA ) & 0x02) << 7;
	w   = (w + 1) << 3;
	
	h   = nv_incrtc( mmio, CRTC_VERT_DISPLAY_END );
	val = nv_incrtc( mmio, CRTC_OVERFLOW );
	h  |= (val & 0x02) << 7;
	h  |= (val & 0x40) << 3;
	h++;
	h  |= nv_incrtc( mmio, CRTC_EXTRA ) << 9;
	h  |= nv_incrtc( mmio, 0x41 ) << 9;
	h >>= (nv_incrtc( mmio, CRTC_MAX_SCAN_LINE ) & 0x80) >> 7;
	
     D_DEBUG( "DirectFB/NVidia/Crtc1: "
              "detected screen resolution %dx%d.\n", w, h );

     *ret_width  = w;
     *ret_height = h;
     
     return DFB_OK;
}
Exemplo n.º 12
0
int
smd_nvme_md_stab_create(struct umem_attr *p_umem_attr,
			struct smd_nvme_stream_tab_df *table_df)
{
	int		rc = 0;
	daos_handle_t	btr_hdl;

	D_ASSERT(table_df->nst_btr.tr_class == 0);
	D_DEBUG(DB_DF, "Create Persistent NVMe MD Device Index, type=%d\n",
		DBTREE_CLASS_SMD_DTAB);

	rc = dbtree_create_inplace(DBTREE_CLASS_SMD_STAB, 0, SMD_STAB_ORDER,
				   p_umem_attr, &table_df->nst_btr, &btr_hdl);
	if (rc) {
		D_ERROR("Persistent NVMe pool dbtree create failed\n");
		D_GOTO(exit, rc);
	}

	rc = dbtree_close(btr_hdl);
	if (rc)
		D_ERROR("Error in closing btree handle\n");
exit:
	return rc;

}
Exemplo n.º 13
0
static void
process_killrank_request(Drpc__Call *drpc_req, Mgmt__DaosResponse *daos_resp)
{
	Mgmt__DaosRank	*pb_rank = NULL;

	mgmt__daos_response__init(daos_resp);

	/* Unpack the daos request from the drpc call body */
	pb_rank = mgmt__daos_rank__unpack(
		NULL, drpc_req->body.len, drpc_req->body.data);

	if (pb_rank == NULL) {
		daos_resp->status = MGMT__DAOS_REQUEST_STATUS__ERR_UNKNOWN;
		D_ERROR("Failed to extract rank from request\n");

		return;
	}

	/* response status is populated with SUCCESS on init */
	D_DEBUG(DB_MGMT, "Received request to kill rank (%u) on pool (%s)\n",
		pb_rank->rank, pb_rank->pool_uuid);

	/* TODO: do something with request and populate daos response status */

	mgmt__daos_rank__free_unpacked(pb_rank, NULL);
}
static void
IDirectFBInputDevice_Dispatcher_Destruct( IDirectFBInputDevice *thiz )
{
     D_DEBUG( "%s (%p)\n", __FUNCTION__, thiz );

     DIRECT_DEALLOCATE_INTERFACE( thiz );
}
Exemplo n.º 15
0
static void
handle_response( VoodooManager         *manager,
                 VoodooResponseMessage *response )
{
     D_MAGIC_ASSERT( manager, VoodooManager );
     D_ASSERT( response != NULL );
     D_ASSERT( response->header.size >= sizeof(VoodooResponseMessage) );
     D_ASSERT( response->header.type == VMSG_RESPONSE );
     D_ASSERT( response->request < manager->msg_serial );

     D_DEBUG( "Voodoo/Dispatch: Handling RESPONSE message %llu (%s) with instance %u for request "
              "%llu (%d bytes).\n", (unsigned long long)response->header.serial, DirectResultString( response->result ),
              response->instance, (unsigned long long)response->request, response->header.size );

     pthread_mutex_lock( &manager->response.lock );

     D_ASSERT( manager->response.current == NULL );

     manager->response.current = response;

     pthread_cond_broadcast( &manager->response.wait );

     while (manager->response.current && !manager->quit)
          pthread_cond_wait( &manager->response.wait, &manager->response.lock );

     pthread_mutex_unlock( &manager->response.lock );
}
Exemplo n.º 16
0
DirectResult
voodoo_manager_quit( VoodooManager *manager )
{
     D_MAGIC_ASSERT( manager, VoodooManager );
     D_ASSUME( !manager->quit );

     if (manager->quit)
          return DR_OK;

     D_DEBUG( "Voodoo/Manager: Quitting manager at %p!\n", manager );

     /* Have all threads quit upon this. */
     manager->quit = true;

     /* Acquire locks and wake up waiters. */
     pthread_mutex_lock( &manager->input.lock );
     pthread_cond_broadcast( &manager->input.wait );
     pthread_mutex_unlock( &manager->input.lock );

     pthread_mutex_lock( &manager->response.lock );
     pthread_cond_broadcast( &manager->response.wait );
     pthread_mutex_unlock( &manager->response.lock );

     pthread_mutex_lock( &manager->output.lock );
     pthread_cond_broadcast( &manager->output.wait );
     pthread_mutex_unlock( &manager->output.lock );

     return DR_OK;
}
Exemplo n.º 17
0
static DFBResult
primarySetRegion( CoreLayer                  *layer,
                  void                       *driver_data,
                  void                       *layer_data,
                  void                       *region_data,
                  CoreLayerRegionConfig      *config,
                  CoreLayerRegionConfigFlags  updated,
                  CoreSurface                *surface,
                  CorePalette                *palette,
                  CoreSurfaceBufferLock      *lock )
{
     DFBResult ret;

     D_DEBUG( "DirectFB/RTD: primarySetRegion\n");

     ret = dfb_rtd_set_video_mode( dfb_rtd_core, config );
     if (ret)
          return ret;

     if (surface)
          dfb_rtd->primary = surface;

     if (palette)
          dfb_rtd_set_palette( palette );

#if 0
     driver_data = (void*) rfb_screen; 
#endif
     
     return DFB_OK;
}
Exemplo n.º 18
0
static int
pool_iv_ent_copy(d_sg_list_t *dst, d_sg_list_t *src)
{
	struct pool_iv_entry *src_iv = src->sg_iovs[0].iov_buf;
	struct pool_iv_entry *dst_iv = dst->sg_iovs[0].iov_buf;

	if (dst_iv == src_iv)
		return 0;

	D_ASSERT(src_iv != NULL);
	D_ASSERT(dst_iv != NULL);

	dst_iv->piv_master_rank = src_iv->piv_master_rank;
	uuid_copy(dst_iv->piv_pool_uuid, src_iv->piv_pool_uuid);
	dst_iv->piv_pool_map_ver = src_iv->piv_pool_map_ver;

	if (src_iv->piv_pool_buf.pb_nr > 0) {
		int src_len = pool_buf_size(src_iv->piv_pool_buf.pb_nr);
		int dst_len = dst->sg_iovs[0].iov_buf_len - sizeof(*dst_iv) +
			      sizeof(struct pool_buf);

		/* copy pool buf */
		if (dst_len < src_len) {
			D_ERROR("dst %d\n src %d\n", dst_len, src_len);
			return -DER_REC2BIG;
		}

		memcpy(&dst_iv->piv_pool_buf, &src_iv->piv_pool_buf, src_len);
	}

	dst->sg_iovs[0].iov_len = src->sg_iovs[0].iov_len;
	D_DEBUG(DB_TRACE, "pool "DF_UUID" map ver %d\n",
		 DP_UUID(dst_iv->piv_pool_uuid), dst_iv->piv_pool_map_ver);
	return 0;
}
static void
IDirectFBImageProvider_Requestor_Destruct( IDirectFBImageProvider *thiz )
{
     D_DEBUG( "%s (%p)\n", __FUNCTION__, thiz );

     DIRECT_DEALLOCATE_INTERFACE( thiz );
}
Exemplo n.º 20
0
static DFBResult
dfb_rtd_set_palette_handler( CorePalette *palette )
{
#if 0
     unsigned int i;
     uint8_t* map;

     rfb_screen->colourMap.count = palette->num_entries;
     rfb_screen->colourMap.is16 = false;
     rfb_screen->serverFormat.trueColour=FALSE;

     D_DEBUG( "DirectFB/RTD: setting colourmap of size %d\n", palette->num_entries);
     
     if( (map = (uint8_t*) malloc(rfb_screen->colourMap.count*sizeof(uint8_t)*3)) == NULL )
          return DFB_NOSYSTEMMEMORY;

     for (i=0; i<palette->num_entries; i++) {
          *(map++) = palette->entries[i].r;
          *(map++) = palette->entries[i].g;
          *(map++) = palette->entries[i].b;
     }

     fusion_skirmish_prevail( &dfb_rtd->lock );

     if( rfb_screen->colourMap.data.bytes )
          free(rfb_screen->colourMap.data.bytes);
     rfb_screen->colourMap.data.bytes = map;

     fusion_skirmish_dismiss( &dfb_rtd->lock );

#endif
     return DFB_OK;
}
Exemplo n.º 21
0
/**
 * Server NVMe get device corresponding to a stream
 *
 * \param	[IN]	stream_id	SMD NVMe stream ID
 * \param	[OUT]	bond		SMD bond information
 *
 * \returns				Zero on success,
 *					negative value on error
 */
int
smd_nvme_get_stream_bond(int stream_id,
			 struct smd_nvme_stream_bond *bond)
{
	struct smd_nvme_stream_df	nvme_stab_args;
	struct smd_store		*store = get_smd_store();
	daos_iov_t			key, value;
	int				rc	 = 0;

	D_DEBUG(DB_TRACE, "looking up device id in stream table\n");
	if (bond == NULL) {
		rc = -DER_INVAL;
		D_ERROR("Missing input parameters: %d\n", rc);
		return rc;
	}
	daos_iov_set(&key, &stream_id, sizeof(stream_id));
	daos_iov_set(&value, &nvme_stab_args,
		     sizeof(struct smd_nvme_stream_df));

	smd_lock(SMD_STAB_LOCK);
	rc = dbtree_lookup(store->sms_stream_tab, &key, &value);
	smd_unlock(SMD_STAB_LOCK);
	if (!rc)
		*bond = nvme_stab_args.ns_map;
	return rc;
}
Exemplo n.º 22
0
static void
IFusionSound_Requestor_Destruct( IFusionSound *thiz )
{
     D_DEBUG( "%s (%p)\n", __FUNCTION__, thiz );

     DIRECT_DEALLOCATE_INTERFACE( thiz );
}
Exemplo n.º 23
0
static void
IVoodooPlayer_Dispatcher_Destruct( IVoodooPlayer *thiz )
{
     D_DEBUG( "%s (%p)\n", __FUNCTION__, thiz );

     DIRECT_DEALLOCATE_INTERFACE( thiz );
}
static void
IDirectFBWindows_Requestor_Destruct( IDirectFBWindows *thiz )
{
     D_DEBUG( "%s (%p)\n", __FUNCTION__, thiz );

     DIRECT_DEALLOCATE_INTERFACE( thiz );
}
Exemplo n.º 25
0
static void
IDirectFBDataBuffer_Requestor_Destruct( IDirectFBDataBuffer *thiz )
{
     D_DEBUG( "%s (%p)\n", __FUNCTION__, thiz );

     IDirectFBDataBuffer_Destruct( thiz );
}
static void
IDirectFBDisplayLayer_Dispatcher_Destruct( IDirectFBDisplayLayer *thiz )
{
     D_DEBUG( "%s (%p)^n", __FUNCTION__, thiz );

     DIRECT_DEALLOCATE_INTERFACE( thiz );
}
Exemplo n.º 27
0
static void
rdb_kvs_free_ref(struct daos_llink *llink)
{
	struct rdb_kvs *kvs = rdb_kvs_obj(llink);

	D_DEBUG(DB_TRACE, "freeing %p "DF_X64"\n", kvs, kvs->de_object);
	D_FREE(kvs);
}
Exemplo n.º 28
0
static int
cont_open_bcast(crt_context_t ctx, struct cont *cont, const uuid_t pool_hdl,
		const uuid_t cont_hdl, uint64_t capas)
{
	struct cont_tgt_open_in	       *in;
	struct cont_tgt_open_out       *out;
	crt_rpc_t		       *rpc;
	int				rc;

	D_DEBUG(DF_DSMS, DF_CONT": bcasting: pool_hdl="DF_UUID" cont_hdl="
		DF_UUID" capas="******"\n",
		DP_CONT(cont->c_svc->cs_pool_uuid, cont->c_uuid),
		DP_UUID(pool_hdl), DP_UUID(cont_hdl), capas);

	rc = ds_cont_bcast_create(ctx, cont->c_svc, CONT_TGT_OPEN, &rpc);
	if (rc != 0)
		D_GOTO(out, rc);

	in = crt_req_get(rpc);
	uuid_copy(in->toi_pool_uuid, cont->c_svc->cs_pool_uuid);
	uuid_copy(in->toi_pool_hdl, pool_hdl);
	uuid_copy(in->toi_uuid, cont->c_uuid);
	uuid_copy(in->toi_hdl, cont_hdl);
	in->toi_capas = capas;

	rc = dss_rpc_send(rpc);
	if (rc != 0)
		D_GOTO(out_rpc, rc);

	out = crt_reply_get(rpc);
	rc = out->too_rc;
	if (rc != 0) {
		D_ERROR(DF_CONT": failed to open %d targets\n",
			DP_CONT(cont->c_svc->cs_pool_uuid, cont->c_uuid), rc);
		rc = -DER_IO;
	}

out_rpc:
	crt_req_decref(rpc);
out:
	D_DEBUG(DF_DSMS, DF_CONT": bcasted: pool_hdl="DF_UUID" cont_hdl="DF_UUID
		" capas="******": %d\n",
		DP_CONT(cont->c_svc->cs_pool_uuid, cont->c_uuid),
		DP_UUID(pool_hdl), DP_UUID(cont_hdl), capas, rc);
	return rc;
}
Exemplo n.º 29
0
static void
driver_close_device(CoreGraphicsDevice * device,
                    void *driver_data, void *device_data)
{
   NSCDeviceData *gxdev = (NSCDeviceData *) device_data;

   (void)gxdev;
   D_DEBUG("DirectFB/nsc: 5");
}
Exemplo n.º 30
0
static DFBResult
uc_ovl_set_region( CoreLayer                  *layer,
                   void                       *driver_data,
                   void                       *layer_data,
                   void                       *region_data,
                   CoreLayerRegionConfig      *config,
                   CoreLayerRegionConfigFlags  updated,
                   CoreSurface                *surface,
                   CorePalette                *palette,
                   CoreSurfaceBufferLock      *lock )
{
    UcDriverData*  ucdrv = (UcDriverData*) driver_data;
    UcOverlayData* ucovl = (UcOverlayData*) layer_data;
    DFBRectangle   win;
    
    /* remember configuration */
    ucovl->config = *config;

    /* get new destination rectangle */
    win = config->dest;

    // Bounds checking
    if ((win.x < -8192) || (win.x > 8192) ||
        (win.y < -8192) || (win.y > 8192) ||
        (win.w < 32) || (win.w > 4096) ||
        (win.h < 32) || (win.h > 4096))
    {
        D_DEBUG("Layer size or position is out of bounds.");
        return DFB_INVAREA;
    }

    ucovl->v1.isenabled = true;
    ucovl->v1.win = win;
    ucovl->v1.dst_key = config->dst_key;
    ucovl->v1.dstkey_enabled = config->options & DLOP_DST_COLORKEY;
    
    if (config->options & DLOP_OPACITY)
        ucovl->v1.opacity = config->opacity;
    else
        ucovl->v1.opacity = 0xff;

    // printf("uc_overlay: color-keying is %s\n",
    //     ucovl->v1.dstkey_enabled ? "enabled" : "disabled");

    ucovl->deinterlace = config->options & DLOP_DEINTERLACING;
    ucovl->surface     = surface;
    ucovl->lock        = lock;

    if (ucdrv->canfliponvsync) {
        FBDev *dfb_fbdev = dfb_system_data();
        int field_option = VIAFB_WAIT_FLIP; // wait for any pending flip
        ioctl(dfb_fbdev->fd, FBIO_WAITFORVSYNC, &field_option);
    }

    return uc_ovl_update(ucdrv, ucovl, UC_OVL_CHANGE, surface, lock);
}