本文整理汇总了C++中FREE_NULL_LIST函数的典型用法代码示例。如果您正苦于以下问题:C++ FREE_NULL_LIST函数的具体用法?C++ FREE_NULL_LIST怎么用?C++ FREE_NULL_LIST使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FREE_NULL_LIST函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fini
extern int fini(void)
{
debug("%s: unloading %s", __func__, plugin_name);
FREE_NULL_LIST(gres_devices);
FREE_NULL_LIST(mps_info);
return SLURM_SUCCESS;
}
示例2: _destroy_local_resv_usage
static void _destroy_local_resv_usage(void *object)
{
local_resv_usage_t *r_usage = (local_resv_usage_t *)object;
if (r_usage) {
FREE_NULL_LIST(r_usage->local_assocs);
FREE_NULL_LIST(r_usage->loc_tres);
xfree(r_usage);
}
}
示例3: _add_clusters_to_remove
/* Add clusters to be removed if "setting" a federation to a specific set of
* clusters or clearing all clusters.
*
* IN cluster_list: list of slurmdb_cluster_rec_t's with cluster names set that
* are to be "set" on the federation the federation.
* IN federation: name of the federation that is being added/modified.
*/
static int _add_clusters_to_remove(List cluster_list, const char *federation)
{
List db_list = NULL;
ListIterator db_itr = NULL;
slurmdb_federation_cond_t db_cond;
slurmdb_federation_rec_t *db_rec = NULL;
slurmdb_cluster_rec_t *db_cluster = NULL;
slurmdb_init_federation_cond(&db_cond, 0);
db_cond.federation_list = list_create(slurm_destroy_char);
list_append(db_cond.federation_list, xstrdup(federation));
db_list = acct_storage_g_get_federations(db_conn, my_uid, &db_cond);
if (!db_list || !list_count(db_list)) {
fprintf(stderr, " Problem getting federations "
"from database. Contact your admin.\n");
return SLURM_ERROR;
}
FREE_NULL_LIST(db_cond.federation_list);
db_rec = list_peek(db_list);
db_itr = list_iterator_create(db_rec->cluster_list);
while ((db_cluster = list_next(db_itr))) {
bool found_cluster = false;
slurmdb_cluster_rec_t *orig_cluster = NULL;
ListIterator orig_itr = list_iterator_create(cluster_list);
/* Figure out if cluster in cluster_list is already on the
* federation. If if is, don't add to list to remove */
while ((orig_cluster = list_next(orig_itr))) {
char *db_name = db_cluster->name;
if (*db_name == '+' || *db_name == '-')
++db_name;
if (!xstrcmp(orig_cluster->name, db_name)) {
found_cluster = true;
break;
}
}
list_iterator_destroy(orig_itr);
if (found_cluster)
continue;
slurmdb_cluster_rec_t *cluster =
xmalloc(sizeof(slurmdb_cluster_rec_t));
slurmdb_init_cluster_rec(cluster, 0);
cluster->name = xstrdup_printf("-%s", db_cluster->name);
list_append(cluster_list, cluster);
}
list_iterator_destroy(db_itr);
FREE_NULL_LIST(db_list);
return SLURM_SUCCESS;
}
示例4: eio_handle_destroy
void eio_handle_destroy(eio_handle_t *eio)
{
xassert(eio != NULL);
xassert(eio->magic == EIO_MAGIC);
close(eio->fds[0]);
close(eio->fds[1]);
FREE_NULL_LIST(eio->obj_list);
FREE_NULL_LIST(eio->new_objs);
slurm_mutex_destroy(&eio->shutdown_mutex);
xassert(eio->magic = ~EIO_MAGIC);
xfree(eio);
}
示例5: _transfer_loc_tres
/* This will destroy the *loc_tres given after it is transfered */
static void _transfer_loc_tres(List *loc_tres, local_id_usage_t *usage)
{
if (!usage || !*loc_tres || !list_count(*loc_tres)) {
FREE_NULL_LIST(*loc_tres);
return;
}
if (!usage->loc_tres) {
usage->loc_tres = *loc_tres;
*loc_tres = NULL;
} else {
_add_job_alloc_time_to_cluster(usage->loc_tres, *loc_tres);
FREE_NULL_LIST(*loc_tres);
}
}
示例6: _block_list_del
static void _block_list_del(void *object)
{
db2_block_info_t *block_ptr = (db2_block_info_t *)object;
if (block_ptr) {
xfree(block_ptr->bg_block_name);
xfree(block_ptr->slurm_part_name);
xfree(block_ptr->mp_str);
xfree(block_ptr->ionode_str);
FREE_NULL_LIST(block_ptr->nodelist);
FREE_NULL_LIST(block_ptr->job_list);
xfree(block_ptr);
}
}
示例7: run_script
int run_script(const char *name, const char *pattern, uint32_t job_id,
int max_wait, char **env, uid_t uid)
{
int rc = 0;
List l;
ListIterator i;
char *s;
if (pattern == NULL || pattern[0] == '\0')
return 0;
l = _script_list_create (pattern);
if (l == NULL)
return error ("Unable to run %s [%s]", name, pattern);
i = list_iterator_create (l);
while ((s = list_next (i))) {
rc = _run_one_script (name, s, job_id, max_wait, env, uid);
if (rc) {
error ("%s: exited with status 0x%04x\n", s, rc);
break;
}
}
list_iterator_destroy (i);
FREE_NULL_LIST (l);
return rc;
}
示例8: get_system_stats
extern int get_system_stats(GtkTable *table)
{
int rc = SLURM_SUCCESS;
node_info_msg_t *node_info_ptr = NULL;
List node_list = NULL;
if ((rc = get_new_info_node(&node_info_ptr, force_refresh))
== SLURM_NO_CHANGE_IN_DATA) {
} else if (rc != SLURM_SUCCESS)
return SLURM_ERROR;
select_g_ba_init(node_info_ptr, 0);
node_list = create_node_info_list(node_info_ptr, false);
if (grid_button_list) {
rc = update_grid_table(main_grid_table, grid_button_list,
node_list);
if (rc == RESET_GRID) {
FREE_NULL_LIST(grid_button_list);
grid_button_list = list_create(destroy_grid_button);
setup_grid_table(main_grid_table, grid_button_list,
node_list);
}
} else {
grid_button_list = list_create(destroy_grid_button);
setup_grid_table(main_grid_table, grid_button_list, node_list);
}
gtk_widget_show_all(GTK_WIDGET(main_grid_table));
return SLURM_SUCCESS;
}
示例9: _isdefault_old
static int _isdefault_old(List acct_list)
{
int rc = 0;
slurmdb_user_cond_t user_cond;
List ret_list = NULL;
if (!acct_list || !list_count(acct_list))
return rc;
memset(&user_cond, 0, sizeof(slurmdb_user_cond_t));
user_cond.def_acct_list = acct_list;
ret_list = slurmdb_users_get(db_conn, &user_cond);
if (ret_list && list_count(ret_list)) {
ListIterator itr = list_iterator_create(ret_list);
slurmdb_user_rec_t *user = NULL;
fprintf(stderr," Users listed below have these "
"as their Default Accounts.\n");
while((user = list_next(itr))) {
fprintf(stderr, " User - %-10.10s Account - %s\n",
user->name, user->default_acct);
}
list_iterator_destroy(itr);
rc = 1;
}
FREE_NULL_LIST(ret_list);
return rc;
}
示例10: _get_info
/* clear_old IN - if set then don't preserve old info (it might be from
* another cluster) */
static int _get_info(bool clear_old)
{
partition_info_msg_t *partition_msg = NULL;
node_info_msg_t *node_msg = NULL;
block_info_msg_t *block_msg = NULL;
reserve_info_msg_t *reserv_msg = NULL;
List sinfo_list = NULL;
int rc = 0;
if (_query_server(&partition_msg, &node_msg, &block_msg, &reserv_msg,
clear_old))
rc = 1;
else if (params.bg_flag)
(void) _bg_report(block_msg);
else if (params.reservation_flag)
(void) _reservation_report(reserv_msg);
else {
sinfo_list = list_create(_sinfo_list_delete);
_build_sinfo_data(sinfo_list, partition_msg, node_msg);
sort_sinfo_list(sinfo_list);
print_sinfo_list(sinfo_list);
FREE_NULL_LIST(sinfo_list);
}
return rc;
}
示例11: _build_parts
/* Build the gs_part_list. The job_list will be created later,
* once a job is added. */
static void _build_parts(void)
{
ListIterator part_iterator;
struct part_record *p_ptr;
struct gs_part *gs_part_ptr;
int num_parts;
FREE_NULL_LIST(gs_part_list);
/* reset the sorted list, since it's currently
* pointing to partitions we just destroyed */
num_sorted_part = 0;
num_parts = list_count(part_list);
if (num_parts == 0)
return;
gs_part_list = list_create(_destroy_parts);
part_iterator = list_iterator_create(part_list);
while ((p_ptr = (struct part_record *) list_next(part_iterator))) {
gs_part_ptr = xmalloc(sizeof(struct gs_part));
gs_part_ptr->part_name = xstrdup(p_ptr->name);
gs_part_ptr->priority = p_ptr->priority;
/* everything else is already set to zero/NULL */
list_append(gs_part_list, gs_part_ptr);
}
list_iterator_destroy(part_iterator);
}
示例12: _create_resv_info_list
static List _create_resv_info_list(reserve_info_msg_t *resv_info_ptr)
{
static List info_list = NULL;
List last_list = NULL;
ListIterator last_list_itr = NULL;
int i = 0;
static reserve_info_msg_t *last_resv_info_ptr = NULL;
sview_resv_info_t *sview_resv_info_ptr = NULL;
reserve_info_t *resv_ptr = NULL;
if (info_list && (resv_info_ptr == last_resv_info_ptr))
goto update_color;
last_resv_info_ptr = resv_info_ptr;
if (info_list)
last_list = info_list;
info_list = list_create(_resv_info_list_del);
if (last_list)
last_list_itr = list_iterator_create(last_list);
for(i=0; i<resv_info_ptr->record_count; i++) {
resv_ptr = &(resv_info_ptr->reservation_array[i]);
sview_resv_info_ptr = NULL;
if (last_list_itr) {
while ((sview_resv_info_ptr =
list_next(last_list_itr))) {
if (!xstrcmp(sview_resv_info_ptr->resv_name,
resv_ptr->name)) {
list_remove(last_list_itr);
_resv_info_free(sview_resv_info_ptr);
break;
}
}
list_iterator_reset(last_list_itr);
}
if (!sview_resv_info_ptr)
sview_resv_info_ptr =
xmalloc(sizeof(sview_resv_info_t));
sview_resv_info_ptr->resv_name = xstrdup(resv_ptr->name);
sview_resv_info_ptr->pos = i;
sview_resv_info_ptr->resv_ptr = resv_ptr;
sview_resv_info_ptr->color_inx = i % sview_colors_cnt;
list_append(info_list, sview_resv_info_ptr);
}
list_sort(info_list,
(ListCmpF)_sview_resv_sort_aval_dec);
if (last_list) {
list_iterator_destroy(last_list_itr);
FREE_NULL_LIST(last_list);
}
update_color:
return info_list;
}
示例13: as_mysql_remove_wckeys
extern List as_mysql_remove_wckeys(mysql_conn_t *mysql_conn,
uint32_t uid,
slurmdb_wckey_cond_t *wckey_cond)
{
List ret_list = NULL;
int rc = SLURM_SUCCESS;
char *extra = NULL, *object = NULL;
char *user_name = NULL;
List use_cluster_list = as_mysql_cluster_list;
ListIterator itr;
if (!wckey_cond) {
xstrcat(extra, " where deleted=0");
goto empty;
}
if (check_connection(mysql_conn) != SLURM_SUCCESS)
return NULL;
if (!is_user_min_admin_level(mysql_conn, uid, SLURMDB_ADMIN_OPERATOR)) {
errno = ESLURM_ACCESS_DENIED;
return NULL;
}
(void) _setup_wckey_cond_limits(wckey_cond, &extra);
if (wckey_cond->cluster_list && list_count(wckey_cond->cluster_list))
use_cluster_list = wckey_cond->cluster_list;
empty:
if (!extra) {
error("Nothing to remove");
return NULL;
}
user_name = uid_to_string((uid_t) uid);
if (use_cluster_list == as_mysql_cluster_list)
slurm_mutex_lock(&as_mysql_cluster_list_lock);
ret_list = list_create(slurm_destroy_char);
itr = list_iterator_create(use_cluster_list);
while ((object = list_next(itr))) {
if ((rc = _cluster_remove_wckeys(
mysql_conn, extra, object, user_name, ret_list))
!= SLURM_SUCCESS)
break;
}
list_iterator_destroy(itr);
xfree(extra);
xfree(user_name);
if (use_cluster_list == as_mysql_cluster_list)
slurm_mutex_unlock(&as_mysql_cluster_list_lock);
if (rc == SLURM_ERROR) {
FREE_NULL_LIST(ret_list);
return NULL;
}
return ret_list;
}
示例14: _pmix_p2p_send_core
static int _pmix_p2p_send_core(const char *nodename, const char *address,
const char *data, uint32_t len)
{
int rc, timeout;
slurm_msg_t msg;
forward_data_msg_t req;
List ret_list;
ret_data_info_t *ret_data_info = NULL;
pmixp_debug_hang(0);
slurm_msg_t_init(&msg);
PMIXP_DEBUG("nodelist=%s, address=%s, len=%u", nodename, address, len);
req.address = (char *)address;
req.len = len;
/* there is not much we can do - just cast) */
req.data = (char*)data;
msg.msg_type = REQUEST_FORWARD_DATA;
msg.data = &req;
if (slurm_conf_get_addr(nodename, &msg.address) == SLURM_ERROR) {
PMIXP_ERROR("Can't find address for host "
"%s, check slurm.conf", nodename);
return SLURM_ERROR;
}
timeout = slurm_get_msg_timeout() * 1000;
msg.forward.timeout = timeout;
msg.forward.cnt = 0;
msg.forward.nodelist = NULL;
ret_list = slurm_send_addr_recv_msgs(&msg, (char*)nodename, timeout);
if (!ret_list) {
/* This should never happen (when this was
* written slurm_send_addr_recv_msgs always
* returned a list */
PMIXP_ERROR("No return list given from "
"slurm_send_addr_recv_msgs spawned for %s",
nodename);
return SLURM_ERROR;
} else if ((errno != SLURM_COMMUNICATIONS_CONNECTION_ERROR) &&
!list_count(ret_list)) {
PMIXP_ERROR("failed to send to %s, errno=%d", nodename, errno);
return SLURM_ERROR;
}
rc = SLURM_SUCCESS;
while ((ret_data_info = list_pop(ret_list))) {
int temp_rc = slurm_get_return_code(ret_data_info->type,
ret_data_info->data);
if (temp_rc != SLURM_SUCCESS)
rc = temp_rc;
destroy_data_info(ret_data_info);
}
FREE_NULL_LIST(ret_list);
return rc;
}
示例15: get_part_list
/*
* get_part_list - find record for named partition(s)
* IN name - partition name(s) in a comma separated list
* RET List of pointers to the partitions or NULL if not found
* NOTE: Caller must free the returned list
*/
extern List get_part_list(char *name)
{
struct part_record *part_ptr;
List job_part_list = NULL;
char *token, *last = NULL, *tmp_name;
if (name == NULL)
return job_part_list;
tmp_name = xstrdup(name);
token = strtok_r(tmp_name, ",", &last);
while (token) {
part_ptr = list_find_first(part_list, &list_find_part, token);
if (part_ptr) {
if (job_part_list == NULL) {
job_part_list = list_create(NULL);
}
list_append(job_part_list, part_ptr);
} else {
FREE_NULL_LIST(job_part_list);
break;
}
token = strtok_r(NULL, ",", &last);
}
xfree(tmp_name);
return job_part_list;
}