aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/fs/fs_api.c21
-rw-r--r--src/fs/fs_api.h2
-rw-r--r--src/util/bio.c45
-rw-r--r--src/util/common_logging.c2
4 files changed, 39 insertions, 31 deletions
diff --git a/src/fs/fs_api.c b/src/fs/fs_api.c
index be351b279..e5707c804 100644
--- a/src/fs/fs_api.c
+++ b/src/fs/fs_api.c
@@ -1187,7 +1187,7 @@ make_serialization_file_name_in_dir (struct GNUNET_FS_Handle *h,
1187 * 1187 *
1188 * @param wh write handle 1188 * @param wh write handle
1189 * @param fi file with reader 1189 * @param fi file with reader
1190 * @return GNUNET_OK on success 1190 * @return #GNUNET_OK on success
1191 */ 1191 */
1192static int 1192static int
1193copy_from_reader (struct GNUNET_BIO_WriteHandle *wh, 1193copy_from_reader (struct GNUNET_BIO_WriteHandle *wh,
@@ -1330,6 +1330,9 @@ GNUNET_FS_file_information_sync_ (struct GNUNET_FS_FileInformation *fi)
1330 } 1330 }
1331 break; 1331 break;
1332 case 4: /* directory */ 1332 case 4: /* directory */
1333 if ( (NULL != fi->data.dir.entries) &&
1334 (NULL == fi->data.dir.entries->serialization) )
1335 GNUNET_FS_file_information_sync_ (fi->data.dir.entries);
1333 if ((GNUNET_OK != GNUNET_BIO_write_int32 (wh, fi->data.dir.dir_size)) || 1336 if ((GNUNET_OK != GNUNET_BIO_write_int32 (wh, fi->data.dir.dir_size)) ||
1334 (GNUNET_OK != 1337 (GNUNET_OK !=
1335 GNUNET_BIO_write (wh, fi->data.dir.dir_data, 1338 GNUNET_BIO_write (wh, fi->data.dir.dir_data,
@@ -1348,6 +1351,9 @@ GNUNET_FS_file_information_sync_ (struct GNUNET_FS_FileInformation *fi)
1348 GNUNET_assert (0); 1351 GNUNET_assert (0);
1349 goto cleanup; 1352 goto cleanup;
1350 } 1353 }
1354 if ( (NULL != fi->next) &&
1355 (NULL == fi->next->serialization) )
1356 GNUNET_FS_file_information_sync_ (fi->next);
1351 if (GNUNET_OK != 1357 if (GNUNET_OK !=
1352 GNUNET_BIO_write_string (wh, 1358 GNUNET_BIO_write_string (wh,
1353 (fi->next != 1359 (fi->next !=
@@ -1398,9 +1404,6 @@ find_file_position (struct GNUNET_FS_FileInformation *pos,
1398 1404
1399 while (NULL != pos) 1405 while (NULL != pos)
1400 { 1406 {
1401 fprintf (stderr,
1402 "CMP: %s %s\n",
1403 srch, pos->serialization);
1404 if (0 == strcmp (srch, pos->serialization)) 1407 if (0 == strcmp (srch, pos->serialization))
1405 return pos; 1408 return pos;
1406 if ( (GNUNET_YES == pos->is_directory) && 1409 if ( (GNUNET_YES == pos->is_directory) &&
@@ -1416,7 +1419,7 @@ find_file_position (struct GNUNET_FS_FileInformation *pos,
1416 * Signal the FS's progress function that we are resuming 1419 * Signal the FS's progress function that we are resuming
1417 * an upload. 1420 * an upload.
1418 * 1421 *
1419 * @param cls closure (of type "struct GNUNET_FS_PublishContext*") 1422 * @param cls closure (of type `struct GNUNET_FS_PublishContext *`, for the parent (!))
1420 * @param fi the entry in the publish-structure 1423 * @param fi the entry in the publish-structure
1421 * @param length length of the file or directory 1424 * @param length length of the file or directory
1422 * @param meta metadata for the file or directory (can be modified) 1425 * @param meta metadata for the file or directory (can be modified)
@@ -1424,7 +1427,7 @@ find_file_position (struct GNUNET_FS_FileInformation *pos,
1424 * @param bo block options (can be modified) 1427 * @param bo block options (can be modified)
1425 * @param do_index should we index? 1428 * @param do_index should we index?
1426 * @param client_info pointer to client context set upon creation (can be modified) 1429 * @param client_info pointer to client context set upon creation (can be modified)
1427 * @return GNUNET_OK to continue (always) 1430 * @return #GNUNET_OK to continue (always)
1428 */ 1431 */
1429static int 1432static int
1430fip_signal_resume (void *cls, struct GNUNET_FS_FileInformation *fi, 1433fip_signal_resume (void *cls, struct GNUNET_FS_FileInformation *fi,
@@ -1442,8 +1445,8 @@ fip_signal_resume (void *cls, struct GNUNET_FS_FileInformation *fi,
1442 return GNUNET_OK; 1445 return GNUNET_OK;
1443 } 1446 }
1444 pi.status = GNUNET_FS_STATUS_PUBLISH_RESUME; 1447 pi.status = GNUNET_FS_STATUS_PUBLISH_RESUME;
1445 pi.value.publish.specifics.resume.message = pc->fi->emsg; 1448 pi.value.publish.specifics.resume.message = fi->emsg;
1446 pi.value.publish.specifics.resume.chk_uri = pc->fi->chk_uri; 1449 pi.value.publish.specifics.resume.chk_uri = fi->chk_uri;
1447 *client_info = GNUNET_FS_publish_make_status_ (&pi, pc, fi, 0); 1450 *client_info = GNUNET_FS_publish_make_status_ (&pi, pc, fi, 0);
1448 if (GNUNET_YES == GNUNET_FS_meta_data_test_for_directory (meta)) 1451 if (GNUNET_YES == GNUNET_FS_meta_data_test_for_directory (meta))
1449 { 1452 {
@@ -1459,7 +1462,7 @@ fip_signal_resume (void *cls, struct GNUNET_FS_FileInformation *fi,
1459 * Function called with a filename of serialized publishing operation 1462 * Function called with a filename of serialized publishing operation
1460 * to deserialize. 1463 * to deserialize.
1461 * 1464 *
1462 * @param cls the 'struct GNUNET_FS_Handle*' 1465 * @param cls the `struct GNUNET_FS_Handle *`
1463 * @param filename complete filename (absolute path) 1466 * @param filename complete filename (absolute path)
1464 * @return #GNUNET_OK (continue to iterate) 1467 * @return #GNUNET_OK (continue to iterate)
1465 */ 1468 */
diff --git a/src/fs/fs_api.h b/src/fs/fs_api.h
index 1700b469b..5cc9d6ed9 100644
--- a/src/fs/fs_api.h
+++ b/src/fs/fs_api.h
@@ -340,7 +340,7 @@ struct GNUNET_FS_FileInformation
340 int do_index; 340 int do_index;
341 341
342 /** 342 /**
343 * Is "file_id" already valid? Set to GNUNET_YES once the hash 343 * Is "file_id" already valid? Set to #GNUNET_YES once the hash
344 * has been calculated. 344 * has been calculated.
345 */ 345 */
346 int have_hash; 346 int have_hash;
diff --git a/src/util/bio.c b/src/util/bio.c
index dd2a182b1..b4f33f589 100644
--- a/src/util/bio.c
+++ b/src/util/bio.c
@@ -75,7 +75,7 @@ GNUNET_BIO_read_open (const char *fn)
75 * 75 *
76 * @param h file handle 76 * @param h file handle
77 * @param emsg set to the error message 77 * @param emsg set to the error message
78 * @return GNUNET_OK on success, GNUNET_SYSERR otherwise 78 * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise
79 */ 79 */
80int 80int
81GNUNET_BIO_read_close (struct GNUNET_BIO_ReadHandle *h, char **emsg) 81GNUNET_BIO_read_close (struct GNUNET_BIO_ReadHandle *h, char **emsg)
@@ -100,7 +100,7 @@ GNUNET_BIO_read_close (struct GNUNET_BIO_ReadHandle *h, char **emsg)
100 * @param what describes what is being read (for error message creation) 100 * @param what describes what is being read (for error message creation)
101 * @param result the buffer to write the result to 101 * @param result the buffer to write the result to
102 * @param len the number of bytes to read 102 * @param len the number of bytes to read
103 * @return GNUNET_OK on success, GNUNET_SYSERR on failure 103 * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
104 */ 104 */
105int 105int
106GNUNET_BIO_read (struct GNUNET_BIO_ReadHandle *h, const char *what, 106GNUNET_BIO_read (struct GNUNET_BIO_ReadHandle *h, const char *what,
@@ -111,7 +111,7 @@ GNUNET_BIO_read (struct GNUNET_BIO_ReadHandle *h, const char *what,
111 size_t pos; 111 size_t pos;
112 ssize_t ret; 112 ssize_t ret;
113 113
114 if (h->emsg != NULL) 114 if (NULL != h->emsg)
115 return GNUNET_SYSERR; 115 return GNUNET_SYSERR;
116 pos = 0; 116 pos = 0;
117 do 117 do
@@ -131,15 +131,19 @@ GNUNET_BIO_read (struct GNUNET_BIO_ReadHandle *h, const char *what,
131 GNUNET_assert (h->have == h->pos); 131 GNUNET_assert (h->have == h->pos);
132 /* fill buffer */ 132 /* fill buffer */
133 ret = GNUNET_DISK_file_read (h->fd, h->buffer, h->size); 133 ret = GNUNET_DISK_file_read (h->fd, h->buffer, h->size);
134 if (ret == -1) 134 if (-1 == ret)
135 { 135 {
136 GNUNET_asprintf (&h->emsg, _("Error reading `%s': %s"), what, 136 GNUNET_asprintf (&h->emsg,
137 _("Error reading `%s': %s"),
138 what,
137 STRERROR (errno)); 139 STRERROR (errno));
138 return GNUNET_SYSERR; 140 return GNUNET_SYSERR;
139 } 141 }
140 if (ret == 0) 142 if (0 == ret)
141 { 143 {
142 GNUNET_asprintf (&h->emsg, _("Error reading `%s': %s"), what, 144 GNUNET_asprintf (&h->emsg,
145 _("Error reading `%s': %s"),
146 what,
143 _("End of file")); 147 _("End of file"));
144 return GNUNET_SYSERR; 148 return GNUNET_SYSERR;
145 } 149 }
@@ -159,7 +163,7 @@ GNUNET_BIO_read (struct GNUNET_BIO_ReadHandle *h, const char *what,
159 * @param line line number in the source file 163 * @param line line number in the source file
160 * @param result the buffer to write the result to 164 * @param result the buffer to write the result to
161 * @param len the number of bytes to read 165 * @param len the number of bytes to read
162 * @return GNUNET_OK on success, GNUNET_SYSERR on failure 166 * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
163 */ 167 */
164int 168int
165GNUNET_BIO_read_fn (struct GNUNET_BIO_ReadHandle *h, const char *file, int line, 169GNUNET_BIO_read_fn (struct GNUNET_BIO_ReadHandle *h, const char *file, int line,
@@ -180,7 +184,7 @@ GNUNET_BIO_read_fn (struct GNUNET_BIO_ReadHandle *h, const char *file, int line,
180 * @param result the buffer to store a pointer to the (allocated) string to 184 * @param result the buffer to store a pointer to the (allocated) string to
181 * (note that *result could be set to NULL as well) 185 * (note that *result could be set to NULL as well)
182 * @param maxLen maximum allowed length for the string 186 * @param maxLen maximum allowed length for the string
183 * @return GNUNET_OK on success, GNUNET_SYSERR on failure 187 * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
184 */ 188 */
185int 189int
186GNUNET_BIO_read_string (struct GNUNET_BIO_ReadHandle *h, const char *what, 190GNUNET_BIO_read_string (struct GNUNET_BIO_ReadHandle *h, const char *what,
@@ -195,7 +199,7 @@ GNUNET_BIO_read_string (struct GNUNET_BIO_ReadHandle *h, const char *what,
195 GNUNET_asprintf (&h->emsg, _("Error reading length of string `%s'"), what); 199 GNUNET_asprintf (&h->emsg, _("Error reading length of string `%s'"), what);
196 return GNUNET_SYSERR; 200 return GNUNET_SYSERR;
197 } 201 }
198 if (big == 0) 202 if (0 == big)
199 { 203 {
200 *result = NULL; 204 *result = NULL;
201 return GNUNET_OK; 205 return GNUNET_OK;
@@ -209,7 +213,7 @@ GNUNET_BIO_read_string (struct GNUNET_BIO_ReadHandle *h, const char *what,
209 buf = GNUNET_malloc (big); 213 buf = GNUNET_malloc (big);
210 *result = buf; 214 *result = buf;
211 buf[--big] = '\0'; 215 buf[--big] = '\0';
212 if (big == 0) 216 if (0 == big)
213 return GNUNET_OK; 217 return GNUNET_OK;
214 if (GNUNET_OK != GNUNET_BIO_read (h, what, buf, big)) 218 if (GNUNET_OK != GNUNET_BIO_read (h, what, buf, big))
215 { 219 {
@@ -227,7 +231,7 @@ GNUNET_BIO_read_string (struct GNUNET_BIO_ReadHandle *h, const char *what,
227 * @param h handle to an open file 231 * @param h handle to an open file
228 * @param what describes what is being read (for error message creation) 232 * @param what describes what is being read (for error message creation)
229 * @param result the buffer to store a pointer to the (allocated) metadata 233 * @param result the buffer to store a pointer to the (allocated) metadata
230 * @return GNUNET_OK on success, GNUNET_SYSERR on failure 234 * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
231 */ 235 */
232int 236int
233GNUNET_BIO_read_meta_data (struct GNUNET_BIO_ReadHandle *h, const char *what, 237GNUNET_BIO_read_meta_data (struct GNUNET_BIO_ReadHandle *h, const char *what,
@@ -277,7 +281,7 @@ GNUNET_BIO_read_meta_data (struct GNUNET_BIO_ReadHandle *h, const char *what,
277 * @param file name of the source file 281 * @param file name of the source file
278 * @param line line number in the source file 282 * @param line line number in the source file
279 * @param i address of 32-bit integer to read 283 * @param i address of 32-bit integer to read
280 * @return GNUNET_OK on success, GNUNET_SYSERR on error 284 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
281 */ 285 */
282int 286int
283GNUNET_BIO_read_int32__ (struct GNUNET_BIO_ReadHandle *h, const char *file, 287GNUNET_BIO_read_int32__ (struct GNUNET_BIO_ReadHandle *h, const char *file,
@@ -299,7 +303,7 @@ GNUNET_BIO_read_int32__ (struct GNUNET_BIO_ReadHandle *h, const char *file,
299 * @param file name of the source file 303 * @param file name of the source file
300 * @param line line number in the source file 304 * @param line line number in the source file
301 * @param i address of 64-bit integer to read 305 * @param i address of 64-bit integer to read
302 * @return GNUNET_OK on success, GNUNET_SYSERR on error 306 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
303 */ 307 */
304int 308int
305GNUNET_BIO_read_int64__ (struct GNUNET_BIO_ReadHandle *h, const char *file, 309GNUNET_BIO_read_int64__ (struct GNUNET_BIO_ReadHandle *h, const char *file,
@@ -357,7 +361,7 @@ GNUNET_BIO_write_open (const char *fn)
357 * Close an open file for writing. 361 * Close an open file for writing.
358 * 362 *
359 * @param h file handle 363 * @param h file handle
360 * @return GNUNET_OK on success, GNUNET_SYSERR otherwise 364 * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise
361 */ 365 */
362int 366int
363GNUNET_BIO_write_close (struct GNUNET_BIO_WriteHandle *h) 367GNUNET_BIO_write_close (struct GNUNET_BIO_WriteHandle *h)
@@ -376,7 +380,7 @@ GNUNET_BIO_write_close (struct GNUNET_BIO_WriteHandle *h)
376 * Force a buffered writer to flush its buffer 380 * Force a buffered writer to flush its buffer
377 * 381 *
378 * @param h the writer handle 382 * @param h the writer handle
379 * @return GNUNET_OK upon success. Upon failure GNUNET_SYSERR is returned and 383 * @return #GNUNET_OK upon success. Upon failure #GNUNET_SYSERR is returned and
380 * the file is closed 384 * the file is closed
381 */ 385 */
382int 386int
@@ -402,7 +406,7 @@ GNUNET_BIO_flush (struct GNUNET_BIO_WriteHandle *h)
402 * @param h handle to open file 406 * @param h handle to open file
403 * @param buffer the data to write 407 * @param buffer the data to write
404 * @param n number of bytes to write 408 * @param n number of bytes to write
405 * @return GNUNET_OK on success, GNUNET_SYSERR on error 409 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
406 */ 410 */
407int 411int
408GNUNET_BIO_write (struct GNUNET_BIO_WriteHandle *h, const void *buffer, 412GNUNET_BIO_write (struct GNUNET_BIO_WriteHandle *h, const void *buffer,
@@ -441,10 +445,11 @@ GNUNET_BIO_write (struct GNUNET_BIO_WriteHandle *h, const void *buffer,
441 * 445 *
442 * @param h handle to open file 446 * @param h handle to open file
443 * @param s string to write (can be NULL) 447 * @param s string to write (can be NULL)
444 * @return GNUNET_OK on success, GNUNET_SYSERR on error 448 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
445 */ 449 */
446int 450int
447GNUNET_BIO_write_string (struct GNUNET_BIO_WriteHandle *h, const char *s) 451GNUNET_BIO_write_string (struct GNUNET_BIO_WriteHandle *h,
452 const char *s)
448{ 453{
449 uint32_t slen; 454 uint32_t slen;
450 455
@@ -462,7 +467,7 @@ GNUNET_BIO_write_string (struct GNUNET_BIO_WriteHandle *h, const char *s)
462 * 467 *
463 * @param h handle to open file 468 * @param h handle to open file
464 * @param m metadata to write 469 * @param m metadata to write
465 * @return GNUNET_OK on success, GNUNET_SYSERR on error 470 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
466 */ 471 */
467int 472int
468GNUNET_BIO_write_meta_data (struct GNUNET_BIO_WriteHandle *h, 473GNUNET_BIO_write_meta_data (struct GNUNET_BIO_WriteHandle *h,
diff --git a/src/util/common_logging.c b/src/util/common_logging.c
index 5929fc94a..0c9973d44 100644
--- a/src/util/common_logging.c
+++ b/src/util/common_logging.c
@@ -663,7 +663,7 @@ parse_all_definitions ()
663 * @param comp default component to use 663 * @param comp default component to use
664 * @param loglevel what types of messages should be logged 664 * @param loglevel what types of messages should be logged
665 * @param logfile which file to write log messages to (can be NULL) 665 * @param logfile which file to write log messages to (can be NULL)
666 * @return GNUNET_OK on success 666 * @return #GNUNET_OK on success
667 */ 667 */
668int 668int
669GNUNET_log_setup (const char *comp, const char *loglevel, const char *logfile) 669GNUNET_log_setup (const char *comp, const char *loglevel, const char *logfile)