diff --git a/src/partition_allocator/partition_allocator.c b/src/partition_allocator/partition_allocator.c index 97d9492be8975dc49408666bebccb11e0a35c036..102698c87180fc0d18ffb6dafe210603dc6e4386 100644 --- a/src/partition_allocator/partition_allocator.c +++ b/src/partition_allocator/partition_allocator.c @@ -100,28 +100,20 @@ int _set_one_dim(int *start, int *end, int *coord); * * return SUCCESS of operation. */ -int new_pa_request(pa_request_t* pa_request, - int geometry[PA_SYSTEM_DIMENSIONS], int size, - bool rotate, bool elongate, - bool force_contig, bool co_proc, int conn_type) +int new_pa_request(pa_request_t* pa_request) { int i, i2, i3, picked, total_sz=1 , size2, size3; float sz=1; int checked[8]; /* size will be overided by geometry size if given */ - if (geometry[0] != -1){ + if (pa_request->geometry[0] != -1){ for (i=0; i<PA_SYSTEM_DIMENSIONS; i++){ - if (geometry[i] < 1 || geometry[i] > DIM_SIZE[i]){ + if (pa_request->geometry[i] < 1 || pa_request->geometry[i] > DIM_SIZE[i]){ printf("new_pa_request Error, request geometry is invalid\n"); return 0; } } - - for (i=0; i<PA_SYSTEM_DIMENSIONS; i++){ - pa_request->geometry[i] = geometry[i]; - } - } else { /* decompose the size into a cubic geometry */ @@ -130,10 +122,10 @@ int new_pa_request(pa_request_t* pa_request, pa_request->geometry[i] = 1; } - if(size==1) + if(pa_request->size==1) goto endit; - if(size>total_sz || size<1) { + if(pa_request->size>total_sz || pa_request->size<1) { printf("new_pa_request ERROR, requested size must be\ngreater than 0 and less than %d.\n",total_sz); return 0; } @@ -144,11 +136,11 @@ int new_pa_request(pa_request_t* pa_request, checked[i]=0; /* see if We can find a cube or square root of the size to make an easy cube */ for(i=0;i<PA_SYSTEM_DIMENSIONS-1;i++) { - sz = powf((float)size,(float)1/(PA_SYSTEM_DIMENSIONS-i)); - if(pow(sz,(PA_SYSTEM_DIMENSIONS-i))==size) + sz = powf((float)pa_request->size,(float)1/(PA_SYSTEM_DIMENSIONS-i)); + if(pow(sz,(PA_SYSTEM_DIMENSIONS-i))==pa_request->size) break; } - size3=size; + size3=pa_request->size; if(i<PA_SYSTEM_DIMENSIONS-1) { i3=i; /* we found something that looks like a cube! */ @@ -163,10 +155,10 @@ int new_pa_request(pa_request_t* pa_request, } else { picked=0; tryagain: - if(size3!=size) + if(size3!=pa_request->size) size2=size3; else - size2=size; + size2=pa_request->size; //messedup: for (i=picked; i<PA_SYSTEM_DIMENSIONS; i++) { if(size2<=1) @@ -196,7 +188,7 @@ int new_pa_request(pa_request_t* pa_request, } } if(i2==1) { - size +=1; + pa_request->size +=1; goto startagain; } @@ -216,14 +208,9 @@ endit: //printf("geometry: %d %d %d size = %d\n", pa_request->geometry[0],pa_request->geometry[1],pa_request->geometry[2], pa_request->size); - pa_request->conn_type = conn_type; pa_request->rotate_count= 0; - pa_request->rotate = rotate; pa_request->elongate_count = 0; - pa_request->elongate = elongate; - pa_request->force_contig = force_contig; - pa_request->co_proc = co_proc; - + return 1; } @@ -454,7 +441,7 @@ int remove_part(List nodes) } } } - + return 1; } @@ -470,8 +457,10 @@ int alter_part(List nodes, int conn_type) pa_node_t* pa_node; pa_switch_t *curr_switch; int size=0; - - while((pa_node = (pa_node_t*) list_pop(nodes)) != NULL) { + ListIterator results_i; + + results_i = list_iterator_create(nodes); + while ((pa_node = list_next(results_i)) != NULL) { pa_node->used = false; for(dim=0;dim<PA_SYSTEM_DIMENSIONS;dim++) { @@ -486,6 +475,7 @@ int alter_part(List nodes, int conn_type) } size++; } + list_iterator_destroy(results_i); _set_internal_wires(nodes, size, conn_type); return 1; @@ -502,8 +492,11 @@ int redo_part(List nodes, int conn_type) pa_node_t* pa_node; pa_switch_t *curr_switch; int size=0; - - while((pa_node = (pa_node_t*) list_pop(nodes)) != NULL) { + char *name; + ListIterator results_i; + + results_i = list_iterator_create(nodes); + while ((pa_node = list_next(results_i)) != NULL) { pa_node->used = false; for(dim=0;dim<PA_SYSTEM_DIMENSIONS;dim++) { @@ -518,8 +511,10 @@ int redo_part(List nodes, int conn_type) } size++; } - _set_internal_wires(nodes, size, conn_type); - + + list_iterator_destroy(results_i); + name = _set_internal_wires(nodes, size, conn_type); + xfree(name); return 1; } @@ -983,7 +978,7 @@ char *_set_internal_wires(List nodes, int size, int conn_type) { pa_node_t* pa_node[size+1]; //pa_switch_t *next_switch; - int count=0, i; + int count=0, i, set=0; int *start; int *end; char *name = (char *) xmalloc(sizeof(char)*8); @@ -991,7 +986,6 @@ char *_set_internal_wires(List nodes, int size, int conn_type) ListIterator itr; memset(name,0,8); - itr = list_iterator_create(nodes); while((pa_node[count] = (pa_node_t*) list_next(itr))) { count++; @@ -1000,7 +994,7 @@ char *_set_internal_wires(List nodes, int size, int conn_type) start = pa_node[0]->coord; end = pa_node[count-1]->coord; - + //printf("hey %d\n",count); sprintf(name, "%d%d%dx%d%d%d",start[0],start[1],start[2],end[0],end[1],end[2]); //printf("the name = %s\n",name); @@ -1021,6 +1015,7 @@ char *_set_internal_wires(List nodes, int size, int conn_type) pa_node[i]->color = pa_system_ptr->fill_in_value[part_count].color; + set=1; } } else { printf("AHHHHHHH I can't do it in _set_internal_wires\n"); @@ -1032,7 +1027,8 @@ char *_set_internal_wires(List nodes, int size, int conn_type) for(i=0;i<count;i++) { _set_one_dim(start, end, pa_node[i]->coord); } - part_count++; + if(set) + part_count++; /* int i; */ /* itr = list_iterator_create(nodes); */ /* while((pa_node = (pa_node_t*) list_next(itr))){ */ @@ -1358,20 +1354,19 @@ int _set_one_dim(int *start, int *end, int *coord) /** */ int main(int argc, char** argv) { - int geo[3] = {-1,-1,-1}; - bool rotate = true; - bool elongate = true; - bool force_contig = true; - bool co_proc = true; - pa_request_t *request; + pa_request_t *request = (pa_request_t*) xmalloc(sizeof(pa_request_t)); int error_code; time_t start, end; node_info_msg_t * node_info_ptr; List results; List results2; // int i,j; - request = (pa_request_t*) xmalloc(sizeof(pa_request_t)); - + + request->rotate = true; + request->elongate = true; + request->force_contig = true; + request->co_proc = true; + request->geometry[0]=-1; //printf("geometry: %d %d %d size = %d\n", request->geometry[0], request->geometry[1], request->geometry[2], request->size); #ifdef HAVE_BGL error_code = slurm_load_node((time_t) NULL, &node_info_ptr, 0); @@ -1387,11 +1382,11 @@ int main(int argc, char** argv) #endif results = list_create(NULL); - geo[0] = 2; - geo[1] = 2; - geo[2] = 2; - int size = -1; //atoi(argv[1]); - new_pa_request(request, geo, size, rotate, elongate, force_contig, co_proc, SELECT_TORUS); + request->geometry[0] = 2; + request->geometry[1] = 2; + request->geometry[2] = 2; + request->size = -1; //atoi(argv[1]); + new_pa_request(request); time(&start); print_pa_request(request); allocate_part(request, results); @@ -1400,10 +1395,10 @@ int main(int argc, char** argv) //list_destroy(results); printf("name = %s\n",request->save_name); results2 = list_create(NULL); - geo[0] = 3; - geo[1] = 1; - geo[2] = 1; - new_pa_request(request, geo, -1, rotate, elongate, force_contig, co_proc, SELECT_TORUS); + request->geometry[0] = 3; + request->geometry[1] = 1; + request->geometry[2] = 1; + new_pa_request(request); time(&start); print_pa_request(request); allocate_part(request, results2); @@ -1411,6 +1406,7 @@ int main(int argc, char** argv) //printf("allocate_part: %ld\n", (end-start)); //list_destroy(results); remove_part(results); + redo_part(results2, request->conn_type); /* results = list_create(NULL); */ /* geo[0] = 2; */ /* geo[1] = 2; */ diff --git a/src/partition_allocator/partition_allocator.h b/src/partition_allocator/partition_allocator.h index 292eb4a7f53f54a9b3927f1174bc6389fe2c0d6d..da14e331b120d748512dd2ed93e05360240fb188 100644 --- a/src/partition_allocator/partition_allocator.h +++ b/src/partition_allocator/partition_allocator.h @@ -181,10 +181,7 @@ typedef struct { * * return success of allocation/validation of params */ -int new_pa_request(pa_request_t* pa_request, - int geometry[PA_SYSTEM_DIMENSIONS], int size, - bool rotate, bool elongate, - bool force_contig, bool co_proc, int conn_type); +int new_pa_request(pa_request_t* pa_request); /** * delete a partition request diff --git a/src/smap/configure_functions.c b/src/smap/configure_functions.c index 79e92da2c6bfef704f5c2a502ce077da7630d64e..fc6a3240a67fc213ad7fdaaa002ef131ec4d435f 100644 --- a/src/smap/configure_functions.c +++ b/src/smap/configure_functions.c @@ -34,69 +34,71 @@ typedef struct { } command_info_t; typedef struct { + int color; char letter; - int conn_type; List nodes; pa_request_t *request; } allocated_part_t; -void print_header_command(void); -int print_text_command(void); void _delete_allocated_parts(List allocated_partitions); int _create_allocation(command_info_t *com, List allocated_partitions); int _remove_allocation(command_info_t *com, List allocated_partitions); int _alter_allocation(command_info_t *com, List allocated_partitions); +int _copy_allocation(command_info_t *com, List allocated_partitions); int _save_allocation(command_info_t *com, List allocated_partitions); +void _print_header_command(); +void _print_text_command(allocated_part_t *allocated_part); void _delete_allocated_parts(List allocated_partitions) { - ListIterator results_i; allocated_part_t *allocated_part; - results_i = list_iterator_create(allocated_partitions); - while ((allocated_part = list_next(results_i)) != NULL) { + while ((allocated_part = list_pop(allocated_partitions)) != NULL) { list_destroy(allocated_part->nodes); delete_pa_request(allocated_part->request); + xfree(allocated_part); } list_destroy(allocated_partitions); } int _create_allocation(command_info_t *com, List allocated_partitions) { - int torus=MESH, i=6, i2=-1, i3=0, geo[PA_SYSTEM_DIMENSIONS] = {-1,-1,-1}; + int i=6, i2=-1, i3=0; static int count=0; int len = strlen(com->str); - pa_request_t *request; + pa_request_t *request = (pa_request_t*) xmalloc(sizeof(pa_request_t)); pa_node_t *current; allocated_part_t *allocated_part; - bool rotate = false; - bool elongate = false; - bool force_contig = false; - bool co_proc = false; + request->geometry[0] = -1; + request->conn_type=MESH; + request->rotate = false; + request->elongate = false; + request->force_contig = false; + request->co_proc = false; List results; - ListIterator results_i; - + ListIterator results_i; + while(i<len) { while(com->str[i-1]!=' ' && i<len) { i++; } if(!strncmp(com->str+i, "torus", 5)) { - torus=TORUS; + request->conn_type=TORUS; i+=5; } else if(!strncmp(com->str+i, "rotate", 6)) { - rotate=true; + request->rotate=true; i+=6; } else if(!strncmp(com->str+i, "elongate", 8)) { - elongate=true; + request->elongate=true; i+=8; } else if(!strncmp(com->str+i, "force", 5)) { - force_contig=true; + request->force_contig=true; i+=5; } else if(!strncmp(com->str+i, "proc", 4)) { - co_proc=true; + request->co_proc=true; i+=4; } else if(i2<0 && (com->str[i] < 58 && com->str[i] > 47)) { i2=i; @@ -116,13 +118,13 @@ int _create_allocation(command_info_t *com, List allocated_partitions) while(i3<len) { if(com->str[i3]==' ' || i3==(len-1)) { /* for size */ - i = atoi(&com->str[i2]); + request->size = atoi(&com->str[i2]); break; } if(com->str[i3]=='x') { /* for geometery */ - geo[0] = atoi(&com->str[i2]); + request->geometry[0] = atoi(&com->str[i2]); i2++; while(com->str[i2-1]!='x' && i2<len) i2++; @@ -132,7 +134,7 @@ int _create_allocation(command_info_t *com, List allocated_partitions) pa_system_ptr->ycord++; break; } - geo[1] = atoi(&com->str[i2]); + request->geometry[1] = atoi(&com->str[i2]); i2++; while(com->str[i2-1]!='x' && i2<len) i2++; @@ -142,24 +144,24 @@ int _create_allocation(command_info_t *com, List allocated_partitions) pa_system_ptr->ycord++; break; } - geo[2] = atoi(&com->str[i2]); - i = -1; + request->geometry[2] = atoi(&com->str[i2]); + request->size = -1; break; } i3++; } - + /* - Here is where we do the allocating of the partition. - It will send a request back which we will throw into - a list just incase we change something later. + Here is where we do the allocating of the partition. + It will send a request back which we will throw into + a list just incase we change something later. */ - request = (pa_request_t*) xmalloc(sizeof(pa_request_t)); results = list_create(NULL); - if(!new_pa_request(request, geo, i, rotate, elongate, force_contig, co_proc, torus)) { + if(!new_pa_request(request)) { mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord,"Problems with request for %d%d%d", geo[0], geo[1], geo[2]); + pa_system_ptr->xcord,"Problems with request for %d%d%d", + request->geometry[0], request->geometry[1], request->geometry[2]); pa_system_ptr->ycord++; mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, pa_system_ptr->xcord,"Either you put in something that doesn't work,"); @@ -171,7 +173,7 @@ int _create_allocation(command_info_t *com, List allocated_partitions) if (!allocate_part(request, results)){ mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, pa_system_ptr->xcord,"allocate failure for %d%d%d\n", - geo[0], geo[1], geo[2]); + request->geometry[0], request->geometry[1], request->geometry[2]); pa_system_ptr->ycord++; list_destroy(results); } else { @@ -179,8 +181,8 @@ int _create_allocation(command_info_t *com, List allocated_partitions) allocated_part = (allocated_part_t *)xmalloc(sizeof(allocated_part_t)); allocated_part->request = request; allocated_part->nodes = list_create(NULL); - allocated_part->conn_type = torus; - if(torus==TORUS) { + allocated_part->color = count; + if(allocated_part->request->conn_type==TORUS) { allocated_part->letter = pa_system_ptr->fill_in_value[count].letter; } else { allocated_part->letter = pa_system_ptr->fill_in_value[count+32].letter; @@ -189,28 +191,10 @@ int _create_allocation(command_info_t *com, List allocated_partitions) while ((current = list_next(results_i)) != NULL) { list_append(allocated_part->nodes,current); } - + list_iterator_destroy(results_i); list_append(allocated_partitions, allocated_part); list_destroy(results); - wattron(pa_system_ptr->text_win, - COLOR_PAIR(pa_system_ptr->fill_in_value[count].color)); - - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "%c",allocated_part->letter); - pa_system_ptr->xcord += 4; - /* mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, */ -/* pa_system_ptr->xcord, "PARTITION"); */ -/* pa_system_ptr->xcord += 10; */ - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "%d",allocated_part->request->size); - pa_system_ptr->xcord += 7; - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "bgl[%s]",allocated_part->request->save_name); - pa_system_ptr->xcord = 1; - pa_system_ptr->ycord++; - wattroff(pa_system_ptr->text_win, - COLOR_PAIR(pa_system_ptr->fill_in_value[count].color)); count++; } @@ -224,7 +208,6 @@ int _remove_allocation(command_info_t *com, List allocated_partitions) { ListIterator results_i; allocated_part_t *allocated_part; - int i=6, found=0; int len = strlen(com->str); char letter; @@ -244,12 +227,16 @@ int _remove_allocation(command_info_t *com, List allocated_partitions) results_i = list_iterator_create(allocated_partitions); while((allocated_part = list_next(results_i)) != NULL) { if(found) { - redo_part(allocated_part->nodes, allocated_part->conn_type); + redo_part(allocated_part->nodes, allocated_part->request->conn_type); } else if(allocated_part->letter==letter) { found=1; remove_part(allocated_part->nodes); + list_destroy(allocated_part->nodes); + delete_pa_request(allocated_part->request); + list_remove(results_i); } } + list_iterator_destroy(results_i); } return 1; @@ -295,35 +282,178 @@ int _alter_allocation(command_info_t *com, List allocated_partitions) return 1; } +int _copy_allocation(command_info_t *com, List allocated_partitions) +{ + ListIterator results_i; + allocated_part_t *allocated_part; + + int i=6, found=0; + int len = strlen(com->str); + char letter; + + while(com->str[i-1]!=' ' && i<len) { + i++; + } + + if(i==len) { + return 0; + } else { + letter = com->str[i]; + mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, + pa_system_ptr->xcord,"deleting partition %c\n", + letter); + pa_system_ptr->ycord++; + results_i = list_iterator_create(allocated_partitions); + while((allocated_part = list_next(results_i)) != NULL) { + if(found) { + redo_part(allocated_part->nodes, allocated_part->request->conn_type); + } else if(allocated_part->letter==letter) { + found=1; + remove_part(allocated_part->nodes); + } + } + list_iterator_destroy(results_i); + + } + + return 1; +} + int _save_allocation(command_info_t *com, List allocated_partitions) { return 1; } + +void _print_header_command() +{ + pa_system_ptr->ycord=2; + mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, + pa_system_ptr->xcord, "ID"); + pa_system_ptr->xcord += 4; + /* mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, */ +/* pa_system_ptr->xcord, "PARTITION"); */ +/* pa_system_ptr->xcord += 10; */ + mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, + pa_system_ptr->xcord, "TYPE"); + pa_system_ptr->xcord += 7; + mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, + pa_system_ptr->xcord, "CONF"); + pa_system_ptr->xcord += 9; + mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, + pa_system_ptr->xcord, "CONTIG"); + pa_system_ptr->xcord += 7; + mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, + pa_system_ptr->xcord, "ROTATE"); + pa_system_ptr->xcord += 7; + mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, + pa_system_ptr->xcord, "ELONG"); + pa_system_ptr->xcord += 7; + mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, + pa_system_ptr->xcord, "NODES"); + pa_system_ptr->xcord += 7; + mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, + pa_system_ptr->xcord, "NODELIST"); + pa_system_ptr->xcord = 1; + pa_system_ptr->ycord++; +} + +void _print_text_command(allocated_part_t *allocated_part) +{ + wattron(pa_system_ptr->text_win, + COLOR_PAIR(pa_system_ptr->fill_in_value[allocated_part->color].color)); + + mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, + pa_system_ptr->xcord, "%c",allocated_part->letter); + pa_system_ptr->xcord += 4; + /* mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, */ + /* pa_system_ptr->xcord, "PARTITION"); */ + /* pa_system_ptr->xcord += 10; */ + if(allocated_part->request->conn_type==TORUS) + mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, + pa_system_ptr->xcord, "TORUS"); + else + mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, + pa_system_ptr->xcord, "MESH"); + pa_system_ptr->xcord += 7; + + if(allocated_part->request->co_proc) + mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, + pa_system_ptr->xcord, "coproc"); + else + mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, + pa_system_ptr->xcord, "virtual"); + pa_system_ptr->xcord += 9; + + if(allocated_part->request->force_contig) + mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, + pa_system_ptr->xcord, "Y"); + else + mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, + pa_system_ptr->xcord, "N"); + pa_system_ptr->xcord += 7; + + if(allocated_part->request->rotate) + mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, + pa_system_ptr->xcord, "Y"); + else + mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, + pa_system_ptr->xcord, "N"); + pa_system_ptr->xcord += 7; + + if(allocated_part->request->elongate) + mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, + pa_system_ptr->xcord, "Y"); + else + mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, + pa_system_ptr->xcord, "N"); + pa_system_ptr->xcord += 7; + + mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, + pa_system_ptr->xcord, "%d",allocated_part->request->size); + pa_system_ptr->xcord += 7; + mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, + pa_system_ptr->xcord, "bgl[%s]",allocated_part->request->save_name); + pa_system_ptr->xcord = 1; + pa_system_ptr->ycord++; + wattroff(pa_system_ptr->text_win, + COLOR_PAIR(pa_system_ptr->fill_in_value[allocated_part->color].color)); + return; +} + void get_command(void) { command_info_t *com = xmalloc(sizeof(command_info_t)); //static node_info_msg_t *node_info_ptr; - int text_height, text_width, text_starty, text_startx; + int text_width, text_startx; + allocated_part_t *allocated_part; + WINDOW *command_win; List allocated_partitions; + ListIterator results_i; allocated_partitions = list_create(NULL); - text_height = pa_system_ptr->text_win->_maxy; // - pa_system_ptr->text_win->_begy; text_width = pa_system_ptr->text_win->_maxx; // - pa_system_ptr->text_win->_begx; - text_starty = pa_system_ptr->text_win->_begy; text_startx = pa_system_ptr->text_win->_begx; command_win = newwin(3, text_width - 1, LINES - 4, text_startx + 1); echo(); - if (!params.no_header) - print_header_command(); while (strcmp(com->str, "quit")) { print_grid(); + wclear(pa_system_ptr->text_win); box(pa_system_ptr->text_win, 0, 0); box(pa_system_ptr->grid_win, 0, 0); + + if (!params.no_header) + _print_header_command(); + results_i = list_iterator_create(allocated_partitions); + while((allocated_part = list_next(results_i)) != NULL) { + _print_text_command(allocated_part); + } + list_iterator_destroy(results_i); + wrefresh(pa_system_ptr->text_win); wrefresh(pa_system_ptr->grid_win); wclear(command_win); @@ -348,6 +478,8 @@ void get_command(void) _alter_allocation(com, allocated_partitions); } else if (!strncmp(com->str, "create", 6)) { _create_allocation(com, allocated_partitions); + } else if (!strncmp(com->str, "copy", 4)) { + _copy_allocation(com, allocated_partitions); } else if (!strncmp(com->str, "save", 4)) { _save_allocation(com, allocated_partitions); } @@ -363,25 +495,3 @@ void get_command(void) get_job(); return; } - -void print_header_command(void) -{ - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "ID"); - pa_system_ptr->xcord += 4; - /* mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, */ -/* pa_system_ptr->xcord, "PARTITION"); */ -/* pa_system_ptr->xcord += 10; */ - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "NODES"); - pa_system_ptr->xcord += 7; - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "NODELIST"); - pa_system_ptr->xcord = 1; - pa_system_ptr->ycord++; -} - -int print_text_command() -{ - return 1; -} diff --git a/src/smap/smap.c b/src/smap/smap.c index 600be40ab39ba37c2be65ceff30d798d8202ade4..92733cbe48c43d83b92138dd3f9396d9680e8d3b 100644 --- a/src/smap/smap.c +++ b/src/smap/smap.c @@ -54,7 +54,8 @@ int main(int argc, char *argv[]) int end = 0; int i; //char *name; - + + log_init(xbasename(argv[0]), opts, SYSLOG_FACILITY_DAEMON, NULL); parse_command_line(argc, argv); #ifdef HAVE_BGL @@ -89,7 +90,13 @@ int main(int argc, char *argv[]) curs_set(1); nodelay(stdscr, TRUE); start_color(); - + + //if(can_change_color()) { + printf("hey\n"); + init_color(3, 3, 200, 50); + printf("hey\n"); + //} + pa_system_ptr->grid_win = newwin(height, width, starty, startx); box(pa_system_ptr->grid_win, 0, 0);