diff options
author | Nils Durner <durner@gnunet.org> | 2009-06-15 20:11:51 +0000 |
---|---|---|
committer | Nils Durner <durner@gnunet.org> | 2009-06-15 20:11:51 +0000 |
commit | 1088905b5a89a24706d2c1877d289589e3f3c222 (patch) | |
tree | 38ec7cdc1b80502aa950c68ebefe1e3f42efa14b /src/util/test_os_load.c | |
parent | 7e3df72d6b8a32b15b02110b54c77f77e28928a2 (diff) | |
download | gnunet-1088905b5a89a24706d2c1877d289589e3f3c222.tar.gz gnunet-1088905b5a89a24706d2c1877d289589e3f3c222.zip |
more complete DISK API
Diffstat (limited to 'src/util/test_os_load.c')
-rw-r--r-- | src/util/test_os_load.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/util/test_os_load.c b/src/util/test_os_load.c index 2f82f60c7..8e9776883 100644 --- a/src/util/test_os_load.c +++ b/src/util/test_os_load.c | |||
@@ -99,7 +99,7 @@ static int | |||
99 | testdisk () | 99 | testdisk () |
100 | { | 100 | { |
101 | int ret; | 101 | int ret; |
102 | int fd; | 102 | struct GNUNET_IO_Handle *fh; |
103 | char buf[65536]; | 103 | char buf[65536]; |
104 | struct GNUNET_TIME_Absolute start; | 104 | struct GNUNET_TIME_Absolute start; |
105 | struct GNUNET_CONFIGURATION_Handle *cfg; | 105 | struct GNUNET_CONFIGURATION_Handle *cfg; |
@@ -132,20 +132,20 @@ testdisk () | |||
132 | return 0; | 132 | return 0; |
133 | } | 133 | } |
134 | memset (buf, 42, sizeof (buf)); | 134 | memset (buf, 42, sizeof (buf)); |
135 | fd = | 135 | fh = GNUNET_DISK_file_open (".loadfile", GNUNET_DISK_OPEN_WRITE |
136 | GNUNET_DISK_file_open (".loadfile", O_WRONLY | O_CREAT, | 136 | | GNUNET_DISK_OPEN_CREATE, GNUNET_DISK_PERM_USER_READ |
137 | S_IRUSR | S_IWUSR); | 137 | | GNUNET_DISK_PERM_USER_WRITE); |
138 | GNUNET_assert (fd != -1); | 138 | GNUNET_assert (GNUNET_NO == GNUNET_IO_handle_invalid(fh)); |
139 | while (GNUNET_TIME_absolute_get_duration (start).value < 60 * 1000) | 139 | while (GNUNET_TIME_absolute_get_duration (start).value < 60 * 1000) |
140 | { | 140 | { |
141 | LSEEK (fd, GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, | 141 | GNUNET_DISK_file_seek (fh, GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, |
142 | 1024 * 1024 * 1024), SEEK_SET); | 142 | 1024 * 1024 * 1024), GNUNET_SEEK_SET); |
143 | GNUNET_assert (sizeof (buf) == WRITE (fd, buf, sizeof (buf))); | 143 | GNUNET_assert (sizeof (buf) == GNUNET_DISK_file_write (fh, buf, sizeof (buf))); |
144 | fsync (fd); | 144 | GNUNET_DISK_file_sync (fh); |
145 | if (ret < GNUNET_OS_load_disk_get (cfg)) | 145 | if (ret < GNUNET_OS_load_disk_get (cfg)) |
146 | break; | 146 | break; |
147 | } | 147 | } |
148 | GNUNET_break (0 == CLOSE (fd)); | 148 | GNUNET_break (GNUNET_OK == GNUNET_DISK_file_close (&fh)); |
149 | GNUNET_break (0 == UNLINK (".loadfile")); | 149 | GNUNET_break (0 == UNLINK (".loadfile")); |
150 | if (ret >= GNUNET_OS_load_disk_get (cfg)) | 150 | if (ret >= GNUNET_OS_load_disk_get (cfg)) |
151 | { | 151 | { |