Esempio n. 1
0
File: kbicho.c Progetto: taysom/tau
static kbicho_s *lookup_bicho_by_id (guid_t id)
{
	kbicho_s	*bicho = NULL;

	for (;;) {
		next_dq(bicho, &Kbicho, kb_link);
		if (!bicho) return NULL;
		if (uuid_compare(id, bicho->kb_id) == 0) return bicho;
	}
}
Esempio n. 2
0
int get_interface(void **pp, const uuid_t uuid)
{
        if(uuid_compare(uuid, UUID_OH_ABI_V2)==0) {
                *pp = &oh_snmp_rsa_plugin;
                return 0;
        }

        *pp = NULL;
        return -1;
}
Esempio n. 3
0
/* Simple driver for UUID generator */
void main(int argc, char **argv)
{
    uuid_t u;
    int f;
    int i;
    for(i=0;i<100;i++) {
      uuid_create(&u);
      printf("uuid_create(): "); puid(u);
    }

    f = uuid_compare(&u, &u);
    printf("uuid_compare(u,u): %d\n", f);     /* should be 0 */
    f = uuid_compare(&u, &NameSpace_DNS);
    printf("uuid_compare(u, NameSpace_DNS): %d\n", f); /* s.b. 1 */
    f = uuid_compare(&NameSpace_DNS, &u);
    printf("uuid_compare(NameSpace_DNS, u): %d\n", f); /* s.b. -1 */
    uuid_create_md5_from_name(&u, NameSpace_DNS, "www.widgets.com", 15);
    printf("uuid_create_md5_from_name(): "); puid(u);
}
Esempio n. 4
0
/*
 * Match against fs_label/pfs_fsid.  Together these two items represent a
 * unique node.  In most cases the primary differentiator is pfs_fsid but
 * we also string-match fs_label.
 */
static
int
h2span_node_cmp(h2span_node_t *node1, h2span_node_t *node2)
{
	int r;

	r = strcmp(node1->fs_label, node2->fs_label);
	if (r == 0)
		r = uuid_compare(&node1->pfs_fsid, &node2->pfs_fsid, NULL);
	return (r);
}
Esempio n. 5
0
static int
shall_close(const uuid_t pool_hdl, uuid_t *pool_hdls, int n_pool_hdls)
{
	int i;

	for (i = 0; i < n_pool_hdls; i++) {
		if (uuid_compare(pool_hdls[i], pool_hdl) == 0)
			return 1;
	}
	return 0;
}
Esempio n. 6
0
/**
 * get_interface:
 * @pp: Location of a pointer to the plugin interface structure.
 * @uuid: Intra-structure's ABI version.
 *
 * Checks that the ABI version supported by the plugin is compatible with that
 * supported by the core infra-structure code.
 *
 * Return values:
 * SA_OK - Normal case.
 * SA_ERR_HPI_INTERNAL_ERROR - Infra-structure and plugin ABI versions are incompatible.
 **/
SaErrorT get_interface(void **pp, const uuid_t uuid)
{
        if (uuid_compare(uuid, UUID_OH_ABI_V2) == 0) {
                *pp = &oh_snmp_bc_plugin;
                return(SA_OK);
        }

        *pp = NULL;
	dbg("Incompatable plugin ABI version");
        return(SA_ERR_HPI_INTERNAL_ERROR);
}
Esempio n. 7
0
static void
smd_ut_listing_test(void **state)
{
	int				i, rc = 0, stream;
	uint32_t			nr = 5;
	daos_anchor_t			anchor;
	struct smd_nvme_stream_bond	*bonds, streams[10];

	daos_anchor_set_zero(&anchor);
	bonds = &streams[0];
	rc = smd_nvme_list_streams(&nr, bonds, &anchor);
	assert_int_equal(rc, 0);
	assert_int_equal(nr, 5);
	for (i = 0; i < nr; i++) {
		stream = global_stream_list[i] = (i + 1);
		assert_int_equal(stream, streams[i].nsm_stream_id);
		rc = uuid_compare(global_uuid, streams[i].nsm_dev_id);
		assert_int_equal(rc, 0);
	}
	bonds = &streams[5];
	rc = smd_nvme_list_streams(&nr, bonds, &anchor);
	assert_int_equal(rc, 0);
	assert_int_equal(nr, 5);
	for (i = nr; i < nr*2; i++) {
		stream = global_stream_list[i] = (i + 1);
		assert_int_equal(stream, streams[i].nsm_stream_id);
		rc = uuid_compare(global_uuid, streams[i].nsm_dev_id);
		assert_int_equal(rc, 0);
	}

	memset(&streams[0], '0', (10 * sizeof(struct smd_nvme_stream_bond)));
	bonds = &streams[0];
	rc = smd_nvme_list_streams(&nr, bonds, &anchor);
	assert_int_equal(rc, 0);
	assert_int_equal(nr, 1);
	assert_int_equal(streams[0].nsm_stream_id, 2000);
	global_stream_list[10] = 2000;
	rc = uuid_compare(global_uuid, streams[0].nsm_dev_id);
	assert_int_equal(rc, 0);
}
Esempio n. 8
0
/* Simple driver for UUID generator */
int main(int argc, char **argv)
{
    UUID_T u;
    int f;
    
    if (uuid_sys_init("eth0") == ERROR)
    {
        printf("UUID system initialization error!\n");
        return ERROR;
    }

    uuid_create(&u);
    puid(u);

    f = uuid_compare(&u, &u);
    printf("uuid_compare(u,u): %d\n", f);     /* should be 0 */
    f = uuid_compare(&u, &NameSpace_DNS);
    printf("uuid_compare(u, NameSpace_DNS): %d\n", f); /* s.b. 1 */
    f = uuid_compare(&NameSpace_DNS, &u);

    return OK;
}
Esempio n. 9
0
/* Simple driver for UUID generator */
void main(int argc, char **argv)
{
    uuid_t u;
    int f;

    uuid_create(&u);
    printf("uuid_create(): "); puid(u);

    char my_uuid[35];
    gen_uuid(my_uuid, 35);
    printf("my_uuid:%s\n", my_uuid);


    f = uuid_compare(&u, &u);
    printf("uuid_compare(u,u): %d\n", f);     /* should be 0 */
    f = uuid_compare(&u, &NameSpace_DNS);
    printf("uuid_compare(u, NameSpace_DNS): %d\n", f); /* s.b. 1 */
    f = uuid_compare(&NameSpace_DNS, &u);
    printf("uuid_compare(NameSpace_DNS, u): %d\n", f); /* s.b. -1 */
    uuid_create_md5_from_name(&u, NameSpace_DNS, "www.widgets.com", 15);
    printf("uuid_create_md5_from_name(): "); puid(u);
}
Esempio n. 10
0
int h_core_uuid_compare(void *uuid_object_a,
    void *uuid_object_b)
{
  assert(uuid_object_a);
  assert(uuid_object_b);
  h_core_uuid_t *uuid_a;
  h_core_uuid_t *uuid_b;

  uuid_a = uuid_object_a;
  uuid_b = uuid_object_b;

  return uuid_compare(uuid_a->uuid, uuid_b->uuid);
}
Esempio n. 11
0
int
cl_uuid_compare(const cl_uuid_t* uu1, const cl_uuid_t* uu2)
{
    if (uu1 == NULL || uu2 == NULL) {
        cl_log(LOG_ERR, "cl_uuid_compare: "
               " wrong argument (%s is NULL)",
               uu1 == NULL?"uu1":"uu2");
        assert(0);
    }

    return uuid_compare(uu1->uuid, uu2->uuid);

}
Esempio n. 12
0
int main(int argc, char **argv) {
#else
  void main(int argc, char **argv) {
#endif
    uuid_t u;
    int f;

    uuid_create(&u);
    printf("uuid_create()             -> "); puid(u);

    f = uuid_compare(&u, &u);
    printf("uuid_compare(u,u): %d\n", f);     /* should be 0 */
    f = uuid_compare(&u, &NameSpace_DNS);
    printf("uuid_compare(u, NameSpace_DNS): %d\n", f); /* s.b. 1 */
    f = uuid_compare(&NameSpace_DNS, &u);
    printf("uuid_compare(NameSpace_DNS, u): %d\n", f); /* s.b. -1 */

    uuid_create_from_name(&u, NameSpace_DNS, "www.widgets.com", 15);
    printf("uuid_create_from_name() -> "); puid(u);
#ifdef BUILD_HACK
    return 0;
#endif
  };
Esempio n. 13
0
static void queue_jlog_dispose(fq_rk *qname, fqd_queue_impl_data f) {
  struct queue_jlog *d = (struct queue_jlog *)f;
  uuid_t exist;
  (void)qname;
  uuid_clear(exist);
  read_sig(d, exist);
  if(uuid_compare(d->uuid, exist) == 0) {
    /* This is my jlog queue ... I can delete it */
    fq_debug(FQ_DEBUG_IO, "jlog: removing %s\n", d->qpath);
    nftw(d->qpath, multi_unlink, 2, FTW_DEPTH);
    rmdir(d->qpath);
  }
  free(d);
}
Esempio n. 14
0
__BEGIN_DECLS
int
get_interface( void **pp, const uuid_t uuid )
{
  if ( uuid_compare( uuid, UUID_OH_ABI_V2 ) != 0 )
     {
       *pp = NULL;
       return -1;
     }

  if ( !oh_ipmi_plugin_init )
     {
       memset( &oh_ipmi_plugin, 0, sizeof(oh_ipmi_plugin) );

       oh_ipmi_plugin.open                     = IpmiOpen;
       oh_ipmi_plugin.close                    = IpmiClose;
       oh_ipmi_plugin.get_event                = IpmiGetEvent;
       oh_ipmi_plugin.discover_resources       = IpmiDiscoverResources;
       oh_ipmi_plugin.set_resource_severity    = IpmiSetResourceSeverity;
       oh_ipmi_plugin.get_sel_info             = IpmiGetSelInfo;
       oh_ipmi_plugin.set_sel_time             = IpmiSetSelTime;
       oh_ipmi_plugin.add_sel_entry            = IpmiAddSelEntry;
       oh_ipmi_plugin.del_sel_entry            = IpmiDelSelEntry;
       oh_ipmi_plugin.get_sel_entry            = IpmiGetSelEntry;
       oh_ipmi_plugin.clear_sel                = IpmiClearSel;
       oh_ipmi_plugin.get_sensor_data          = IpmiGetSensorData;
       oh_ipmi_plugin.get_sensor_thresholds    = IpmiGetSensorThresholds;
       oh_ipmi_plugin.set_sensor_thresholds    = IpmiSetSensorThresholds;
       oh_ipmi_plugin.get_sensor_event_enables = IpmiGetSensorEventEnables;
       oh_ipmi_plugin.set_sensor_event_enables = IpmiSetSensorEventEnables;
       oh_ipmi_plugin.get_inventory_size       = IpmiGetInventorySize;
       oh_ipmi_plugin.get_inventory_info       = IpmiGetInventoryInfo;
       oh_ipmi_plugin.get_hotswap_state        = IpmiGetHotswapState;
       oh_ipmi_plugin.set_hotswap_state        = IpmiSetHotswapState;
       oh_ipmi_plugin.request_hotswap_action   = IpmiRequestHotswapAction;
       oh_ipmi_plugin.get_power_state          = IpmiGetPowerState;
       oh_ipmi_plugin.set_power_state          = IpmiSetPowerState;
       oh_ipmi_plugin.get_indicator_state      = IpmiGetIndicatorState;
       oh_ipmi_plugin.set_indicator_state      = IpmiSetIndicatorState;
       oh_ipmi_plugin.control_parm             = IpmiControlParm;
       oh_ipmi_plugin.get_reset_state          = IpmiGetResetState;
       oh_ipmi_plugin.set_reset_state          = IpmiSetResetState;

       oh_ipmi_plugin_init = true;
     }
 
  *pp = &oh_ipmi_plugin;
  return 0;
}
Esempio n. 15
0
DC_Workunit *_DC_getWUByName(const char *name)
{
	DC_Workunit *wu;
	char *uuid_str;
	uuid_t uuid;
	int ret;

	if (_DC_wu_table)
	{
		wu = (DC_Workunit *)g_hash_table_lookup(_DC_wu_table, name);
		if (wu)
			return wu;
	}

	/* Check if the WU belongs to this application */
	uuid_str = g_strndup(name, 36);
	ret = uuid_parse(uuid_str, uuid);
	g_free(uuid_str);
	if (ret)
	{
		DC_log(LOG_ERR, "WU name contains illegal UUID");
		return NULL;
	}

	if (uuid_compare(uuid, project_uuid))
	{
		DC_log(LOG_WARNING, "WU does not belong to this application");
		return NULL;
	}

	if (name[36] != '_')
	{
		DC_log(LOG_ERR, "Illegal WU name syntax");
		return NULL;
	}

	/* Check the WU's UUID */
	uuid_str = g_strndup(name + 37, 36);
	ret = uuid_parse(uuid_str, uuid);
	g_free(uuid_str);
	if (ret)
	{
		DC_log(LOG_ERR, "WU name contains illegal UUID");
		return NULL;
	}

	DC_log(LOG_ERR, "WU %s not found!", name);
	return NULL;
}
Esempio n. 16
0
static int check_session(server *srv, connection *con, plugin_data *p,
		bits_packet_t packet_type)
{
	int err;
	buffer *req_session_id;
	uuid_t req_session_uuid;
	char uuid_str[UUID_STR_LEN];

	if (packet_type == BITS_PING ||
	    packet_type == BITS_CREATE_SESSION) {
		return 0;
	}

	if (uuid_is_null(p->session_id)) {
		LOG("s", "ERROR: No-one is logged in.");
		return -EINVAL;
	}

	uuid_clear(req_session_uuid);
	req_session_id = get_bits_session_id(srv, con);
	if (!req_session_id) {
		LOG("s", "ERROR: No session ID provided in request");
		return -EINVAL;
	}

	if (strlen(req_session_id->ptr) != UUID_IN_BRACES_STR_LEN -1) {
		LOG("ss", "ERROR: session ID invalid:",
		    req_session_id->ptr);
		return -EINVAL;
	}
	strncpy(uuid_str, req_session_id->ptr + 1, UUID_STR_LEN - 1);
	uuid_str[UUID_STR_LEN - 1] = '\0';
	err = uuid_parse(uuid_str, req_session_uuid);
	if (err) {
		LOG("ss", "ERROR: session ID not a valid UUID:",
		    uuid_str);
		return -EINVAL;
	}

	if (uuid_compare(p->session_id, req_session_uuid)) {
		char uuid_str2[UUID_STR_LEN];
		uuid_unparse(p->session_id, uuid_str2);
		LOG("ssss", "ERROR: Wrong session ID:",
		    req_session_id->ptr, "expect:", uuid_str2);
		return -EINVAL;
	}

	return 0;
}
Esempio n. 17
0
File: rep_ep.c Progetto: tniuli/xio
static int repep_add (struct epbase *ep, struct tgtd *tg, char *ubuf)
{
	struct rtentry *rt = rt_cur (ubuf);

	if (uuid_compare (rt->uuid, get_rep_tgtd (tg)->uuid) )
		uuid_copy (get_rep_tgtd (tg)->uuid, rt->uuid);
	DEBUG_OFF ("ep %d recv req %10.10s from socket %d", ep->eid, ubuf, tg->fd);
	mutex_lock (&ep->lock);
	skbuf_head_in (&ep->rcv, ubuf);
	BUG_ON (ep->rcv.waiters < 0);
	if (ep->rcv.waiters)
		condition_broadcast (&ep->cond);
	mutex_unlock (&ep->lock);
	return 0;
}
Esempio n. 18
0
int
get_interface( void **pp, const uuid_t uuid )
{
  if ( uuid_compare( uuid, UUID_OH_ABI_V2 ) != 0 )
     {
       *pp = NULL;
       return -1;
     }

  if ( !oh_remote_client_plugin_init )
     {
       memset( &oh_remote_client_plugin, 0, sizeof(oh_abi_v2) );

       oh_remote_client_plugin.open                     = RemoteClientOpen;
       oh_remote_client_plugin.close                    = RemoteClientClose;
       oh_remote_client_plugin.get_event                = RemoteClientGetEvent;
       oh_remote_client_plugin.discover_resources       = RemoteClientDiscoverResources;
       oh_remote_client_plugin.set_resource_severity    = RemoteClientSetResourceSeverity;
       oh_remote_client_plugin.get_sel_info             = RemoteClientGetSelInfo;
       oh_remote_client_plugin.set_sel_time             = RemoteClientSetSelTime;
       oh_remote_client_plugin.add_sel_entry            = RemoteClientAddSelEntry;
       oh_remote_client_plugin.del_sel_entry            = RemoteClientDelSelEntry;
       oh_remote_client_plugin.get_sel_entry            = RemoteClientGetSelEntry;
       oh_remote_client_plugin.clear_sel                = RemoteClientClearSel;
       oh_remote_client_plugin.get_sensor_data          = RemoteClientGetSensorData;
       oh_remote_client_plugin.get_sensor_thresholds    = RemoteClientGetSensorThresholds;
       oh_remote_client_plugin.set_sensor_thresholds    = RemoteClientSetSensorThresholds;
       oh_remote_client_plugin.get_sensor_event_enables = RemoteClientGetSensorEventEnables;
       oh_remote_client_plugin.set_sensor_event_enables = RemoteClientSetSensorEventEnables;
       oh_remote_client_plugin.get_control_state        = RemoteClientGetControlState;
       oh_remote_client_plugin.set_control_state        = RemoteClientSetControlState;
       oh_remote_client_plugin.get_inventory_size       = RemoteClientGetInventorySize;
       oh_remote_client_plugin.get_inventory_info       = RemoteClientGetInventoryInfo;
       oh_remote_client_plugin.get_hotswap_state        = RemoteClientGetHotswapState;
       oh_remote_client_plugin.set_hotswap_state        = RemoteClientSetHotswapState;
       oh_remote_client_plugin.request_hotswap_action   = RemoteClientRequestHotswapAction;
       oh_remote_client_plugin.get_power_state          = RemoteClientGetPowerState;
       oh_remote_client_plugin.set_power_state          = RemoteClientSetPowerState;
       oh_remote_client_plugin.get_indicator_state      = RemoteClientGetIndicatorState;
       oh_remote_client_plugin.set_indicator_state      = RemoteClientSetIndicatorState;
       oh_remote_client_plugin.control_parm             = RemoteClientControlParm;
       oh_remote_client_plugin.get_reset_state          = RemoteClientGetResetState;
       oh_remote_client_plugin.set_reset_state          = RemoteClientSetResetState;
     }

  *pp = &oh_remote_client_plugin;
  return 0;
}
Esempio n. 19
0
int uuuid_compare(struct uuuid_t* u1, struct uuuid_t* u2, int* status)
{
	uint32_t st;
	int ret;

	ret = uuid_compare(&u1->uuid, &u2->uuid, &st);

	if (st != uuid_s_ok) {
		*status = UUUID_ERR;
		return -1;
	}

	*status = UUUID_OK;

	return ret;
}
Esempio n. 20
0
static UUIDJobNode *GetServiceJobNode (ServicesListManager *manager_p, const uuid_t job_key)
{
	UUIDJobNode *node_p = (UUIDJobNode *) manager_p -> slm_running_services.ll_head_p;

	while (node_p)
		{
			if (uuid_compare (node_p -> ujn_id, job_key) == 0)
				{
					return node_p;
				}

			node_p = (UUIDJobNode *) (node_p -> ujn_node.ln_next_p);
		}

	return NULL;
}
Esempio n. 21
0
int SessionDao::del(uuid_t id)
{
    std::vector<Session>::iterator itr = sessionMap_ma.begin();
    for(; itr!= sessionMap_ma.end(); ++itr)
    {
        Session& se = *itr;
        if(uuid_compare(se.sessionKey, id) == 0)
        {
            sessionMap_ma.erase(itr);
            return 0;
        }

    }

    return -1;
}
Esempio n. 22
0
/*
 * Cluster peer_type, uuid, AND label must match for a match
 */
static
int
h2span_cluster_cmp(h2span_cluster_t *cls1, h2span_cluster_t *cls2)
{
	int r;

	if (cls1->peer_type < cls2->peer_type)
		return(-1);
	if (cls1->peer_type > cls2->peer_type)
		return(1);
	r = uuid_compare(&cls1->pfs_clid, &cls2->pfs_clid, NULL);
	if (r == 0)
		r = strcmp(cls1->cl_label, cls2->cl_label);

	return r;
}
Esempio n. 23
0
static void
smd_ut_fetch_devtab_streams(void **state)
{
	int				i, rc	= 0;
	struct smd_nvme_device_info	info;

	memset(&info, 0, sizeof(struct smd_nvme_device_info));
	rc = smd_nvme_get_device(global_uuid, &info);
	assert_int_equal(rc, 0);
	assert_int_equal(uuid_compare(info.ndi_dev_id, global_uuid), 0);
	assert_int_equal(info.ndi_xs_cnt, 11);
	for (i = 0; i < info.ndi_xs_cnt; i++) {
		print_message("streams[%d]: %d, gstreams[%d]: %d\n",
		       i, info.ndi_xstreams[i], i, global_stream_list[i]);
		assert_int_equal(info.ndi_xstreams[i], global_stream_list[i]);
	}
}
Esempio n. 24
0
int readMessage(uuid_t node, struct Message *message) {
	struct element *prev = NULL;
	for( struct element *p = root; p != NULL; p = p->next ) {
		if( uuid_compare(p->nodeID, node) == 0 ) {
			*message = p->message;
			if( prev == NULL ) {
				root = p->next;
			} else {
				prev->next = p->next;
			}
			free(p);
			return 1;
		}
		prev = p;
	}
	return 0;
}
Esempio n. 25
0
bool_t
mobj_eql ( inv_mediafile_t *mfp, invt_mobjinfo_t *mobj )
{

	if ( mobj->type == INVT_MOID ) {
		if ( !uuid_compare( *((uuid_t*) mobj->value), 
			      mfp->m_moid) ) {
			return BOOL_TRUE;
		}
	} else {
		if ( STREQL( (char*) mobj->value, 
			    mfp->m_label ) ) {
			return BOOL_TRUE;
		}
	}
	
	return BOOL_FALSE;
}
END_TEST

START_TEST (test_msrpc_rts_get_virtual_channel_cookie)
{
    const char *pdu = testset_msrpc_rts_get_virtual_channel_cookie[_i].data;
    const uuid_t *expected_cookie = &testset_msrpc_rts_get_virtual_channel_cookie[_i].cookie;
    uuid_t *cookie = NULL;
    const char *error = NULL;

    apr_status_t rv = msrpc_rts_get_virtual_channel_cookie(pdu, &cookie, &error);
    fail_unless(rv == APR_SUCCESS, " for iteration %u\n"
                "EXPECTED no error, BUT GOT rv: %u (%s)", _i, rv, error);
    if (uuid_compare(*expected_cookie, *cookie) != 0) {
        char expected_uuid[37];
        uuid_unparse(*expected_cookie, expected_uuid);
        char parsed_uuid[37];
        uuid_unparse(*cookie, parsed_uuid);
        fail(" for iteration %u\nEXPECTED cookie %s, BUT GOT cookie: %s", _i, expected_uuid, parsed_uuid);
    }
}
Esempio n. 27
0
static void
smd_ut_add_and_fetch_devtab(void **state)
{
	int				rc	= 0;
	uuid_t				dev_uuid;
	struct smd_nvme_device_info	info;

	uuid_generate(dev_uuid);
	rc = smd_nvme_set_device_status(dev_uuid, SMD_NVME_NORMAL);
	assert_int_equal(rc, 0);

	memset(&info, 0, sizeof(struct smd_nvme_device_info));
	rc = smd_nvme_get_device(dev_uuid, &info);
	assert_int_equal(rc, 0);

	rc = uuid_compare(dev_uuid, info.ndi_dev_id);
	assert_int_equal(rc, 0);
	assert_int_equal(info.ndi_status, SMD_NVME_NORMAL);
	assert_int_equal(info.ndi_xs_cnt, 0);
}
Esempio n. 28
0
static struct ndctl_btt *check_valid_btt(struct ndctl_region *region,
		struct ndctl_namespace *ndns, uuid_t btt_uuid)
{
	struct ndctl_btt *btt = NULL;
	ndctl_btt_foreach(region, btt) {
		struct ndctl_namespace *btt_ndns;
		uuid_t uu;

		ndctl_btt_get_uuid(btt, uu);
		if (uuid_compare(uu, btt_uuid) != 0)
			continue;
		if (!ndctl_btt_is_enabled(btt))
			continue;
		btt_ndns = ndctl_btt_get_namespace(btt);
		if (strcmp(ndctl_namespace_get_devname(btt_ndns),
				ndctl_namespace_get_devname(ndns)) != 0)
			continue;
		return btt;
	}
	return NULL;
}
Esempio n. 29
0
static void
smd_ut_add_and_fetch_stab(void **state)
{
	int					rc	= 0;
	int					stream;
	struct smd_nvme_stream_bond		bond;

	stream = 2000;
	uuid_generate(global_uuid);

	smd_nvme_set_stream_bond(stream, global_uuid, &bond);
	rc = smd_nvme_add_stream_bond(&bond);
	assert_int_equal(rc, 0);

	memset(&bond, '0', sizeof(struct smd_nvme_stream_bond));
	rc = smd_nvme_get_stream_bond(stream, &bond);
	assert_int_equal(rc, 0);

	rc = uuid_compare(global_uuid, bond.nsm_dev_id);
	assert_int_equal(rc, 0);
	assert_int_equal(bond.nsm_stream_id, stream);
}
Esempio n. 30
0
File: rep_ep.c Progetto: tniuli/xio
static int repep_send (struct epbase *ep, char *ubuf)
{
	int rc = -1;
	struct rrhdr *pg = get_rrhdr (ubuf);
	struct rtentry *rt = rt_cur (ubuf);
	struct tgtd *tg = 0;

	mutex_lock (&ep->lock);
	get_tgtd_if (tg, &ep->connectors, !uuid_compare (get_rep_tgtd (tg)->uuid, rt->uuid) );
	if (tg)
		list_move (&tg->item, &ep->connectors);
	mutex_unlock (&ep->lock);

	pg->go = 0;
	pg->end_ttl = pg->ttl;

	if (tg) {
		rc = xsend (tg->fd, ubuf);
		DEBUG_OFF ("ep %d send resp %10.10s to socket %d", ep->eid, ubuf, tg->fd);
	}
	return rc;
}