Exemplo n.º 1
0
/*__________________________________________________________________________
*/
void dbg_set_tmr_default(char * argv[], uint32_t tcpRef, void *bufRef) 
{

   
   int timer_id;
   
   if (argv[1] ==NULL)
   {
    uma_dbg_send(tcpRef, bufRef, TRUE, "Missing timer identifier (%s <tmr_idx|all> )\n",argv[0]);    
    return;     
   }
   if (strcmp("all",argv[1]) ==0)  
   {
    rozofs_tmr_init_configuration();
    uma_dbg_send(tcpRef, bufRef, TRUE, "Success\n");    
    return;     
   }
   errno = 0;
   timer_id = (int) strtol(argv[1], (char **) NULL, 10);   
   if (errno != 0) {
    uma_dbg_send(tcpRef, bufRef, TRUE, "bad tmr_idx (%s <tmr_idx|all> )\n",argv[0]);    
    return;     
   }
   if (timer_id >= TMR_MAX_ENTRY)
   {
    uma_dbg_send(tcpRef, bufRef, TRUE, "invalid tmr_idx (max %d)\n",(TMR_MAX_ENTRY-1));    
    return;           
   }
   rozofs_tmr_set_to_default(timer_id);
   uma_dbg_send(tcpRef, bufRef, TRUE, "Success\n");    
   return;   
}
Exemplo n.º 2
0
void dbg_set_tmr_default(char * argv[], uint32_t tcpRef, void *bufRef)
{
    char           *pChar=uma_dbg_get_buffer();


    int timer_id;

    if (argv[1] ==NULL)
    {
        pChar = dbg_set_tmr_default_help(pChar);
        uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());
        return;
    }
    if (strcmp("all",argv[1]) ==0)
    {
        rozofs_tmr_init_configuration();
        uma_dbg_send(tcpRef, bufRef, TRUE, "Success\n");
        return;
    }
    /* Check 1rst a string name */
    timer_id = rozofs_tmr_get_idx_from_name(argv[1]);
    /* Check for an index */
    if (timer_id < 0) {
        errno = 0;
        timer_id = (int) strtol(argv[1], (char **) NULL, 10);
        if (errno != 0) {
            pChar = dbg_set_tmr_default_help(pChar);
            uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());
            return;
        }
    }
    if (timer_id >= TMR_MAX_ENTRY)
    {
        pChar += sprintf(pChar,"invalid timer index (max %d)\n",(TMR_MAX_ENTRY-1));
        pChar = dbg_set_tmr_default_help(pChar);
        uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());
        return;
    }
    rozofs_tmr_set_to_default(timer_id);
    uma_dbg_send(tcpRef, bufRef, TRUE, "Success\n");
    return;
}