int main(int argc, char** argv) { int ret = MFS_Init("procyon.cs.wisc.edu", 1345); if(ret != 0) printf("MFS_Init error\n"); //long name test ret = MFS_Creat(1, 1, "veryveryveryveryveryveryveryveryveryverylengthyfilename1111111111111111111.txt"); if(ret < 0) printf("MFS_Creat Error\n"); //Already existing file ret = MFS_Creat(0, 1, "hello.txt"); if(ret < 0) printf("MFS_Creat Error\n"); //Actual create test (creating a file) ret = MFS_Creat(0, 1, "test.txt"); if(ret < 0) printf("MFS_Creat Error\n"); //Do a look up on that created file ret = MFS_Lookup(0, "test.txt"); if(ret != 0) printf("MFS_Lookup Error\n"); ret = MFS_Shutdown(); if(ret < 0) printf("MFS_Shutdown Error\n"); return 0; }
int main(int argc, char *argv[]) { printf("in main\n"); printf("sizes: check_t %d, imap %d, inode %d, MFS_DirEnt_t %d \n", (int)sizeof(check_t), (int)sizeof(inode_map), (int)sizeof(MFS_inode_t), (int)sizeof(MFS_DirEnt_t)); MFS_Init("mumble-34.cs.wisc.edu",10000); int y= MFS_Creat(0,0,"testdir"); printf("y=%d\n",y); int z = MFS_Lookup(1,"."); printf("z %d \n", z); /*int unlnk = MFS_Unlink(0, "test"); // printf("unlink is %d\n", unlnk); // for testing write char * buffer1 = (char*)malloc(65*sizeof(char)); char buffer[4096]; buffer[0] = 's'; buffer[4095] = 'e'; int i; for (i=1;i <4095;i++){ buffer[i] = '\0'; } int wr =MFS_Write(1, buffer, 0); printf("successful write %d\n", wr); printf("%p buf1\n",buffer1); int r = MFS_Read(1, buffer1, 0); printf("%s",buffer1); printf("successful read %d\n", r);*/ MFS_Shutdown(); return 0; }
int main(int argc, char *argv[]) { // Open the server on the specified port int init = MFS_Init("127.0.0.1", 1666); printf("[client] MFS_Init returned %d\n", init); // Create a new file int NewFileCreate = MFS_Creat(0, MFS_REGULAR_FILE, "file666.txt"); printf("[client] MFS_Creat returned %d\n", NewFileCreate); int NewFileInum = MFS_Lookup(0, "file666.txt"); printf("[client] MFS_Lookup returned for file666.txt %d\n", NewFileInum); // Now write a block to this file int NewBlockWrite = MFS_Write(NewFileInum, "test file contents!", 0); printf("[client] MFS_Write returned %d\n", NewBlockWrite); //MFS_Debug(); // Now write a newblock to this file NewBlockWrite = MFS_Write(NewFileInum, "a second block!", 1); printf("[client] MFS_Write returned %d\n", NewBlockWrite); //MFS_Debug(); // Overwrite a block int OverwriteBlock = MFS_Write(NewFileInum, "overwriting the 0th block of the file", 0); printf("[client] MFS_Write returned %d for overwrite\n", OverwriteBlock); //MFS_Debug(); // Do a valid read (of the data we just wrote) char *ValidReadBuffer; ValidReadBuffer = (char*)malloc(MFS_BLOCK_SIZE * sizeof(char)); int ValidRead = MFS_Read(NewFileInum, ValidReadBuffer, 0); printf("[client] MFS_Read returned %d for the valid read, ReadBuffer=%s\n", ValidRead, ValidReadBuffer); // Shutdown MFS_Shutdown(); printf("[client] Sent shutdown, now exiting...\n"); exit(0); }
int main(int argc, char** argv) { char buf[MFS_BLOCK_SIZE]; int inum; int ret = MFS_Init("procyon.cs.wisc.edu", 1345); if(ret != 0) printf("MFS_Init error\n"); ret = MFS_Lookup(1, "hello.txt"); if(ret != 0) printf("MFS_Lookup error\n"); MFS_Stat_t mfs_s; ret = MFS_Stat(1, &mfs_s); if(ret != 0) printf("MFS_Stat error\n"); strcpy(buf, "A random text to be written to write_buffer"); ret = MFS_Write(1, buf, 4); if(ret != 0) printf("MFS_Write error\n"); ret = MFS_Read(1, buf, 4); if(ret != 0) printf("MFS_Read error\n"); inum = MFS_Creat(0, MFS_REGULAR_FILE, "sample.txt"); if(inum != 0) printf("MFS_Creat error\n"); ret = MFS_Unlink(0, "hello.txt"); if(ret != 0) printf("MFS_Unlink error\n"); ret = MFS_Shutdown(); if(ret != 0) printf("MFS_Shutdown error\n"); return 0; }
int main(int argc, char *argv[]) { int rc = MFS_Init("mumble-32.cs.wisc.edu", 11614); printf("CLIENT:: about to send message (%d)\n", rc); char message[BUFFER_SIZE]; sprintf(message, "Hello World"); //rc = UDP_Write(sd, &saddr, message, BUFFER_SIZE); // printf("CLIENT:: sent message (%d)\n", rc); rc = MFS_Shutdown(); if(rc == 0) printf("YAY!\n"); //if (rc == 0) { //struct sockaddr_in raddr; //int rc = UDP_Read(sd, &raddr, buffer, BUFFER_SIZE); //printf("CLIENT:: read %d bytes (message: '%s')\n", rc, buffer); // } return 0; }
int main(int argc, char *argv[]) { int ret; MFS_Stat_t stat; ret = MFS_Init("mumble-28.cs.wisc.edu", 5011); print_val(ret); ret = MFS_Lookup(0, "test"); print_val(ret); ret = MFS_Stat(0, &stat); print_val(ret); ret = MFS_Write(0, (char*) &buffer, 1); print_val(ret); ret = MFS_Read(0, (char*) &buffer, 14); print_val(ret); ret = MFS_Creat(0, MFS_DIRECTORY, "test_filename"); print_val(ret); ret = MFS_Unlink(0, "test_filename"); print_val(ret); ret = MFS_Shutdown(); print_val(ret); return 0; }
int main(int argc,char *argv[]){ char message[100]; char buffer[MFS_BLOCK_SIZE],buffer2[MFS_BLOCK_SIZE],rbuffer[MFS_BLOCK_SIZE],rbuffer2[MFS_BLOCK_SIZE]; int i=0; MFS_Stat_t testing; for(i=0;i<MFS_BLOCK_SIZE;i++){ buffer[i]='a'; buffer2[i]='b'; } sprintf(message,"mumble-23.cs.wisc.edu"); int rc = MFS_Init(message,10001); /* // rc = MFS_Lookup(0,"helloworld.c"); rc = MFS_Creat(0,MFS_REGULAR_FILE,"test"); //rc = MFS_Creat(0,MFS_DIRECTORY,"newfile"); int inode = MFS_Lookup(0,"test"); printf("inode = %d\n",inode); rc = MFS_Write(inode,buffer,0); printf("WRITE return = %d\n",rc); rc = MFS_Read(inode,rbuffer,0); printf("Read return = %d\n",rc); for(i=0;i<MFS_BLOCK_SIZE;i++) printf("%c\n",rbuffer[i]);*/ // rc = MFS_Stat(inode,&testing); // printf("type = %d size= %d\n",testing.type,testing.size); // rc = MFS_Creat(inode,MFS_REGULAR_FILE,"testfile"); // rc = MFS_Stat(inode,&testing); // /* printf("type = %d size= %d\n",testing.type,testing.size); rc = MFS_Unlink(0,"testdir"); printf("Unlink return code: %d\n",rc); rc = MFS_Unlink(inode,"testfile"); printf("Unlink return code: %d\n",rc); rc = MFS_Lookup(inode,"testfile"); printf("Lookup return = %d\n",rc); rc = MFS_Stat(inode,&testing); printf("type = %d size= %d\n",testing.type,testing.size); rc = MFS_Unlink(0,"testdir"); printf("Unlink return code: %d\n",rc);*/ // inode = MFS_Lookup(0,"newfile"); // printf("inode returned after unlink = %d\n",inode); // rc = MFS_Write(inode,buffer,0); // printf("RC = %d\n",rc); // rc = MFS_Write(inode,buffer2,13); // rc = MFS_Write(inode,buffer2,0); // rc = MFS_Read(inode,rbuffer,0); // rc = MFS_Read(inode,rbuffer2,13); // for(i=0;i<MFS_BLOCK_SIZE;i++){ // if((rbuffer2[i]-rbuffer[i])!=-1){ // printf("Error at %d is %c and %c\n",i,rbuffer[i],rbuffer2[i]); // break; // } // } /* rc = MFS_Creat(0,MFS_REGULAR_FILE,"newfile2.txt"); rc = MFS_Creat(0,MFS_REGULAR_FILE,"newfile3.txt"); rc = MFS_Creat(0,MFS_REGULAR_FILE,"newfile4.txt"); rc = MFS_Creat(0,MFS_REGULAR_FILE,"newfile5.txt"); */ // rc = MFS_Write(inode,buffer,3); // printf("Write value = %d\n",rc); // MFS_Stat_t m; // rc = MFS_Stat(inode,&m); // printf("STAT: return value:%d, size= %d, type = %d\n",rc,m.size,m.type); MFS_Shutdown(); return(0); }
int main(int argc, char** argv) { int ret = MFS_Init("procyon.cs.wisc.edu", 1345); if(ret != 0) printf("MFS_Init error\n"); //long name test ret = MFS_Creat(1, 1, "veryveryveryveryveryveryveryveryveryverylengthyfilename1111111111111111111.txt"); if(ret < 0) printf("MFS_Creat Error\n"); //Already existing file ret = MFS_Creat(0, 1, "hello.txt"); if(ret < 0) printf("MFS_Creat Error\n"); //Actual create test (creating a file) ret = MFS_Creat(0, 1, "test.txt"); if(ret < 0) printf("MFS_Creat Error\n"); //Actual create test (creating 1 more file ) ret = MFS_Creat(0, 1, "new_inode_test.txt"); if(ret < 0) printf("MFS_Creat Error\n"); //Actual create Dir test ret = MFS_Creat(0, 0, "new_dir"); if(ret < 0) printf("MFS_Creat Error\n"); //Do a look up on that created file ret = MFS_Lookup(0, "test.txt"); if(ret < 0) printf("MFS_Lookup Error\n"); else printf("MFS_Lookup inum: %d\n", ret); //Do a look up on that 2nd file ret = MFS_Lookup(0, "new_inode_test.txt"); if(ret < 0) printf("MFS_Lookup Error\n"); else printf("MFS_Lookup inum: %d\n", ret); //Do a look up on that new dir ret = MFS_Lookup(0, "new_dir"); if(ret < 0) printf("MFS_Lookup Error\n"); else printf("MFS_Lookup inum: %d\n", ret); MFS_Stat_t mfs_s; ret = MFS_Stat(14, &mfs_s); if(ret < 0) printf("MFS_Stat Error\n"); else printf("MFS Stat of inum %d- type: %d, size: %d\n", 14, mfs_s.type, mfs_s.size); ret = MFS_Stat(15, &mfs_s); if(ret < 0) printf("MFS_Stat Error\n"); else printf("MFS Stat of inum %d- type: %d, size: %d\n", 15, mfs_s.type, mfs_s.size); ret = MFS_Shutdown(); if(ret < 0) printf("MFS_Shutdown Error\n"); return 0; }
int main(int argc, char** argv) { char buf[MFS_BLOCK_SIZE]; //char write_buf[MFS_BLOCK_SIZE]; int ret = MFS_Init("mumble-38.cs.wisc.edu", 1345); if(ret != 0) printf("MFS_Init error\n"); MFS_Stat_t mfs_s; ret = MFS_Stat(1, &mfs_s); if(ret != 0) printf("MFS_Stat Error\n"); ret = MFS_Lookup(2, "helloworld.c"); if(ret < 0) printf("MFS_Lookup Error\n"); //File write test //strcpy(write_buf, "A random textaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa adj;p asd;kad'\0\0\0text"); char* write_bu; write_bu = "Abc\0\0\0text"; ret = MFS_Write(4, write_bu, 0); if(ret < 0) printf("MFS_Write Error\n"); //File read test ret = MFS_Read(4, buf, 0); if(ret < 0) printf("MFS_Read Error\n"); /* //Dir read test ret = MFS_Read(0, buf, 0); if(ret < 0) printf("MFS_Read Error\n"); */ //Already existing file ret = MFS_Creat(0, 1, "hello.txt"); if(ret < 0) printf("MFS_Creat Error\n"); ret = MFS_Unlink(0, "hello.txt"); if(ret < 0) printf("MFS_Unlink Error\n"); ret = MFS_Shutdown(); if(ret < 0) printf("MFS_Shutdown Error\n"); /* //Dir read test ret = MFS_Read(0, buf, 0); if(ret < 0) printf("MFS_Read Error\n"); //File read test ret = MFS_Read(4, buf, 0); if(ret < 0) printf("MFS_Read Error\n"); //long name test ret = MFS_Creat(1, 1, "veryveryveryveryveryveryveryveryveryverylengthyfilename1111111111111111111.txt"); if(ret < 0) printf("MFS_Creat Error\n"); //Already existing file ret = MFS_Creat(0, 1, "hello.txt"); if(ret < 0) printf("MFS_Creat Error\n"); ret = MFS_Creat(0, 1, "test.txt"); if(ret < 0) printf("MFS_Creat Error\n"); */ return 0; }