Changes in uspace/app/tester/vfs/vfs1.c [6118ccaf:19f857a] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/tester/vfs/vfs1.c
r6118ccaf r19f857a 40 40 #include "../tester.h" 41 41 42 #define TEST_DIRECTORY "/tmp/testdir" 42 #define FS_TYPE "tmpfs" 43 #define MOUNT_POINT "/tmp" 44 #define OPTIONS "" 45 #define FLAGS 0 46 47 #define TEST_DIRECTORY MOUNT_POINT "/testdir" 43 48 #define TEST_FILE TEST_DIRECTORY "/testfile" 44 49 #define TEST_FILE2 TEST_DIRECTORY "/nextfile" … … 70 75 const char *test_vfs1(void) 71 76 { 72 int rc; 73 if ((rc = mkdir(TEST_DIRECTORY, 0)) != 0) { 74 TPRINTF("rc=%d\n", rc); 77 if (mkdir(MOUNT_POINT, 0) != 0) 75 78 return "mkdir() failed"; 79 TPRINTF("Created directory %s\n", MOUNT_POINT); 80 81 int rc = mount(FS_TYPE, MOUNT_POINT, "", OPTIONS, FLAGS); 82 switch (rc) { 83 case EOK: 84 TPRINTF("Mounted %s on %s\n", FS_TYPE, MOUNT_POINT); 85 break; 86 case EBUSY: 87 TPRINTF("(INFO) Filesystem already mounted on %s\n", MOUNT_POINT); 88 break; 89 default: 90 TPRINTF("(ERR) IPC returned errno %d (is tmpfs loaded?)\n", rc); 91 return "mount() failed"; 76 92 } 93 94 if (mkdir(TEST_DIRECTORY, 0) != 0) 95 return "mkdir() failed"; 77 96 TPRINTF("Created directory %s\n", TEST_DIRECTORY); 78 97 … … 86 105 if (cnt < 0) 87 106 return "write() failed"; 88 TPRINTF("Written % zd bytes\n", cnt);107 TPRINTF("Written %d bytes\n", cnt); 89 108 90 109 if (lseek(fd0, 0, SEEK_SET) != 0) … … 97 116 return "read() failed"; 98 117 99 int _cnt = (int) cnt; 100 if (_cnt != cnt) { 101 /* Count overflow, just to be sure. */ 102 TPRINTF("Read %zd bytes\n", cnt); 103 } else { 104 TPRINTF("Read %zd bytes: \"%.*s\"\n", cnt, _cnt, buf); 105 } 118 TPRINTF("Read %d bytes: \".*s\"\n", cnt, cnt, buf); 106 119 } 107 120
Note:
See TracChangeset
for help on using the changeset viewer.