当前位置: 首页>>代码示例>>C++>>正文


C++ cli_out函数代码示例

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


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

示例1: cli_cmd_peer_status_cbk

int
cli_cmd_peer_status_cbk (struct cli_state *state, struct cli_cmd_word *word,
                        const char **words, int wordcount)
{
        int                     ret = -1;
        rpc_clnt_procedure_t    *proc = NULL;
        call_frame_t            *frame = NULL;
        int                     sent = 0;
        int                     parse_error = 0;

        if (wordcount != 2) {
                cli_usage_out (word->pattern);
                parse_error = 1;
                goto out;
        }

        proc = &cli_rpc_prog->proctable[GLUSTER_CLI_LIST_FRIENDS];

        frame = create_frame (THIS, THIS->ctx->pool);
        if (!frame)
                goto out;

        if (proc->fn) {
                ret = proc->fn (frame, THIS, (char *)words[1] );
        }

out:
        if (ret) {
                cli_cmd_sent_status_get (&sent);
                if ((sent == 0) && (parse_error == 0))
                        cli_out ("Peer status failed");
        }
        return ret;
}
开发者ID:mdjunaid,项目名称:glusterfs,代码行数:34,代码来源:cli-cmd-peer.c

示例2: test_print_entry

void
test_print_entry(int unit, test_t *test)
/*
 * Function:    test_print_entry
 * Purpose:     Print a single test entry in a pretty formatted way.
 * Parameters:  unit - Strata Switch unit #
 *              test - pointer to test list entry to print
 * Returns:     Nothing
 */
{
    int         selected;
    uint32      chip = _test_chip(unit);

    selected = (test->t_flags & T_F_SEL_ALL) || 
               ((test->t_flags & T_F_SEL_CHIP) && (test->t_flags & chip));
    cli_out(" %c%c%c |%4d| %-26s|%5d|%5d|%5d|%5d| %s\n", 
            test->t_flags & _test_chip(unit) ? ' ' : 'U',
            test->t_flags & T_F_ACTIVE ? 'A' : ' ',
            selected ? 'S' : ' ',
            test->t_test, test->t_name, test->t_loops, test->t_runs, 
            test->t_success, test->t_fail, 
            test->t_override_string ? 
            test->t_override_string : 
            test->t_default_string ? test->t_default_string : "(none)");
}
开发者ID:ariavie,项目名称:bcm,代码行数:25,代码来源:test.c

示例3: cli_cmd_peer_probe_cbk

int
cli_cmd_peer_probe_cbk (struct cli_state *state, struct cli_cmd_word *word,
                   const char **words, int wordcount)
{
        int                     ret = -1;
        rpc_clnt_procedure_t    *proc = NULL;
        call_frame_t            *frame = NULL;
        dict_t                  *dict = NULL;
        int                     sent = 0;
        int                     parse_error = 0;

        if (!(wordcount == 3)) {
                cli_usage_out (word->pattern);
                parse_error = 1;
                goto out;
        }

        proc = &cli_rpc_prog->proctable[GLUSTER_CLI_PROBE];

        frame = create_frame (THIS, THIS->ctx->pool);
        if (!frame)
                goto out;

        dict = dict_new ();
        if (!dict)
                goto out;

        ret = dict_set_str (dict, "hostname", (char *)words[2]);
        if (ret)
                goto out;

        ret = valid_internet_address ((char *) words[2], _gf_false);
        if (ret == 1) {
                ret = 0;
        } else {
                cli_usage_out (word->pattern);
                parse_error = 1;
                goto out;
        }
/*        if (words[3]) {
                ret = dict_set_str (dict, "port", (char *)words[3]);
                if (ret)
                        goto out;
        }
*/
        if (proc->fn) {
                ret = proc->fn (frame, THIS, dict);
        }

out:
        if (ret) {
                cli_cmd_sent_status_get (&sent);
                if ((sent == 0) && (parse_error == 0))
                        cli_out ("Peer probe failed");
        }
        if (frame)
                STACK_DESTROY (frame->root);

        return ret;
}
开发者ID:rsevero,项目名称:glusterfs,代码行数:60,代码来源:cli-cmd-peer.c

示例4: sal_if_deconfig

static int
sal_if_deconfig(char *pfx,  END_OBJ     *eo, char *if_name, int if_unit)
/*
 * Function: 
 * Purpose:	
 * Parameters:	pfx - prefix to print on errors/warnings
 *		if_name - name of interface ("sn" for "sn0")
 *		if_unit - unit # (0 for "sn0")
 * Returns:	0 - success
 *		-1 - failed
 */
{
#if defined(INCLUDE_DRIVERS)
    int		rv;

    SAL_MAP_NETUNIT(if_unit);

    if (NULL == endFindByName(if_name, if_unit)) {
	cli_out("%s: Error: can not locate device: %s%d\n", 
                pfx, if_name, if_unit);
	return(-1);
    }

    rv = sal_if_do_deconfig(pfx, eo, if_name, if_unit);
    LOG_INFO(BSL_LS_APPL_END,
             (BSL_META("%s: sal_if_deconfig complete: %s%d (%d)\n"), 
              pfx, if_name, if_unit, rv));
    return(rv);
#else  /* !defined(INCLUDE_DRIVERS) */
    return(-1);
#endif /* !defined(INCLUDE_DRIVERS) */
}
开发者ID:ariavie,项目名称:bcm,代码行数:32,代码来源:if.c

示例5: test_run_selected

/*
 * Function:    test_run_selected
 * Purpose:     Run selected tests.
 * Parameters:  u - unit number to run tests on.
 * Returns:     Nothing.
 */
int
test_run_selected(int u)
{
    int         i;

    if (test_options & TEST_O_RANDOM) {
        cli_out("Test: Random mode not supported yet\n");
        return(TEST_STOP);
    }

    for (i = 0; i < test_cnt; i++) {
        if ((test_list[i].t_flags & T_F_SEL_ALL) ||
            ((test_list[i].t_flags & T_F_SEL_CHIP) &&
             (test_list[i].t_flags & _test_chip(u))))
        {
            int         rv;
            switch((rv = test_dispatch(u, &test_list[i], -1, NULL))) {
            case TEST_STOP:
            case TEST_INTR:
                return(rv);
            }
        }
    }
    return(TEST_RUNNING);
}
开发者ID:ariavie,项目名称:bcm,代码行数:31,代码来源:test.c

示例6: cli_cmd_uuid_reset_cbk

int
cli_cmd_uuid_reset_cbk (struct cli_state *state, struct cli_cmd_word *word,
                        const char **words, int wordcount)
{
        int                     ret = -1;
        rpc_clnt_procedure_t    *proc = NULL;
        call_frame_t            *frame = NULL;
        int                     sent = 0;
        int                     parse_error = 0;
        gf_answer_t             answer = GF_ANSWER_NO;
        char                    *question = NULL;
        cli_local_t             *local = NULL;
        dict_t                  *dict  = NULL;
        xlator_t                *this  = NULL;

        question = "Resetting uuid changes the uuid of local glusterd. "
                   "Do you want to continue?";

        if (wordcount != 3) {
                cli_usage_out (word->pattern);
                parse_error = 1;
                goto out;
        }

        proc = &cli_rpc_prog->proctable[GLUSTER_CLI_UUID_RESET];

        this = THIS;
        frame = create_frame (this, this->ctx->pool);
        if (!frame)
                goto out;

        dict = dict_new ();
        if (!dict) {
                ret = -1;
                goto out;
        }
        CLI_LOCAL_INIT (local, words, frame, dict);
        answer = cli_cmd_get_confirmation (state, question);

        if (GF_ANSWER_NO == answer) {
                ret = 0;
                goto out;
        }

        //send NULL as argument since no dictionary is sent to glusterd
        if (proc->fn) {
                ret = proc->fn (frame, this, dict);
        }

out:
        if (ret) {
                cli_cmd_sent_status_get (&sent);
                if ((sent == 0) && (parse_error == 0))
                        cli_out ("uuid reset failed");
        }

        CLI_STACK_DESTROY (frame);

        return ret;
}
开发者ID:ArikaChen,项目名称:glusterfs,代码行数:60,代码来源:cli-cmd-system.c

示例7: _robo_xd_init

STATIC void
_robo_xd_init(int unit, xd_t *xd)
{
    static sal_mac_addr_t default_mac_src ={ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 };
    static sal_mac_addr_t default_mac_dst ={ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15 };

    /*
     * First time through, everything 0 (BSS), so set up defaults.
     */

    xd->hdr_mode = 0;

    xd->xd_unit     = unit;
    xd->xd_init     = TRUE;
    xd->xd_state    = XD_IDLE;
    xd->xd_file = NULL;
    xd->xd_pkt_len  = 68;
    xd->xd_pat  = 0x12345678;
    xd->xd_pat_inc  = 1;
    SOC_PBMP_ASSIGN(xd->pkt_info.tx_pbmp, PBMP_ALL(unit));
    SOC_PBMP_ASSIGN(xd->xd_ppsm_pbm, PBMP_ALL(unit));
    xd->xd_vlan = 0x1;
    xd->xd_prio = 0;
    xd->xd_ppsm = 0;
#if defined(BCM_TB_SUPPORT) || defined(BCM_POLAR_SUPPORT)
    xd->pkt_info.prio_int = 0;
#endif /* BCM_TB_SUPPORT || BCM_POLAR_SUPPORT */
#ifdef BCM_TB_SUPPORT
    xd->pkt_info.multicast_group= -1;
    xd->pkt_info.color = bcmColorGreen;
    xd->pkt_info.flow_id= 0;
    xd->pkt_info.filter_enable= 0;
#endif /* BCM_TB_SUPPORT */

    xd->xd_cbk_enable = 0;
    xd->pkt_info.call_back = NULL;

    ENET_SET_MACADDR(xd->xd_mac_dst, default_mac_dst);
    ENET_SET_MACADDR(xd->xd_mac_src, default_mac_src);
    xd->xd_crc      = 1;        /* Re-gen CRC by default */

    if (xd->pkt_info.pkt_data) { /* Has been setup before */
        soc_cm_sfree(unit, xd->pkt_info.alloc_ptr);
        xd->pkt_info.pkt_data = NULL;
    }
    xd->pkt_info.flags = 0;

    if ((xd->pkt_info.alloc_ptr = (uint8 *)soc_cm_salloc(unit,
                   xd->xd_pkt_len, "TX")) == NULL) {
        cli_out("WARNING:  Could not allocate tx buffer.  Memory error.\n");
        xd->xd_init     = FALSE;
        xd->pkt_info.pkt_data = NULL;
        xd->pkt_info._pkt_data.len = 0;
    } else {
        xd->pkt_info._pkt_data.data = xd->pkt_info.alloc_ptr;
        xd->pkt_info.pkt_data = &xd->pkt_info._pkt_data;
        xd->pkt_info.blk_count = 1;
        xd->pkt_info._pkt_data.len = xd->xd_pkt_len;
    }
}
开发者ID:ariavie,项目名称:bcm,代码行数:60,代码来源:txrx.c

示例8: cli_cmd_volume_replace_brick_cbk

int
cli_cmd_volume_replace_brick_cbk (struct cli_state *state,
                                  struct cli_cmd_word *word,
                                  const char **words,
                                  int wordcount)
{
        int                     ret = -1;
        rpc_clnt_procedure_t    *proc = NULL;
        call_frame_t            *frame = NULL;
        dict_t                  *options = NULL;
        int                     sent = 0;
        int                     parse_error = 0;

#ifdef GF_SOLARIS_HOST_OS
        cli_out ("Command not supported on Solaris");
        goto out;
#endif
        proc = &cli_rpc_prog->proctable[GLUSTER_CLI_REPLACE_BRICK];

        frame = create_frame (THIS, THIS->ctx->pool);
        if (!frame)
                goto out;

        ret = cli_cmd_volume_replace_brick_parse (words, wordcount, &options);

        if (ret) {
                cli_usage_out (word->pattern);
                parse_error = 1;
                goto out;
        }

        if (proc->fn) {
                ret = proc->fn (frame, THIS, options);
        }

out:
        if (options)
                dict_unref (options);

        if (ret) {
                cli_cmd_sent_status_get (&sent);
                if ((sent == 0) && (parse_error == 0))
                        cli_out ("Volume replace-brick failed");
        }

        return ret;
}
开发者ID:pavantc,项目名称:glusterd_scalability,代码行数:47,代码来源:cli-cmd-volume.c

示例9: cli_debug_xid

static void
cli_debug_xid(struct cli *cli, const char * const *av, void *priv)
{
    (void)priv;
    if (av[2] != NULL)
        xids = strtoul(av[2], NULL, 0);
    cli_out(cli, "XID is %u", xids);
}
开发者ID:akrito,项目名称:Varnish-Least-Busy-Director,代码行数:8,代码来源:cache_center.c

示例10: _send_echo_pkt_cb

STATIC void
_send_echo_pkt_cb(uint8 *pkt, void *cookie, int rv)
{
    _echo_cb_async_t *async_data;

    if (cookie == NULL) {
        cli_out("Error in async callback routine; missing data\n");
        return;
    }
    
    async_data = (_echo_cb_async_t *)cookie;
    cli_out("Async callback routine, unit %d\n", async_data->unit);

    /* Free buffer allocated earlier in _ct_echo() */
    sal_dma_free(pkt);
    sal_free(async_data);
}
开发者ID:ariavie,项目名称:bcm,代码行数:17,代码来源:ctrans.c

示例11: cmd_cint

cmd_result_t
cmd_cint(int unit, args_t* a)
{
    char* s; 
    int cmp;
    int argc = 0; 
    char* argv[16]; 

    cmd_cint_initialize(); 
    
    s = ARG_CUR(a);
    if(s) {
        cmp = sal_strcmp(s, "allow_file_info");
        if(!cmp) {
            argv[argc] = ARG_GET(a);
            argc++;
        }
    }

    if(ARG_CUR(a)) {
        /* Load file */
        FILE* fp; 
        s = ARG_GET(a); 
        
        if((fp = sal_fopen(s, "r")) != NULL) {
                

                
            sal_memset(argv, 0, sizeof(argv)); 
            while( (argv[argc] = ARG_GET(a)) ) {
                argc++; 
            }   

            cint_interpreter_parse(fp, NULL, argc, argv); 
            sal_fclose(fp); 
        }   
        else {
            cli_out("error: could not open file '%s'\n", s); 
        }       
    }   
    else {
        cli_out("Entering C Interpreter. Type 'exit;' to quit.\n\n"); 
        cint_interpreter_parse(NULL, "cint> ", argc, argv); 
    }
    return 0; 
}
开发者ID:ariavie,项目名称:bcm,代码行数:46,代码来源:cmd_cint.c

示例12: test_run

cmd_result_t
test_run(int u, args_t *a)
/*
 * Function:    test_run
 * Purpose:     Perform "run" command for test.
 * Parameters:  none - Run all selected tests with loaded parameters.
 *              "test [options]"
 * Returns:     Test result.
 */
{
    test_t      *test;
    int         rv;
    int         loops = -1;

    if (test_active) {
        cli_out("%s: Already running: %s\n", ARG_CMD(a), test_active->t_name);
        return(CMD_FAIL);
    } else if (!sh_check_attached(ARG_CMD(a), u)) {
        return(CMD_FAIL);
    }

    if (!ARG_CNT(a)) {
        rv = test_run_selected(u);
    } else {
        if (NULL == (test = test_find(ARG_CUR(a)))) {
            cli_out("%s: Unknown test: %s\n", ARG_CMD(a), ARG_CUR(a));
            return(CMD_FAIL);
        }

        if (!(test->t_flags & _test_chip(u)) && 
            !(test_options & TEST_O_OVERRIDE)) {
            cli_out("Error: Test %d (%s) not supported on %s\n"
                    "Error: use \"testmode +override\" to override and run\n",
                    test->t_test, test->t_name, SOC_UNIT_GROUP(u));
            return(CMD_FAIL);
        }           
        ARG_NEXT(a);                    /* Move arg pointer */
        /* If there is an argument which is an integer, it's a loop count */
        if (ARG_CUR(a) && isint(ARG_CUR(a))) {
            loops = strtoul(_ARG_GET(a), NULL, 10);
        }
        rv = test_dispatch(u, test, loops, ARG_CNT(a) ? a : NULL);
    }
    return(rv == TEST_INTR ? CMD_INTR : rv);
}
开发者ID:ariavie,项目名称:bcm,代码行数:45,代码来源:test.c

示例13: if_dump_table

/*
 * Function: 	if_dump_table
 * Purpose:	Dump the interface table.
 * Parameters:	Unit - Strataswitch Unit #.
 *		interface - interface #
 * Returns:	Nothing
 */
static void
if_dump_table(int u, int interface, int all)
{
    int 	us, ue;
    int		is, ie;
    char	ip_str[SAL_IPADDR_STR_LEN+3];
    char	mac_str[SAL_MACADDR_STR_LEN];
    if_soc_t	*ifs;

    if (SOC_UNIT_VALID(u)) {
	us = ue = u;
    } else {
	us = 0;
	ue = soc_ndev;
    }
    if (interface < 0) {
	is = 0;
	ie = MAX_INTERFACE-1;
    } else {
	is = interface;
	ie = interface;
    }
    for (u = us; u <= ue; u++) {
	if (if_table[u] == NULL) {
	    continue;
	}
	for (interface = is; interface <= ie; interface++) {
	    ifs = &if_table[u][interface];
	    if (!all && !ifs->ifs_sal) {
		continue;;
	    }
	    if (ifs->ifs_sal) {
		format_ipaddr_mask(ip_str, ifs->ifs_net_ip, ifs->ifs_net_mask);
		format_macaddr(mac_str, ifs->ifs_net_mac);
		cli_out("unit %d interface %s%d: mac %s ip %s\n", u,
                        ifs->ifs_net_name, ifs->ifs_net_interface,
                        mac_str, ip_str);
	    } else {
            cli_out("unit %d interface %d: down\n", u, interface);
	    }
	}
    }
}
开发者ID:ariavie,项目名称:bcm,代码行数:50,代码来源:if.c

示例14: test_print_header

void
test_print_header(int status_report)
/*
 * Function:    test_print_header
 * Purpose:     Print header string for output.
 * Parameters:  None.
 * Returns:     Nothing
 */
{
    if (status_report) {
        cli_out("-----+----+--- TEST STATUS REPORT ----+"
                "-----+-----+-----+-----+-----------\n");
    }

    cli_out("U/A/S|Test|            Test           |Loop | Run |Pass |Fail |"
            "  Arguments\n");
    cli_out("     | #  |            Name           |Count|Count|Count|Count|"
            "\n");
}
开发者ID:ariavie,项目名称:bcm,代码行数:19,代码来源:test.c

示例15: test_mode

cmd_result_t
test_mode(int u, args_t *a)
/*
 * Function:    test_mode
 * Purpose:     Set test test mode
 * Parameters:  [+/-] "soe" or "stoponerror"
 * Returns:     0 - success, 
 *              -1 - failed.
 */
{
    static      parse_pm_t options[] = {
        {"@SOE",        TEST_O_SOE},
        {"@AOE",        TEST_O_AOE},
        {"Stoponerror", TEST_O_SOE},
        {"Abortonerror",TEST_O_AOE},
        {"Quiet",       TEST_O_QUIET},
        {"Progress",    TEST_O_PROGRESS},
        {"RANDom",      TEST_O_RANDOM},
        {"SIlent",      TEST_O_SILENT},
        {"Run",         TEST_O_RUN},
        {"Override",    TEST_O_OVERRIDE},
        {"NoReinit",    TEST_O_NO_REINIT},
        {NULL,          0}
    };
    char        *c;

    COMPILER_REFERENCE(u);

    if (0 == ARG_CNT(a)) {
        cli_out("Test: Options: ");
        parse_mask_format(80, options, test_options);
        cli_out("\n");
        return(CMD_OK);
    }

    while ((c = ARG_GET(a)) != NULL) {
        if (parse_mask(c, options, &test_options)) {
            cli_out("%s: Error: invalid option ignored: %s\n", ARG_CMD(a), c);
        }
    }
    return(CMD_OK);
}
开发者ID:ariavie,项目名称:bcm,代码行数:42,代码来源:test.c


注:本文中的cli_out函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。