Changeset f7017572 in mainline for uspace/app/tester/vfs/vfs1.c
- Timestamp:
- 2008-01-27T18:54:16Z (17 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- acfdcb0
- Parents:
- 15b9970
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/tester/vfs/vfs1.c
r15b9970 rf7017572 39 39 #include "../tester.h" 40 40 41 char text[] = "O xein', angellein Lakedaimoniois hoti teide " 42 "keimetha tois keinon rhemasi peithomenoi."; 43 41 44 char *test_vfs1(bool quiet) 42 45 { … … 46 49 if (mkdir("/mydir", 0) != 0) 47 50 return "mkdir() failed.\n"; 51 if (!quiet) 52 printf("Created directory /mydir\n"); 53 54 int fd0 = open("/mydir/myfile", O_CREAT); 55 if (fd0 < 0) 56 return "open() failed.\n"; 57 if (!quiet) 58 printf("Created /mydir/myfile, handle=%d\n", fd0); 59 60 ssize_t cnt; 61 size_t size = sizeof(text); 62 cnt = write(fd0, text, size); 63 if (cnt < 0) 64 return "write() failed.\n"; 65 if (!quiet) 66 printf("Written %d btyes to handle %d.\n", cnt, fd0); 67 if (lseek(fd0, 0, SEEK_SET) != 0) 68 return "lseek() failed.\n"; 48 69 49 70 DIR *dirp; … … 57 78 closedir(dirp); 58 79 59 int fd1 = open("/dir1/file1", 0);60 int fd2 = open("/dir2/file2", 0);80 int fd1 = open("/dir1/file1", O_RDONLY); 81 int fd2 = open("/dir2/file2", O_RDONLY); 61 82 62 83 if (fd1 < 0) … … 70 91 char buf[10]; 71 92 72 ssize_t cnt = read(fd1, buf, sizeof(buf));93 cnt = read(fd0, buf, sizeof(buf)); 73 94 if (cnt < 0) 74 95 return "read() failed.\n"; 75 96 76 97 if (!quiet) 77 printf("Read %d bytes: %.*s\n", cnt, cnt, buf); 98 printf("Read %d bytes from handle %d: %.*s\n", cnt, fd0, cnt, 99 buf); 100 101 cnt = read(fd1, buf, sizeof(buf)); 102 if (cnt < 0) 103 return "read() failed.\n"; 104 105 if (!quiet) 106 printf("Read %d bytes from handle %d: %.*s\n", cnt, fd1, cnt, 107 buf); 78 108 79 109 return NULL;
Note:
See TracChangeset
for help on using the changeset viewer.