From d2749aa61b63bff4d8e8b0e7bee8fbec098896e5 Mon Sep 17 00:00:00 2001 From: Danny Auble <da@llnl.gov> Date: Thu, 2 Dec 2004 19:35:07 +0000 Subject: [PATCH] Version 1 of smap is done. clear all is added, save, delete, copy, create all work. --- src/partition_allocator/partition_allocator.c | 41 +- src/partition_allocator/partition_allocator.h | 4 +- src/smap/configure_functions.c | 374 +++++++++++------- 3 files changed, 259 insertions(+), 160 deletions(-) diff --git a/src/partition_allocator/partition_allocator.c b/src/partition_allocator/partition_allocator.c index 102698c8718..3ad6d356816 100644 --- a/src/partition_allocator/partition_allocator.c +++ b/src/partition_allocator/partition_allocator.c @@ -40,6 +40,7 @@ pa_system_t *pa_system_ptr; List path; List best_path; int best_count; +int color_count = 0; /** internal helper functions */ /** */ @@ -106,6 +107,10 @@ int new_pa_request(pa_request_t* pa_request) float sz=1; int checked[8]; + pa_request->rotate_count= 0; + pa_request->elongate_count = 0; + + /* size will be overided by geometry size if given */ if (pa_request->geometry[0] != -1){ for (i=0; i<PA_SYSTEM_DIMENSIONS; i++){ @@ -116,6 +121,8 @@ int new_pa_request(pa_request_t* pa_request) } } else { /* decompose the size into a cubic geometry */ + pa_request->rotate= 1; + pa_request->elongate = 1; for (i=0; i<PA_SYSTEM_DIMENSIONS; i++) { total_sz *= DIM_SIZE[i]; @@ -208,9 +215,6 @@ 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->rotate_count= 0; - pa_request->elongate_count = 0; - return 1; } @@ -419,7 +423,7 @@ int _reset_the_path(pa_switch_t *curr_switch, int source, int target, int dim) * * returns SLURM_SUCCESS if undo was successful. */ -int remove_part(List nodes) +int remove_part(List nodes, int new_count) { int dim; pa_node_t* pa_node; @@ -441,7 +445,7 @@ int remove_part(List nodes) } } } - + color_count=new_count; return 1; } @@ -486,7 +490,7 @@ int alter_part(List nodes, int conn_type) * be redone to make sure correct path will be used in the real system * */ -int redo_part(List nodes, int conn_type) +int redo_part(List nodes, int conn_type, int new_count) { int dim; pa_node_t* pa_node; @@ -498,6 +502,16 @@ int redo_part(List nodes, int conn_type) results_i = list_iterator_create(nodes); while ((pa_node = list_next(results_i)) != NULL) { pa_node->used = false; + if(conn_type==TORUS) + pa_node->letter = + pa_system_ptr->fill_in_value[new_count].letter; + + else + pa_node->letter = + pa_system_ptr->fill_in_value[new_count+32].letter; + + pa_node->color = + pa_system_ptr->fill_in_value[new_count].color; for(dim=0;dim<PA_SYSTEM_DIMENSIONS;dim++) { curr_switch = &pa_node->axis_switch[dim]; @@ -511,7 +525,7 @@ int redo_part(List nodes, int conn_type) } size++; } - + color_count++; list_iterator_destroy(results_i); name = _set_internal_wires(nodes, size, conn_type); xfree(name); @@ -982,7 +996,6 @@ char *_set_internal_wires(List nodes, int size, int conn_type) int *start; int *end; char *name = (char *) xmalloc(sizeof(char)*8); - static int part_count=0; ListIterator itr; memset(name,0,8); @@ -1007,14 +1020,14 @@ char *_set_internal_wires(List nodes, int size, int conn_type) if(pa_node[i]->letter == '.') { if(conn_type==TORUS) pa_node[i]->letter = - pa_system_ptr->fill_in_value[part_count].letter; + pa_system_ptr->fill_in_value[color_count].letter; else pa_node[i]->letter = - pa_system_ptr->fill_in_value[part_count+32].letter; + pa_system_ptr->fill_in_value[color_count+32].letter; pa_node[i]->color = - pa_system_ptr->fill_in_value[part_count].color; + pa_system_ptr->fill_in_value[color_count].color; set=1; } } else { @@ -1028,7 +1041,7 @@ char *_set_internal_wires(List nodes, int size, int conn_type) _set_one_dim(start, end, pa_node[i]->coord); } if(set) - part_count++; + color_count++; /* int i; */ /* itr = list_iterator_create(nodes); */ /* while((pa_node = (pa_node_t*) list_next(itr))){ */ @@ -1405,8 +1418,8 @@ int main(int argc, char** argv) time(&end); //printf("allocate_part: %ld\n", (end-start)); //list_destroy(results); - remove_part(results); - redo_part(results2, request->conn_type); + remove_part(results,color_count); + redo_part(results2, request->conn_type,color_count); /* 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 da14e331b12..f73e0233b3a 100644 --- a/src/partition_allocator/partition_allocator.h +++ b/src/partition_allocator/partition_allocator.h @@ -230,7 +230,7 @@ int allocate_part(pa_request_t* pa_request, List results); * Admin wants to remove a previous allocation. * will allow Admin to delete a previous allocation retrival by letter code. */ -int remove_part(List nodes); +int remove_part(List nodes, int new_count); /** * Admin wants to change something about a previous allocation. @@ -245,7 +245,7 @@ int alter_part(List nodes, int conn_type); * be redone to make sure correct path will be used in the real system * */ -int redo_part(List nodes, int conn_type); +int redo_part(List nodes, int conn_type, int new_count); void init_grid(node_info_msg_t *node_info_ptr); diff --git a/src/smap/configure_functions.c b/src/smap/configure_functions.c index fc6a3240a67..980e0e5ea58 100644 --- a/src/smap/configure_functions.c +++ b/src/smap/configure_functions.c @@ -28,11 +28,6 @@ #include "src/common/uid.h" #include "src/smap/smap.h" -typedef struct { - int type; - char str[255]; -} command_info_t; - typedef struct { int color; char letter; @@ -41,19 +36,23 @@ typedef struct { } allocated_part_t; 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); +allocated_part_t *_make_request(pa_request_t *request); +int _create_allocation(char *com, List allocated_partitions); +int _remove_allocation(char *com, List allocated_partitions); +int _alter_allocation(char *com, List allocated_partitions); +int _copy_allocation(char *com, List allocated_partitions); +int _save_allocation(char *com, List allocated_partitions); void _print_header_command(); void _print_text_command(allocated_part_t *allocated_part); +char error_string[255]; + void _delete_allocated_parts(List allocated_partitions) { allocated_part_t *allocated_part; while ((allocated_part = list_pop(allocated_partitions)) != NULL) { + remove_part(allocated_part->nodes,0); list_destroy(allocated_part->nodes); delete_pa_request(allocated_part->request); xfree(allocated_part); @@ -61,15 +60,43 @@ void _delete_allocated_parts(List allocated_partitions) list_destroy(allocated_partitions); } -int _create_allocation(command_info_t *com, List allocated_partitions) +allocated_part_t *_make_request(pa_request_t *request) +{ + List results = list_create(NULL); + ListIterator results_i; + allocated_part_t *allocated_part; + pa_node_t *current; + + if (!allocate_part(request, results)){ + memset(error_string,0,255); + sprintf(error_string,"allocate failure for %d%d%d", + request->geometry[0], request->geometry[1], request->geometry[2]); + return NULL; + } else { + + allocated_part = (allocated_part_t *)xmalloc(sizeof(allocated_part_t)); + allocated_part->request = request; + allocated_part->nodes = list_create(NULL); + results_i = list_iterator_create(results); + while ((current = list_next(results_i)) != NULL) { + list_append(allocated_part->nodes,current); + allocated_part->color = current->color; + allocated_part->letter = current->letter; + } + list_iterator_destroy(results_i); + } + list_destroy(results); + return(allocated_part); + +} + +int _create_allocation(char *com, List allocated_partitions) { int i=6, i2=-1, i3=0; - static int count=0; - int len = strlen(com->str); + int len = strlen(com); - pa_request_t *request = (pa_request_t*) xmalloc(sizeof(pa_request_t)); - pa_node_t *current; allocated_part_t *allocated_part; + pa_request_t *request = (pa_request_t*) xmalloc(sizeof(pa_request_t)); request->geometry[0] = -1; request->conn_type=MESH; @@ -77,30 +104,28 @@ int _create_allocation(command_info_t *com, List allocated_partitions) request->elongate = false; request->force_contig = false; request->co_proc = false; - List results; - ListIterator results_i; - + while(i<len) { - while(com->str[i-1]!=' ' && i<len) { + while(com[i-1]!=' ' && i<len) { i++; } - if(!strncmp(com->str+i, "torus", 5)) { + if(!strncmp(com+i, "torus", 5) || !strncmp(com+i, "TORUS", 5) || !strncmp(com+i, "Torus", 5)) { request->conn_type=TORUS; i+=5; - } else if(!strncmp(com->str+i, "rotate", 6)) { + } else if(!strncmp(com+i, "rotate", 6) || !strncmp(com+i, "ROTATE", 6) || !strncmp(com+i, "Rotate", 6)) { request->rotate=true; i+=6; - } else if(!strncmp(com->str+i, "elongate", 8)) { + } else if(!strncmp(com+i, "elongate", 8) || !strncmp(com+i, "ELONGATE", 8) || !strncmp(com+i, "Elongate", 8)) { request->elongate=true; i+=8; - } else if(!strncmp(com->str+i, "force", 5)) { + } else if(!strncmp(com+i, "force", 5) || !strncmp(com+i, "FORCE", 5) || !strncmp(com+i, "Force", 5)) { request->force_contig=true; i+=5; - } else if(!strncmp(com->str+i, "proc", 4)) { + } else if(!strncmp(com+i, "proc", 4) || !strncmp(com+i, "PROC", 4) || !strncmp(com+i, "Proc", 4)) { request->co_proc=true; i+=4; - } else if(i2<0 && (com->str[i] < 58 && com->str[i] > 47)) { + } else if(i2<0 && (com[i] < 58 && com[i] > 47)) { i2=i; i++; } else { @@ -110,41 +135,37 @@ int _create_allocation(command_info_t *com, List allocated_partitions) } if(i2<0) { - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "No size or dimension specified, please re-enter"); - pa_system_ptr->ycord++; + memset(error_string,0,255); + sprintf(error_string, "No size or dimension specified, please re-enter"); } else { i3=i2; while(i3<len) { - if(com->str[i3]==' ' || i3==(len-1)) { + if(com[i3]==' ' || i3==(len-1)) { /* for size */ - request->size = atoi(&com->str[i2]); + request->size = atoi(&com[i2]); break; } - if(com->str[i3]=='x') { + if(com[i3]=='x') { /* for geometery */ - request->geometry[0] = atoi(&com->str[i2]); + request->geometry[0] = atoi(&com[i2]); i2++; - while(com->str[i2-1]!='x' && i2<len) + while(com[i2-1]!='x' && i2<len) i2++; if(i2==len){ - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "Error in dimension specified, please re-enter"); - pa_system_ptr->ycord++; + memset(error_string,0,255); + sprintf(error_string, "Error in dimension specified, please re-enter"); break; } - request->geometry[1] = atoi(&com->str[i2]); - i2++; - while(com->str[i2-1]!='x' && i2<len) + request->geometry[1] = atoi(&com[i2]); + i2++; while(com[i2-1]!='x' && i2<len) i2++; if(i2==len){ - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord, "Error in dimension specified, please re-enter"); - pa_system_ptr->ycord++; + memset(error_string,0,255); + sprintf(error_string, "Error in dimension specified, please re-enter"); break; } - request->geometry[2] = atoi(&com->str[i2]); + request->geometry[2] = atoi(&com[i2]); request->size = -1; break; } @@ -156,85 +177,72 @@ int _create_allocation(command_info_t *com, List allocated_partitions) It will send a request back which we will throw into a list just incase we change something later. */ - results = list_create(NULL); - + 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", + memset(error_string,0,255); + if(request->size!=-1) + sprintf(error_string, "Problems with request for %d\nEither you put in something that doesn't work,\nor we are unable to process your request.", + request->size); + else + sprintf(error_string, "Problems with request for %d%d%d\nEither you put in something that doesn't work,\nor we are unable to process your request.", 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,"); - pa_system_ptr->ycord++; - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, - pa_system_ptr->xcord,"or we are unable to process your request."); - list_destroy(results); } else { - 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", - request->geometry[0], request->geometry[1], request->geometry[2]); - pa_system_ptr->ycord++; - list_destroy(results); - } else { - - allocated_part = (allocated_part_t *)xmalloc(sizeof(allocated_part_t)); - allocated_part->request = request; - allocated_part->nodes = list_create(NULL); - 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; - } - results_i = list_iterator_create(results); - while ((current = list_next(results_i)) != NULL) { - list_append(allocated_part->nodes,current); - } - list_iterator_destroy(results_i); + if((allocated_part = _make_request(request)) != NULL) list_append(allocated_partitions, allocated_part); - - list_destroy(results); - count++; - - } } } return 1; } -int _remove_allocation(command_info_t *com, List allocated_partitions) +int _remove_allocation(char *com, List allocated_partitions) { ListIterator results_i; allocated_part_t *allocated_part; int i=6, found=0; - int len = strlen(com->str); + int len = strlen(com); char letter; - - while(com->str[i-1]!=' ' && i<len) { + char letter_case = '\0'; + + int color_count = 0; + while(com[i-1]!=' ' && i<len) { i++; } - if(i==len) { + if(i>(len-1)) { + memset(error_string,0,255); + sprintf(error_string, "You need to specify which letter to delete."); 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++; + letter = com[i]; + if(letter>91) { + letter_case = letter-32; + } else { + letter_case = letter+32; + } 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) { + redo_part(allocated_part->nodes, allocated_part->request->conn_type, color_count); + if(allocated_part->request->conn_type==TORUS) + allocated_part->letter = + pa_system_ptr->fill_in_value[color_count].letter; + + else + allocated_part->letter = + pa_system_ptr->fill_in_value[color_count+32].letter; + allocated_part->color = + pa_system_ptr->fill_in_value[color_count].color; + + } else if((allocated_part->letter == letter) || (allocated_part->letter == letter_case)) { found=1; - remove_part(allocated_part->nodes); + remove_part(allocated_part->nodes,color_count); list_destroy(allocated_part->nodes); delete_pa_request(allocated_part->request); list_remove(results_i); + color_count--; } + color_count++; } list_iterator_destroy(results_i); } @@ -242,10 +250,10 @@ int _remove_allocation(command_info_t *com, List allocated_partitions) return 1; } -int _alter_allocation(command_info_t *com, List allocated_partitions) +int _alter_allocation(char *com, List allocated_partitions) { int torus=MESH, i=5, i2=0; - int len = strlen(com->str); + int len = strlen(com); bool rotate = false; bool elongate = false; bool force_contig = false; @@ -253,25 +261,25 @@ int _alter_allocation(command_info_t *com, List allocated_partitions) while(i<len) { - while(com->str[i-1]!=' ' && i<len) { + while(com[i-1]!=' ' && i<len) { i++; } - if(!strncmp(com->str+i, "torus", 5)) { + if(!strncmp(com+i, "torus", 5)) { torus=TORUS; i+=5; - } else if(!strncmp(com->str+i, "rotate", 6)) { + } else if(!strncmp(com+i, "rotate", 6)) { rotate=true; i+=6; - } else if(!strncmp(com->str+i, "elongate", 8)) { + } else if(!strncmp(com+i, "elongate", 8)) { elongate=true; i+=8; - } else if(!strncmp(com->str+i, "force", 5)) { + } else if(!strncmp(com+i, "force", 5)) { force_contig=true; i+=5; - } else if(!strncmp(com->str+i, "proc", 4)) { + } else if(!strncmp(com+i, "proc", 4)) { co_proc=true; i+=4; - } else if(i2<0 && (com->str[i] < 58 && com->str[i] > 47)) { + } else if(i2<0 && (com[i] < 58 && com[i] > 47)) { i2=i; i++; } else { @@ -282,46 +290,100 @@ int _alter_allocation(command_info_t *com, List allocated_partitions) return 1; } -int _copy_allocation(command_info_t *com, List allocated_partitions) +int _copy_allocation(char *com, List allocated_partitions) { ListIterator results_i; allocated_part_t *allocated_part; + pa_request_t *request = (pa_request_t*) xmalloc(sizeof(pa_request_t)); - int i=6, found=0; - int len = strlen(com->str); - char letter; + int i=4; + int len = strlen(com); + char letter = '\0'; + char letter_case = '\0'; - while(com->str[i-1]!=' ' && i<len) { + while(com[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); - } + if(i<len) { + letter = com[i]; + if(letter>91) { + letter_case = letter-32; + } else { + letter_case = letter+32; } - list_iterator_destroy(results_i); - } - + request->geometry[X] = -1; + + results_i = list_iterator_create(allocated_partitions); + while((allocated_part = list_next(results_i)) != NULL) { + request->geometry[X] = allocated_part->request->geometry[X]; + request->geometry[Y] = allocated_part->request->geometry[Y]; + request->geometry[Z] = allocated_part->request->geometry[Z]; + request->size = allocated_part->request->size; + request->conn_type=allocated_part->request->conn_type; + request->rotate =allocated_part->request->rotate; + request->elongate = allocated_part->request->elongate; + request->force_contig = allocated_part->request->force_contig; + request->co_proc = allocated_part->request->co_proc; + if((allocated_part->letter == letter) || (allocated_part->letter == letter_case)) { + break; + } + } + list_iterator_destroy(results_i); + + if(request->geometry[X]==-1) { + memset(error_string,0,255); + sprintf(error_string, "Problem with the copy\nAre you sure there is enough room for it?"); + return 0; + } + request->rotate_count= 0; + request->elongate_count = 0; + + if((allocated_part = _make_request(request)) != NULL) + list_append(allocated_partitions, allocated_part); return 1; } -int _save_allocation(command_info_t *com, List allocated_partitions) +int _save_allocation(char *com, List allocated_partitions) { + int len = strlen(com); + int i=5, j=0; + allocated_part_t *allocated_part; + char filename[20]; + char save_string[255]; + FILE *file_ptr; + ListIterator results_i; + memset(filename,0,20); + if(len>5) + while(i<len) { + + while(com[i-1]!=' ' && i<len) { + i++; + } + while(i<len && com[i]!=' ') { + filename[j] = com[i]; + i++; + j++; + } + } + if(filename[0]=='\0') { + pa_system_ptr->now_time = time(NULL); + sprintf(filename,"bluegene.conf.%ld",pa_system_ptr->now_time); + } + file_ptr = fopen(filename,"w"); + if (file_ptr!=NULL) + { + results_i = list_iterator_create(allocated_partitions); + while((allocated_part = list_next(results_i)) != NULL) { + memset(save_string,0,255); + sprintf(save_string, "Nodes=bgl[%s] Type=%d\n", allocated_part->request->save_name, allocated_part->request->conn_type); + + fputs (save_string,file_ptr); + } + fclose (file_ptr); + } return 1; } @@ -361,7 +423,7 @@ void _print_header_command() 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)); + COLOR_PAIR(allocated_part->color)); mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, pa_system_ptr->xcord, "%c",allocated_part->letter); @@ -417,17 +479,17 @@ void _print_text_command(allocated_part_t *allocated_part) 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)); + COLOR_PAIR(allocated_part->color)); return; } void get_command(void) { - command_info_t *com = xmalloc(sizeof(command_info_t)); + char com[255]; //static node_info_msg_t *node_info_ptr; int text_width, text_startx; allocated_part_t *allocated_part; - + int i=0; WINDOW *command_win; List allocated_partitions; ListIterator results_i; @@ -440,7 +502,7 @@ void get_command(void) echo(); - while (strcmp(com->str, "quit")) { + while (strcmp(com, "quit")) { print_grid(); wclear(pa_system_ptr->text_win); box(pa_system_ptr->text_win, 0, 0); @@ -448,6 +510,24 @@ void get_command(void) if (!params.no_header) _print_header_command(); + + if(error_string!=NULL) { + i=0; + while(error_string[i]!='\0') { + if(error_string[i]=='\n') { + pa_system_ptr->ycord++; + pa_system_ptr->xcord=1; + i++; + } + mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, + pa_system_ptr->xcord, "%c",error_string[i++]); + pa_system_ptr->xcord++; + } + pa_system_ptr->ycord++; + pa_system_ptr->xcord=1; + memset(error_string,0,255); + + } results_i = list_iterator_create(allocated_partitions); while((allocated_part = list_next(results_i)) != NULL) { _print_text_command(allocated_part); @@ -461,27 +541,33 @@ void get_command(void) mvwprintw(command_win, 0, 3, "Input Command: (type quit to change view, exit to exit)"); wmove(command_win, 1, 1); - wgetstr(command_win, com->str); + wgetstr(command_win, com); - if (!strcmp(com->str, "exit")) { + if (!strcmp(com, "exit")) { endwin(); _delete_allocated_parts(allocated_partitions); pa_fini(); exit(0); - } else if (!strncmp(com->str, "resume", 6)) { - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, pa_system_ptr->xcord, "%s", com->str); - } else if (!strncmp(com->str, "drain", 5)) { - mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, pa_system_ptr->xcord, "%s", com->str); - } else if (!strncmp(com->str, "remove", 6) || !strncmp(com->str, "delete", 6) || !strncmp(com->str, "drop", 4)) { + } else if (!strncmp(com, "resume", 6)) { + mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, pa_system_ptr->xcord, "%s", com); + } else if (!strncmp(com, "drain", 5)) { + mvwprintw(pa_system_ptr->text_win, pa_system_ptr->ycord, pa_system_ptr->xcord, "%s", com); + } else if (!strncmp(com, "remove", 6) || !strncmp(com, "delete", 6) || !strncmp(com, "drop", 4)) { _remove_allocation(com, allocated_partitions); - } else if (!strncmp(com->str, "alter", 5)) { + } else if (!strncmp(com, "alter", 5)) { _alter_allocation(com, allocated_partitions); - } else if (!strncmp(com->str, "create", 6)) { + } else if (!strncmp(com, "create", 6)) { _create_allocation(com, allocated_partitions); - } else if (!strncmp(com->str, "copy", 4)) { + } else if (!strncmp(com, "copy", 4) || !strncmp(com, "c ", 2) || !strncmp(com, "c\0", 2)) { _copy_allocation(com, allocated_partitions); - } else if (!strncmp(com->str, "save", 4)) { + } else if (!strncmp(com, "save", 4)) { _save_allocation(com, allocated_partitions); + } else if (!strncmp(com, "clear all", 9)) { + _delete_allocated_parts(allocated_partitions); + allocated_partitions = list_create(NULL); + } else { + memset(error_string,0,255); + sprintf(error_string, "Unknown command '%s'",com); } } _delete_allocated_parts(allocated_partitions); -- GitLab