本文整理汇总了C++中DisplayLog函数的典型用法代码示例。如果您正苦于以下问题:C++ DisplayLog函数的具体用法?C++ DisplayLog怎么用?C++ DisplayLog使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DisplayLog函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: File_CreateSetStripe
int File_CreateSetStripe( const char * path, const stripe_info_t * old_stripe )
{
int rc;
/* try to restripe using previous pool name */
if ( !EMPTY_STRING( old_stripe->pool_name ) )
{
rc = llapi_file_create_pool( path, old_stripe->stripe_size,
-1, old_stripe->stripe_count, 0,
(char *)old_stripe->pool_name );
if ( rc == 0 || rc == -EEXIST )
return rc;
else
{
DisplayLog( LVL_MAJOR, TAG_CR_STRIPE, "Error %d creating '%s' in pool '%s': %s",
rc, path, old_stripe->pool_name, strerror(-rc) );
DisplayLog( LVL_MAJOR, TAG_CR_STRIPE, "Trying to create it without pool information..." );
}
}
rc = llapi_file_create( path, old_stripe->stripe_size,
-1, old_stripe->stripe_count, 0 );
if ( rc != 0 || rc == -EEXIST )
DisplayLog( LVL_MAJOR, TAG_CR_STRIPE,
"Error %d creating '%s' with stripe. Trying to create it without specific stripe...",
rc, path );
return rc;
}
示例2: EntryProcessor_Get
void *enqueue_thread( void *arg )
{
int rc, i;
entry_proc_op_t *new_op;
for ( i = 0; i < NB_OP_ENQUEUE; i++ )
{
new_op = EntryProcessor_Get( );
if ( !new_op )
{
printf( "Error in EntryProcessor_Get\n");
return NULL;
}
/* initial stage */
new_op->pipeline_stage = entry_proc_pipeline[0].stage_index;
#ifdef _LUSTRE_HSM
new_op->extra_info.log_record.record_id = i;
DisplayLog( LVL_FULL, "EnqueueThr", "Enqueuing record #%u", i );
#else
sprintf( ATTR( &new_op->entry_attr, fullpath ), "/dir%u/file%d",
( unsigned int ) time( NULL ), i );
DisplayLog( LVL_FULL, "EnqueueThr", "Enqueuing file %s",
ATTR( &new_op->entry_attr, fullpath ) );
#endif
EntryProcessor_Push( new_op );
}
}
示例3: CreateStriped
int CreateStriped( const char * path, const stripe_info_t * old_stripe, int overwrite )
{
int rc;
/* try to restripe using previous pool name */
if ( !EMPTY_STRING( old_stripe->pool_name ) )
rc = llapi_file_create_pool( path, old_stripe->stripe_size,
-1, old_stripe->stripe_count, 0,
(char *)old_stripe->pool_name );
else
rc = llapi_file_create( path, old_stripe->stripe_size,
-1, old_stripe->stripe_count, 0 );
if ((rc == -EEXIST) && overwrite)
{
if (unlink(path)) {
rc = -errno;
DisplayLog( LVL_MAJOR, TAG_CR_STRIPE, "Can't remove previous entry %s: %s",
path, strerror(-rc));
return rc;
}
return CreateStriped(path, old_stripe, false /*target not expected to exist*/);
}
else if ( rc != 0 && rc != -EEXIST )
{
DisplayLog( LVL_MAJOR, TAG_CR_STRIPE, "Error %d creating '%s' with stripe.",
rc, path );
}
return rc;
}
示例4: File_GetStripeByDirFd
int File_GetStripeByDirFd( int dirfd, const char *fname,
stripe_info_t * p_stripe_info,
stripe_items_t * p_stripe_items )
{
int rc = 0;
char lum_buffer[4096];
struct lov_user_md *p_lum = ( struct lov_user_md * ) lum_buffer;
if ( !fname|| !fname[0] )
return -EFAULT;
memset( lum_buffer, 0, sizeof( lum_buffer ) );
strcpy((char *)p_lum, fname);
if (ioctl(dirfd, IOC_MDC_GETFILESTRIPE, (void *)p_lum) == -1)
rc = -errno;
if ( rc != 0 )
{
if ( rc == -ENODATA )
DisplayLog( LVL_DEBUG, TAG_STRIPE,
"File %s has no stripe information",
fname );
else if ( ( rc != -ENOENT ) && ( rc != -ESTALE ) )
DisplayLog( LVL_CRIT, TAG_STRIPE,
"Error %d getting stripe info for %s", rc,
fname );
return rc;
}
return fill_stripe_info(p_lum, p_stripe_info, p_stripe_items);
}
示例5: id_constraint_unregister
/**
* This removes the current reference to an id when the operation is removed.
*/
int id_constraint_unregister( entry_proc_op_t * p_op )
{
unsigned int hash_index;
id_constraint_item_t *p_curr;
id_constraint_item_t *p_prev;
if ( !p_op->entry_id_is_set )
return ID_MISSING;
if ( !p_op->id_is_referenced )
return ID_NOT_EXISTS;
/* compute id hash value */
hash_index = hash_id( &p_op->entry_id, ID_HASH_SIZE );
/* check if the entry id exists and is a stage >= pipeline_stage */
P( id_hash[hash_index].lock );
for ( p_curr = id_hash[hash_index].id_list_first, p_prev = NULL;
p_curr != NULL; p_prev = p_curr, p_curr = p_curr->p_next )
{
if ( p_curr->op_ptr == p_op )
{
/* found */
if ( p_prev == NULL )
id_hash[hash_index].id_list_first = p_curr->p_next;
else
p_prev->p_next = p_curr->p_next;
/* was it the last ? */
if ( id_hash[hash_index].id_list_last == p_curr )
id_hash[hash_index].id_list_last = p_prev;
p_curr->op_ptr->id_is_referenced = FALSE;
id_hash[hash_index].count--;
V( id_hash[hash_index].lock );
/* free the slot */
MemFree( p_curr );
return ID_OK;
}
}
V( id_hash[hash_index].lock );
#ifdef _HAVE_FID
DisplayLog( LVL_MAJOR, ENTRYPROC_TAG,
"id_constraint_unregister: op not found (list %u): id [%llu, %u] record %u",
hash_index, p_op->entry_id.f_seq, p_op->entry_id.f_oid, p_op->entry_id.f_ver );
#else
DisplayLog( LVL_MAJOR, ENTRYPROC_TAG,
"id_constraint_unregister: op not found (list %u): id [dev %llu, ino %llu]",
hash_index, ( unsigned long long ) p_op->entry_id.device,
( unsigned long long ) p_op->entry_id.inode );
#endif
return ID_NOT_EXISTS;
}
示例6: File_GetStripeByPath
int File_GetStripeByPath( const char *entry_path, stripe_info_t * p_stripe_info,
stripe_items_t * p_stripe_items )
{
int rc;
struct lov_user_md *p_lum;
if ( !entry_path || !entry_path[0] )
return -EFAULT;
p_lum = (struct lov_user_md *)MemAlloc(LUM_SIZE_MAX);
if (!p_lum)
return -ENOMEM;
memset(p_lum, 0, LUM_SIZE_MAX);
rc = llapi_file_get_stripe(entry_path, p_lum);
if ( rc != 0 )
{
if ( rc == -ENODATA )
DisplayLog( LVL_DEBUG, TAG_STRIPE,
"File %s has no stripe information",
entry_path );
else if ( ( rc != -ENOENT ) && ( rc != -ESTALE ) )
DisplayLog( LVL_CRIT, TAG_STRIPE,
"Error %d getting stripe info for %s", rc,
entry_path );
goto out_free;
}
rc = fill_stripe_info(p_lum, p_stripe_info, p_stripe_items);
out_free:
MemFree(p_lum);
return rc;
}
示例7: Reload_Rmdir_Config
int Reload_Rmdir_Config( void *module_config )
{
rmdir_config_t *conf = ( rmdir_config_t * ) module_config;
/* parameters that can't be modified dynamically */
if (rmdir_config.nb_threads_rmdir != conf->nb_threads_rmdir )
DisplayLog( LVL_MAJOR, "RmdirConfig",
RMDIR_PARAM_BLOCK
"::nb_threads_rmdir changed in config file, but cannot be modified dynamically" );
if (rmdir_config.rmdir_queue_size != conf->rmdir_queue_size )
DisplayLog( LVL_MAJOR, "RmdirConfig",
RMDIR_PARAM_BLOCK
"::rmdir_queue_size changed in config file, but cannot be modified dynamically" );
/* dynamic parameters */
if (rmdir_config.runtime_interval != conf->runtime_interval )
{
DisplayLog( LVL_EVENT, "RmdirConfig", RMDIR_PARAM_BLOCK
"::runtime_interval updated: %"PRI_TT"->%"PRI_TT,
rmdir_config.runtime_interval, conf->runtime_interval );
rmdir_config.runtime_interval = conf->runtime_interval;
}
return 0;
}
示例8: DisplayLog
/* Scan starter thread */
static void *scan_starter( void *arg )
{
int rc;
DisplayLog( LVL_VERB, FSSCAN_TAG, "Launching FS Scan starter thread" );
if ( fsscan_flags & FLAG_ONCE )
{
rc = Robinhood_CheckScanDeadlines( );
if ( rc )
DisplayLog( LVL_CRIT, FSSCAN_TAG, "Error %d checking FS Scan status", rc );
pthread_exit( NULL );
return NULL;
}
/* not a one-shot mode */
while ( !terminate )
{
rc = Robinhood_CheckScanDeadlines( );
if ( rc )
DisplayLog( LVL_CRIT, FSSCAN_TAG, "Error %d checking FS Scan status", rc );
/* attente de la boucle suivante */
rh_sleep( fs_scan_config.spooler_check_interval );
}
return NULL;
}
示例9: db_connect
/* create client connection */
int db_connect( db_conn_t * conn )
{
int rc;
/* Connect to database */
rc = sqlite3_open( lmgr_config.db_config.filepath, conn );
if ( rc != 0 )
{
if ( *conn )
{
DisplayLog( LVL_CRIT, LISTMGR_TAG,
"Failed to connect to SQLite DB (file %s): Error: %s",
lmgr_config.db_config.filepath, sqlite3_errmsg( *conn ) );
}
else
{
DisplayLog( LVL_CRIT, LISTMGR_TAG,
"Failed to connect to SQLite DB (file %s): Error: %d",
lmgr_config.db_config.filepath, rc );
}
return DB_CONNECT_FAILED;
}
DisplayLog( LVL_FULL, LISTMGR_TAG, "Logged on to database successfully" );
set_cache_size( *conn );
return DB_SUCCESS;
}
示例10: generate_fields
/** generate fields */
void generate_fields( attr_set_t * p_set )
{
int i;
int mask = 1;
for ( i = 0; i < ATTR_COUNT; i++, mask <<= 1 )
{
if ( ( p_set->attr_mask & mask) && (field_infos[i].flags & GENERATED) )
{
void * src_data;
void * tgt_data;
if ( field_infos[i].gen_func == NULL )
{
/* cannot generate a field without a function */
DisplayLog( LVL_DEBUG, LISTMGR_TAG,
"generated field without generation function: %s",
field_infos[i].field_name );
p_set->attr_mask &= ~mask;
continue;
}
/* is it generated from another field ? */
if ( field_infos[i].gen_index != -1 )
{
int src_mask = 1 << field_infos[i].gen_index;
/* is source set? */
if ( (p_set->attr_mask & src_mask) == 0 )
{
DisplayLog( LVL_FULL, LISTMGR_TAG,
"Source info '%s' of generated field '%s' is not set "
"in the database",
field_infos[field_infos[i].gen_index].field_name,
field_infos[i].field_name );
p_set->attr_mask &= ~mask;
continue;
}
src_data = ( char * ) &p_set->attr_values + field_infos[field_infos[i].gen_index].offset;
}
else
{
/* nothing needed to generate it */
src_data = NULL;
}
tgt_data = ( char * ) &p_set->attr_values + field_infos[i].offset;
if ( field_infos[i].gen_func( tgt_data, src_data ) != 0 )
p_set->attr_mask &= ~mask;
else
DisplayLog( LVL_FULL, LISTMGR_TAG, "Field '%s' auto-generated",
field_infos[i].field_name );
} /* end if generated */
} /* end for attr list */
}
示例11: execute_shell_command
int execute_shell_command( const char * cmd, int argc, ... )
{
#define SHCMD "ShCmd"
va_list arglist;
char cmdline[4096];
char argbuf[1024];
char * curr = cmdline;
int rc, i;
int exrc;
curr += sprintf( cmdline, "%s", cmd );
va_start(arglist, argc);
for (i = 0; i < argc; i++)
curr += sprintf( curr, " %s",
escape_shell_arg( va_arg(arglist, char *), argbuf ));
va_end(arglist);
curr += sprintf( curr, " %s", " >/dev/null 2>/dev/null");
DisplayLog(LVL_DEBUG, SHCMD, "Executing command: %s", cmdline);
rc = system(cmdline);
if ( WIFEXITED(rc) )
{
const char * str_error;
exrc = WEXITSTATUS(rc);
if (exrc == 0)
{
DisplayLog(LVL_DEBUG, SHCMD, "Command successful");
return 0;
}
/* shell special return values */
if (exrc == 126)
str_error = "permission problem or command is not an executable";
else if (exrc == 127)
str_error = "command not found";
else if (exrc == 128)
str_error = "invalid argument to exit";
else
str_error = "external command exited";
DisplayLog( LVL_MAJOR, SHCMD,
"ERROR: %s, error %d (cmdline=%s)",
str_error, exrc, cmdline );
rc = -exrc;
}
else if (WIFSIGNALED(rc))
{
DisplayLog( LVL_MAJOR, SHCMD,
"ERROR: command terminated by signal %d. cmdline=%s",
WTERMSIG(rc), cmdline );
rc = -EINTR;
}
return rc;
}
示例12: ListMgr_BatchInsert
/**
* Insert a batch of entries into the database.
* All entries must have the same attr mask.
*/
int ListMgr_BatchInsert(lmgr_t * p_mgr, entry_id_t ** p_ids,
attr_set_t ** p_attrs,
unsigned int count,
int update_if_exists)
{
int rc;
char buff[4096];
if (count == 0)
return DB_SUCCESS;
else if (p_ids == NULL || p_attrs == NULL)
RBH_BUG("NULL pointer argument");
/* read only fields in info mask? */
if (readonly_attr_set & p_attrs[0]->attr_mask)
{
DisplayLog(LVL_MAJOR, LISTMGR_TAG, "Error: trying to insert read only values: attr_mask=%#x",
readonly_attr_set & p_attrs[0]->attr_mask);
return DB_INVALID_ARG;
}
/* retry the whole transaction when the error is retryable */
retry:
/* We want insert operation set to be atomic */
rc = lmgr_begin(p_mgr);
if (lmgr_delayed_retry(p_mgr, rc))
goto retry;
else if (rc)
return rc;
rc = listmgr_batch_insert_no_tx(p_mgr, p_ids, p_attrs, count, update_if_exists);
if (lmgr_delayed_retry(p_mgr, rc))
goto retry;
else if (rc)
{
lmgr_rollback(p_mgr);
DisplayLog(LVL_CRIT, LISTMGR_TAG,
"DB query failed in %s line %d: code=%d: %s",
__FUNCTION__, __LINE__, rc, db_errmsg(&p_mgr->conn, buff, 4096));
return rc;
}
rc = lmgr_commit(p_mgr);
if (lmgr_delayed_retry(p_mgr, rc))
goto retry;
/* success, count it */
if (!rc)
{
if (update_if_exists)
p_mgr->nbop[OPIDX_UPDATE] += count;
else
p_mgr->nbop[OPIDX_INSERT] += count;
}
return rc;
}
示例13: lustre_mds_stat
/* This code is an adaptation of llapi_mds_getfileinfo() in liblustreapi.
* It is unused for now, but could be useful when SOM will be implemented.
*/
int lustre_mds_stat(char *fullpath, int parentfd, struct stat *inode)
{
/* this buffer must be large enough for handling filename */
char buffer[1024];
struct lov_user_mds_data *lmd = ( struct lov_user_mds_data * ) buffer;
char *filename;
int rc;
/* sanity checks */
if ((fullpath == NULL) || (inode == NULL))
return EINVAL;
filename = basename( fullpath );
if ( filename == NULL )
filename = fullpath;
memset(lmd, 0, sizeof(buffer));
rh_strncpy(buffer, filename, strlen(filename) + 1);
rc = ioctl(parentfd, IOC_MDC_GETFILEINFO, (void *)lmd);
if ( rc )
{
if ( errno == ENOTTY )
{
/* ioctl is not supported, it is not a lustre fs.
* Do the regular lstat(2) instead. */
rc = lstat( fullpath, inode );
if ( rc )
{
DisplayLog( LVL_CRIT, TAG_MDSSTAT, "Error: %s: lstat failed for %s",
__FUNCTION__, fullpath );
return rc;
}
}
else if ( ( errno == ENOENT ) || ( errno == ESTALE ) )
{
DisplayLog( LVL_MAJOR, TAG_MDSSTAT, "Warning: %s: %s does not exist",
__FUNCTION__, fullpath );
return ENOENT;
}
else
{
DisplayLog(LVL_CRIT, TAG_MDSSTAT,
"Error: %s: IOC_MDC_GETFILEINFO failed for %s: rc=%d, errno=%d",
__FUNCTION__, fullpath, rc, errno);
return rc;
}
}
else
*inode = lmd->lmd_st;
return 0;
}
示例14: LustreHSM_Action
/** Trigger a HSM action */
int LustreHSM_Action( enum hsm_user_action action, const entry_id_t * p_id,
const char * hints, unsigned int archive_id )
{
struct hsm_user_request * req;
int data_len = 0;
int rc;
char * mpath;
if ( hints != NULL )
data_len = strlen(hints)+1;
req = llapi_hsm_user_request_alloc(1, data_len);
if (!req)
{
rc = -errno;
DisplayLog( LVL_CRIT, "HSMAction", "Cannot create HSM request: %s",
strerror(-rc) );
return rc;
}
req->hur_request.hr_action = action;
req->hur_request.hr_archive_id = archive_id;
req->hur_user_item[0].hui_fid = *p_id;
req->hur_user_item[0].hui_extent.offset = 0 ;
/* XXX for now, always transfer entire file */
req->hur_user_item[0].hui_extent.length = -1LL;
req->hur_request.hr_itemcount = 1;
if ( hints != NULL )
{
req->hur_request.hr_data_len = data_len;
memcpy(hur_data(req), hints, data_len);
}
else
{
req->hur_request.hr_data_len = 0;
}
/* make tmp copy as llapi_hsm_request arg is not const */
mpath = strdup(get_mount_point(NULL));
rc = llapi_hsm_request(mpath, req);
free(mpath);
free(req);
if (rc)
DisplayLog( LVL_CRIT, "HSMAction", "ERROR performing HSM request(%s,"
" root=%s, fid="DFID"): %s",
hsm_user_action2name(action), mpath, PFID(p_id),
strerror(-rc) );
return rc;
}
示例15: module_unload
/**
* Release resources associated to a single module. Note that the mod_list
* is not resized.
*
* \param[in, out] mod Module descriptor to release
*
* \return 0 on success, negative error code on failure
*/
static int module_unload(rbh_module_t *mod)
{
if (mod->name != NULL)
DisplayLog(LVL_DEBUG, MODULE_TAG, "Unloading module %s", mod->name);
if (mod->sym_hdl == NULL) {
DisplayLog(LVL_VERB, MODULE_TAG, "Module already unloaded, ignoring");
return 0; /* -EALREADY ? */
}
dlclose(mod->sym_hdl);
mod->sym_hdl = NULL;
return 0;
}