Skip to content

Commit

Permalink
Merge remote-tracking branch 'slundqui/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
asmeurer committed Apr 26, 2012
2 parents 8e68a29 + d2d958d commit bf6c205
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion filesystem/file_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,29 @@ void listDirectory(){

}

void listBuffers(){
int i;
int j;
for (i = 0; i < NUM_BUFFERS; i++){
printf("Buffer number %d\n", i);
for (j = 0; j < BUFFER_SIZE; j++){
if(buffers[i][j].init == 0){
break;
}
else{
printf("%d: Device: %d Addr: %d Access Type: ",j, buffers[i][j].device_num, buffers[i][j].addr);
if(buffers[i][j].access_type == READ){
printf("Read");
}
else{
printf("Write");
}
printf("\n");
}
}
printf("End buffer %d\n", i);
}
}



Expand Down Expand Up @@ -859,13 +882,18 @@ int main(int argc, char *argv[]) {
listDirectory();
error = 0;
}
else if (!strcmp(init_arg, "BUFFERS\n")) {
printf("LIST BUFFER called\n");
listBuffers();
error = 0;
}
else{
error = 1;
}
}
if(error == 1){
textcolor(BRIGHT, RED, BLACK);
printf("Usage: LIST [DEVICES|FILEINFO <filename>|DIRECTORY]\n");
printf("Usage: LIST [DEVICES|FILEINFO <filename>|DIRECTORY|BUFFERS]\n");
textcolor(RESET, -1, -1);
}
}
Expand All @@ -890,6 +918,7 @@ int main(int argc, char *argv[]) {
printf("WRITE <filehandle> <block_number> <buf_prt> \n");
printf("CLOSE <filehandle>\n");
printf("DELETE <filepath>\n");
printf("LIST [DEVICES|FILEINFO <filename>|DIRECTORY|BUFFERS]\n");
printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
}
else {
Expand Down

0 comments on commit bf6c205

Please sign in to comment.