diff options
author | Nils Durner <durner@gnunet.org> | 2009-06-16 20:13:13 +0000 |
---|---|---|
committer | Nils Durner <durner@gnunet.org> | 2009-06-16 20:13:13 +0000 |
commit | dc6e9887c24209d0e3dfb6cfb30fbde6ae3b47e9 (patch) | |
tree | 08e0d0aaf9d67b2fd259dcfed6def6abc91f34c4 /src | |
parent | 841cf45c29f46825a8e9913c6e45dcff21318f5a (diff) | |
download | gnunet-dc6e9887c24209d0e3dfb6cfb30fbde6ae3b47e9.tar.gz gnunet-dc6e9887c24209d0e3dfb6cfb30fbde6ae3b47e9.zip |
GNUNET_IO_handle => GNUNET_DISK_handle
Diffstat (limited to 'src')
-rw-r--r-- | src/include/Makefile.am | 1 | ||||
-rw-r--r-- | src/include/gnunet_disk_lib.h | 13 | ||||
-rw-r--r-- | src/include/gnunet_io_lib.h | 46 | ||||
-rw-r--r-- | src/include/gnunet_util_lib.h | 1 | ||||
-rw-r--r-- | src/util/Makefile.am | 2 | ||||
-rw-r--r-- | src/util/container_bloomfilter.c | 6 | ||||
-rw-r--r-- | src/util/crypto_hash.c | 2 | ||||
-rw-r--r-- | src/util/disk.c | 49 | ||||
-rw-r--r-- | src/util/io_handle.c | 58 | ||||
-rw-r--r-- | src/util/io_handle.h | 38 | ||||
-rw-r--r-- | src/util/test_disk.c | 4 | ||||
-rw-r--r-- | src/util/test_os_load.c | 2 |
12 files changed, 60 insertions, 162 deletions
diff --git a/src/include/Makefile.am b/src/include/Makefile.am index 0fb7aa0fd..bc832c444 100644 --- a/src/include/Makefile.am +++ b/src/include/Makefile.am | |||
@@ -24,7 +24,6 @@ gnunetinclude_HEADERS = \ | |||
24 | gnunet_fragmentation_lib.h \ | 24 | gnunet_fragmentation_lib.h \ |
25 | gnunet_getopt_lib.h \ | 25 | gnunet_getopt_lib.h \ |
26 | gnunet_hello_lib.h \ | 26 | gnunet_hello_lib.h \ |
27 | gnunet_io_lib.h \ | ||
28 | gnunet_network_lib.h \ | 27 | gnunet_network_lib.h \ |
29 | gnunet_peerinfo_service.h \ | 28 | gnunet_peerinfo_service.h \ |
30 | gnunet_program_lib.h \ | 29 | gnunet_program_lib.h \ |
diff --git a/src/include/gnunet_disk_lib.h b/src/include/gnunet_disk_lib.h index 080d8c09b..2c7488cc4 100644 --- a/src/include/gnunet_disk_lib.h +++ b/src/include/gnunet_disk_lib.h | |||
@@ -28,7 +28,6 @@ | |||
28 | 28 | ||
29 | #include "gnunet_configuration_lib.h" | 29 | #include "gnunet_configuration_lib.h" |
30 | #include "gnunet_scheduler_lib.h" | 30 | #include "gnunet_scheduler_lib.h" |
31 | #include "gnunet_io_lib.h" | ||
32 | 31 | ||
33 | /* we need size_t, and since it can be both unsigned int | 32 | /* we need size_t, and since it can be both unsigned int |
34 | or unsigned long long, this IS platform dependent; | 33 | or unsigned long long, this IS platform dependent; |
@@ -75,6 +74,8 @@ extern "C" | |||
75 | 74 | ||
76 | enum GNUNET_DISK_Seek {GNUNET_SEEK_SET, GNUNET_SEEK_CUR, GNUNET_SEEK_END}; | 75 | enum GNUNET_DISK_Seek {GNUNET_SEEK_SET, GNUNET_SEEK_CUR, GNUNET_SEEK_END}; |
77 | 76 | ||
77 | struct GNUNET_IO_Handle; | ||
78 | |||
78 | /** | 79 | /** |
79 | * Get the number of blocks that are left on the partition that | 80 | * Get the number of blocks that are left on the partition that |
80 | * contains the given file (for normal users). | 81 | * contains the given file (for normal users). |
@@ -86,6 +87,14 @@ long GNUNET_DISK_get_blocks_available (const char *part); | |||
86 | 87 | ||
87 | 88 | ||
88 | /** | 89 | /** |
90 | * Checks whether a handle is invalid | ||
91 | * @param h handle to check | ||
92 | * @return GNUNET_YES if invalid, GNUNET_NO if valid | ||
93 | */ | ||
94 | int GNUNET_DISK_handle_invalid (const struct GNUNET_IO_Handle *h); | ||
95 | |||
96 | |||
97 | /** | ||
89 | * Check that fil corresponds to a filename | 98 | * Check that fil corresponds to a filename |
90 | * (of a file that exists and that is not a directory). | 99 | * (of a file that exists and that is not a directory). |
91 | * | 100 | * |
@@ -153,7 +162,7 @@ int GNUNET_DISK_file_read (const struct GNUNET_IO_Handle *h, void *result, int l | |||
153 | * @param fn file name | 162 | * @param fn file name |
154 | * @param result the buffer to write the result to | 163 | * @param result the buffer to write the result to |
155 | * @param len the maximum number of bytes to read | 164 | * @param len the maximum number of bytes to read |
156 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 165 | * @return number of bytes read, GNUNET_SYSERR on failure |
157 | */ | 166 | */ |
158 | int GNUNET_DISK_fn_read (const char * const fn, void *result, int len); | 167 | int GNUNET_DISK_fn_read (const char * const fn, void *result, int len); |
159 | 168 | ||
diff --git a/src/include/gnunet_io_lib.h b/src/include/gnunet_io_lib.h deleted file mode 100644 index 3d04a2317..000000000 --- a/src/include/gnunet_io_lib.h +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | (C) 2009 Christian Grothoff (and other contributing authors) | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 2, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
18 | Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file include/gnunet_io_lib.h | ||
23 | * @brief Helper functions for abstract IO handles | ||
24 | * @author Nils Durner | ||
25 | */ | ||
26 | |||
27 | #ifndef IO_HANDLE_H_ | ||
28 | #define IO_HANDLE_H_ | ||
29 | |||
30 | struct GNUNET_IO_Handle; | ||
31 | |||
32 | /** | ||
33 | * Checks whether a handle is invalid | ||
34 | * @param h handle to check | ||
35 | * @return GNUNET_YES if invalid, GNUNET_NO if valid | ||
36 | */ | ||
37 | int GNUNET_IO_handle_invalid (const struct GNUNET_IO_Handle *h); | ||
38 | |||
39 | /** | ||
40 | * Mark a handle as invalid | ||
41 | * @param h file handle | ||
42 | */ | ||
43 | void GNUNET_IO_handle_invalidate (struct GNUNET_IO_Handle *h); | ||
44 | |||
45 | |||
46 | #endif /* IO_HANDLE_H_ */ | ||
diff --git a/src/include/gnunet_util_lib.h b/src/include/gnunet_util_lib.h index 58621caf5..6354e28fa 100644 --- a/src/include/gnunet_util_lib.h +++ b/src/include/gnunet_util_lib.h | |||
@@ -43,7 +43,6 @@ extern "C" | |||
43 | #include "gnunet_crypto_lib.h" | 43 | #include "gnunet_crypto_lib.h" |
44 | #include "gnunet_disk_lib.h" | 44 | #include "gnunet_disk_lib.h" |
45 | #include "gnunet_getopt_lib.h" | 45 | #include "gnunet_getopt_lib.h" |
46 | #include "gnunet_io_lib.h" | ||
47 | #include "gnunet_network_lib.h" | 46 | #include "gnunet_network_lib.h" |
48 | #include "gnunet_plugin_lib.h" | 47 | #include "gnunet_plugin_lib.h" |
49 | #include "gnunet_program_lib.h" | 48 | #include "gnunet_program_lib.h" |
diff --git a/src/util/Makefile.am b/src/util/Makefile.am index 014521f90..64178e538 100644 --- a/src/util/Makefile.am +++ b/src/util/Makefile.am | |||
@@ -33,8 +33,6 @@ libgnunetutil_la_SOURCES = \ | |||
33 | disk.c \ | 33 | disk.c \ |
34 | getopt.c \ | 34 | getopt.c \ |
35 | getopt_helpers.c \ | 35 | getopt_helpers.c \ |
36 | io_handle.c \ | ||
37 | io_handle.h \ | ||
38 | network.c \ | 36 | network.c \ |
39 | os_installation.c \ | 37 | os_installation.c \ |
40 | os_load.c \ | 38 | os_load.c \ |
diff --git a/src/util/container_bloomfilter.c b/src/util/container_bloomfilter.c index 37780cb2a..e5a0955c4 100644 --- a/src/util/container_bloomfilter.c +++ b/src/util/container_bloomfilter.c | |||
@@ -151,7 +151,7 @@ incrementBit (char *bitArray, unsigned int bitIdx, const struct GNUNET_IO_Handle | |||
151 | unsigned int targetLoc; | 151 | unsigned int targetLoc; |
152 | 152 | ||
153 | setBit (bitArray, bitIdx); | 153 | setBit (bitArray, bitIdx); |
154 | if (GNUNET_IO_handle_invalid (fh)) | 154 | if (GNUNET_DISK_handle_invalid (fh)) |
155 | return; | 155 | return; |
156 | /* Update the counter file on disk */ | 156 | /* Update the counter file on disk */ |
157 | fileSlot = bitIdx / 2; | 157 | fileSlot = bitIdx / 2; |
@@ -195,7 +195,7 @@ decrementBit (char *bitArray, unsigned int bitIdx, const struct GNUNET_IO_Handle | |||
195 | unsigned int low; | 195 | unsigned int low; |
196 | unsigned int targetLoc; | 196 | unsigned int targetLoc; |
197 | 197 | ||
198 | if (GNUNET_IO_handle_invalid (fh)) | 198 | if (GNUNET_DISK_handle_invalid (fh)) |
199 | return; /* cannot decrement! */ | 199 | return; /* cannot decrement! */ |
200 | /* Each char slot in the counter file holds two 4 bit counters */ | 200 | /* Each char slot in the counter file holds two 4 bit counters */ |
201 | fileSlot = bitIdx / 2; | 201 | fileSlot = bitIdx / 2; |
@@ -246,7 +246,7 @@ makeEmptyFile (const struct GNUNET_IO_Handle *fh, unsigned int size) | |||
246 | unsigned int bytesleft = size; | 246 | unsigned int bytesleft = size; |
247 | int res = 0; | 247 | int res = 0; |
248 | 248 | ||
249 | if (GNUNET_IO_handle_invalid (fh)) | 249 | if (GNUNET_DISK_handle_invalid (fh)) |
250 | return GNUNET_SYSERR; | 250 | return GNUNET_SYSERR; |
251 | buffer = GNUNET_malloc (BUFFSIZE); | 251 | buffer = GNUNET_malloc (BUFFSIZE); |
252 | memset (buffer, 0, BUFFSIZE); | 252 | memset (buffer, 0, BUFFSIZE); |
diff --git a/src/util/crypto_hash.c b/src/util/crypto_hash.c index 5a7cb33d7..dbb112666 100644 --- a/src/util/crypto_hash.c +++ b/src/util/crypto_hash.c | |||
@@ -443,7 +443,7 @@ file_hash_finish (struct FileHashContext *fhc, const GNUNET_HashCode * res) | |||
443 | { | 443 | { |
444 | fhc->callback (fhc->callback_cls, res); | 444 | fhc->callback (fhc->callback_cls, res); |
445 | GNUNET_free (fhc->filename); | 445 | GNUNET_free (fhc->filename); |
446 | if (!GNUNET_IO_handle_invalid (fhc->fh)) | 446 | if (!GNUNET_DISK_handle_invalid (fhc->fh)) |
447 | GNUNET_break (0 == GNUNET_DISK_file_close (&fhc->fh)); | 447 | GNUNET_break (0 == GNUNET_DISK_file_close (&fhc->fh)); |
448 | GNUNET_free (fhc); /* also frees fhc->buffer */ | 448 | GNUNET_free (fhc); /* also frees fhc->buffer */ |
449 | } | 449 | } |
diff --git a/src/util/disk.c b/src/util/disk.c index 2c592dcfa..2722dda71 100644 --- a/src/util/disk.c +++ b/src/util/disk.c | |||
@@ -26,10 +26,8 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include "platform.h" | 28 | #include "platform.h" |
29 | #include "io_handle.h" | ||
30 | #include "gnunet_common.h" | 29 | #include "gnunet_common.h" |
31 | #include "gnunet_directories.h" | 30 | #include "gnunet_directories.h" |
32 | #include "gnunet_io_lib.h" | ||
33 | #include "gnunet_disk_lib.h" | 31 | #include "gnunet_disk_lib.h" |
34 | #include "gnunet_scheduler_lib.h" | 32 | #include "gnunet_scheduler_lib.h" |
35 | #include "gnunet_strings_lib.h" | 33 | #include "gnunet_strings_lib.h" |
@@ -76,6 +74,15 @@ typedef struct | |||
76 | int include_sym_links; | 74 | int include_sym_links; |
77 | } GetFileSizeData; | 75 | } GetFileSizeData; |
78 | 76 | ||
77 | struct GNUNET_IO_Handle | ||
78 | { | ||
79 | #if MINGW | ||
80 | HANDLE h; | ||
81 | #else | ||
82 | int fd; | ||
83 | #endif | ||
84 | }; | ||
85 | |||
79 | static int | 86 | static int |
80 | getSizeRec (void *ptr, const char *fn) | 87 | getSizeRec (void *ptr, const char *fn) |
81 | { | 88 | { |
@@ -111,6 +118,34 @@ getSizeRec (void *ptr, const char *fn) | |||
111 | return GNUNET_OK; | 118 | return GNUNET_OK; |
112 | } | 119 | } |
113 | 120 | ||
121 | /** | ||
122 | * Checks whether a handle is invalid | ||
123 | * @param h handle to check | ||
124 | * @return GNUNET_YES if invalid, GNUNET_NO if valid | ||
125 | */ | ||
126 | int | ||
127 | GNUNET_DISK_handle_invalid (const struct GNUNET_IO_Handle *h) | ||
128 | { | ||
129 | #ifdef MINGW | ||
130 | return !h || h->h == INVALID_HANDLE_VALUE ? GNUNET_YES : GNUNET_NO; | ||
131 | #else | ||
132 | return !h || h->fd == -1 ? GNUNET_YES : GNUNET_NO; | ||
133 | #endif | ||
134 | } | ||
135 | |||
136 | /** | ||
137 | * Mark a handle as invalid | ||
138 | * @param h file handle | ||
139 | */ | ||
140 | static void | ||
141 | GNUNET_DISK_handle_invalidate (struct GNUNET_IO_Handle *h) | ||
142 | { | ||
143 | #ifdef MINGW | ||
144 | h->h = INVALID_HANDLE_VALUE; | ||
145 | #else | ||
146 | h->fd = -1; | ||
147 | #endif | ||
148 | } | ||
114 | 149 | ||
115 | /** | 150 | /** |
116 | * Move the read/write pointer in a file | 151 | * Move the read/write pointer in a file |
@@ -435,7 +470,7 @@ GNUNET_DISK_file_read (const struct GNUNET_IO_Handle *h, void *result, int len) | |||
435 | * @param fn file name | 470 | * @param fn file name |
436 | * @param result the buffer to write the result to | 471 | * @param result the buffer to write the result to |
437 | * @param len the maximum number of bytes to read | 472 | * @param len the maximum number of bytes to read |
438 | * @return GNUNET_OK on success, GNUNET_SYSERR on failure | 473 | * @return number of bytes read, GNUNET_SYSERR on failure |
439 | */ | 474 | */ |
440 | int | 475 | int |
441 | GNUNET_DISK_fn_read (const char * const fn, void *result, int len) | 476 | GNUNET_DISK_fn_read (const char * const fn, void *result, int len) |
@@ -446,7 +481,7 @@ GNUNET_DISK_fn_read (const char * const fn, void *result, int len) | |||
446 | fh = GNUNET_DISK_file_open (fn, GNUNET_DISK_OPEN_READ); | 481 | fh = GNUNET_DISK_file_open (fn, GNUNET_DISK_OPEN_READ); |
447 | if (!fh) | 482 | if (!fh) |
448 | return GNUNET_SYSERR; | 483 | return GNUNET_SYSERR; |
449 | ret = (len == GNUNET_DISK_file_read (fh, result, len)) ? GNUNET_OK : GNUNET_SYSERR; | 484 | ret = GNUNET_DISK_file_read (fh, result, len); |
450 | GNUNET_assert(GNUNET_OK == GNUNET_DISK_file_close(&fh)); | 485 | GNUNET_assert(GNUNET_OK == GNUNET_DISK_file_close(&fh)); |
451 | 486 | ||
452 | return ret; | 487 | return ret; |
@@ -1094,7 +1129,7 @@ GNUNET_DISK_file_close (struct GNUNET_IO_Handle **h) | |||
1094 | } | 1129 | } |
1095 | #endif | 1130 | #endif |
1096 | 1131 | ||
1097 | GNUNET_IO_handle_invalidate (*h); | 1132 | GNUNET_DISK_handle_invalidate (*h); |
1098 | free(*h); | 1133 | free(*h); |
1099 | *h = NULL; | 1134 | *h = NULL; |
1100 | 1135 | ||
@@ -1272,7 +1307,7 @@ GNUNET_DISK_file_unmap (struct GNUNET_IO_Handle **h, void *addr, size_t len) | |||
1272 | SetErrnoFromWinError (GetLastError ()); | 1307 | SetErrnoFromWinError (GetLastError ()); |
1273 | } | 1308 | } |
1274 | 1309 | ||
1275 | GNUNET_IO_handle_invalidate (*h); | 1310 | GNUNET_DISK_handle_invalidate (*h); |
1276 | GNUNET_free (*h); | 1311 | GNUNET_free (*h); |
1277 | h = NULL; | 1312 | h = NULL; |
1278 | 1313 | ||
@@ -1280,7 +1315,7 @@ GNUNET_DISK_file_unmap (struct GNUNET_IO_Handle **h, void *addr, size_t len) | |||
1280 | #else | 1315 | #else |
1281 | int ret; | 1316 | int ret; |
1282 | ret = munmap (addr, len) != -1 ? GNUNET_OK : GNUNET_SYSERR; | 1317 | ret = munmap (addr, len) != -1 ? GNUNET_OK : GNUNET_SYSERR; |
1283 | GNUNET_IO_handle_invalidate (h); | 1318 | GNUNET_DISK_handle_invalidate (*h); |
1284 | return ret; | 1319 | return ret; |
1285 | #endif | 1320 | #endif |
1286 | } | 1321 | } |
diff --git a/src/util/io_handle.c b/src/util/io_handle.c deleted file mode 100644 index 438974797..000000000 --- a/src/util/io_handle.c +++ /dev/null | |||
@@ -1,58 +0,0 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | (C) 2009 Christian Grothoff (and other contributing authors) | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 2, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
18 | Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | /** | ||
21 | * @file util/io_handle.c | ||
22 | * @brief common functions for IO handles | ||
23 | * @author Nils Durner | ||
24 | */ | ||
25 | #include "platform.h" | ||
26 | #include "io_handle.h" | ||
27 | #include "gnunet_common.h" | ||
28 | |||
29 | /** | ||
30 | * Checks whether a handle is invalid | ||
31 | * @param h handle to check | ||
32 | * @return GNUNET_YES if invalid, GNUNET_NO if valid | ||
33 | */ | ||
34 | int | ||
35 | GNUNET_IO_handle_invalid (const struct GNUNET_IO_Handle *h) | ||
36 | { | ||
37 | #ifdef MINGW | ||
38 | return !h || h->h == INVALID_HANDLE_VALUE ? GNUNET_YES : GNUNET_NO; | ||
39 | #else | ||
40 | return !h || h->fd == -1 ? GNUNET_YES : GNUNET_NO; | ||
41 | #endif | ||
42 | } | ||
43 | |||
44 | /** | ||
45 | * Mark a handle as invalid | ||
46 | * @param h file handle | ||
47 | */ | ||
48 | void | ||
49 | GNUNET_IO_handle_invalidate (struct GNUNET_IO_Handle *h) | ||
50 | { | ||
51 | #ifdef MINGW | ||
52 | h->h = INVALID_HANDLE_VALUE; | ||
53 | #else | ||
54 | h->fd = -1; | ||
55 | #endif | ||
56 | } | ||
57 | |||
58 | /* end of io_handle.c */ | ||
diff --git a/src/util/io_handle.h b/src/util/io_handle.h deleted file mode 100644 index 04e735748..000000000 --- a/src/util/io_handle.h +++ /dev/null | |||
@@ -1,38 +0,0 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | (C) 2009 Christian Grothoff (and other contributing authors) | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 2, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
18 | Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file util/io_handle.h | ||
23 | * @brief wrapper structure for file handles, sockets, ... | ||
24 | */ | ||
25 | |||
26 | #ifndef IO_HANDLE_H_ | ||
27 | #define IO_HANDLE_H_ | ||
28 | |||
29 | struct GNUNET_IO_Handle | ||
30 | { | ||
31 | #if MINGW | ||
32 | HANDLE h; | ||
33 | #else | ||
34 | int fd; | ||
35 | #endif | ||
36 | }; | ||
37 | |||
38 | #endif /* IO_HANDLE_H_ */ | ||
diff --git a/src/util/test_disk.c b/src/util/test_disk.c index e305889d8..f89b1de25 100644 --- a/src/util/test_disk.c +++ b/src/util/test_disk.c | |||
@@ -92,7 +92,7 @@ testOpenClose () | |||
92 | fh = GNUNET_DISK_file_open (".testfile", GNUNET_DISK_OPEN_READWRITE | 92 | fh = GNUNET_DISK_file_open (".testfile", GNUNET_DISK_OPEN_READWRITE |
93 | | GNUNET_DISK_OPEN_CREATE, GNUNET_DISK_PERM_USER_READ | 93 | | GNUNET_DISK_OPEN_CREATE, GNUNET_DISK_PERM_USER_READ |
94 | | GNUNET_DISK_PERM_USER_WRITE); | 94 | | GNUNET_DISK_PERM_USER_WRITE); |
95 | GNUNET_assert (GNUNET_NO == GNUNET_IO_handle_invalid (fh)); | 95 | GNUNET_assert (GNUNET_NO == GNUNET_DISK_handle_invalid (fh)); |
96 | GNUNET_break (5 == GNUNET_DISK_file_write (fh, "Hello", 5)); | 96 | GNUNET_break (5 == GNUNET_DISK_file_write (fh, "Hello", 5)); |
97 | GNUNET_DISK_file_close (&fh); | 97 | GNUNET_DISK_file_close (&fh); |
98 | GNUNET_break (GNUNET_OK == | 98 | GNUNET_break (GNUNET_OK == |
@@ -108,7 +108,7 @@ testOpenClose () | |||
108 | fh = GNUNET_DISK_file_open (".testfile", GNUNET_DISK_OPEN_READWRITE | 108 | fh = GNUNET_DISK_file_open (".testfile", GNUNET_DISK_OPEN_READWRITE |
109 | | GNUNET_DISK_OPEN_CREATE, GNUNET_DISK_PERM_USER_WRITE | 109 | | GNUNET_DISK_OPEN_CREATE, GNUNET_DISK_PERM_USER_WRITE |
110 | | GNUNET_DISK_PERM_USER_READ); | 110 | | GNUNET_DISK_PERM_USER_READ); |
111 | GNUNET_assert (GNUNET_NO == GNUNET_IO_handle_invalid (fh)); | 111 | GNUNET_assert (GNUNET_NO == GNUNET_DISK_handle_invalid (fh)); |
112 | while ((avail == GNUNET_DISK_get_blocks_available (".testfile")) && | 112 | while ((avail == GNUNET_DISK_get_blocks_available (".testfile")) && |
113 | (avail != -1)) | 113 | (avail != -1)) |
114 | if (16 != GNUNET_DISK_file_write (fh, "HelloWorld123456", 16)) | 114 | if (16 != GNUNET_DISK_file_write (fh, "HelloWorld123456", 16)) |
diff --git a/src/util/test_os_load.c b/src/util/test_os_load.c index 8e9776883..4885ed3bb 100644 --- a/src/util/test_os_load.c +++ b/src/util/test_os_load.c | |||
@@ -135,7 +135,7 @@ testdisk () | |||
135 | fh = GNUNET_DISK_file_open (".loadfile", GNUNET_DISK_OPEN_WRITE | 135 | fh = GNUNET_DISK_file_open (".loadfile", GNUNET_DISK_OPEN_WRITE |
136 | | GNUNET_DISK_OPEN_CREATE, GNUNET_DISK_PERM_USER_READ | 136 | | GNUNET_DISK_OPEN_CREATE, GNUNET_DISK_PERM_USER_READ |
137 | | GNUNET_DISK_PERM_USER_WRITE); | 137 | | GNUNET_DISK_PERM_USER_WRITE); |
138 | GNUNET_assert (GNUNET_NO == GNUNET_IO_handle_invalid(fh)); | 138 | GNUNET_assert (GNUNET_NO == GNUNET_DISK_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 | GNUNET_DISK_file_seek (fh, GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, | 141 | GNUNET_DISK_file_seek (fh, GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, |