diff options
-rw-r--r-- | src/fs/fs_file_information.c | 30 | ||||
-rw-r--r-- | src/fs/fs_publish.c | 72 | ||||
-rw-r--r-- | src/fs/gnunet-helper-fs-publish.c | 66 | ||||
-rw-r--r-- | src/fs/test_fs_publish_persistence.c | 15 | ||||
-rw-r--r-- | src/include/gnunet_fs_service.h | 102 | ||||
-rw-r--r-- | src/util/service.c | 2 |
6 files changed, 171 insertions, 116 deletions
diff --git a/src/fs/fs_file_information.c b/src/fs/fs_file_information.c index 3e6d53af6..da4e85b78 100644 --- a/src/fs/fs_file_information.c +++ b/src/fs/fs_file_information.c | |||
@@ -37,8 +37,7 @@ | |||
37 | * | 37 | * |
38 | * @param s structure to get the filename for | 38 | * @param s structure to get the filename for |
39 | * @return NULL on error, otherwise filename that | 39 | * @return NULL on error, otherwise filename that |
40 | * can be passed to "GNUNET_FS_file_information_recover" | 40 | * can be used to read this fi-struct from disk. |
41 | * to read this fi-struct from disk. | ||
42 | */ | 41 | */ |
43 | const char * | 42 | const char * |
44 | GNUNET_FS_file_information_get_id (struct GNUNET_FS_FileInformation *s) | 43 | GNUNET_FS_file_information_get_id (struct GNUNET_FS_FileInformation *s) |
@@ -80,6 +79,7 @@ GNUNET_FS_file_information_set_filename (struct GNUNET_FS_FileInformation *s, | |||
80 | s->filename = NULL; | 79 | s->filename = NULL; |
81 | } | 80 | } |
82 | 81 | ||
82 | |||
83 | /** | 83 | /** |
84 | * Create an entry for a file in a publish-structure. | 84 | * Create an entry for a file in a publish-structure. |
85 | * | 85 | * |
@@ -89,8 +89,8 @@ GNUNET_FS_file_information_set_filename (struct GNUNET_FS_FileInformation *s, | |||
89 | * @param keywords under which keywords should this file be available | 89 | * @param keywords under which keywords should this file be available |
90 | * directly; can be NULL | 90 | * directly; can be NULL |
91 | * @param meta metadata for the file | 91 | * @param meta metadata for the file |
92 | * @param do_index GNUNET_YES for index, GNUNET_NO for insertion, | 92 | * @param do_index #GNUNET_YES for index, #GNUNET_NO for insertion, |
93 | * GNUNET_SYSERR for simulation | 93 | * #GNUNET_SYSERR for simulation |
94 | * @param bo block options | 94 | * @param bo block options |
95 | * @return publish structure entry for the file | 95 | * @return publish structure entry for the file |
96 | */ | 96 | */ |
@@ -215,8 +215,8 @@ GNUNET_FS_file_information_create_from_data (struct GNUNET_FS_Handle *h, | |||
215 | * @param keywords under which keywords should this file be available | 215 | * @param keywords under which keywords should this file be available |
216 | * directly; can be NULL | 216 | * directly; can be NULL |
217 | * @param meta metadata for the file | 217 | * @param meta metadata for the file |
218 | * @param do_index GNUNET_YES for index, GNUNET_NO for insertion, | 218 | * @param do_index #GNUNET_YES for index, #GNUNET_NO for insertion, |
219 | * GNUNET_SYSERR for simulation | 219 | * #GNUNET_SYSERR for simulation |
220 | * @param bo block options | 220 | * @param bo block options |
221 | * @return publish structure entry for the file | 221 | * @return publish structure entry for the file |
222 | */ | 222 | */ |
@@ -316,13 +316,13 @@ GNUNET_FS_file_information_create_empty_directory (struct GNUNET_FS_Handle *h, | |||
316 | /** | 316 | /** |
317 | * Add an entry to a directory in a publish-structure. Clients | 317 | * Add an entry to a directory in a publish-structure. Clients |
318 | * should never modify publish structures that were passed to | 318 | * should never modify publish structures that were passed to |
319 | * "GNUNET_FS_publish_start" already. | 319 | * #GNUNET_FS_publish_start already. |
320 | * | 320 | * |
321 | * @param dir the directory | 321 | * @param dir the directory |
322 | * @param ent the entry to add; the entry must not have been | 322 | * @param ent the entry to add; the entry must not have been |
323 | * added to any other directory at this point and | 323 | * added to any other directory at this point and |
324 | * must not include "dir" in its structure | 324 | * must not include @a dir in its structure |
325 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 325 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
326 | */ | 326 | */ |
327 | int | 327 | int |
328 | GNUNET_FS_file_information_add (struct GNUNET_FS_FileInformation *dir, | 328 | GNUNET_FS_file_information_add (struct GNUNET_FS_FileInformation *dir, |
@@ -344,16 +344,16 @@ GNUNET_FS_file_information_add (struct GNUNET_FS_FileInformation *dir, | |||
344 | /** | 344 | /** |
345 | * Inspect a file or directory in a publish-structure. Clients | 345 | * Inspect a file or directory in a publish-structure. Clients |
346 | * should never modify publish structures that were passed to | 346 | * should never modify publish structures that were passed to |
347 | * "GNUNET_FS_publish_start" already. When called on a directory, | 347 | * #GNUNET_FS_publish_start already. When called on a directory, |
348 | * this function will FIRST call "proc" with information about | 348 | * this function will FIRST call @a proc with information about |
349 | * the directory itself and then for each of the files in the | 349 | * the directory itself and then for each of the files in the |
350 | * directory (but not for files in subdirectories). When called | 350 | * directory (but not for files in subdirectories). When called |
351 | * on a file, "proc" will be called exactly once (with information | 351 | * on a file, @a proc will be called exactly once (with information |
352 | * about the specific file). | 352 | * about the specific file). |
353 | * | 353 | * |
354 | * @param dir the directory | 354 | * @param dir the directory |
355 | * @param proc function to call on each entry | 355 | * @param proc function to call on each entry |
356 | * @param proc_cls closure for proc | 356 | * @param proc_cls closure for @a proc |
357 | */ | 357 | */ |
358 | void | 358 | void |
359 | GNUNET_FS_file_information_inspect (struct GNUNET_FS_FileInformation *dir, | 359 | GNUNET_FS_file_information_inspect (struct GNUNET_FS_FileInformation *dir, |
@@ -392,13 +392,13 @@ GNUNET_FS_file_information_inspect (struct GNUNET_FS_FileInformation *dir, | |||
392 | 392 | ||
393 | /** | 393 | /** |
394 | * Destroy publish-structure. Clients should never destroy publish | 394 | * Destroy publish-structure. Clients should never destroy publish |
395 | * structures that were passed to "GNUNET_FS_publish_start" already. | 395 | * structures that were passed to #GNUNET_FS_publish_start already. |
396 | * | 396 | * |
397 | * @param fi structure to destroy | 397 | * @param fi structure to destroy |
398 | * @param cleaner function to call on each entry in the structure | 398 | * @param cleaner function to call on each entry in the structure |
399 | * (useful to clean up client_info); can be NULL; return | 399 | * (useful to clean up client_info); can be NULL; return |
400 | * values are ignored | 400 | * values are ignored |
401 | * @param cleaner_cls closure for cleaner | 401 | * @param cleaner_cls closure for @a cleaner |
402 | */ | 402 | */ |
403 | void | 403 | void |
404 | GNUNET_FS_file_information_destroy (struct GNUNET_FS_FileInformation *fi, | 404 | GNUNET_FS_file_information_destroy (struct GNUNET_FS_FileInformation *fi, |
diff --git a/src/fs/fs_publish.c b/src/fs/fs_publish.c index 9483ec36a..c554c8bb2 100644 --- a/src/fs/fs_publish.c +++ b/src/fs/fs_publish.c | |||
@@ -106,8 +106,8 @@ publish_cleanup (struct GNUNET_FS_PublishContext *pc) | |||
106 | * Function called by the datastore API with | 106 | * Function called by the datastore API with |
107 | * the result from the PUT request. | 107 | * the result from the PUT request. |
108 | * | 108 | * |
109 | * @param cls the 'struct GNUNET_FS_PublishContext' | 109 | * @param cls the `struct GNUNET_FS_PublishContext *` |
110 | * @param success GNUNET_OK on success | 110 | * @param success #GNUNET_OK on success |
111 | * @param min_expiration minimum expiration time required for content to be stored | 111 | * @param min_expiration minimum expiration time required for content to be stored |
112 | * @param msg error message (or NULL) | 112 | * @param msg error message (or NULL) |
113 | */ | 113 | */ |
@@ -200,7 +200,7 @@ signal_publish_error (struct GNUNET_FS_FileInformation *p, | |||
200 | /** | 200 | /** |
201 | * Datastore returns from reservation cancel request. | 201 | * Datastore returns from reservation cancel request. |
202 | * | 202 | * |
203 | * @param cls the 'struct GNUNET_FS_PublishContext' | 203 | * @param cls the `struct GNUNET_FS_PublishContext *` |
204 | * @param success success code (not used) | 204 | * @param success success code (not used) |
205 | * @param min_expiration minimum expiration time required for content to be stored | 205 | * @param min_expiration minimum expiration time required for content to be stored |
206 | * @param msg error message (typically NULL, not used) | 206 | * @param msg error message (typically NULL, not used) |
@@ -284,7 +284,7 @@ publish_sblock (struct GNUNET_FS_PublishContext *pc) | |||
284 | * We've finished publishing a KBlock as part of a larger upload. | 284 | * We've finished publishing a KBlock as part of a larger upload. |
285 | * Check the result and continue the larger upload. | 285 | * Check the result and continue the larger upload. |
286 | * | 286 | * |
287 | * @param cls the "struct GNUNET_FS_PublishContext*" | 287 | * @param cls the `struct GNUNET_FS_PublishContext *` |
288 | * of the larger upload | 288 | * of the larger upload |
289 | * @param uri URI of the published blocks | 289 | * @param uri URI of the published blocks |
290 | * @param emsg NULL on success, otherwise error message | 290 | * @param emsg NULL on success, otherwise error message |
@@ -399,6 +399,7 @@ encode_cont (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
399 | 399 | ||
400 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Finished with tree encoder\n"); | 400 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Finished with tree encoder\n"); |
401 | p = pc->fi_pos; | 401 | p = pc->fi_pos; |
402 | GNUNET_FS_file_information_sync_ (p); | ||
402 | GNUNET_FS_tree_encoder_finish (p->te, &p->chk_uri, &emsg); | 403 | GNUNET_FS_tree_encoder_finish (p->te, &p->chk_uri, &emsg); |
403 | p->te = NULL; | 404 | p->te = NULL; |
404 | if (NULL != emsg) | 405 | if (NULL != emsg) |
@@ -423,8 +424,7 @@ encode_cont (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
423 | pi.value.publish.specifics.progress.depth = GNUNET_FS_compute_depth (flen); | 424 | pi.value.publish.specifics.progress.depth = GNUNET_FS_compute_depth (flen); |
424 | p->client_info = GNUNET_FS_publish_make_status_ (&pi, pc, p, flen); | 425 | p->client_info = GNUNET_FS_publish_make_status_ (&pi, pc, p, flen); |
425 | } | 426 | } |
426 | GNUNET_FS_file_information_sync_ (p); | 427 | /* continue with main */ /* continue with main */ |
427 | /* continue with main */ | ||
428 | GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == pc->upload_task); | 428 | GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == pc->upload_task); |
429 | pc->upload_task = | 429 | pc->upload_task = |
430 | GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_BACKGROUND, | 430 | GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_BACKGROUND, |
@@ -444,7 +444,7 @@ encode_cont (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
444 | * @param depth depth of the block in the file, 0 for DBLOCK | 444 | * @param depth depth of the block in the file, 0 for DBLOCK |
445 | * @param type type of the block (IBLOCK or DBLOCK) | 445 | * @param type type of the block (IBLOCK or DBLOCK) |
446 | * @param block the (encrypted) block | 446 | * @param block the (encrypted) block |
447 | * @param block_size size of block (in bytes) | 447 | * @param block_size size of @a block (in bytes) |
448 | */ | 448 | */ |
449 | static void | 449 | static void |
450 | block_proc (void *cls, const struct ContentHashKey *chk, uint64_t offset, | 450 | block_proc (void *cls, const struct ContentHashKey *chk, uint64_t offset, |
@@ -508,7 +508,7 @@ block_proc (void *cls, const struct ContentHashKey *chk, uint64_t offset, | |||
508 | * @param cls closure | 508 | * @param cls closure |
509 | * @param offset where are we in the file | 509 | * @param offset where are we in the file |
510 | * @param pt_block plaintext of the currently processed block | 510 | * @param pt_block plaintext of the currently processed block |
511 | * @param pt_size size of pt_block | 511 | * @param pt_size size of @a pt_block |
512 | * @param depth depth of the block in the tree, 0 for DBLOCK | 512 | * @param depth depth of the block in the tree, 0 for DBLOCK |
513 | */ | 513 | */ |
514 | static void | 514 | static void |
@@ -611,11 +611,12 @@ publish_content (struct GNUNET_FS_PublishContext *pc) | |||
611 | * Process the response (or lack thereof) from | 611 | * Process the response (or lack thereof) from |
612 | * the "fs" service to our 'start index' request. | 612 | * the "fs" service to our 'start index' request. |
613 | * | 613 | * |
614 | * @param cls closure (of type "struct GNUNET_FS_PublishContext*"_) | 614 | * @param cls closure (of type `struct GNUNET_FS_PublishContext *`) |
615 | * @param msg the response we got | 615 | * @param msg the response we got |
616 | */ | 616 | */ |
617 | static void | 617 | static void |
618 | process_index_start_response (void *cls, const struct GNUNET_MessageHeader *msg) | 618 | process_index_start_response (void *cls, |
619 | const struct GNUNET_MessageHeader *msg) | ||
619 | { | 620 | { |
620 | struct GNUNET_FS_PublishContext *pc = cls; | 621 | struct GNUNET_FS_PublishContext *pc = cls; |
621 | struct GNUNET_FS_FileInformation *p; | 622 | struct GNUNET_FS_FileInformation *p; |
@@ -668,7 +669,8 @@ process_index_start_response (void *cls, const struct GNUNET_MessageHeader *msg) | |||
668 | * @param res resulting hash, NULL on error | 669 | * @param res resulting hash, NULL on error |
669 | */ | 670 | */ |
670 | static void | 671 | static void |
671 | hash_for_index_cb (void *cls, const struct GNUNET_HashCode * res) | 672 | hash_for_index_cb (void *cls, |
673 | const struct GNUNET_HashCode *res) | ||
672 | { | 674 | { |
673 | struct GNUNET_FS_PublishContext *pc = cls; | 675 | struct GNUNET_FS_PublishContext *pc = cls; |
674 | struct GNUNET_FS_FileInformation *p; | 676 | struct GNUNET_FS_FileInformation *p; |
@@ -773,7 +775,7 @@ hash_for_index_cb (void *cls, const struct GNUNET_HashCode * res) | |||
773 | /** | 775 | /** |
774 | * Main function that performs the upload. | 776 | * Main function that performs the upload. |
775 | * | 777 | * |
776 | * @param cls "struct GNUNET_FS_PublishContext" identifies the upload | 778 | * @param cls `struct GNUNET_FS_PublishContext *` identifies the upload |
777 | * @param tc task context | 779 | * @param tc task context |
778 | */ | 780 | */ |
779 | void | 781 | void |
@@ -799,8 +801,10 @@ GNUNET_FS_publish_main_ (void *cls, | |||
799 | return; | 801 | return; |
800 | } | 802 | } |
801 | /* find starting position */ | 803 | /* find starting position */ |
802 | while ((p->is_directory == GNUNET_YES) && (NULL != p->data.dir.entries) && (NULL == p->emsg) | 804 | while ( (GNUNET_YES == p->is_directory) && |
803 | && (NULL == p->data.dir.entries->chk_uri)) | 805 | (NULL != p->data.dir.entries) && |
806 | (NULL == p->emsg) && | ||
807 | (NULL == p->data.dir.entries->chk_uri) ) | ||
804 | { | 808 | { |
805 | p = p->data.dir.entries; | 809 | p = p->data.dir.entries; |
806 | pc->fi_pos = p; | 810 | pc->fi_pos = p; |
@@ -809,7 +813,9 @@ GNUNET_FS_publish_main_ (void *cls, | |||
809 | /* abort on error */ | 813 | /* abort on error */ |
810 | if (NULL != p->emsg) | 814 | if (NULL != p->emsg) |
811 | { | 815 | { |
812 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Error uploading: %s\n", p->emsg); | 816 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
817 | "Error uploading: %s\n", | ||
818 | p->emsg); | ||
813 | /* error with current file, abort all | 819 | /* error with current file, abort all |
814 | * related files as well! */ | 820 | * related files as well! */ |
815 | while (NULL != p->dir) | 821 | while (NULL != p->dir) |
@@ -897,7 +903,7 @@ GNUNET_FS_publish_main_ (void *cls, | |||
897 | * Signal the FS's progress function that we are starting | 903 | * Signal the FS's progress function that we are starting |
898 | * an upload. | 904 | * an upload. |
899 | * | 905 | * |
900 | * @param cls closure (of type "struct GNUNET_FS_PublishContext*") | 906 | * @param cls closure (of type `struct GNUNET_FS_PublishContext *`) |
901 | * @param fi the entry in the publish-structure | 907 | * @param fi the entry in the publish-structure |
902 | * @param length length of the file or directory | 908 | * @param length length of the file or directory |
903 | * @param meta metadata for the file or directory (can be modified) | 909 | * @param meta metadata for the file or directory (can be modified) |
@@ -905,13 +911,17 @@ GNUNET_FS_publish_main_ (void *cls, | |||
905 | * @param bo block options | 911 | * @param bo block options |
906 | * @param do_index should we index? | 912 | * @param do_index should we index? |
907 | * @param client_info pointer to client context set upon creation (can be modified) | 913 | * @param client_info pointer to client context set upon creation (can be modified) |
908 | * @return GNUNET_OK to continue (always) | 914 | * @return #GNUNET_OK to continue (always) |
909 | */ | 915 | */ |
910 | static int | 916 | static int |
911 | fip_signal_start (void *cls, struct GNUNET_FS_FileInformation *fi, | 917 | fip_signal_start (void *cls, |
912 | uint64_t length, struct GNUNET_CONTAINER_MetaData *meta, | 918 | struct GNUNET_FS_FileInformation *fi, |
913 | struct GNUNET_FS_Uri **uri, struct GNUNET_FS_BlockOptions *bo, | 919 | uint64_t length, |
914 | int *do_index, void **client_info) | 920 | struct GNUNET_CONTAINER_MetaData *meta, |
921 | struct GNUNET_FS_Uri **uri, | ||
922 | struct GNUNET_FS_BlockOptions *bo, | ||
923 | int *do_index, | ||
924 | void **client_info) | ||
915 | { | 925 | { |
916 | struct GNUNET_FS_PublishContext *pc = cls; | 926 | struct GNUNET_FS_PublishContext *pc = cls; |
917 | struct GNUNET_FS_ProgressInfo pi; | 927 | struct GNUNET_FS_ProgressInfo pi; |
@@ -1024,13 +1034,16 @@ suspend_operation (struct GNUNET_FS_FileInformation *fi, | |||
1024 | * @param bo block options | 1034 | * @param bo block options |
1025 | * @param do_index should we index? | 1035 | * @param do_index should we index? |
1026 | * @param client_info pointer to client context set upon creation (can be modified) | 1036 | * @param client_info pointer to client context set upon creation (can be modified) |
1027 | * @return GNUNET_OK to continue (always) | 1037 | * @return #GNUNET_OK to continue (always) |
1028 | */ | 1038 | */ |
1029 | static int | 1039 | static int |
1030 | fip_signal_suspend (void *cls, struct GNUNET_FS_FileInformation *fi, | 1040 | fip_signal_suspend (void *cls, |
1031 | uint64_t length, struct GNUNET_CONTAINER_MetaData *meta, | 1041 | struct GNUNET_FS_FileInformation *fi, |
1042 | uint64_t length, | ||
1043 | struct GNUNET_CONTAINER_MetaData *meta, | ||
1032 | struct GNUNET_FS_Uri **uri, | 1044 | struct GNUNET_FS_Uri **uri, |
1033 | struct GNUNET_FS_BlockOptions *bo, int *do_index, | 1045 | struct GNUNET_FS_BlockOptions *bo, |
1046 | int *do_index, | ||
1034 | void **client_info) | 1047 | void **client_info) |
1035 | { | 1048 | { |
1036 | struct GNUNET_FS_PublishContext *pc = cls; | 1049 | struct GNUNET_FS_PublishContext *pc = cls; |
@@ -1081,7 +1094,7 @@ GNUNET_FS_publish_signal_suspend_ (void *cls) | |||
1081 | * We have gotten a reply for our space reservation request. | 1094 | * We have gotten a reply for our space reservation request. |
1082 | * Either fail (insufficient space) or start publishing for good. | 1095 | * Either fail (insufficient space) or start publishing for good. |
1083 | * | 1096 | * |
1084 | * @param cls the 'struct GNUNET_FS_PublishContext*' | 1097 | * @param cls the `struct GNUNET_FS_PublishContext *` |
1085 | * @param success positive reservation ID on success | 1098 | * @param success positive reservation ID on success |
1086 | * @param min_expiration minimum expiration time required for content to be stored | 1099 | * @param min_expiration minimum expiration time required for content to be stored |
1087 | * @param msg error message on error, otherwise NULL | 1100 | * @param msg error message on error, otherwise NULL |
@@ -1097,7 +1110,8 @@ finish_reserve (void *cls, int success, | |||
1097 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Reservation complete (%d)!\n", success); | 1110 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Reservation complete (%d)!\n", success); |
1098 | if ((msg != NULL) || (success <= 0)) | 1111 | if ((msg != NULL) || (success <= 0)) |
1099 | { | 1112 | { |
1100 | GNUNET_asprintf (&pc->fi->emsg, _("Insufficient space for publishing: %s"), | 1113 | GNUNET_asprintf (&pc->fi->emsg, |
1114 | _("Insufficient space for publishing: %s"), | ||
1101 | msg); | 1115 | msg); |
1102 | signal_publish_error (pc->fi, pc, pc->fi->emsg); | 1116 | signal_publish_error (pc->fi, pc, pc->fi->emsg); |
1103 | return; | 1117 | return; |
@@ -1193,7 +1207,7 @@ GNUNET_FS_publish_start (struct GNUNET_FS_Handle *h, | |||
1193 | * Signal the FS's progress function that we are stopping | 1207 | * Signal the FS's progress function that we are stopping |
1194 | * an upload. | 1208 | * an upload. |
1195 | * | 1209 | * |
1196 | * @param cls closure (of type "struct GNUNET_FS_PublishContext*") | 1210 | * @param cls closure (of type `struct GNUNET_FS_PublishContext *`) |
1197 | * @param fi the entry in the publish-structure | 1211 | * @param fi the entry in the publish-structure |
1198 | * @param length length of the file or directory | 1212 | * @param length length of the file or directory |
1199 | * @param meta metadata for the file or directory (can be modified) | 1213 | * @param meta metadata for the file or directory (can be modified) |
@@ -1201,7 +1215,7 @@ GNUNET_FS_publish_start (struct GNUNET_FS_Handle *h, | |||
1201 | * @param bo block options (can be modified) | 1215 | * @param bo block options (can be modified) |
1202 | * @param do_index should we index? | 1216 | * @param do_index should we index? |
1203 | * @param client_info pointer to client context set upon creation (can be modified) | 1217 | * @param client_info pointer to client context set upon creation (can be modified) |
1204 | * @return GNUNET_OK to continue (always) | 1218 | * @return #GNUNET_OK to continue (always) |
1205 | */ | 1219 | */ |
1206 | static int | 1220 | static int |
1207 | fip_signal_stop (void *cls, struct GNUNET_FS_FileInformation *fi, | 1221 | fip_signal_stop (void *cls, struct GNUNET_FS_FileInformation *fi, |
diff --git a/src/fs/gnunet-helper-fs-publish.c b/src/fs/gnunet-helper-fs-publish.c index 7ea94998d..2aa9df0e4 100644 --- a/src/fs/gnunet-helper-fs-publish.c +++ b/src/fs/gnunet-helper-fs-publish.c | |||
@@ -87,6 +87,11 @@ struct ScanTreeNode | |||
87 | */ | 87 | */ |
88 | static struct EXTRACTOR_PluginList *plugins; | 88 | static struct EXTRACTOR_PluginList *plugins; |
89 | 89 | ||
90 | /** | ||
91 | * File descriptor we use for IPC with the parent. | ||
92 | */ | ||
93 | static int output_stream; | ||
94 | |||
90 | 95 | ||
91 | /** | 96 | /** |
92 | * Add meta data that libextractor finds to our meta data | 97 | * Add meta data that libextractor finds to our meta data |
@@ -140,11 +145,11 @@ free_tree (struct ScanTreeNode *tree) | |||
140 | 145 | ||
141 | 146 | ||
142 | /** | 147 | /** |
143 | * Write 'size' bytes from 'buf' into 'out'. | 148 | * Write @a size bytes from @a buf into the #output_stream. |
144 | * | 149 | * |
145 | * @param buf buffer with data to write | 150 | * @param buf buffer with data to write |
146 | * @param size number of bytes to write | 151 | * @param size number of bytes to write |
147 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 152 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
148 | */ | 153 | */ |
149 | static int | 154 | static int |
150 | write_all (const void *buf, | 155 | write_all (const void *buf, |
@@ -157,7 +162,7 @@ write_all (const void *buf, | |||
157 | total = 0; | 162 | total = 0; |
158 | do | 163 | do |
159 | { | 164 | { |
160 | wr = write (1, | 165 | wr = write (output_stream, |
161 | &cbuf[total], | 166 | &cbuf[total], |
162 | size - total); | 167 | size - total); |
163 | if (wr > 0) | 168 | if (wr > 0) |
@@ -176,8 +181,8 @@ write_all (const void *buf, | |||
176 | * | 181 | * |
177 | * @param message_type message type to use | 182 | * @param message_type message type to use |
178 | * @param data data to append, NULL for none | 183 | * @param data data to append, NULL for none |
179 | * @param data_length number of bytes in data | 184 | * @param data_length number of bytes in @a data |
180 | * @return GNUNET_SYSERR to stop scanning (the pipe was broken somehow) | 185 | * @return #GNUNET_SYSERR to stop scanning (the pipe was broken somehow) |
181 | */ | 186 | */ |
182 | static int | 187 | static int |
183 | write_message (uint16_t message_type, | 188 | write_message (uint16_t message_type, |
@@ -187,7 +192,8 @@ write_message (uint16_t message_type, | |||
187 | struct GNUNET_MessageHeader hdr; | 192 | struct GNUNET_MessageHeader hdr; |
188 | 193 | ||
189 | #if 0 | 194 | #if 0 |
190 | fprintf (stderr, "Helper sends %u-byte message of type %u\n", | 195 | fprintf (stderr, |
196 | "Helper sends %u-byte message of type %u\n", | ||
191 | (unsigned int) (sizeof (struct GNUNET_MessageHeader) + data_length), | 197 | (unsigned int) (sizeof (struct GNUNET_MessageHeader) + data_length), |
192 | (unsigned int) message_type); | 198 | (unsigned int) message_type); |
193 | #endif | 199 | #endif |
@@ -211,8 +217,8 @@ write_message (uint16_t message_type, | |||
211 | * | 217 | * |
212 | * @param filename file or directory to scan | 218 | * @param filename file or directory to scan |
213 | * @param dst where to store the resulting share tree item; | 219 | * @param dst where to store the resulting share tree item; |
214 | * NULL is stored in 'dst' upon recoverable errors (GNUNET_OK is returned) | 220 | * NULL is stored in @a dst upon recoverable errors (#GNUNET_OK is returned) |
215 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 221 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
216 | */ | 222 | */ |
217 | static int | 223 | static int |
218 | preprocess_file (const char *filename, | 224 | preprocess_file (const char *filename, |
@@ -241,9 +247,9 @@ struct RecursionContext | |||
241 | * of the files in the directory to the tree. Called by the directory | 247 | * of the files in the directory to the tree. Called by the directory |
242 | * scanner to initiate the scan. Does NOT yet add any metadata. | 248 | * scanner to initiate the scan. Does NOT yet add any metadata. |
243 | * | 249 | * |
244 | * @param cls the 'struct RecursionContext' | 250 | * @param cls the `struct RecursionContext` |
245 | * @param filename file or directory to scan | 251 | * @param filename file or directory to scan |
246 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 252 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
247 | */ | 253 | */ |
248 | static int | 254 | static int |
249 | scan_callback (void *cls, | 255 | scan_callback (void *cls, |
@@ -276,8 +282,8 @@ scan_callback (void *cls, | |||
276 | * | 282 | * |
277 | * @param filename file or directory to scan | 283 | * @param filename file or directory to scan |
278 | * @param dst where to store the resulting share tree item; | 284 | * @param dst where to store the resulting share tree item; |
279 | * NULL is stored in 'dst' upon recoverable errors (GNUNET_OK is returned) | 285 | * NULL is stored in @a dst upon recoverable errors (#GNUNET_OK is returned) |
280 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 286 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
281 | */ | 287 | */ |
282 | static int | 288 | static int |
283 | preprocess_file (const char *filename, | 289 | preprocess_file (const char *filename, |
@@ -340,7 +346,7 @@ preprocess_file (const char *filename, | |||
340 | * Extract metadata from files. | 346 | * Extract metadata from files. |
341 | * | 347 | * |
342 | * @param item entry we are processing | 348 | * @param item entry we are processing |
343 | * @return GNUNET_OK on success, GNUNET_SYSERR on fatal errors | 349 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on fatal errors |
344 | */ | 350 | */ |
345 | static int | 351 | static int |
346 | extract_files (struct ScanTreeNode *item) | 352 | extract_files (struct ScanTreeNode *item) |
@@ -428,6 +434,29 @@ ignore_sigpipe () | |||
428 | fprintf (stderr, | 434 | fprintf (stderr, |
429 | "Failed to install SIGPIPE handler: %s\n", strerror (errno)); | 435 | "Failed to install SIGPIPE handler: %s\n", strerror (errno)); |
430 | } | 436 | } |
437 | |||
438 | |||
439 | /** | ||
440 | * Turn the given file descriptor in to '/dev/null'. | ||
441 | * | ||
442 | * @param fd fd to bind to /dev/null | ||
443 | * @param flags flags to use (O_RDONLY or O_WRONLY) | ||
444 | */ | ||
445 | static void | ||
446 | make_dev_zero (int fd, | ||
447 | int flags) | ||
448 | { | ||
449 | int z; | ||
450 | |||
451 | GNUNET_assert (0 == close (fd)); | ||
452 | z = open ("/dev/null", flags); | ||
453 | GNUNET_assert (-1 != z); | ||
454 | if (z == fd) | ||
455 | return; | ||
456 | dup2 (z, fd); | ||
457 | GNUNET_assert (0 == close (z)); | ||
458 | } | ||
459 | |||
431 | #endif | 460 | #endif |
432 | 461 | ||
433 | 462 | ||
@@ -441,8 +470,9 @@ ignore_sigpipe () | |||
441 | * otherwise custom plugins to load from LE | 470 | * otherwise custom plugins to load from LE |
442 | * @return 0 on success | 471 | * @return 0 on success |
443 | */ | 472 | */ |
444 | int main(int argc, | 473 | int |
445 | char *const *argv) | 474 | main (int argc, |
475 | char *const *argv) | ||
446 | { | 476 | { |
447 | const char *filename_expanded; | 477 | const char *filename_expanded; |
448 | const char *ex; | 478 | const char *ex; |
@@ -456,8 +486,14 @@ int main(int argc, | |||
456 | /* Get utf-8-encoded arguments */ | 486 | /* Get utf-8-encoded arguments */ |
457 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) | 487 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) |
458 | return 5; | 488 | return 5; |
489 | output_stream = 1; /* stdout */ | ||
459 | #else | 490 | #else |
460 | ignore_sigpipe (); | 491 | ignore_sigpipe (); |
492 | /* move stdout to some other FD for IPC, bind | ||
493 | stdout/stderr to /dev/null */ | ||
494 | output_stream = dup (1); | ||
495 | make_dev_zero (1, O_WRONLY); | ||
496 | make_dev_zero (2, O_WRONLY); | ||
461 | #endif | 497 | #endif |
462 | 498 | ||
463 | /* parse command line */ | 499 | /* parse command line */ |
diff --git a/src/fs/test_fs_publish_persistence.c b/src/fs/test_fs_publish_persistence.c index 1dc8c43aa..e3bbc77a1 100644 --- a/src/fs/test_fs_publish_persistence.c +++ b/src/fs/test_fs_publish_persistence.c | |||
@@ -93,8 +93,10 @@ restart_fs_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
93 | { | 93 | { |
94 | rtask = GNUNET_SCHEDULER_NO_TASK; | 94 | rtask = GNUNET_SCHEDULER_NO_TASK; |
95 | GNUNET_FS_stop (fs); | 95 | GNUNET_FS_stop (fs); |
96 | fs = GNUNET_FS_start (cfg, "test-fs-publish-persistence", &progress_cb, NULL, | 96 | fs = GNUNET_FS_start (cfg, "test-fs-publish-persistence", |
97 | GNUNET_FS_FLAGS_PERSISTENCE, GNUNET_FS_OPTIONS_END); | 97 | &progress_cb, NULL, |
98 | GNUNET_FS_FLAGS_PERSISTENCE, | ||
99 | GNUNET_FS_OPTIONS_END); | ||
98 | } | 100 | } |
99 | 101 | ||
100 | 102 | ||
@@ -123,7 +125,8 @@ consider_restart (int ev) | |||
123 | 125 | ||
124 | 126 | ||
125 | static void * | 127 | static void * |
126 | progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event) | 128 | progress_cb (void *cls, |
129 | const struct GNUNET_FS_ProgressInfo *event) | ||
127 | { | 130 | { |
128 | void *ret; | 131 | void *ret; |
129 | 132 | ||
@@ -138,7 +141,8 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event) | |||
138 | (1 + | 141 | (1 + |
139 | GNUNET_TIME_absolute_get_duration | 142 | GNUNET_TIME_absolute_get_duration |
140 | (start).rel_value_us) / 1024)); | 143 | (start).rel_value_us) / 1024)); |
141 | if (0 == strcmp ("publish-context-dir", event->value.publish.cctx)) | 144 | if ( (NULL != event->value.publish.cctx) && |
145 | (0 == strcmp ("publish-context-dir", event->value.publish.cctx)) ) | ||
142 | GNUNET_SCHEDULER_add_now (&abort_publish_task, NULL); | 146 | GNUNET_SCHEDULER_add_now (&abort_publish_task, NULL); |
143 | break; | 147 | break; |
144 | case GNUNET_FS_STATUS_PUBLISH_PROGRESS: | 148 | case GNUNET_FS_STATUS_PUBLISH_PROGRESS: |
@@ -206,7 +210,8 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event) | |||
206 | break; | 210 | break; |
207 | case GNUNET_FS_STATUS_PUBLISH_STOPPED: | 211 | case GNUNET_FS_STATUS_PUBLISH_STOPPED: |
208 | consider_restart (event->status); | 212 | consider_restart (event->status); |
209 | if (0 == strcmp ("publish-context-dir", event->value.publish.cctx)) | 213 | if ( (NULL != event->value.publish.cctx) && |
214 | (0 == strcmp ("publish-context-dir", event->value.publish.cctx)) ) | ||
210 | GNUNET_assert (publish == event->value.publish.pc); | 215 | GNUNET_assert (publish == event->value.publish.pc); |
211 | break; | 216 | break; |
212 | default: | 217 | default: |
diff --git a/src/include/gnunet_fs_service.h b/src/include/gnunet_fs_service.h index 0f4b5ae25..3a3228a6e 100644 --- a/src/include/gnunet_fs_service.h +++ b/src/include/gnunet_fs_service.h | |||
@@ -186,7 +186,7 @@ GNUNET_FS_uri_ksk_get_keyword_count (const struct GNUNET_FS_Uri *uri); | |||
186 | * | 186 | * |
187 | * @param uri ksk uri to get the keywords from | 187 | * @param uri ksk uri to get the keywords from |
188 | * @param iterator function to call on each keyword | 188 | * @param iterator function to call on each keyword |
189 | * @param iterator_cls closure for iterator | 189 | * @param iterator_cls closure for @a iterator |
190 | * @return -1 if this is not a keyword URI, otherwise number of | 190 | * @return -1 if this is not a keyword URI, otherwise number of |
191 | * keywords iterated over until iterator aborted | 191 | * keywords iterated over until iterator aborted |
192 | */ | 192 | */ |
@@ -201,7 +201,7 @@ GNUNET_FS_uri_ksk_get_keywords (const struct GNUNET_FS_Uri *uri, | |||
201 | * | 201 | * |
202 | * @param uri the location URI to inspect | 202 | * @param uri the location URI to inspect |
203 | * @param peer where to store the identify of the peer (presumably) offering the content | 203 | * @param peer where to store the identify of the peer (presumably) offering the content |
204 | * @return GNUNET_SYSERR if this is not a location URI, otherwise GNUNET_OK | 204 | * @return #GNUNET_SYSERR if this is not a location URI, otherwise #GNUNET_OK |
205 | */ | 205 | */ |
206 | int | 206 | int |
207 | GNUNET_FS_uri_loc_get_peer_identity (const struct GNUNET_FS_Uri *uri, | 207 | GNUNET_FS_uri_loc_get_peer_identity (const struct GNUNET_FS_Uri *uri, |
@@ -303,7 +303,8 @@ GNUNET_FS_uri_ksk_create (const char *keywords, char **emsg); | |||
303 | * if keywords is not legal (i.e. empty). | 303 | * if keywords is not legal (i.e. empty). |
304 | */ | 304 | */ |
305 | struct GNUNET_FS_Uri * | 305 | struct GNUNET_FS_Uri * |
306 | GNUNET_FS_uri_ksk_create_from_args (unsigned int argc, const char **argv); | 306 | GNUNET_FS_uri_ksk_create_from_args (unsigned int argc, |
307 | const char **argv); | ||
307 | 308 | ||
308 | 309 | ||
309 | /** | 310 | /** |
@@ -311,7 +312,7 @@ GNUNET_FS_uri_ksk_create_from_args (unsigned int argc, const char **argv); | |||
311 | * | 312 | * |
312 | * @param u1 one of the URIs | 313 | * @param u1 one of the URIs |
313 | * @param u2 the other URI | 314 | * @param u2 the other URI |
314 | * @return GNUNET_YES if the URIs are equal | 315 | * @return #GNUNET_YES if the URIs are equal |
315 | */ | 316 | */ |
316 | int | 317 | int |
317 | GNUNET_FS_uri_test_equal (const struct GNUNET_FS_Uri *u1, | 318 | GNUNET_FS_uri_test_equal (const struct GNUNET_FS_Uri *u1, |
@@ -322,7 +323,7 @@ GNUNET_FS_uri_test_equal (const struct GNUNET_FS_Uri *u1, | |||
322 | * Is this a namespace URI? | 323 | * Is this a namespace URI? |
323 | * | 324 | * |
324 | * @param uri the uri to check | 325 | * @param uri the uri to check |
325 | * @return GNUNET_YES if this is an SKS uri | 326 | * @return #GNUNET_YES if this is an SKS uri |
326 | */ | 327 | */ |
327 | int | 328 | int |
328 | GNUNET_FS_uri_test_sks (const struct GNUNET_FS_Uri *uri); | 329 | GNUNET_FS_uri_test_sks (const struct GNUNET_FS_Uri *uri); |
@@ -346,7 +347,7 @@ GNUNET_FS_uri_sks_create (const struct GNUNET_CRYPTO_EccPublicSignKey *ns, | |||
346 | * | 347 | * |
347 | * @param uri the uri to get the namespace ID from | 348 | * @param uri the uri to get the namespace ID from |
348 | * @param pseudonym where to store the public key of the namespace | 349 | * @param pseudonym where to store the public key of the namespace |
349 | * @return GNUNET_OK on success | 350 | * @return #GNUNET_OK on success |
350 | */ | 351 | */ |
351 | int | 352 | int |
352 | GNUNET_FS_uri_sks_get_namespace (const struct GNUNET_FS_Uri *uri, | 353 | GNUNET_FS_uri_sks_get_namespace (const struct GNUNET_FS_Uri *uri, |
@@ -367,7 +368,7 @@ GNUNET_FS_uri_sks_get_content_id (const struct GNUNET_FS_Uri *uri); | |||
367 | * Is this a keyword URI? | 368 | * Is this a keyword URI? |
368 | * | 369 | * |
369 | * @param uri the uri | 370 | * @param uri the uri |
370 | * @return GNUNET_YES if this is a KSK uri | 371 | * @return #GNUNET_YES if this is a KSK uri |
371 | */ | 372 | */ |
372 | int | 373 | int |
373 | GNUNET_FS_uri_test_ksk (const struct GNUNET_FS_Uri *uri); | 374 | GNUNET_FS_uri_test_ksk (const struct GNUNET_FS_Uri *uri); |
@@ -377,7 +378,7 @@ GNUNET_FS_uri_test_ksk (const struct GNUNET_FS_Uri *uri); | |||
377 | * Is this a file (or directory) URI? | 378 | * Is this a file (or directory) URI? |
378 | * | 379 | * |
379 | * @param uri the uri to check | 380 | * @param uri the uri to check |
380 | * @return GNUNET_YES if this is a CHK uri | 381 | * @return #GNUNET_YES if this is a CHK uri |
381 | */ | 382 | */ |
382 | int | 383 | int |
383 | GNUNET_FS_uri_test_chk (const struct GNUNET_FS_Uri *uri); | 384 | GNUNET_FS_uri_test_chk (const struct GNUNET_FS_Uri *uri); |
@@ -398,7 +399,7 @@ GNUNET_FS_uri_chk_get_file_size (const struct GNUNET_FS_Uri *uri); | |||
398 | * Is this a location URI? | 399 | * Is this a location URI? |
399 | * | 400 | * |
400 | * @param uri the uri to check | 401 | * @param uri the uri to check |
401 | * @return GNUNET_YES if this is a LOC uri | 402 | * @return #GNUNET_YES if this is a LOC uri |
402 | */ | 403 | */ |
403 | int | 404 | int |
404 | GNUNET_FS_uri_test_loc (const struct GNUNET_FS_Uri *uri); | 405 | GNUNET_FS_uri_test_loc (const struct GNUNET_FS_Uri *uri); |
@@ -429,7 +430,7 @@ GNUNET_FS_uri_ksk_create_from_meta_data (const struct GNUNET_CONTAINER_MetaData | |||
429 | * @param scls must be of type "struct GNUNET_FS_Uri **" | 430 | * @param scls must be of type "struct GNUNET_FS_Uri **" |
430 | * @param option name of the option (typically 'k') | 431 | * @param option name of the option (typically 'k') |
431 | * @param value command line argument given | 432 | * @param value command line argument given |
432 | * @return GNUNET_OK on success | 433 | * @return #GNUNET_OK on success |
433 | */ | 434 | */ |
434 | int | 435 | int |
435 | GNUNET_FS_getopt_set_keywords (struct GNUNET_GETOPT_CommandLineProcessorContext | 436 | GNUNET_FS_getopt_set_keywords (struct GNUNET_GETOPT_CommandLineProcessorContext |
@@ -444,10 +445,10 @@ GNUNET_FS_getopt_set_keywords (struct GNUNET_GETOPT_CommandLineProcessorContext | |||
444 | * the metadata must be passed as the "scls" argument. | 445 | * the metadata must be passed as the "scls" argument. |
445 | * | 446 | * |
446 | * @param ctx command line processor context | 447 | * @param ctx command line processor context |
447 | * @param scls must be of type "struct GNUNET_CONTAINER_MetaData **" | 448 | * @param scls must be of type `struct GNUNET_CONTAINER_MetaData **` |
448 | * @param option name of the option (typically 'k') | 449 | * @param option name of the option (typically 'k') |
449 | * @param value command line argument given | 450 | * @param value command line argument given |
450 | * @return GNUNET_OK on success | 451 | * @return #GNUNET_OK on success |
451 | */ | 452 | */ |
452 | int | 453 | int |
453 | GNUNET_FS_getopt_set_metadata (struct GNUNET_GETOPT_CommandLineProcessorContext | 454 | GNUNET_FS_getopt_set_metadata (struct GNUNET_GETOPT_CommandLineProcessorContext |
@@ -1664,7 +1665,7 @@ GNUNET_FS_stop (struct GNUNET_FS_Handle *h); | |||
1664 | 1665 | ||
1665 | 1666 | ||
1666 | /** | 1667 | /** |
1667 | * Function called on entries in a GNUNET_FS_FileInformation publish-structure. | 1668 | * Function called on entries in a `struct GNUNET_FS_FileInformation` iteration. |
1668 | * | 1669 | * |
1669 | * @param cls closure | 1670 | * @param cls closure |
1670 | * @param fi the entry in the publish-structure | 1671 | * @param fi the entry in the publish-structure |
@@ -1674,8 +1675,8 @@ GNUNET_FS_stop (struct GNUNET_FS_Handle *h); | |||
1674 | * @param bo block options (can be modified) | 1675 | * @param bo block options (can be modified) |
1675 | * @param do_index should we index (can be modified) | 1676 | * @param do_index should we index (can be modified) |
1676 | * @param client_info pointer to client context set upon creation (can be modified) | 1677 | * @param client_info pointer to client context set upon creation (can be modified) |
1677 | * @return GNUNET_OK to continue, GNUNET_NO to remove | 1678 | * @return #GNUNET_OK to continue, #GNUNET_NO to remove |
1678 | * this entry from the directory, GNUNET_SYSERR | 1679 | * this entry from the directory, #GNUNET_SYSERR |
1679 | * to abort the iteration | 1680 | * to abort the iteration |
1680 | */ | 1681 | */ |
1681 | typedef int (*GNUNET_FS_FileInformationProcessor) (void *cls, | 1682 | typedef int (*GNUNET_FS_FileInformationProcessor) (void *cls, |
@@ -1697,8 +1698,7 @@ typedef int (*GNUNET_FS_FileInformationProcessor) (void *cls, | |||
1697 | * file information structures. | 1698 | * file information structures. |
1698 | * | 1699 | * |
1699 | * @param s structure to get the filename for | 1700 | * @param s structure to get the filename for |
1700 | * @return NULL on error, otherwise filename that | 1701 | * @return NULL on error, otherwise filename that can be used |
1701 | * can be passed to "GNUNET_FS_file_information_recover" | ||
1702 | * to read this fi-struct from disk. | 1702 | * to read this fi-struct from disk. |
1703 | */ | 1703 | */ |
1704 | const char * | 1704 | const char * |
@@ -1737,8 +1737,8 @@ GNUNET_FS_file_information_set_filename (struct GNUNET_FS_FileInformation *s, | |||
1737 | * @param keywords under which keywords should this file be available | 1737 | * @param keywords under which keywords should this file be available |
1738 | * directly; can be NULL | 1738 | * directly; can be NULL |
1739 | * @param meta metadata for the file | 1739 | * @param meta metadata for the file |
1740 | * @param do_index GNUNET_YES for index, GNUNET_NO for insertion, | 1740 | * @param do_index #GNUNET_YES for index, #GNUNET_NO for insertion, |
1741 | * GNUNET_SYSERR for simulation | 1741 | * #GNUNET_SYSERR for simulation |
1742 | * @param bo block options | 1742 | * @param bo block options |
1743 | * @return publish structure entry for the file | 1743 | * @return publish structure entry for the file |
1744 | */ | 1744 | */ |
@@ -1766,8 +1766,8 @@ GNUNET_FS_file_information_create_from_file (struct GNUNET_FS_Handle *h, | |||
1766 | * @param keywords under which keywords should this file be available | 1766 | * @param keywords under which keywords should this file be available |
1767 | * directly; can be NULL | 1767 | * directly; can be NULL |
1768 | * @param meta metadata for the file | 1768 | * @param meta metadata for the file |
1769 | * @param do_index GNUNET_YES for index, GNUNET_NO for insertion, | 1769 | * @param do_index #GNUNET_YES for index, #GNUNET_NO for insertion, |
1770 | * GNUNET_SYSERR for simulation | 1770 | * #GNUNET_SYSERR for simulation |
1771 | * @param bo block options | 1771 | * @param bo block options |
1772 | * @return publish structure entry for the file | 1772 | * @return publish structure entry for the file |
1773 | */ | 1773 | */ |
@@ -1802,7 +1802,7 @@ GNUNET_FS_file_information_create_from_data (struct GNUNET_FS_Handle *h, | |||
1802 | * the reader to clean up its internal state | 1802 | * the reader to clean up its internal state |
1803 | * @param buf where the reader should write the data | 1803 | * @param buf where the reader should write the data |
1804 | * @param emsg location for the reader to store an error message | 1804 | * @param emsg location for the reader to store an error message |
1805 | * @return number of bytes written, usually "max", 0 on error | 1805 | * @return number of bytes written, usually @a max, 0 on error |
1806 | */ | 1806 | */ |
1807 | typedef size_t (*GNUNET_FS_DataReader) (void *cls, uint64_t offset, size_t max, | 1807 | typedef size_t (*GNUNET_FS_DataReader) (void *cls, uint64_t offset, size_t max, |
1808 | void *buf, char **emsg); | 1808 | void *buf, char **emsg); |
@@ -1815,12 +1815,12 @@ typedef size_t (*GNUNET_FS_DataReader) (void *cls, uint64_t offset, size_t max, | |||
1815 | * @param client_info initial client-info value for this entry | 1815 | * @param client_info initial client-info value for this entry |
1816 | * @param length length of the file | 1816 | * @param length length of the file |
1817 | * @param reader function that can be used to obtain the data for the file | 1817 | * @param reader function that can be used to obtain the data for the file |
1818 | * @param reader_cls closure for "reader" | 1818 | * @param reader_cls closure for @a reader |
1819 | * @param keywords under which keywords should this file be available | 1819 | * @param keywords under which keywords should this file be available |
1820 | * directly; can be NULL | 1820 | * directly; can be NULL |
1821 | * @param meta metadata for the file | 1821 | * @param meta metadata for the file |
1822 | * @param do_index GNUNET_YES for index, GNUNET_NO for insertion, | 1822 | * @param do_index #GNUNET_YES for index, #GNUNET_NO for insertion, |
1823 | * GNUNET_SYSERR for simulation | 1823 | * #GNUNET_SYSERR for simulation |
1824 | * @param bo block options | 1824 | * @param bo block options |
1825 | * @return publish structure entry for the file | 1825 | * @return publish structure entry for the file |
1826 | */ | 1826 | */ |
@@ -1842,7 +1842,7 @@ GNUNET_FS_file_information_create_from_reader (struct GNUNET_FS_Handle *h, | |||
1842 | /** | 1842 | /** |
1843 | * Create an entry for an empty directory in a publish-structure. | 1843 | * Create an entry for an empty directory in a publish-structure. |
1844 | * This function should be used by applications for which the | 1844 | * This function should be used by applications for which the |
1845 | * use of "GNUNET_FS_file_information_create_from_directory" | 1845 | * use of #GNUNET_FS_file_information_create_from_directory |
1846 | * is not appropriate. | 1846 | * is not appropriate. |
1847 | * | 1847 | * |
1848 | * @param h handle to the file sharing subsystem | 1848 | * @param h handle to the file sharing subsystem |
@@ -2100,7 +2100,7 @@ struct GNUNET_FS_GetIndexedContext; | |||
2100 | * @param h handle to the file sharing subsystem | 2100 | * @param h handle to the file sharing subsystem |
2101 | * @param iterator function to call on each indexed file | 2101 | * @param iterator function to call on each indexed file |
2102 | * @param iterator_cls closure for @a iterator | 2102 | * @param iterator_cls closure for @a iterator |
2103 | * @return NULL on error ('iter' is not called) | 2103 | * @return NULL on error (@a iterator is not called) |
2104 | */ | 2104 | */ |
2105 | struct GNUNET_FS_GetIndexedContext * | 2105 | struct GNUNET_FS_GetIndexedContext * |
2106 | GNUNET_FS_get_indexed_files (struct GNUNET_FS_Handle *h, | 2106 | GNUNET_FS_get_indexed_files (struct GNUNET_FS_Handle *h, |
@@ -2145,8 +2145,8 @@ GNUNET_FS_unindex_stop (struct GNUNET_FS_UnindexContext *uc); | |||
2145 | * | 2145 | * |
2146 | * @param cls closure | 2146 | * @param cls closure |
2147 | * @param last_id last identifier | 2147 | * @param last_id last identifier |
2148 | * @param last_uri uri used for the content published under the last_id | 2148 | * @param last_uri uri used for the content published under the @a last_id |
2149 | * @param last_meta metadata associated with last_uri | 2149 | * @param last_meta metadata associated with @a last_uri |
2150 | * @param next_id identifier that should be used for updates | 2150 | * @param next_id identifier that should be used for updates |
2151 | */ | 2151 | */ |
2152 | typedef void (*GNUNET_FS_IdentifierProcessor) (void *cls, | 2152 | typedef void (*GNUNET_FS_IdentifierProcessor) (void *cls, |
@@ -2282,35 +2282,35 @@ GNUNET_FS_probe_stop (struct GNUNET_FS_SearchResult *sr); | |||
2282 | */ | 2282 | */ |
2283 | enum GNUNET_FS_DownloadOptions | 2283 | enum GNUNET_FS_DownloadOptions |
2284 | { | 2284 | { |
2285 | /** | 2285 | /** |
2286 | * No options (use defaults for everything). | 2286 | * No options (use defaults for everything). |
2287 | */ | 2287 | */ |
2288 | GNUNET_FS_DOWNLOAD_OPTION_NONE = 0, | 2288 | GNUNET_FS_DOWNLOAD_OPTION_NONE = 0, |
2289 | 2289 | ||
2290 | /** | 2290 | /** |
2291 | * Only download from the local host, do not access remote systems (no P2P) | 2291 | * Only download from the local host, do not access remote systems (no P2P) |
2292 | */ | 2292 | */ |
2293 | GNUNET_FS_DOWNLOAD_OPTION_LOOPBACK_ONLY = 1, | 2293 | GNUNET_FS_DOWNLOAD_OPTION_LOOPBACK_ONLY = 1, |
2294 | 2294 | ||
2295 | /** | 2295 | /** |
2296 | * Do a recursive download (that is, automatically trigger the | 2296 | * Do a recursive download (that is, automatically trigger the |
2297 | * download of files in directories). | 2297 | * download of files in directories). |
2298 | */ | 2298 | */ |
2299 | GNUNET_FS_DOWNLOAD_OPTION_RECURSIVE = 2, | 2299 | GNUNET_FS_DOWNLOAD_OPTION_RECURSIVE = 2, |
2300 | 2300 | ||
2301 | /** | 2301 | /** |
2302 | * Do not append temporary data to | 2302 | * Do not append temporary data to |
2303 | * the target file (for the IBlocks). | 2303 | * the target file (for the IBlocks). |
2304 | */ | 2304 | */ |
2305 | GNUNET_FS_DOWNLOAD_NO_TEMPORARIES = 4, | 2305 | GNUNET_FS_DOWNLOAD_NO_TEMPORARIES = 4, |
2306 | 2306 | ||
2307 | /** | 2307 | /** |
2308 | * Internal option used to flag this download as a 'probe' for a | 2308 | * Internal option used to flag this download as a 'probe' for a |
2309 | * search result. Impacts the priority with which the download is | 2309 | * search result. Impacts the priority with which the download is |
2310 | * run and causes signalling callbacks to be done differently. | 2310 | * run and causes signalling callbacks to be done differently. |
2311 | * Also, probe downloads are not serialized on suspension. Normal | 2311 | * Also, probe downloads are not serialized on suspension. Normal |
2312 | * clients should not use this! | 2312 | * clients should not use this! |
2313 | */ | 2313 | */ |
2314 | GNUNET_FS_DOWNLOAD_IS_PROBE = (1 << 31) | 2314 | GNUNET_FS_DOWNLOAD_IS_PROBE = (1 << 31) |
2315 | }; | 2315 | }; |
2316 | 2316 | ||
diff --git a/src/util/service.c b/src/util/service.c index 551ab4825..9e624ebbd 100644 --- a/src/util/service.c +++ b/src/util/service.c | |||
@@ -1573,7 +1573,7 @@ service_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1573 | * Detach from terminal. | 1573 | * Detach from terminal. |
1574 | * | 1574 | * |
1575 | * @param sctx service context | 1575 | * @param sctx service context |
1576 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 1576 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
1577 | */ | 1577 | */ |
1578 | static int | 1578 | static int |
1579 | detach_terminal (struct GNUNET_SERVICE_Context *sctx) | 1579 | detach_terminal (struct GNUNET_SERVICE_Context *sctx) |