void tegra_mmc_init(void) { int node_list[CONFIG_SYS_MMC_MAX_DEVICE], count; const void *blob = gd->fdt_blob; debug("%s entry\n", __func__); /* See if any Tegra186 MMC controllers are present */ count = fdtdec_find_aliases_for_id(blob, "sdhci", COMPAT_NVIDIA_TEGRA186_SDMMC, node_list, CONFIG_SYS_MMC_MAX_DEVICE); debug("%s: count of Tegra186 sdhci nodes is %d\n", __func__, count); if (process_nodes(blob, node_list, count)) { printf("%s: Error processing T186 mmc node(s)!\n", __func__); return; } /* See if any Tegra210 MMC controllers are present */ count = fdtdec_find_aliases_for_id(blob, "sdhci", COMPAT_NVIDIA_TEGRA210_SDMMC, node_list, CONFIG_SYS_MMC_MAX_DEVICE); debug("%s: count of Tegra210 sdhci nodes is %d\n", __func__, count); if (process_nodes(blob, node_list, count)) { printf("%s: Error processing T210 mmc node(s)!\n", __func__); return; } /* See if any Tegra124 MMC controllers are present */ count = fdtdec_find_aliases_for_id(blob, "sdhci", COMPAT_NVIDIA_TEGRA124_SDMMC, node_list, CONFIG_SYS_MMC_MAX_DEVICE); debug("%s: count of Tegra124 sdhci nodes is %d\n", __func__, count); if (process_nodes(blob, node_list, count)) { printf("%s: Error processing T124 mmc node(s)!\n", __func__); return; } /* See if any Tegra30 MMC controllers are present */ count = fdtdec_find_aliases_for_id(blob, "sdhci", COMPAT_NVIDIA_TEGRA30_SDMMC, node_list, CONFIG_SYS_MMC_MAX_DEVICE); debug("%s: count of T30 sdhci nodes is %d\n", __func__, count); if (process_nodes(blob, node_list, count)) { printf("%s: Error processing T30 mmc node(s)!\n", __func__); return; } /* Now look for any Tegra20 MMC controllers */ count = fdtdec_find_aliases_for_id(blob, "sdhci", COMPAT_NVIDIA_TEGRA20_SDMMC, node_list, CONFIG_SYS_MMC_MAX_DEVICE); debug("%s: count of T20 sdhci nodes is %d\n", __func__, count); if (process_nodes(blob, node_list, count)) { printf("%s: Error processing T20 mmc node(s)!\n", __func__); return; } }
/****************************************************************************** * * * Function: main_nodewatcher_loop * * * * Purpose: periodically calculates checksum of config data * * * * Parameters: * * * * Return value: * * * * Author: Alexei Vladishev * * * * Comments: never returns * * * ******************************************************************************/ void main_nodewatcher_loop() { int start, end; int lastrun = 0; zabbix_log(LOG_LEVEL_DEBUG, "In main_nodewatcher_loop()"); zbx_setproctitle("%s [connecting to the database]", get_process_type_string(process_type)); DBconnect(ZBX_DB_CONNECT_NORMAL); for (;;) { zbx_setproctitle("%s [exchanging data]", get_process_type_string(process_type)); start = time(NULL); zabbix_log(LOG_LEVEL_DEBUG, "Starting sync with nodes"); if (lastrun + 120 < start) { process_nodes(); lastrun = start; } /* send new history data to master node */ main_historysender(); end = time(NULL); zbx_sleep_loop(10 - (end - start)); } }
void tegra_xusb_padctl_init(const void *fdt) { int count, nodes[1]; count = fdtdec_find_aliases_for_id(fdt, "padctl", COMPAT_NVIDIA_TEGRA124_XUSB_PADCTL, nodes, ARRAY_SIZE(nodes)); if (process_nodes(fdt, nodes, count)) return; }
int exynos_mmc_init(const void *blob) { int count; int node_list[SDHCI_MAX_HOSTS]; count = fdtdec_find_aliases_for_id(blob, "mmc", COMPAT_SAMSUNG_EXYNOS_MMC, node_list, SDHCI_MAX_HOSTS); return process_nodes(blob, node_list, count); }
/* Sadly there is no error return from this function */ void i2c_init_board(void) { int node_list[TEGRA_I2C_NUM_CONTROLLERS]; const void *blob = gd->fdt_blob; int count; /* First get the normal i2c ports */ count = fdtdec_find_aliases_for_id(blob, "i2c", COMPAT_NVIDIA_TEGRA20_I2C, node_list, TEGRA_I2C_NUM_CONTROLLERS); if (process_nodes(blob, node_list, count, 0)) return; /* Now look for dvc ports */ count = fdtdec_add_aliases_for_id(blob, "i2c", COMPAT_NVIDIA_TEGRA20_DVC, node_list, TEGRA_I2C_NUM_CONTROLLERS); if (process_nodes(blob, node_list, count, 1)) return; }
int process_element( xmlNode *node) { char *str; int rc = PBSE_NONE; if (node == NULL) return(PBSE_NONE); if (!strcmp((const char *)node->name, response_data)) { str = (char *)xmlGetProp(node, (const xmlChar *)"status"); if (strcmp(str, success)) { free(str); return(ALPS_QUERY_FAILURE); } else rc = process_element(node->children); free(str); } else if (!strcmp((const char *)node->name, node_array)) { rc = process_nodes(node->children); rc = process_element(node->next); } else if (!strcmp((const char *)node->name, reservation_array)) { rc = process_reservations(node->children); } else if (!strcmp((const char *)node->name, text_name)) { rc = process_element(node->next); } else if (!strcmp((const char *)node->name, system_tag)) { rc = process_system(node); } else { /* move on to the next child */ rc = process_element(node->children); } return(rc); } /* END process_element() */
extern bg_record_t *create_small_record(bg_record_t *bg_record, bitstr_t *ionodes, int size) { bg_record_t *found_record = NULL; ba_mp_t *new_ba_mp = NULL; ba_mp_t *ba_mp = NULL; char bitstring[BITSIZE]; found_record = (bg_record_t*) xmalloc(sizeof(bg_record_t)); found_record->magic = BLOCK_MAGIC; found_record->job_running = NO_JOB_RUNNING; found_record->user_name = xstrdup(bg_record->user_name); found_record->user_uid = bg_record->user_uid; found_record->ba_mp_list = list_create(destroy_ba_mp); if (bg_record->ba_mp_list) ba_mp = list_peek(bg_record->ba_mp_list); if (!ba_mp) { if (bg_record->mp_str) { hostlist_t hl = hostlist_create(bg_record->mp_str); char *host = hostlist_shift(hl); hostlist_destroy(hl); found_record->mp_str = xstrdup(host); free(host); error("you gave me a list with no ba_mps using %s", found_record->mp_str); } else { char tmp_char[SYSTEM_DIMENSIONS+1]; int dim; for (dim=0; dim<SYSTEM_DIMENSIONS; dim++) tmp_char[dim] = alpha_num[found_record->start[dim]]; tmp_char[dim] = '\0'; found_record->mp_str = xstrdup_printf( "%s%s", bg_conf->slurm_node_prefix, tmp_char); error("you gave me a record with no ba_mps " "and no nodes either using %s", found_record->mp_str); } } else { new_ba_mp = ba_copy_mp(ba_mp); /* We need to have this node wrapped in Q to handle wires correctly when creating around the midplane. */ ba_setup_mp(new_ba_mp, false, true); new_ba_mp->used = BA_MP_USED_TRUE; list_append(found_record->ba_mp_list, new_ba_mp); found_record->mp_count = 1; found_record->mp_str = xstrdup_printf( "%s%s", bg_conf->slurm_node_prefix, new_ba_mp->coord_str); } #ifdef HAVE_BGL found_record->node_use = SELECT_COPROCESSOR_MODE; found_record->blrtsimage = xstrdup(bg_record->blrtsimage); #endif #ifdef HAVE_BG_L_P found_record->linuximage = xstrdup(bg_record->linuximage); found_record->ramdiskimage = xstrdup(bg_record->ramdiskimage); #endif found_record->mloaderimage = xstrdup(bg_record->mloaderimage); process_nodes(found_record, false); found_record->conn_type[0] = SELECT_SMALL; xassert(bg_conf->cpu_ratio); found_record->cpu_cnt = bg_conf->cpu_ratio * size; found_record->cnode_cnt = size; found_record->ionode_bitmap = bit_copy(ionodes); bit_fmt(bitstring, BITSIZE, found_record->ionode_bitmap); found_record->ionode_str = xstrdup(bitstring); if (bg_conf->slurm_debug_flags & DEBUG_FLAG_BG_PICK) info("made small block of %s[%s]", found_record->mp_str, found_record->ionode_str); return found_record; }
extern bg_record_t *create_small_record(bg_record_t *bg_record, bitstr_t *ionodes, int size) { bg_record_t *found_record = NULL; ba_mp_t *new_ba_mp = NULL; ba_mp_t *ba_mp = NULL; found_record = (bg_record_t*) xmalloc(sizeof(bg_record_t)); found_record->magic = BLOCK_MAGIC; /* This will be a list containing jobs running on this block */ if (bg_conf->sub_blocks) found_record->job_list = list_create(NULL); found_record->job_running = NO_JOB_RUNNING; #ifdef HAVE_BGL found_record->node_use = SELECT_COPROCESSOR_MODE; found_record->blrtsimage = xstrdup(bg_record->blrtsimage); #endif #ifdef HAVE_BG_L_P found_record->linuximage = xstrdup(bg_record->linuximage); found_record->ramdiskimage = xstrdup(bg_record->ramdiskimage); #endif found_record->mloaderimage = xstrdup(bg_record->mloaderimage); if (bg_record->conn_type[0] >= SELECT_SMALL) found_record->conn_type[0] = bg_record->conn_type[0]; else found_record->conn_type[0] = SELECT_SMALL; xassert(bg_conf->cpu_ratio); found_record->cpu_cnt = bg_conf->cpu_ratio * size; found_record->cnode_cnt = size; found_record->ionode_bitmap = bit_copy(ionodes); ba_set_ionode_str(found_record); found_record->ba_mp_list = list_create(destroy_ba_mp); slurm_mutex_lock(&ba_system_mutex); if (bg_record->ba_mp_list) ba_mp = list_peek(bg_record->ba_mp_list); if (!ba_mp) { if (bg_record->mp_str) { int j = 0, dim; char *nodes = bg_record->mp_str; uint16_t coords[SYSTEM_DIMENSIONS]; while (nodes[j] != '\0') { if ((nodes[j] >= '0' && nodes[j] <= '9') || (nodes[j] >= 'A' && nodes[j] <= 'Z')) { break; } j++; } if (nodes[j] && ((strlen(nodes) - (j + SYSTEM_DIMENSIONS)) >= 0)) { for (dim = 0; dim < SYSTEM_DIMENSIONS; dim++, j++) coords[dim] = select_char2coord( nodes[j]); ba_mp = coord2ba_mp(coords); } error("you gave me a list with no ba_mps using %s", ba_mp->coord_str); } else { ba_mp = coord2ba_mp(found_record->start); error("you gave me a record with no ba_mps " "and no nodes either using %s", ba_mp->coord_str); } } xassert(ba_mp); new_ba_mp = ba_copy_mp(ba_mp); slurm_mutex_unlock(&ba_system_mutex); /* We need to have this node wrapped in Q to handle wires correctly when creating around the midplane. */ ba_setup_mp(new_ba_mp, false, true); new_ba_mp->used = BA_MP_USED_TRUE; /* Create these now so we can deal with error cnodes if/when they happen. Since this is the easiest place to figure it out for blocks that don't use the entire block */ if ((new_ba_mp->cnode_bitmap = ba_create_ba_mp_cnode_bitmap(found_record))) { new_ba_mp->cnode_err_bitmap = bit_alloc(bg_conf->mp_cnode_cnt); new_ba_mp->cnode_usable_bitmap = bit_copy(new_ba_mp->cnode_bitmap); } list_append(found_record->ba_mp_list, new_ba_mp); found_record->mp_count = 1; found_record->mp_str = xstrdup_printf( "%s%s", bg_conf->slurm_node_prefix, new_ba_mp->coord_str); process_nodes(found_record, false); /* Force small blocks to always be non-full system blocks. * This really only plays a part on sub-midplane systems. */ found_record->full_block = 0; if (bg_conf->slurm_debug_flags & DEBUG_FLAG_BG_PICK) info("made small block of %s[%s]", found_record->mp_str, found_record->ionode_str); return found_record; }
static VALUE parse_osm_data(VALUE obj) { FILE *input = DATA_PTR(obj); OSMPBF__BlobHeader *header = read_blob_header(input); if(header == NULL) return Qfalse; if(strcmp("OSMData", header->type) != 0) rb_raise(rb_eIOError, "OSMData not found"); void *blob = NULL; size_t blob_length = 0, datasize = header->datasize; OSMPBF__PrimitiveBlock *primitive_block = NULL; osmpbf__blob_header__free_unpacked(header, NULL); blob = read_blob(input, datasize, &blob_length); primitive_block = osmpbf__primitive_block__unpack(NULL, blob_length, blob); free(blob); if(primitive_block == NULL) rb_raise(rb_eIOError, "Unable to unpack the PrimitiveBlock"); int64_t lat_offset, lon_offset, granularity; int32_t ts_granularity; lat_offset = primitive_block->lat_offset; lon_offset = primitive_block->lon_offset; granularity = primitive_block->granularity; ts_granularity = primitive_block->date_granularity; OSMPBF__StringTable *string_table = primitive_block->stringtable; VALUE data = init_data_arr(); VALUE nodes = rb_hash_aref(data, STR2SYM("nodes")); VALUE ways = rb_hash_aref(data, STR2SYM("ways")); VALUE relations = rb_hash_aref(data, STR2SYM("relations")); size_t i = 0; for(i = 0; i < primitive_block->n_primitivegroup; i++) { OSMPBF__PrimitiveGroup *primitive_group = primitive_block->primitivegroup[i]; if(primitive_group->nodes) process_nodes(nodes, primitive_group, string_table, lat_offset, lon_offset, granularity, ts_granularity); if(primitive_group->dense) process_dense_nodes(nodes, primitive_group->dense, string_table, lat_offset, lon_offset, granularity, ts_granularity); if(primitive_group->ways) process_ways(ways, primitive_group, string_table, ts_granularity); if(primitive_group->relations) process_relations(relations, primitive_group, string_table, ts_granularity); } rb_iv_set(obj, "@data", data); osmpbf__primitive_block__free_unpacked(primitive_block, NULL); // Increment position rb_iv_set(obj, "@pos", INT2NUM(NUM2INT(rb_iv_get(obj, "@pos")) + 1)); return Qtrue; }
/* block_state_mutex must be locked before calling this. */ extern int add_bg_record(List records, List *used_nodes, select_ba_request_t *blockreq, bool no_check, bitoff_t io_start) { bg_record_t *bg_record = NULL; ba_mp_t *ba_mp = NULL; ListIterator itr; uid_t pw_uid; int i, len; int small_count = 0; xassert(bg_conf->slurm_user_name); if (!records) { fatal("add_bg_record: no records list given"); } bg_record = (bg_record_t*) xmalloc(sizeof(bg_record_t)); bg_record->magic = BLOCK_MAGIC; bg_record->user_name = xstrdup(bg_conf->slurm_user_name); bg_record->target_name = xstrdup(bg_conf->slurm_user_name); if (uid_from_string (bg_record->user_name, &pw_uid) < 0) error("add_bg_record: No such user: %s", bg_record->user_name); else bg_record->user_uid = pw_uid; if (used_nodes && *used_nodes) { #ifdef HAVE_BGQ bg_record->ba_mp_list = *used_nodes; *used_nodes = NULL; #else bg_record->ba_mp_list = list_create(destroy_ba_mp); if (copy_node_path(*used_nodes, &bg_record->ba_mp_list) == SLURM_ERROR) error("add_bg_record: " "couldn't copy the path for the allocation"); #endif } else bg_record->ba_mp_list = list_create(destroy_ba_mp); /* bg_record->boot_state = 0; Implicit */ bg_record->state = BG_BLOCK_FREE; #ifdef HAVE_BGL if (bg_conf->slurm_debug_flags & DEBUG_FLAG_BG_PICK) info("add_bg_record: asking for %s %d %d %s", blockreq->save_name, blockreq->small32, blockreq->small128, conn_type_string(blockreq->conn_type[0])); #else if (bg_conf->slurm_debug_flags & DEBUG_FLAG_BG_PICK) info("add_bg_record: asking for %s %d %d %d %d %d %s", blockreq->save_name, blockreq->small256, blockreq->small128, blockreq->small64, blockreq->small32, blockreq->small16, conn_type_string(blockreq->conn_type[0])); #endif /* Set the bitmap blank here if it is a full node we don't want anything set we also don't want the bg_record->ionode_str set. */ bg_record->ionode_bitmap = bit_alloc(bg_conf->ionodes_per_mp); bg_record->mp_used_bitmap = bit_alloc(node_record_count); len = strlen(blockreq->save_name); i=0; while (i<len && blockreq->save_name[i] != '[' && (blockreq->save_name[i] < '0' || blockreq->save_name[i] > 'Z' || (blockreq->save_name[i] > '9' && blockreq->save_name[i] < 'A'))) i++; if (i<len) { len -= i; len += strlen(bg_conf->slurm_node_prefix)+1; bg_record->mp_str = xmalloc(len); snprintf(bg_record->mp_str, len, "%s%s", bg_conf->slurm_node_prefix, blockreq->save_name+i); } else fatal("add_bg_record: MPs=%s is in a weird format", blockreq->save_name); process_nodes(bg_record, false); #ifdef HAVE_BGL bg_record->node_use = SELECT_COPROCESSOR_MODE; #endif memcpy(bg_record->conn_type, blockreq->conn_type, sizeof(bg_record->conn_type)); bg_record->cpu_cnt = bg_conf->cpus_per_mp * bg_record->mp_count; bg_record->cnode_cnt = bg_conf->mp_cnode_cnt * bg_record->mp_count; bg_record->job_running = NO_JOB_RUNNING; #ifdef HAVE_BGL if (blockreq->blrtsimage) bg_record->blrtsimage = xstrdup(blockreq->blrtsimage); else bg_record->blrtsimage = xstrdup(bg_conf->default_blrtsimage); #endif #ifdef HAVE_BG_L_P if (blockreq->linuximage) bg_record->linuximage = xstrdup(blockreq->linuximage); else bg_record->linuximage = xstrdup(bg_conf->default_linuximage); if (blockreq->ramdiskimage) bg_record->ramdiskimage = xstrdup(blockreq->ramdiskimage); else bg_record->ramdiskimage = xstrdup(bg_conf->default_ramdiskimage); #endif if (blockreq->mloaderimage) bg_record->mloaderimage = xstrdup(blockreq->mloaderimage); else bg_record->mloaderimage = xstrdup(bg_conf->default_mloaderimage); if (bg_record->conn_type[0] < SELECT_SMALL) { /* this needs to be an append so we keep things in the order we got them, they will be sorted later */ list_append(records, bg_record); /* this isn't a correct list so we need to set it later for now we just used it to be the mp number */ if (!used_nodes) { debug4("add_bg_record: " "we didn't get a request list so we are " "destroying this mp list"); list_destroy(bg_record->ba_mp_list); bg_record->ba_mp_list = NULL; } } else { List ba_mp_list = NULL; if (bg_conf->slurm_debug_flags & DEBUG_FLAG_BG_PICK) info("add_bg_record: adding a small block"); if (no_check) goto no_check; /* if the ionode cnt for small32 is 0 then don't allow a sub quarter allocation */ if (bg_conf->nodecard_ionode_cnt < 2) { if (!bg_conf->nodecard_ionode_cnt && blockreq->small32) fatal("add_bg_record: " "There is an error in your " "bluegene.conf file.\n" "Can't create a 32 node block with " "IonodesPerMP=%u. (Try setting it " "to at least 16)", bg_conf->ionodes_per_mp); #ifndef HAVE_BGL if (blockreq->small16) fatal("add_bg_record: " "There is an error in your " "bluegene.conf file.\n" "Can't create a 16 node block with " "IonodesPerMP=%u. (Try setting it to " "at least 32)", bg_conf->ionodes_per_mp); if ((bg_conf->io_ratio < 0.5) && blockreq->small64) fatal("add_bg_record: " "There is an error in your " "bluegene.conf file.\n" "Can't create a 64 node block with " "IonodesPerMP=%u. (Try setting it " "to at least 8)", bg_conf->ionodes_per_mp); #endif } #ifdef HAVE_BGL if (blockreq->small32==0 && blockreq->small128==0) { info("add_bg_record: " "No specs given for this small block, " "I am spliting this block into 4 128CnBlocks"); blockreq->small128=4; } i = (blockreq->small32*bg_conf->nodecard_cnode_cnt) + (blockreq->small128*bg_conf->quarter_cnode_cnt); if (i != bg_conf->mp_cnode_cnt) fatal("add_bg_record: " "There is an error in your bluegene.conf file.\n" "I am unable to request %d nodes consisting of " "%u 32CnBlocks and\n%u 128CnBlocks in one " "base partition with %u nodes.", i, blockreq->small32, blockreq->small128, bg_conf->mp_cnode_cnt); small_count = blockreq->small32+blockreq->small128; #else if (!blockreq->small16 && !blockreq->small32 && !blockreq->small64 && !blockreq->small128 && !blockreq->small256) { info("add_bg_record: " "No specs given for this small block, " "I am spliting this block into 2 256CnBlocks"); blockreq->small256=2; } i = (blockreq->small16*16) + (blockreq->small32*32) + (blockreq->small64*64) + (blockreq->small128*128) + (blockreq->small256*256); if (i != bg_conf->mp_cnode_cnt) fatal("add_bg_record: " "There is an error in your bluegene.conf file.\n" "I am unable to request %d nodes consisting of " "%u 16CNBlocks, %u 32CNBlocks,\n" "%u 64CNBlocks, %u 128CNBlocks, " "and %u 256CNBlocks\n" "in one base partition with %u nodes.", i, blockreq->small16, blockreq->small32, blockreq->small64, blockreq->small128, blockreq->small256, bg_conf->mp_cnode_cnt); small_count = blockreq->small16 + blockreq->small32 + blockreq->small64 + blockreq->small128 + blockreq->small256; #endif no_check: /* Automatically create 2-way split if * conn_type == SELECT_SMALL in bluegene.conf * Here we go through each node listed and do the same thing * for each node. */ ba_mp_list = bg_record->ba_mp_list; bg_record->ba_mp_list = list_create(NULL); itr = list_iterator_create(ba_mp_list); while ((ba_mp = list_next(itr)) != NULL) { xfree(bg_record->mp_str); bg_record->mp_str = xstrdup_printf( "%s%s", bg_conf->slurm_node_prefix, ba_mp->coord_str); list_append(bg_record->ba_mp_list, ba_mp); handle_small_record_request(records, blockreq, bg_record, io_start); list_flush(bg_record->ba_mp_list); } list_iterator_destroy(itr); destroy_bg_record(bg_record); list_destroy(ba_mp_list); } return SLURM_SUCCESS; }