• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ dbg_log函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中dbg_log函数的典型用法代码示例。如果您正苦于以下问题:C++ dbg_log函数的具体用法?C++ dbg_log怎么用?C++ dbg_log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了dbg_log函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: ubifs_add_bud

/**
 * ubifs_add_bud - add bud LEB to the tree of buds and its journal head list.
 * @c: UBIFS file-system description object
 * @bud: the bud to add
 */
void ubifs_add_bud(struct ubifs_info *c, struct ubifs_bud *bud)
{
	struct rb_node **p, *parent = NULL;
	struct ubifs_bud *b;
	struct ubifs_jhead *jhead;

	spin_lock(&c->buds_lock);
	p = &c->buds.rb_node;
	while (*p) {
		parent = *p;
		b = rb_entry(parent, struct ubifs_bud, rb);
		ubifs_assert(bud->lnum != b->lnum);
		if (bud->lnum < b->lnum)
			p = &(*p)->rb_left;
		else
			p = &(*p)->rb_right;
	}

	rb_link_node(&bud->rb, parent, p);
	rb_insert_color(&bud->rb, &c->buds);
	if (c->jheads) {
		jhead = &c->jheads[bud->jhead];
		list_add_tail(&bud->list, &jhead->buds_list);
	} else
		ubifs_assert(c->replaying && c->ro_mount);

	/*
	 * Note, although this is a new bud, we anyway account this space now,
	 * before any data has been written to it, because this is about to
	 * guarantee fixed mount time, and this bud will anyway be read and
	 * scanned.
	 */
	c->bud_bytes += c->leb_size - bud->start;

	dbg_log("LEB %d:%d, jhead %s, bud_bytes %lld", bud->lnum,
		bud->start, dbg_jhead(bud->jhead), c->bud_bytes);
	spin_unlock(&c->buds_lock);
}
开发者ID:4Fwolf,项目名称:motorola-hawk-kernel-3.4.67,代码行数:43,代码来源:log.c


示例2: sdcard_set_of_name_board

static void sdcard_set_of_name_board(char *of_name)
{
	unsigned int cpu_board_id = get_cm_sn();
	unsigned int disp_board_id = get_dm_sn();

	if (cpu_board_id == BOARD_ID_SAM9G15_CM)
		strcpy(of_name, "at91sam9g15ek");
	else if (cpu_board_id == BOARD_ID_SAM9G25_CM)
		strcpy(of_name, "at91sam9g25ek");
	else if (cpu_board_id == BOARD_ID_SAM9G35_CM)
		strcpy(of_name, "at91sam9g35ek");
	else if (cpu_board_id == BOARD_ID_SAM9X25_CM)
		strcpy(of_name, "at91sam9x25ek");
	else if (cpu_board_id == BOARD_ID_SAM9X35_CM)
		strcpy(of_name, "at91sam9x35ek");
	else
		dbg_log(1, "WARNING: Not correct CPU board ID\n\r");

	if (disp_board_id == BOARD_ID_PDA_DM)
		strcat(of_name, "_pda");

	strcat(of_name, ".dtb");
}
开发者ID:husthl,项目名称:at91bootstrap,代码行数:23,代码来源:at91sam9x5ek.c


示例3: rawDataUpdate8slen

uint8_t   rawDataUpdate8slen(RawData *raw_data, const uint32_t offset, const uint8_t *data, const uint32_t len)
{
    uint32_t num;
    uint8_t *buffer;

    if(offset + sizeof(uint32_t) + len > raw_data->cur_size)
    {
        dbg_log(SEC_0132_RAW, 0)(LOGSTDOUT, "error:rawDataUpdate8slen: offset %d + %d + len %d > cur_size %d\n",
                            offset, sizeof(uint32_t), len, raw_data->cur_size);
        return RAW_FILE_FAIL;
    }

    num = gdb_hton_uint32(len);

    buffer = raw_data->buffer + offset;
    memcpy(buffer, &num, sizeof(uint32_t));

    buffer += sizeof(uint32_t);
    memcpy(buffer, data, len);

    RAWDATA_SET_DIRTY(raw_data);
    return RAW_FILE_SUCC;
}
开发者ID:petercloud,项目名称:RFS,代码行数:23,代码来源:raw_data.c


示例4: cextsrv_req_encode_size

EC_BOOL cextsrv_req_encode_size(CEXTSRV *cextsrv, const TASK_FUNC *task_req_func, UINT32 *size)
{
    FUNC_ADDR_NODE *func_addr_node;

    UINT32 send_comm;

    /*clear size*/
    *size = 0;

    send_comm = CMPI_ANY_COMM;

    if(0 != dbg_fetch_func_addr_node_by_index(task_req_func->func_id, &func_addr_node))
    {
        dbg_log(SEC_0069_CEXTSRV, 0)(LOGSTDOUT, "error:cextsrv_req_encode_size: failed to fetch func addr node by func id %lx\n", task_req_func->func_id);
        return (EC_FALSE);
    }

    cmpi_encode_uint32_size(send_comm, (task_req_func->func_id), size);
    cmpi_encode_uint32_size(send_comm, (task_req_func->func_para_num), size);

    task_req_func_para_encode_size(send_comm, func_addr_node->func_para_num, (FUNC_PARA *)task_req_func->func_para, func_addr_node, size);

    return (EC_TRUE);
}
开发者ID:inevity,项目名称:ebgn,代码行数:24,代码来源:cextsrv.c


示例5: ubifs_log_start_commit

/**
 * ubifs_log_start_commit - start commit.
 * @c: UBIFS file-system description object
 * @ltail_lnum: return new log tail LEB number
 *
 * The commit operation starts with writing "commit start" node to the log and
 * reference nodes for all journal heads which will define new journal after
 * the commit has been finished. The commit start and reference nodes are
 * written in one go to the nearest empty log LEB (hence, when commit is
 * finished UBIFS may safely unmap all the previous log LEBs). This function
 * returns zero in case of success and a negative error code in case of
 * failure.
 */
int ubifs_log_start_commit(struct ubifs_info *c, int *ltail_lnum)
{
	void *buf;
	struct ubifs_cs_node *cs;
	struct ubifs_ref_node *ref;
	int err, i, max_len, len;

	err = dbg_check_bud_bytes(c);
	if (err)
		return err;

	max_len = UBIFS_CS_NODE_SZ + c->jhead_cnt * UBIFS_REF_NODE_SZ;
	max_len = ALIGN(max_len, c->min_io_size);
	buf = cs = kmalloc(max_len, GFP_NOFS);
	if (!buf)
		return -ENOMEM;

	cs->ch.node_type = UBIFS_CS_NODE;
	cs->cmt_no = cpu_to_le64(c->cmt_no);
	ubifs_prepare_node(c, cs, UBIFS_CS_NODE_SZ, 0);

	/*
	 * Note, we do not lock 'c->log_mutex' because this is the commit start
	 * phase and we are exclusively using the log. And we do not lock
	 * write-buffer because nobody can write to the file-system at this
	 * phase.
	 */

	len = UBIFS_CS_NODE_SZ;
	for (i = 0; i < c->jhead_cnt; i++) {
		int lnum = c->jheads[i].wbuf.lnum;
		int offs = c->jheads[i].wbuf.offs;

		if (lnum == -1 || offs == c->leb_size)
			continue;

		dbg_log("add ref to LEB %d:%d for jhead %s",
			lnum, offs, dbg_jhead(i));
		ref = buf + len;
		ref->ch.node_type = UBIFS_REF_NODE;
		ref->lnum = cpu_to_le32(lnum);
		ref->offs = cpu_to_le32(offs);
		ref->jhead = cpu_to_le32(i);

		ubifs_prepare_node(c, ref, UBIFS_REF_NODE_SZ, 0);
		len += UBIFS_REF_NODE_SZ;
	}

	ubifs_pad(c, buf + len, ALIGN(len, c->min_io_size) - len);

#ifdef CONFIG_UBIFS_FS_FULL_USE_LOG
	/* Not Switch to next log LEB, programming next available page in the same log LEB continuously*/

	/* if available page is in the end of the LEB, switch to next LEB*/
	if(c->lhead_offs >= (c->leb_size - (c->min_io_size * 4)) )
	{
		int old_lnum = c->lhead_lnum;
		int old_offs = c->lhead_offs;
		c->lhead_lnum = ubifs_next_log_lnum(c, c->lhead_lnum);
		c->lhead_offs = 0;
		ubifs_msg("switch log LEB %d:%d to %d:%d\n", old_lnum, old_offs, c->lhead_lnum, c->lhead_offs);
	}
#else
	/* Switch to the next log LEB */
	if (c->lhead_offs) {
		int old_lnum = c->lhead_lnum;
		int old_offs = c->lhead_offs;
		c->lhead_lnum = ubifs_next_log_lnum(c, c->lhead_lnum);
		c->lhead_offs = 0;
		ubifs_msg("switch log LEB %d:%d to %d:%d\n", old_lnum, old_offs, c->lhead_lnum, c->lhead_offs);
	}
#endif

	if (c->lhead_offs == 0) {
		/* Must ensure next LEB has been unmapped */
		err = ubifs_leb_unmap(c, c->lhead_lnum);
		if (err)
			goto out;
	}

	len = ALIGN(len, c->min_io_size);
	dbg_log("writing commit start at LEB %d:0, len %d", c->lhead_lnum, len);
	err = ubifs_leb_write(c, c->lhead_lnum, cs, c->lhead_offs, len); //MTK, modify offset 0 -> c->lhead_offs
	if (err)
		goto out;

	*ltail_lnum = c->lhead_lnum;
//.........这里部分代码省略.........
开发者ID:4Fwolf,项目名称:motorola-hawk-kernel-3.4.67,代码行数:101,代码来源:log.c


示例6: dbg_log

CSOCKET_CNODE *cconnp_reserve(CCONNP *cconnp)
{
    CSOCKET_CNODE *csocket_cnode;
    int            sockfd;

    if(EC_TRUE == cqueue_is_empty(CCONNP_IDLE_CONN_QUEUE(cconnp)))
    {
        CQUEUE_DATA *cqueue_data;
     
        /*if no idle, new one*/
        if(csocket_connect(CCONNP_SRV_IPADDR(cconnp), CCONNP_SRV_PORT(cconnp), CSOCKET_IS_NONBLOCK_MODE, &sockfd))
        {
            dbg_log(SEC_0154_CCONNP, 0)(LOGSTDOUT, "error:cconnp_reserve: connect server %s:%ld failed\n",
                                CCONNP_SRV_IPADDR_STR(cconnp), CCONNP_SRV_PORT(cconnp));
            return (NULL_PTR);
        }

        csocket_cnode = csocket_cnode_new(CCONNP_SRV_TCID(cconnp), sockfd, CSOCKET_TYPE_TCP, CCONNP_SRV_IPADDR(cconnp), CCONNP_SRV_PORT(cconnp));
        if(NULL_PTR == csocket_cnode)
        {
            dbg_log(SEC_0154_CCONNP, 0)(LOGSTDOUT, "error:cconnp_reserve: new csocket_cnode for socket %d to server %s:%ld failed\n",
                            sockfd, CCONNP_SRV_IPADDR_STR(cconnp), CCONNP_SRV_PORT(cconnp));
            csocket_close(sockfd);
            return (NULL_PTR);
        }

        cqueue_data = cqueue_push(CCONNP_IDLE_CONN_QUEUE(cconnp), (void *)csocket_cnode);
        if(NULL_PTR == cqueue_data)
        {
            dbg_log(SEC_0154_CCONNP, 0)(LOGSTDOUT, "error:cconnp_reserve: push socket %d to server %s:%ld failed\n",
                            sockfd, CCONNP_SRV_IPADDR_STR(cconnp), CCONNP_SRV_PORT(cconnp));
            csocket_cnode_free(csocket_cnode);
            return (NULL_PTR);
        }
     
        CSOCKET_CNODE_WORK_NODE(csocket_cnode)    = (void *)cqueue_data;
        CSOCKET_CNODE_WORK_OWNER(csocket_cnode)   = (void *)cconnp;
        CSOCKET_CNODE_WORK_RELEASE(csocket_cnode) = (CSOCKET_CNODE_WORK_REL)cconnp_erase;;
        CSOCKET_CNODE_WORK_STATUS(csocket_cnode)  = CSOCKET_CNODE_WORK_STATUS_IDLE;

        dbg_log(SEC_0154_CCONNP, 9)(LOGSTDOUT, "[DEBUG] cconnp_reserve: create and push sockfd %d to server %s:%ld done\n",
                        CSOCKET_CNODE_SOCKFD(csocket_cnode),
                        CCONNP_SRV_IPADDR_STR(cconnp), CCONNP_SRV_PORT(cconnp));      
    }

    /*reserve one idle*/
    csocket_cnode = cqueue_pop(CCONNP_IDLE_CONN_QUEUE(cconnp));
    if(NULL_PTR == csocket_cnode)
    {
        dbg_log(SEC_0154_CCONNP, 0)(LOGSTDOUT, "error:cconnp_reserve: server %s:%ld has no idle conn\n",
                        CCONNP_SRV_IPADDR_STR(cconnp), CCONNP_SRV_PORT(cconnp));
        return (NULL_PTR);
    }

    if(EC_TRUE == CSOCKET_CNODE_WORK_PUSHED(csocket_cnode))
    {
        /*when csocket_cnode was released and pushed to connp, RD event was set. here need to clear it*/
        cepoll_del_event(task_brd_default_get_cepoll(), CSOCKET_CNODE_SOCKFD(csocket_cnode), CEPOLL_RD_EVENT);
        CSOCKET_CNODE_WORK_PUSHED(csocket_cnode) = EC_FALSE;
    }
 
    CSOCKET_CNODE_WORK_NODE(csocket_cnode)    = NULL_PTR;
    CSOCKET_CNODE_WORK_OWNER(csocket_cnode)   = (void *)cconnp;
    CSOCKET_CNODE_WORK_RELEASE(csocket_cnode) = (CSOCKET_CNODE_WORK_REL)cconnp_release;
    CSOCKET_CNODE_WORK_STATUS(csocket_cnode)  = CSOCKET_CNODE_WORK_STATUS_NONE;

    dbg_log(SEC_0154_CCONNP, 9)(LOGSTDOUT, "[DEBUG] cconnp_reserve: pop sockfd %d from server %s:%ld done\n",
                    CSOCKET_CNODE_SOCKFD(csocket_cnode),
                    CCONNP_SRV_IPADDR_STR(cconnp), CCONNP_SRV_PORT(cconnp));  
    return (csocket_cnode);
}
开发者ID:petercloud,项目名称:RFS,代码行数:71,代码来源:cconnp.c


示例7: ubifs_add_bud_to_log

/**
 * ubifs_add_bud_to_log - add a new bud to the log.
 * @c: UBIFS file-system description object
 * @jhead: journal head the bud belongs to
 * @lnum: LEB number of the bud
 * @offs: starting offset of the bud
 *
 * This function writes reference node for the new bud LEB @lnum it to the log,
 * and adds it to the buds tress. It also makes sure that log size does not
 * exceed the 'c->max_bud_bytes' limit. Returns zero in case of success,
 * %-EAGAIN if commit is required, and a negative error codes in case of
 * failure.
 */
int ubifs_add_bud_to_log(struct ubifs_info *c, int jhead, int lnum, int offs)
{
	int err;
	struct ubifs_bud *bud;
	struct ubifs_ref_node *ref;

	bud = kmalloc(sizeof(struct ubifs_bud), GFP_NOFS);
	if (!bud)
		return -ENOMEM;
	ref = kzalloc(c->ref_node_alsz, GFP_NOFS);
	if (!ref) {
		kfree(bud);
		return -ENOMEM;
	}

	mutex_lock(&c->log_mutex);
	ubifs_assert(!c->ro_media && !c->ro_mount);
	if (c->ro_error) {
		err = -EROFS;
		goto out_unlock;
	}

	/* Make sure we have enough space in the log */
	if (empty_log_bytes(c) - c->ref_node_alsz < c->min_log_bytes) {
		dbg_log("not enough log space - %lld, required %d",
			empty_log_bytes(c), c->min_log_bytes);
		ubifs_commit_required(c);
		err = -EAGAIN;
		goto out_unlock;
	}

	/*
	 * Make sure the amount of space in buds will not exceed the
	 * 'c->max_bud_bytes' limit, because we want to guarantee mount time
	 * limits.
	 *
	 * It is not necessary to hold @c->buds_lock when reading @c->bud_bytes
	 * because we are holding @c->log_mutex. All @c->bud_bytes take place
	 * when both @c->log_mutex and @c->bud_bytes are locked.
	 */
	if (c->bud_bytes + c->leb_size - offs > c->max_bud_bytes) {
		dbg_log("bud bytes %lld (%lld max), require commit",
			c->bud_bytes, c->max_bud_bytes);
		ubifs_commit_required(c);
		err = -EAGAIN;
		goto out_unlock;
	}

	/*
	 * If the journal is full enough - start background commit. Note, it is
	 * OK to read 'c->cmt_state' without spinlock because integer reads
	 * are atomic in the kernel.
	 */
	if (c->bud_bytes >= c->bg_bud_bytes &&
	    c->cmt_state == COMMIT_RESTING) {
		dbg_log("bud bytes %lld (%lld max), initiate BG commit",
			c->bud_bytes, c->max_bud_bytes);
		ubifs_request_bg_commit(c);
	}

	bud->lnum = lnum;
	bud->start = offs;
	bud->jhead = jhead;

	ref->ch.node_type = UBIFS_REF_NODE;
	ref->lnum = cpu_to_le32(bud->lnum);
	ref->offs = cpu_to_le32(bud->start);
	ref->jhead = cpu_to_le32(jhead);

	if (c->lhead_offs > c->leb_size - c->ref_node_alsz) {
		c->lhead_lnum = ubifs_next_log_lnum(c, c->lhead_lnum);
		c->lhead_offs = 0;
	}

	if (c->lhead_offs == 0) {
		/* Must ensure next log LEB has been unmapped */
		err = ubifs_leb_unmap(c, c->lhead_lnum);
		if (err)
			goto out_unlock;
	}

	if (bud->start == 0) {
		/*
		 * Before writing the LEB reference which refers an empty LEB
		 * to the log, we have to make sure it is mapped, because
		 * otherwise we'd risk to refer an LEB with garbage in case of
		 * an unclean reboot, because the target LEB might have been
//.........这里部分代码省略.........
开发者ID:4Fwolf,项目名称:motorola-hawk-kernel-3.4.67,代码行数:101,代码来源:log.c


示例8: sendMessage

/*!
 * \brief Message exchange function communicate with user-mode application.<br>
 * <br>
 * \param [in] pSmartcardExtension A pointer to the smart card extension,
		SMARTCARD_EXTENSION, of the device.
 * \param [in] mty MTY: Message type.
 * \param [in] nad NAD: Node addess
 * \param [in] pSnd PY0: A pointer to first byte of payload.
 * \param [in] sndLen LN: length of payload.
 * \param [out] pRcv A pointer to buffer of received data.
 * \param [in] rcvLenExp length of pRcv. caller's expected Max length of receiving data.
 * \param [out] pRcvLen actual lengh of received data.
 * \param [in] pDueTime wait time duration in LARGE_INTEGER. if it is NULL,
	the routine waits indefinitely.
 *
 * \retval STATUS_SUCCESS the routine successfully end.
 * \retval STATUS_IO_TIMEOUT The request timed out.
 * \retval STATUS_BUFFER_TOO_SMALL Expected ATR Length is too small.
 */
static int sendMessage(
    PREADER_EXTENSION pReaderExtension,
    unsigned char const mty,
    unsigned char const nad,
    char const *const pSnd,
    unsigned short const sndLen,
    char *const pRcv,
    unsigned short const rcvLenExp,
    unsigned short *const pRcvLen,
    PLARGE_INTEGER pDueTime)
{
	dbg_log("sendMessage start");

	NTSTATUS status;

	// set exchanging messages in pReaderExtension->pSndBuffer.
	if (pReaderExtension == NULL) {
		status = STATUS_INSUFFICIENT_RESOURCES;
		dbg_log("pReaderExtension == NULL");
		return status;
	}
	if (pReaderExtension->pSndBuffer == NULL) {
		status = STATUS_INSUFFICIENT_RESOURCES;
		dbg_log("pReaderExtension->pSndBuffer == NULL");
		return status;
	}
	// set message header.
	pReaderExtension->pSndBuffer[0] = mty;			// MTY
	pReaderExtension->pSndBuffer[1] = nad;			// NAD
	pReaderExtension->pSndBuffer[2] = sndLen / 256;	// LNH High byte of payload length
	pReaderExtension->pSndBuffer[3] = sndLen % 256;	// LNL Low byte of payload length
	// set message payload.
	RtlCopyMemory(pReaderExtension->pSndBuffer + 4, pSnd, sndLen);
	// set whole message length.
	pReaderExtension->iSndLen = sndLen + 4;

	// notify to the user-mode application.
	if (pReaderExtension->hEventSnd == NULL) {
		status = STATUS_INSUFFICIENT_RESOURCES;
		dbg_log("pReaderExtension->hEventSnd == NULL");
		return status;
	}
	KeSetEvent((PKEVENT)pReaderExtension->hEventSnd, 0, FALSE);

	// wait for the process completion of user-mode application as follows:
	//  1. invoke ReadFile and get command data in pReaderExtension->pSndBuffer.
	//  2. communicate with JCOP simulator.
	//  3. invoke WriteFile and set response data in pReaderExtension->pRcvBuffer.
	//  4. set event pReaderExtension->hEventRcv.

	if (pReaderExtension->hEventRcv == NULL) {
		status = STATUS_INSUFFICIENT_RESOURCES;
		dbg_log("pReaderExtension->hEventRcv == NULL");
		return status;
	}
	// wait for event.
	status = KeWaitForSingleObject(
	             (PKEVENT)pReaderExtension->hEventRcv,
	             Executive,
	             KernelMode,
	             FALSE,
	             pDueTime
	         );
	if (status != STATUS_SUCCESS) {
		switch (status) {
			case STATUS_ALERTED :
				dbg_log("STATUS_ALERTED\r\n");
				break;
			case STATUS_USER_APC :
				dbg_log("STATUS_USER_APC \r\n");
				break;
			case STATUS_TIMEOUT :
				dbg_log("STATUS_TIMEOUT \r\n");
				break;
			case STATUS_ABANDONED_WAIT_0 :
				dbg_log("STATUS_ABANDONED_WAIT_0 \r\n");
				break;
			default:
				dbg_log("STATUS_XXXXX \r\n");
				break;
		}
//.........这里部分代码省略.........
开发者ID:kn1kn1,项目名称:jcopvr,代码行数:101,代码来源:jcop_vr.cpp


示例9: configure

static rt_err_t configure(struct rt_spi_device *device,
                          struct rt_spi_configuration *configuration)
{
    struct rt_spi_bus *spi_bus = (struct rt_spi_bus *)device->bus;
    struct tina_spi_cs *tina_spi_cs = device->parent.user_data;
    struct tina_spi *_spi_info = (struct tina_spi *)spi_bus->parent.user_data;
    SPI_T *spi = _spi_info->spi;

    DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__);

    RT_ASSERT(device != RT_NULL);
    RT_ASSERT(configuration != RT_NULL);

    DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__);

    DEBUG_PRINTF("spi address: %08X\n", (rt_uint32_t)spi);

    SPI_Disable(spi);
    SPI_Reset(spi);
    SPI_ResetRxFifo(spi);
    SPI_ResetTxFifo(spi);

    DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__);

    /* data_width */
    if (configuration->data_width != 8)
    {
        DEBUG_PRINTF("error: data_width is %d\n", configuration->data_width);
        return RT_EIO;
    }

    DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__);
    SPI_SetDuplex(spi, SPI_TCTRL_DHB_FULL_DUPLEX);
    SPI_SetMode(spi, SPI_CTRL_MODE_MASTER);

    /* MSB or LSB */
    if (configuration->mode & RT_SPI_MSB)
    {
        SPI_SetFirstTransmitBit(spi, SPI_TCTRL_FBS_MSB);
    }
    else
    {
        SPI_SetFirstTransmitBit(spi, SPI_TCTRL_FBS_LSB);
    }

    switch (configuration->mode)
    {
    case RT_SPI_MODE_0:
        SPI_SetSclkMode(spi, SPI_SCLK_Mode0);
        break;
    case RT_SPI_MODE_1:
        SPI_SetSclkMode(spi, SPI_SCLK_Mode1);
        break;
    case RT_SPI_MODE_2:
        SPI_SetSclkMode(spi, SPI_SCLK_Mode2);
        break;
    case RT_SPI_MODE_3:
        SPI_SetSclkMode(spi, SPI_SCLK_Mode3);
        break;
    }

    /* baudrate */
    {
        unsigned int spi_clock = 0;
        rt_uint32_t max_hz;
        rt_uint32_t div;

        DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__);

        max_hz = configuration->max_hz;

        if (max_hz > SPI_BUS_MAX_CLK)
        {
            max_hz = SPI_BUS_MAX_CLK;
        }
        spi_clock = ahb_get_clk();

        DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__);

        div = (spi_clock + max_hz - 1) / max_hz;

        dbg_log(DBG_LOG, "configuration->max_hz: %d\n", configuration->max_hz);
        dbg_log(DBG_LOG, "max freq: %d\n", max_hz);
        dbg_log(DBG_LOG, "spi_clock: %d\n", spi_clock);
        dbg_log(DBG_LOG, "div: %d\n", div);

        SPI_SetClkDiv(spi, div / 2);
    } /* baudrate */

    SPI_ManualChipSelect(spi, tina_spi_cs->cs);
    SPI_SetDataSize(spi, 0, 0);
    SPI_Enable(spi);

    DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__);

    return RT_EOK;
};
开发者ID:DigFarmer,项目名称:rt-thread,代码行数:97,代码来源:drv_spi.c


示例10: _signal_default_handler

static void _signal_default_handler(int signo)
{
    dbg_log(DBG_INFO, "handled signo[%d] with default action.\n", signo);
    return ;
}
开发者ID:onelife,项目名称:rt-thread,代码行数:5,代码来源:signal.c


示例11: prune_cache

/* Walk through the table and remove all entries which lifetime ended.

   We have a problem here.  To actually remove the entries we must get
   the write-lock.  But since we want to keep the time we have the
   lock as short as possible we cannot simply acquire the lock when we
   start looking for timedout entries.

   Therefore we do it in two stages: first we look for entries which
   must be invalidated and remember them.  Then we get the lock and
   actually remove them.  This is complicated by the way we have to
   free the data structures since some hash table entries share the same
   data.  */
time_t
prune_cache (struct database_dyn *table, time_t now, int fd)
{
  size_t cnt = table->head->module;

  /* If this table is not actually used don't do anything.  */
  if (cnt == 0)
    {
      if (fd != -1)
	{
	  /* Reply to the INVALIDATE initiator.  */
	  int32_t resp = 0;
	  writeall (fd, &resp, sizeof (resp));
	}

      /* No need to do this again anytime soon.  */
      return 24 * 60 * 60;
    }

  /* If we check for the modification of the underlying file we invalidate
     the entries also in this case.  */
  if (table->inotify_descr < 0 && table->check_file && now != LONG_MAX)
    {
      struct stat64 st;

      if (stat64 (table->filename, &st) < 0)
	{
	  char buf[128];
	  /* We cannot stat() the file, disable file checking if the
             file does not exist.  */
	  dbg_log (_("cannot stat() file `%s': %s"),
		   table->filename, strerror_r (errno, buf, sizeof (buf)));
	  if (errno == ENOENT)
	    table->check_file = 0;
	}
      else
	{
	  if (st.st_mtime != table->file_mtime)
	    {
	      /* The file changed.  Invalidate all entries.  */
	      now = LONG_MAX;
	      table->file_mtime = st.st_mtime;
	    }
	}
    }

  /* We run through the table and find values which are not valid anymore.

     Note that for the initial step, finding the entries to be removed,
     we don't need to get any lock.  It is at all timed assured that the
     linked lists are set up correctly and that no second thread prunes
     the cache.  */
  bool *mark;
  size_t memory_needed = cnt * sizeof (bool);
  bool mark_use_alloca;
  if (__builtin_expect (memory_needed <= MAX_STACK_USE, 1))
    {
      mark = alloca (cnt * sizeof (bool));
      memset (mark, '\0', memory_needed);
      mark_use_alloca = true;
    }
  else
    {
      mark = xcalloc (1, memory_needed);
      mark_use_alloca = false;
    }
  size_t first = cnt + 1;
  size_t last = 0;
  char *const data = table->data;
  bool any = false;

  if (__builtin_expect (debug_level > 2, 0))
    dbg_log (_("pruning %s cache; time %ld"),
	     dbnames[table - dbs], (long int) now);

#define NO_TIMEOUT LONG_MAX
  time_t next_timeout = NO_TIMEOUT;
  do
    {
      ref_t run = table->head->array[--cnt];

      while (run != ENDREF)
	{
	  struct hashentry *runp = (struct hashentry *) (data + run);
	  struct datahead *dh = (struct datahead *) (data + runp->packet);

	  /* Some debug support.  */
	  if (__builtin_expect (debug_level > 2, 0))
//.........这里部分代码省略.........
开发者ID:mseaborn,项目名称:plash-glibc,代码行数:101,代码来源:cache.c


示例12: gdbGetFreeBlockList

uint8_t
gdbGetFreeBlockList(GDatabase *db, GdbFreeBlock **blocks, uint32_t *count)
{
    GdbFreeBlock *blockList;
    uint32_t listSize;
    uint8_t *buffer;
    size_t   s;
    uint32_t i, counter = 0;
    offset_t __offset;

    if (blocks == NULL || count == NULL)
    {
        return 0;
    }
    *blocks = NULL;

    /* Seek to the start of the block list. */
    rawFileSeek(db->idxRawFile, DB_FREE_BLOCK_LIST_OFFSET, SEEK_SET);
    __offset = DB_FREE_BLOCK_LIST_OFFSET;
    if (rawFileRead(db->idxRawFile, __offset, &db->freeBlockCount, sizeof(uint32_t), 1, LOC_DB_0001) != 1)
    {
        db->freeBlockCount = 0;
    }
    else
    {
        __offset += sizeof(uint32_t);
    }
    db->freeBlockCount = gdb_ntoh_uint32(db->freeBlockCount);

    *count = db->freeBlockCount;

    if (db->freeBlockCount == 0)
    {
        return 0;
    }
    /* Get the total size of the free blocks list. */
    listSize = db->freeBlockCount * (sizeof(uint16_t) + sizeof(offset_t));

    /* Allocate the buffer. */
    MEM_CHECK(buffer = (uint8_t *)SAFE_MALLOC(listSize, LOC_DB_0002));

    /* Read in the list. */
    //rawFileSeek(db->idxRawFile, DB_FREE_BLOCK_LIST_OFFSET + sizeof(uint32_t), SEEK_SET);
    if ((s = rawFileRead(db->idxRawFile, __offset, buffer, 1, listSize, LOC_DB_0003)) != listSize)
    {
        dbg_log(SEC_0131_DB, 0)(LOGSTDOUT,"error:gdbGetFreeBlockList: Truncated block list.\n"
                          "Expected %d bytes, got %d bytes. Block list offset = %d\n"
                          "Free block count = %d. Filename = %s\n",
                          listSize, s, DB_FREE_BLOCK_LIST_OFFSET, db->freeBlockCount,
                          db->filename);
        abort();
    }

    MEM_CHECK(blockList = (GdbFreeBlock *)SAFE_MALLOC(db->freeBlockCount * sizeof(GdbFreeBlock), LOC_DB_0004));

    for (i = 0; i < db->freeBlockCount; i++)
    {
        blockList[i].size   = gdbGet16(buffer, &counter);
        blockList[i].offset = gdbGetOffset(buffer, &counter);
    }

    *blocks = blockList;

    SAFE_FREE(buffer, LOC_DB_0005);

    return 1;
}
开发者ID:inevity,项目名称:ebgn,代码行数:67,代码来源:db_blocklist.c


示例13: lic_cfg_flush

EC_BOOL lic_cfg_flush(int fd, const LIC_CFG *lic_cfg)
{
    UINT32 offset;

    offset = 0;

    if(EC_FALSE == lic_buff_flush(fd, &offset, LIC_VERSION_MAX_SIZE, LIC_CFG_VERSION(lic_cfg)))
    {
        dbg_log(SEC_0060_LICENSE, 0)(LOGSTDOUT, "error:lic_cfg_flush: flush version failed\n");
        return (EC_FALSE);
    }

    if(EC_FALSE == lic_buff_flush(fd, &offset, sizeof(LIC_MAC), (UINT8 *)LIC_CFG_MAC(lic_cfg)))
    {
        dbg_log(SEC_0060_LICENSE, 0)(LOGSTDOUT, "error:lic_cfg_flush: flush mac failed\n");
        return (EC_FALSE);
    }

    if(EC_FALSE == lic_buff_flush(fd, &offset, sizeof(LIC_DATE), (UINT8 *)LIC_CFG_DATE(lic_cfg)))
    {
        dbg_log(SEC_0060_LICENSE, 0)(LOGSTDOUT, "error:lic_cfg_flush: flush date failed\n");
        return (EC_FALSE);
    }

    if(EC_FALSE == lic_buff_flush(fd, &offset, LIC_USER_NAME_MAX_SIZE, LIC_CFG_USER_NAME(lic_cfg)))
    {
        dbg_log(SEC_0060_LICENSE, 0)(LOGSTDOUT, "error:lic_cfg_flush: flush user name failed\n");
        return (EC_FALSE);
    }

    if(EC_FALSE == lic_buff_flush(fd, &offset, LIC_USER_EMAIL_MAX_SIZE, LIC_CFG_USER_EMAIL(lic_cfg)))
    {
        dbg_log(SEC_0060_LICENSE, 0)(LOGSTDOUT, "error:lic_cfg_flush: flush user email failed\n");
        return (EC_FALSE);
    }

    if(EC_FALSE == lic_buff_flush(fd, &offset, LIC_VENDOR_NAME_MAX_SIZE, LIC_CFG_VENDOR_NAME(lic_cfg)))
    {
        dbg_log(SEC_0060_LICENSE, 0)(LOGSTDOUT, "error:lic_cfg_flush: flush vendor name failed\n");
        return (EC_FALSE);
    }

    if(EC_FALSE == lic_buff_flush(fd, &offset, LIC_VENDOR_EMAIL_MAX_SIZE, LIC_CFG_VENDOR_EMAIL(lic_cfg)))
    {
        dbg_log(SEC_0060_LICENSE, 0)(LOGSTDOUT, "error:lic_cfg_flush: flush vendor email failed\n");
        return (EC_FALSE);
    }

    if(EC_FALSE == lic_buff_flush(fd, &offset, sizeof(BIGINT), (UINT8 *)LIC_CFG_PRIVATE_KEY(lic_cfg)))
    {
        dbg_log(SEC_0060_LICENSE, 0)(LOGSTDOUT, "error:lic_cfg_flush: flush private key failed\n");
        return (EC_FALSE);
    }

    if(EC_FALSE == lic_buff_flush(fd, &offset, sizeof(ECC_SIGNATURE), (UINT8 *)LIC_CFG_SIGNATURE(lic_cfg)))
    {
        dbg_log(SEC_0060_LICENSE, 0)(LOGSTDOUT, "error:lic_cfg_flush: flush signature failed\n");
        return (EC_FALSE);
    }

    return (EC_TRUE);
}
开发者ID:inevity,项目名称:ebgn,代码行数:62,代码来源:license.c


示例14: btreeSplit

uint8_t btreeSplit(const BTree *src_tree, const RawFile *src_rawFile,
                    BTree *des_tree_left, RawFile *des_rawFile_left,
                    BTree *des_tree_right, RawFile *des_rawFile_right)
{
    BTreeTraversal *trav;
    uint32_t count;
    offset_t offset;

    if (src_tree == NULL)
    {
        dbg_log(SEC_0130_BTREE, 0)(LOGSTDOUT, "error:btreeSplit: src tree is null\n");
        return 0;/*fail*/
    }
    trav = btreeInitTraversal(src_tree);

    for(count = 0, offset = btreeGetFirstOffset(trav);
        count < (src_tree->size / 2) && 0 != offset;
        count ++, offset = btreeGetNextOffset(trav))
    {
        uint32_t data_len;
        uint32_t kv_len;
        uint8_t *kv;
        uint8_t *key;
        uint32_t filePos;

        if(RAW_FILE_FAIL == rawFileRead32(src_rawFile, &data_len, offset))
        {
            dbg_log(SEC_0130_BTREE, 0)(LOGSTDOUT,"error:btreeSplit: read data_len at offset %d failed where count reaches %d\n", offset, count);
            btreeDestroyTraversal(trav);
            return 0;
        }

        kv = (uint8_t *)SAFE_MALLOC(data_len, LOC_BTREE_0127);
        if(NULL == kv)
        {
            dbg_log(SEC_0130_BTREE, 0)(LOGSTDOUT, "error:btreeSplit: alloc %d bytes failed\n", data_len);
            return 0;
        }

        if(RAW_FILE_FAIL == rawFileRead8s(src_rawFile, kv, data_len, &kv_len, offset + sizeof(uint32_t)) || kv_len != data_len)
        {
            dbg_log(SEC_0130_BTREE, 0)(LOGSTDOUT,"error:btreeSplit: read kv %ld bytes at offset %d failed where count reaches %d, kv_len = %d\n",
                    data_len, offset + sizeof(uint32_t), count, kv_len);

            SAFE_FREE(kv, LOC_BTREE_0128);
            btreeDestroyTraversal(trav);
            return 0;
        }

        //dbg_log(SEC_0130_BTREE, 9)(LOGSTDOUT, "[DEBUG] btreeSplit: read kv[1]: ");
        //kvPrintHs(LOGSTDOUT, kv);

        key = kv;

        rawFileAppend8slen(des_rawFile_left, kv, kv_len, &filePos);
        btreeInsert(des_tree_left, key, filePos, 0);

        SAFE_FREE(kv, LOC_BTREE_0129);
    }

    for(;
        count < src_tree->size && 0 != offset;
        count ++, offset = btreeGetNextOffset(trav))
    {
        uint32_t data_len;
        uint32_t kv_len;
        uint8_t *kv;
        uint8_t *key;
        uint32_t filePos;

        if(RAW_FILE_FAIL == rawFileRead32(src_rawFile, &data_len, offset))
        {
            dbg_log(SEC_0130_BTREE, 0)(LOGSTDOUT,"error:btreeSplit: read data_len at offset %d failed where count reaches %d\n", offset, count);
            btreeDestroyTraversal(trav);
            return 0;
        }

        kv = (uint8_t *)SAFE_MALLOC(data_len, LOC_BTREE_0130);
        if(NULL == kv)
        {
            dbg_log(SEC_0130_BTREE, 0)(LOGSTDOUT, "error:btreeSplit: alloc %d bytes failed\n", data_len);
            return 0;
        }

        if(RAW_FILE_FAIL == rawFileRead8s(src_rawFile, kv, data_len, &kv_len, offset + sizeof(uint32_t)) || kv_len != data_len)
        {
            dbg_log(SEC_0130_BTREE, 0)(LOGSTDOUT,"error:btreeSplit: read kv %ld bytes at offset %d failed where count reaches %d, kv_len = %d\n",
                    data_len, offset + sizeof(uint32_t), count, kv_len);

            SAFE_FREE(kv, LOC_BTREE_0131);
            btreeDestroyTraversal(trav);
            return 0;
        }

        //dbg_log(SEC_0130_BTREE, 9)(LOGSTDOUT, "[DEBUG] btreeSplit: read kv[2]: ");
        //kvPrintHs(LOGSTDOUT, kv);

        key = kv;

        rawFileAppend8slen(des_rawFile_right, kv, kv_len, &filePos);
//.........这里部分代码省略.........
开发者ID:petercloud,项目名称:RFS,代码行数:101,代码来源:btree_split.c


示例15: hw_init

/*----------------------------------------------------------------------------*/
void hw_init(void)
{
    unsigned int cp15;

    /*
     * Configure PIOs 
     */
    const struct pio_desc hw_pio[] = {
#ifdef CONFIG_DEBUG
        {"RXD", AT91C_PIN_PA(9), 0, PIO_DEFAULT, PIO_PERIPH_A},
        {"TXD", AT91C_PIN_PA(10), 0, PIO_DEFAULT, PIO_PERIPH_A},
#endif
        {(char *)0, 0, 0, PIO_DEFAULT, PIO_PERIPH_A},
    };

    /*
     * Disable watchdog 
     */
    writel(AT91C_WDTC_WDDIS, AT91C_BASE_WDTC + WDTC_WDMR);

    /*
     * At this stage the main oscillator is supposed to be enabled
     * * PCK = MCK = MOSC 
     */
    writel(0x00, AT91C_BASE_PMC + PMC_PLLICPR);

    /*
     * Configure PLLA = MOSC * (PLL_MULA + 1) / PLL_DIVA 
     */
    pmc_cfg_plla(PLLA_SETTINGS, PLL_LOCK_TIMEOUT);

    /*
     * PCK = PLLA/2 = 3 * MCK 
     */
    pmc_cfg_mck(BOARD_PRESCALER_MAIN_CLOCK, PLL_LOCK_TIMEOUT);

    /*
     * Switch MCK on PLLA output 
     */
    pmc_cfg_mck(BOARD_PRESCALER_PLLA, PLL_LOCK_TIMEOUT);

    /*
     * Enable External Reset 
     */
    writel(AT91C_RSTC_KEY_UNLOCK
           || AT91C_RSTC_URSTEN, AT91C_BASE_RSTC + RSTC_RMR);

    /*
     * Configure CP15 
     */
    cp15 = get_cp15();
    cp15 |= I_CACHE;
    set_cp15(cp15);

#ifdef CONFIG_SCLK
    sclk_enable();
#endif
    /*
     * Configure the PIO controller 
     */
    writel((1 << AT91C_ID_PIOA_B), (PMC_PCER + AT91C_BASE_PMC));
    pio_setup(hw_pio);

    /*
     * Enable Debug messages on the DBGU 
     */
#ifdef CONFIG_DEBUG
    dbgu_init(BAUDRATE(MASTER_CLOCK, 115200));
    dbgu_print("Start AT91Bootstrap...\n\r");
#endif

#ifdef CONFIG_DDR2
    /*
     * Configure DDRAM Controller 
     */
    dbg_log(1, "Init DDR... ");
    ddramc_hw_init();
    dbg_log(1, "Done!\n\r");
#endif                          /* CONFIG_DDR2 */
}
开发者ID:rascalmicro,项目名称:at91bootstrap,代码行数:81,代码来源:at91sam9x5ek.c


示例16: ipv4_pool_init

EC_BOOL  ipv4_pool_init(IPV4_POOL *ipv4_pool, const uint32_t ipv4_subnet, const uint32_t ipv4_mask)
{
    UINT32 ipv4_addr_max_num;

    IPV4_POOL_SUBNET(ipv4_pool) = (ipv4_subnet & ipv4_mask);
    IPV4_POOL_MASK(ipv4_pool)   = ipv4_mask;

    IPV4_POOL_INIT_CRWLOCK(ipv4_pool, LOC_IPV4POOL_0003);

    ipv4_addr_max_num = (~ipv4_mask) + 1;
    dbg_log(SEC_0027_IPV4POOL, 9)(LOGSTDOUT, "[DEBUG] ipv4_pool_init: subnet %s, mask %s, ipv4 addr max num %ld\n",
                        c_word_to_ipv4(IPV4_POOL_SUBNET(ipv4_pool)),
                        c_word_to_ipv4(IPV4_POOL_MASK(ipv4_pool)),
                        ipv4_addr_max_num);
    if(EC_FALSE == cbitmap_init(IPV4_POOL_CBITMAP(ipv4_pool), ipv4_addr_max_num))
    {
        dbg_log(SEC_0027_IPV4POOL, 0)(LOGSTDOUT, "error:ipv4_pool_init: init cbitmap with ipv4 addr max num %ld failed\n", ipv4_addr_max_num);
        IPV4_POOL_CLEAN_CRWLOCK(ipv4_pool, LOC_IPV4POOL_0004);
        return (EC_FALSE);
    }
    CBITMAP_MAX_BITS(IPV4_POOL_CBITMAP(ipv4_pool)) = ipv4_addr_max_num; /*for safe purpose*/

#if 0
    /*ignore some ipaddr*/
#if  0
    ipv4_addr = 0;
    bit_pos   = (ipv4_addr & (~ IPV4_POOL_MASK(ipv4_pool)));
    if(EC_FALSE == cbitmap_set(IPV4_POOL_CBITMAP(ipv4_pool), bit_pos))
    {
        dbg_log(SEC_0027_IPV4POOL, 0)(LOGSTDOUT, "error:ipv4_pool_init: cbitmap set ipv4 %s failed\n", c_word_to_ipv4(ipv4_addr));
        IPV4_POOL_CLEAN_CRWLOCK(ipv4_pool, LOC_IPV4POOL_0005);
        cbitmap_clean(IPV4_POOL_CBITMAP(ipv4_pool));
        return (EC_FALSE);
    }
    dbg_log(SEC_0027_IPV4POOL, 9)(LOGSTDOUT, "[DEBUG] ipv4_pool_init: ignore ipv4 %s\n", c_word_to_ipv4(ipv4_addr));
#endif

#if  1
    ipv4_addr = (ipv4_subnet & 0xffffff00);
    bit_pos   = (ipv4_addr & (~ IPV4_POOL_MASK(ipv4_pool)));
    if(EC_FALSE == cbitmap_set(IPV4_POOL_CBITMAP(ipv4_pool), bit_pos))
    {
        dbg_log(SEC_0027_IPV4POOL, 0)(LOGSTDOUT, "error:ipv4_pool_init: cbitmap set ipv4 %s failed\n", c_word_to_ipv4(ipv4_addr));
        IPV4_POOL_CLEAN_CRWLOCK(ipv4_pool, LOC_IPV4POOL_0006);
        cbitmap_clean(IPV4_POOL_CBITMAP(ipv4_pool));
        return (EC_FALSE);
    }
    dbg_log(SEC_0027_IPV4POOL, 9)(LOGSTDOUT, "[DEBUG] ipv4_pool_init: ignore ipv4 %s\n", c_word_to_ipv4(ipv4_addr));
#endif

    ipv4_addr = (IPV4_POOL_SUBNET(ipv4_pool) | ((~ipv4_mask) & 0xffffffff));
    bit_pos   =  (ipv4_addr & (~ IPV4_POOL_MASK(ipv4_pool)));
    if(bit_pos < CBITMAP_MAX_BITS(IPV4_POOL_CBITMAP(ipv4_pool)) && EC_FALSE == cbitmap_set(IPV4_POOL_CBITMAP(ipv4_pool), bit_pos))
    {
        dbg_log(SEC_0027_IPV4POOL, 0)(LOGSTDOUT, "error:ipv4_pool_init: cbitmap set ipv4 %s failed\n", c_word_to_ipv4(ipv4_addr));
        IPV4_POOL_CLEAN_CRWLOCK(ipv4_pool, LOC_IPV4POOL_0007);
        cbitmap_clean(IPV4_POOL_CBITMAP(ipv4_pool));
        return (EC_FALSE);
    }
    dbg_log(SEC_0027_IPV4POOL, 9)(LOGSTDOUT, "[DEBUG] ipv4_pool_init: ignore ipv4 %s\n", c_word_to_ipv4(ipv4_addr));

    ipv4_addr = (IPV4_POOL_SUBNET(ipv4_pool) | ((~ipv4_mask) & 0xfffffffe));
    bit_pos   =  (ipv4_addr & (~ IPV4_POOL_MASK(ipv4_pool)));
    if(bit_pos < CBITMAP_MAX_BITS(IPV4_POOL_CBITMAP(ipv4_pool)) && EC_FALSE == cbitmap_set(IPV4_POOL_CBITMAP(ipv4_pool), bit_pos))
    {
        dbg_log(SEC_0027_IPV4POOL, 0)(LOGSTDOUT, "error:ipv4_pool_init: cbitmap set ipv4 %s failed\n", c_word_to_ipv4(ipv4_addr));
        IPV4_POOL_CLEAN_CRWLOCK(ipv4_pool, LOC_IPV4POOL_0008);
        cbitmap_clean(IPV4_POOL_CBITMAP(ipv4_pool));
        return (EC_FALSE);
    }
    dbg_log(SEC_0027_IPV4POOL, 9)(LOGSTDOUT, "[DEBUG] ipv4_pool_init: ignore ipv4 %s\n", c_word_to_ipv4(ipv4_addr));
#endif
    return (EC_TRUE);
}
开发者ID:petercloud,项目名称:RFS,代码行数:74,代码来源:ipv4pool.c


示例17: taskcfgchk_route_test

static EC_BOOL taskcfgchk_route_test(LOG *log, const TASK_CFG *task_cfg, TASKS_CFG *src_tasks_cfg, const UINT32 des_tcid, const UINT32 max_hops)
{
    UINT32 pos;

    if(EC_TRUE == taskcfgchk_conn_test(task_cfg, src_tasks_cfg, des_tcid))
    {
        sys_log(log, "[TASKCFGCHK] %s ==> %s [SUCC]\n", TASKS_CFG_TCID_STR(src_tasks_cfg), c_word_to_ipv4(des_tcid));
        return (EC_TRUE);
    }

    if(0 == max_hops)
    {
        sys_log(log, "[TASKCFGCHK] ==> %s [STOP]\n", TASKS_CFG_TCID_STR(src_tasks_cfg));
        return (EC_FALSE);
    }

    CVECTOR_LOCK(TASKS_CFG_TASKR_CFG_VEC(src_tasks_cfg), LOC_TASKCFGCHK_0011);
    for(pos = 0; pos < cvector_size(TASKS_CFG_TASKR_CFG_VEC(src_tasks_cfg)); pos ++)
    {
        TASKR_CFG *taskr_cfg;
        UINT32 taskr_cfg_mask;

        taskr_cfg = (TASKR_CFG *)cvector_get_no_lock(TASKS_CFG_TASKR_CFG_VEC(src_tasks_cfg), pos);
        if(NULL_PTR == taskr_cfg)
        {
            continue;
        }

        taskr_cfg_mask = TASKR_CFG_MASKR(taskr_cfg);

        /*when des_tcid belong to the intranet of taskr_cfg, i.e., belong to the route*/
        if((des_tcid & taskr_cfg_mask) == (TASKR_CFG_DES_TCID(taskr_cfg) & taskr_cfg_mask))
        {
            TASKS_CFG *rt_tasks_cfg;

            dbg_log(SEC_0057_TASKCFGCHK, 5)(LOGSTDNULL, "[TASKCFGCHK] %s & %s == %s & %s\n",
                            c_word_to_ipv4(des_tcid), c_word_to_ipv4(taskr_cfg_mask),
                            TASKR_CFG_DES_TCID_STR(taskr_cfg), c_word_to_ipv4(taskr_cfg_mask)
                            );

            rt_tasks_cfg = task_cfg_searchs(task_cfg, TASKR_CFG_NEXT_TCID(taskr_cfg), CMPI_ANY_MASK, CMPI_ANY_MASK);
            if(NULL_PTR == rt_tasks_cfg)
            {
                continue;
            }

            sys_log(log, "[TASKCFGCHK] %s ==> %s\n", TASKS_CFG_TCID_STR(src_tasks_cfg), TASKR_CFG_NEXT_TCID_STR(taskr_cfg));

            CVECTOR_UNLOCK(TASKS_CFG_TASKR_CFG_VEC(src_tasks_cfg), LOC_TASKCFGCHK_0012);
            if(EC_TRUE == taskcfgchk_route_test(log, task_cfg, rt_tasks_cfg, des_tcid, max_hops - 1))/*recursively*/
            {
                return (EC_TRUE);
            }
            CVECTOR_LOCK(TASKS_CFG_TASKR_CFG_VEC(src_tasks_cfg), LOC_TASKCFGCHK_0013);
        }
        else
        {
            dbg_log(SEC_0057_TASKCFGCHK, 5)(LOGSTDNULL, "[TASKCFGCHK] %s & %s != %s & %s\n",
                            c_word_to_ipv4(des_tcid), c_word_to_ipv4(taskr_cfg_mask),
                            TASKR_CFG_DES_TCID_STR(taskr_cfg), c_word_to_ipv4(taskr_cfg_mask)
                            );
        }
    }
    CVECTOR_UNLOCK(TASKS_CFG_TASKR_CFG_VEC(src_tasks_cfg), LOC_TASKCFGCHK_0014);
    return (EC_FALSE);
}
开发者ID:petercloud,项目名称:RFS,代码行数:66,代码来源:taskcfgchk.c


示例18: constants

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ dbg_log_event函数代码示例发布时间:2022-05-30
下一篇:
C++ dbg_hid函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap