diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-12-19 18:43:38 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-12-19 18:43:38 +0100 |
commit | 3636ea628d051cf2ba7a9038c50528c561d0aeaa (patch) | |
tree | 87664b904950052e8b6997a371ed5ecb1ea4b310 /src/include | |
parent | 74d7528e6bd53cf5acc939c63a5be74a001e5ce1 (diff) | |
download | gnunet-3636ea628d051cf2ba7a9038c50528c561d0aeaa.tar.gz gnunet-3636ea628d051cf2ba7a9038c50528c561d0aeaa.zip |
change GNUNET_DISK_fn_write() to always do atomic writes and to NOT overwrite existing files; also change the return value to not return the size of the written file but GNUNET_OK on success, and integrate creating the directory if needed; breaks API, hence bumping libgnunetutil version
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/gnunet_common.h | 2 | ||||
-rw-r--r-- | src/include/gnunet_configuration_lib.h | 59 | ||||
-rw-r--r-- | src/include/gnunet_crypto_lib.h | 30 | ||||
-rw-r--r-- | src/include/gnunet_disk_lib.h | 46 |
4 files changed, 71 insertions, 66 deletions
diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h index bc2055709..b5af1146d 100644 --- a/src/include/gnunet_common.h +++ b/src/include/gnunet_common.h | |||
@@ -345,7 +345,7 @@ struct GNUNET_AsyncScopeSave | |||
345 | * #GNUNET_NO to stop iteration with no error, | 345 | * #GNUNET_NO to stop iteration with no error, |
346 | * #GNUNET_SYSERR to abort iteration with error! | 346 | * #GNUNET_SYSERR to abort iteration with error! |
347 | */ | 347 | */ |
348 | typedef int | 348 | typedef enum GNUNET_GenericReturnValue |
349 | (*GNUNET_FileNameCallback) (void *cls, | 349 | (*GNUNET_FileNameCallback) (void *cls, |
350 | const char *filename); | 350 | const char *filename); |
351 | 351 | ||
diff --git a/src/include/gnunet_configuration_lib.h b/src/include/gnunet_configuration_lib.h index b4e7f7d8f..ad55c1b9a 100644 --- a/src/include/gnunet_configuration_lib.h +++ b/src/include/gnunet_configuration_lib.h | |||
@@ -82,7 +82,7 @@ GNUNET_CONFIGURATION_destroy (struct GNUNET_CONFIGURATION_Handle *cfg); | |||
82 | * @param filename name of the configuration file, NULL to load defaults | 82 | * @param filename name of the configuration file, NULL to load defaults |
83 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 83 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
84 | */ | 84 | */ |
85 | int | 85 | enum GNUNET_GenericReturnValue |
86 | GNUNET_CONFIGURATION_load (struct GNUNET_CONFIGURATION_Handle *cfg, | 86 | GNUNET_CONFIGURATION_load (struct GNUNET_CONFIGURATION_Handle *cfg, |
87 | const char *filename); | 87 | const char *filename); |
88 | 88 | ||
@@ -95,7 +95,7 @@ GNUNET_CONFIGURATION_load (struct GNUNET_CONFIGURATION_Handle *cfg, | |||
95 | * @param defaults_d directory with the defaults | 95 | * @param defaults_d directory with the defaults |
96 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 96 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
97 | */ | 97 | */ |
98 | int | 98 | enum GNUNET_GenericReturnValue |
99 | GNUNET_CONFIGURATION_load_from (struct GNUNET_CONFIGURATION_Handle *cfg, | 99 | GNUNET_CONFIGURATION_load_from (struct GNUNET_CONFIGURATION_Handle *cfg, |
100 | const char *defaults_d); | 100 | const char *defaults_d); |
101 | 101 | ||
@@ -120,7 +120,7 @@ GNUNET_CONFIGURATION_default (void); | |||
120 | * @param filename name of the configuration file | 120 | * @param filename name of the configuration file |
121 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 121 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
122 | */ | 122 | */ |
123 | int | 123 | enum GNUNET_GenericReturnValue |
124 | GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg, | 124 | GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg, |
125 | const char *filename); | 125 | const char *filename); |
126 | 126 | ||
@@ -149,7 +149,7 @@ GNUNET_CONFIGURATION_serialize (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
149 | * when we come across them | 149 | * when we come across them |
150 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 150 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
151 | */ | 151 | */ |
152 | int | 152 | enum GNUNET_GenericReturnValue |
153 | GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, | 153 | GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, |
154 | const char *mem, | 154 | const char *mem, |
155 | size_t size, | 155 | size_t size, |
@@ -163,19 +163,20 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, | |||
163 | * @param filename where to write the configuration | 163 | * @param filename where to write the configuration |
164 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 164 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
165 | */ | 165 | */ |
166 | int | 166 | enum GNUNET_GenericReturnValue |
167 | GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *cfg, | 167 | GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *cfg, |
168 | const char *filename); | 168 | const char *filename); |
169 | 169 | ||
170 | 170 | ||
171 | /** | 171 | /** |
172 | * Write only configuration entries that have been changed to configuration file | 172 | * Write only configuration entries that have been changed to configuration file |
173 | * | ||
173 | * @param cfg_default default configuration | 174 | * @param cfg_default default configuration |
174 | * @param cfg_new new configuration | 175 | * @param cfg_new new configuration |
175 | * @param filename where to write the configuration diff between default and new | 176 | * @param filename where to write the configuration diff between default and new |
176 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 177 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
177 | */ | 178 | */ |
178 | int | 179 | enum GNUNET_GenericReturnValue |
179 | GNUNET_CONFIGURATION_write_diffs (const struct | 180 | GNUNET_CONFIGURATION_write_diffs (const struct |
180 | GNUNET_CONFIGURATION_Handle *cfg_default, | 181 | GNUNET_CONFIGURATION_Handle *cfg_default, |
181 | const struct | 182 | const struct |
@@ -204,7 +205,7 @@ GNUNET_CONFIGURATION_get_diff (const struct | |||
204 | * @param cfg configuration to inspect | 205 | * @param cfg configuration to inspect |
205 | * @return #GNUNET_NO if clean, #GNUNET_YES if dirty, #GNUNET_SYSERR on error (i.e. last save failed) | 206 | * @return #GNUNET_NO if clean, #GNUNET_YES if dirty, #GNUNET_SYSERR on error (i.e. last save failed) |
206 | */ | 207 | */ |
207 | int | 208 | enum GNUNET_GenericReturnValue |
208 | GNUNET_CONFIGURATION_is_dirty (const struct GNUNET_CONFIGURATION_Handle *cfg); | 209 | GNUNET_CONFIGURATION_is_dirty (const struct GNUNET_CONFIGURATION_Handle *cfg); |
209 | 210 | ||
210 | 211 | ||
@@ -215,7 +216,7 @@ GNUNET_CONFIGURATION_is_dirty (const struct GNUNET_CONFIGURATION_Handle *cfg); | |||
215 | * @param cfg the configuration | 216 | * @param cfg the configuration |
216 | * @return status code | 217 | * @return status code |
217 | */ | 218 | */ |
218 | typedef int | 219 | typedef enum GNUNET_GenericReturnValue |
219 | (*GNUNET_CONFIGURATION_Callback)(void *cls, | 220 | (*GNUNET_CONFIGURATION_Callback)(void *cls, |
220 | const struct GNUNET_CONFIGURATION_Handle *cfg); | 221 | const struct GNUNET_CONFIGURATION_Handle *cfg); |
221 | 222 | ||
@@ -231,7 +232,7 @@ typedef int | |||
231 | * @return #GNUNET_SYSERR if parsing the configuration failed, | 232 | * @return #GNUNET_SYSERR if parsing the configuration failed, |
232 | * otherwise return value from @a cb. | 233 | * otherwise return value from @a cb. |
233 | */ | 234 | */ |
234 | int | 235 | enum GNUNET_GenericReturnValue |
235 | GNUNET_CONFIGURATION_parse_and_run (const char *filename, | 236 | GNUNET_CONFIGURATION_parse_and_run (const char *filename, |
236 | GNUNET_CONFIGURATION_Callback cb, | 237 | GNUNET_CONFIGURATION_Callback cb, |
237 | void *cb_cls); | 238 | void *cb_cls); |
@@ -311,7 +312,7 @@ GNUNET_CONFIGURATION_remove_section (struct GNUNET_CONFIGURATION_Handle *cfg, | |||
311 | * @param number where to store the numeric value of the option | 312 | * @param number where to store the numeric value of the option |
312 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 313 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
313 | */ | 314 | */ |
314 | int | 315 | enum GNUNET_GenericReturnValue |
315 | GNUNET_CONFIGURATION_get_value_number (const struct | 316 | GNUNET_CONFIGURATION_get_value_number (const struct |
316 | GNUNET_CONFIGURATION_Handle *cfg, | 317 | GNUNET_CONFIGURATION_Handle *cfg, |
317 | const char *section, | 318 | const char *section, |
@@ -328,7 +329,7 @@ GNUNET_CONFIGURATION_get_value_number (const struct | |||
328 | * @param number where to store the floating value of the option | 329 | * @param number where to store the floating value of the option |
329 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 330 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
330 | */ | 331 | */ |
331 | int | 332 | enum GNUNET_GenericReturnValue |
332 | GNUNET_CONFIGURATION_get_value_float (const struct | 333 | GNUNET_CONFIGURATION_get_value_float (const struct |
333 | GNUNET_CONFIGURATION_Handle *cfg, | 334 | GNUNET_CONFIGURATION_Handle *cfg, |
334 | const char *section, | 335 | const char *section, |
@@ -345,7 +346,7 @@ GNUNET_CONFIGURATION_get_value_float (const struct | |||
345 | * @param time set to the time value stored in the configuration | 346 | * @param time set to the time value stored in the configuration |
346 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 347 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
347 | */ | 348 | */ |
348 | int | 349 | enum GNUNET_GenericReturnValue |
349 | GNUNET_CONFIGURATION_get_value_time (const struct | 350 | GNUNET_CONFIGURATION_get_value_time (const struct |
350 | GNUNET_CONFIGURATION_Handle *cfg, | 351 | GNUNET_CONFIGURATION_Handle *cfg, |
351 | const char *section, | 352 | const char *section, |
@@ -362,7 +363,7 @@ GNUNET_CONFIGURATION_get_value_time (const struct | |||
362 | * @param size set to the size in bytes as stored in the configuration | 363 | * @param size set to the size in bytes as stored in the configuration |
363 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 364 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
364 | */ | 365 | */ |
365 | int | 366 | enum GNUNET_GenericReturnValue |
366 | GNUNET_CONFIGURATION_get_value_size (const struct | 367 | GNUNET_CONFIGURATION_get_value_size (const struct |
367 | GNUNET_CONFIGURATION_Handle *cfg, | 368 | GNUNET_CONFIGURATION_Handle *cfg, |
368 | const char *section, | 369 | const char *section, |
@@ -378,7 +379,7 @@ GNUNET_CONFIGURATION_get_value_size (const struct | |||
378 | * @param option option of interest | 379 | * @param option option of interest |
379 | * @return #GNUNET_YES if so, #GNUNET_NO if not. | 380 | * @return #GNUNET_YES if so, #GNUNET_NO if not. |
380 | */ | 381 | */ |
381 | int | 382 | enum GNUNET_GenericReturnValue |
382 | GNUNET_CONFIGURATION_have_value (const struct GNUNET_CONFIGURATION_Handle *cfg, | 383 | GNUNET_CONFIGURATION_have_value (const struct GNUNET_CONFIGURATION_Handle *cfg, |
383 | const char *section, | 384 | const char *section, |
384 | const char *option); | 385 | const char *option); |
@@ -394,12 +395,12 @@ GNUNET_CONFIGURATION_have_value (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
394 | * value, or NULL if option is not specified | 395 | * value, or NULL if option is not specified |
395 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 396 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
396 | */ | 397 | */ |
397 | int | 398 | enum GNUNET_GenericReturnValue |
398 | GNUNET_CONFIGURATION_get_value_string (const struct | 399 | GNUNET_CONFIGURATION_get_value_string ( |
399 | GNUNET_CONFIGURATION_Handle *cfg, | 400 | const struct GNUNET_CONFIGURATION_Handle *cfg, |
400 | const char *section, | 401 | const char *section, |
401 | const char *option, | 402 | const char *option, |
402 | char **value); | 403 | char **value); |
403 | 404 | ||
404 | 405 | ||
405 | /** | 406 | /** |
@@ -413,7 +414,7 @@ GNUNET_CONFIGURATION_get_value_string (const struct | |||
413 | * value, or NULL if option is not specified | 414 | * value, or NULL if option is not specified |
414 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 415 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
415 | */ | 416 | */ |
416 | int | 417 | enum GNUNET_GenericReturnValue |
417 | GNUNET_CONFIGURATION_get_value_filename (const struct | 418 | GNUNET_CONFIGURATION_get_value_filename (const struct |
418 | GNUNET_CONFIGURATION_Handle *cfg, | 419 | GNUNET_CONFIGURATION_Handle *cfg, |
419 | const char *section, | 420 | const char *section, |
@@ -466,7 +467,7 @@ GNUNET_CONFIGURATION_iterate_section_values (const struct | |||
466 | * or NULL if option is not specified and no default given | 467 | * or NULL if option is not specified and no default given |
467 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 468 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
468 | */ | 469 | */ |
469 | int | 470 | enum GNUNET_GenericReturnValue |
470 | GNUNET_CONFIGURATION_get_value_choice (const struct | 471 | GNUNET_CONFIGURATION_get_value_choice (const struct |
471 | GNUNET_CONFIGURATION_Handle *cfg, | 472 | GNUNET_CONFIGURATION_Handle *cfg, |
472 | const char *section, | 473 | const char *section, |
@@ -483,7 +484,7 @@ GNUNET_CONFIGURATION_get_value_choice (const struct | |||
483 | * @param option option of interest | 484 | * @param option option of interest |
484 | * @return #GNUNET_YES, #GNUNET_NO or if option has no valid value, #GNUNET_SYSERR | 485 | * @return #GNUNET_YES, #GNUNET_NO or if option has no valid value, #GNUNET_SYSERR |
485 | */ | 486 | */ |
486 | int | 487 | enum GNUNET_GenericReturnValue |
487 | GNUNET_CONFIGURATION_get_value_yesno (const struct | 488 | GNUNET_CONFIGURATION_get_value_yesno (const struct |
488 | GNUNET_CONFIGURATION_Handle *cfg, | 489 | GNUNET_CONFIGURATION_Handle *cfg, |
489 | const char *section, | 490 | const char *section, |
@@ -502,7 +503,7 @@ GNUNET_CONFIGURATION_get_value_yesno (const struct | |||
502 | * #GNUNET_NO is the value does not exist | 503 | * #GNUNET_NO is the value does not exist |
503 | * #GNUNET_SYSERR on decoding error | 504 | * #GNUNET_SYSERR on decoding error |
504 | */ | 505 | */ |
505 | int | 506 | enum GNUNET_GenericReturnValue |
506 | GNUNET_CONFIGURATION_get_data (const struct GNUNET_CONFIGURATION_Handle *cfg, | 507 | GNUNET_CONFIGURATION_get_data (const struct GNUNET_CONFIGURATION_Handle *cfg, |
507 | const char *section, | 508 | const char *section, |
508 | const char *option, | 509 | const char *option, |
@@ -527,9 +528,9 @@ GNUNET_CONFIGURATION_get_data (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
527 | * @return $-expanded string | 528 | * @return $-expanded string |
528 | */ | 529 | */ |
529 | char * | 530 | char * |
530 | GNUNET_CONFIGURATION_expand_dollar (const struct | 531 | GNUNET_CONFIGURATION_expand_dollar ( |
531 | GNUNET_CONFIGURATION_Handle *cfg, | 532 | const struct GNUNET_CONFIGURATION_Handle *cfg, |
532 | char *orig); | 533 | char *orig); |
533 | 534 | ||
534 | 535 | ||
535 | /** | 536 | /** |
@@ -573,7 +574,7 @@ GNUNET_CONFIGURATION_set_value_string (struct GNUNET_CONFIGURATION_Handle *cfg, | |||
573 | * @return #GNUNET_OK on success, | 574 | * @return #GNUNET_OK on success, |
574 | * #GNUNET_SYSERR if the filename is not in the list | 575 | * #GNUNET_SYSERR if the filename is not in the list |
575 | */ | 576 | */ |
576 | int | 577 | enum GNUNET_GenericReturnValue |
577 | GNUNET_CONFIGURATION_remove_value_filename (struct | 578 | GNUNET_CONFIGURATION_remove_value_filename (struct |
578 | GNUNET_CONFIGURATION_Handle *cfg, | 579 | GNUNET_CONFIGURATION_Handle *cfg, |
579 | const char *section, | 580 | const char *section, |
@@ -592,7 +593,7 @@ GNUNET_CONFIGURATION_remove_value_filename (struct | |||
592 | * @return #GNUNET_OK on success, | 593 | * @return #GNUNET_OK on success, |
593 | * #GNUNET_SYSERR if the filename already in the list | 594 | * #GNUNET_SYSERR if the filename already in the list |
594 | */ | 595 | */ |
595 | int | 596 | enum GNUNET_GenericReturnValue |
596 | GNUNET_CONFIGURATION_append_value_filename (struct | 597 | GNUNET_CONFIGURATION_append_value_filename (struct |
597 | GNUNET_CONFIGURATION_Handle *cfg, | 598 | GNUNET_CONFIGURATION_Handle *cfg, |
598 | const char *section, | 599 | const char *section, |
diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h index 6dc56f0e4..5521dad3c 100644 --- a/src/include/gnunet_crypto_lib.h +++ b/src/include/gnunet_crypto_lib.h | |||
@@ -1023,7 +1023,7 @@ GNUNET_CRYPTO_hmac_derive_key ( | |||
1023 | * @param ... pair of void * & size_t for context chunks, terminated by NULL | 1023 | * @param ... pair of void * & size_t for context chunks, terminated by NULL |
1024 | * @return #GNUNET_YES on success | 1024 | * @return #GNUNET_YES on success |
1025 | */ | 1025 | */ |
1026 | int | 1026 | enum GNUNET_GenericReturnValue |
1027 | GNUNET_CRYPTO_hkdf (void *result, | 1027 | GNUNET_CRYPTO_hkdf (void *result, |
1028 | size_t out_len, | 1028 | size_t out_len, |
1029 | int xtr_algo, | 1029 | int xtr_algo, |
@@ -1049,7 +1049,7 @@ GNUNET_CRYPTO_hkdf (void *result, | |||
1049 | * @param argp va_list of void * & size_t pairs for context chunks | 1049 | * @param argp va_list of void * & size_t pairs for context chunks |
1050 | * @return #GNUNET_YES on success | 1050 | * @return #GNUNET_YES on success |
1051 | */ | 1051 | */ |
1052 | int | 1052 | enum GNUNET_GenericReturnValue |
1053 | GNUNET_CRYPTO_hkdf_v (void *result, | 1053 | GNUNET_CRYPTO_hkdf_v (void *result, |
1054 | size_t out_len, | 1054 | size_t out_len, |
1055 | int xtr_algo, | 1055 | int xtr_algo, |
@@ -1072,7 +1072,7 @@ GNUNET_CRYPTO_hkdf_v (void *result, | |||
1072 | * @param argp va_list of void * & size_t pairs for context chunks | 1072 | * @param argp va_list of void * & size_t pairs for context chunks |
1073 | * @return #GNUNET_YES on success | 1073 | * @return #GNUNET_YES on success |
1074 | */ | 1074 | */ |
1075 | int | 1075 | enum GNUNET_GenericReturnValue |
1076 | GNUNET_CRYPTO_kdf_v (void *result, | 1076 | GNUNET_CRYPTO_kdf_v (void *result, |
1077 | size_t out_len, | 1077 | size_t out_len, |
1078 | const void *xts, | 1078 | const void *xts, |
@@ -1116,7 +1116,7 @@ GNUNET_CRYPTO_kdf_mod_mpi (gcry_mpi_t *r, | |||
1116 | * @param ... void * & size_t pairs for context chunks | 1116 | * @param ... void * & size_t pairs for context chunks |
1117 | * @return #GNUNET_YES on success | 1117 | * @return #GNUNET_YES on success |
1118 | */ | 1118 | */ |
1119 | int | 1119 | enum GNUNET_GenericReturnValue |
1120 | GNUNET_CRYPTO_kdf (void *result, | 1120 | GNUNET_CRYPTO_kdf (void *result, |
1121 | size_t out_len, | 1121 | size_t out_len, |
1122 | const void *xts, | 1122 | const void *xts, |
@@ -1215,7 +1215,7 @@ GNUNET_CRYPTO_eddsa_public_key_to_string ( | |||
1215 | * @param pub where to store the public key | 1215 | * @param pub where to store the public key |
1216 | * @return #GNUNET_OK on success | 1216 | * @return #GNUNET_OK on success |
1217 | */ | 1217 | */ |
1218 | int | 1218 | enum GNUNET_GenericReturnValue |
1219 | GNUNET_CRYPTO_ecdsa_public_key_from_string ( | 1219 | GNUNET_CRYPTO_ecdsa_public_key_from_string ( |
1220 | const char *enc, | 1220 | const char *enc, |
1221 | size_t enclen, | 1221 | size_t enclen, |
@@ -1245,7 +1245,7 @@ GNUNET_CRYPTO_eddsa_private_key_from_string ( | |||
1245 | * @param pub where to store the public key | 1245 | * @param pub where to store the public key |
1246 | * @return #GNUNET_OK on success | 1246 | * @return #GNUNET_OK on success |
1247 | */ | 1247 | */ |
1248 | int | 1248 | enum GNUNET_GenericReturnValue |
1249 | GNUNET_CRYPTO_eddsa_public_key_from_string ( | 1249 | GNUNET_CRYPTO_eddsa_public_key_from_string ( |
1250 | const char *enc, | 1250 | const char *enc, |
1251 | size_t enclen, | 1251 | size_t enclen, |
@@ -1267,7 +1267,7 @@ GNUNET_CRYPTO_eddsa_public_key_from_string ( | |||
1267 | * @return #GNUNET_OK on success, #GNUNET_NO if @a do_create was set but | 1267 | * @return #GNUNET_OK on success, #GNUNET_NO if @a do_create was set but |
1268 | * we found an existing file, #GNUNET_SYSERR on failure | 1268 | * we found an existing file, #GNUNET_SYSERR on failure |
1269 | */ | 1269 | */ |
1270 | int | 1270 | enum GNUNET_GenericReturnValue |
1271 | GNUNET_CRYPTO_ecdsa_key_from_file (const char *filename, | 1271 | GNUNET_CRYPTO_ecdsa_key_from_file (const char *filename, |
1272 | int do_create, | 1272 | int do_create, |
1273 | struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey); | 1273 | struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey); |
@@ -1606,7 +1606,7 @@ GNUNET_CRYPTO_ecc_dlog_release (struct GNUNET_CRYPTO_EccDlogContext *dlc); | |||
1606 | * @param key_material where to write the key material (xyG) | 1606 | * @param key_material where to write the key material (xyG) |
1607 | * @return #GNUNET_SYSERR on error, #GNUNET_OK on success | 1607 | * @return #GNUNET_SYSERR on error, #GNUNET_OK on success |
1608 | */ | 1608 | */ |
1609 | int | 1609 | enum GNUNET_GenericReturnValue |
1610 | GNUNET_CRYPTO_ecc_ecdh (const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, | 1610 | GNUNET_CRYPTO_ecc_ecdh (const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, |
1611 | const struct GNUNET_CRYPTO_EcdhePublicKey *pub, | 1611 | const struct GNUNET_CRYPTO_EcdhePublicKey *pub, |
1612 | struct GNUNET_HashCode *key_material); | 1612 | struct GNUNET_HashCode *key_material); |
@@ -1622,7 +1622,7 @@ GNUNET_CRYPTO_ecc_ecdh (const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, | |||
1622 | * @param key_material where to write the key material H(h(x)yG) | 1622 | * @param key_material where to write the key material H(h(x)yG) |
1623 | * @return #GNUNET_SYSERR on error, #GNUNET_OK on success | 1623 | * @return #GNUNET_SYSERR on error, #GNUNET_OK on success |
1624 | */ | 1624 | */ |
1625 | int | 1625 | enum GNUNET_GenericReturnValue |
1626 | GNUNET_CRYPTO_eddsa_ecdh (const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, | 1626 | GNUNET_CRYPTO_eddsa_ecdh (const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, |
1627 | const struct GNUNET_CRYPTO_EcdhePublicKey *pub, | 1627 | const struct GNUNET_CRYPTO_EcdhePublicKey *pub, |
1628 | struct GNUNET_HashCode *key_material); | 1628 | struct GNUNET_HashCode *key_material); |
@@ -1637,7 +1637,7 @@ GNUNET_CRYPTO_eddsa_ecdh (const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, | |||
1637 | * @param key_material where to write the key material H(h(x)yG) | 1637 | * @param key_material where to write the key material H(h(x)yG) |
1638 | * @return #GNUNET_SYSERR on error, #GNUNET_OK on success | 1638 | * @return #GNUNET_SYSERR on error, #GNUNET_OK on success |
1639 | */ | 1639 | */ |
1640 | int | 1640 | enum GNUNET_GenericReturnValue |
1641 | GNUNET_CRYPTO_ecdsa_ecdh (const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, | 1641 | GNUNET_CRYPTO_ecdsa_ecdh (const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, |
1642 | const struct GNUNET_CRYPTO_EcdhePublicKey *pub, | 1642 | const struct GNUNET_CRYPTO_EcdhePublicKey *pub, |
1643 | struct GNUNET_HashCode *key_material); | 1643 | struct GNUNET_HashCode *key_material); |
@@ -1653,7 +1653,7 @@ GNUNET_CRYPTO_ecdsa_ecdh (const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, | |||
1653 | * @param key_material where to write the key material H(yX)=H(h(x)yG) | 1653 | * @param key_material where to write the key material H(yX)=H(h(x)yG) |
1654 | * @return #GNUNET_SYSERR on error, #GNUNET_OK on success | 1654 | * @return #GNUNET_SYSERR on error, #GNUNET_OK on success |
1655 | */ | 1655 | */ |
1656 | int | 1656 | enum GNUNET_GenericReturnValue |
1657 | GNUNET_CRYPTO_ecdh_eddsa (const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, | 1657 | GNUNET_CRYPTO_ecdh_eddsa (const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, |
1658 | const struct GNUNET_CRYPTO_EddsaPublicKey *pub, | 1658 | const struct GNUNET_CRYPTO_EddsaPublicKey *pub, |
1659 | struct GNUNET_HashCode *key_material); | 1659 | struct GNUNET_HashCode *key_material); |
@@ -1668,7 +1668,7 @@ GNUNET_CRYPTO_ecdh_eddsa (const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, | |||
1668 | * @param key_material where to write the key material H(yX)=H(h(x)yG) | 1668 | * @param key_material where to write the key material H(yX)=H(h(x)yG) |
1669 | * @return #GNUNET_SYSERR on error, #GNUNET_OK on success | 1669 | * @return #GNUNET_SYSERR on error, #GNUNET_OK on success |
1670 | */ | 1670 | */ |
1671 | int | 1671 | enum GNUNET_GenericReturnValue |
1672 | GNUNET_CRYPTO_ecdh_ecdsa (const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, | 1672 | GNUNET_CRYPTO_ecdh_ecdsa (const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, |
1673 | const struct GNUNET_CRYPTO_EcdsaPublicKey *pub, | 1673 | const struct GNUNET_CRYPTO_EcdsaPublicKey *pub, |
1674 | struct GNUNET_HashCode *key_material); | 1674 | struct GNUNET_HashCode *key_material); |
@@ -1689,7 +1689,7 @@ GNUNET_CRYPTO_ecdh_ecdsa (const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, | |||
1689 | * @param[out] sig where to write the signature | 1689 | * @param[out] sig where to write the signature |
1690 | * @return #GNUNET_SYSERR on error, #GNUNET_OK on success | 1690 | * @return #GNUNET_SYSERR on error, #GNUNET_OK on success |
1691 | */ | 1691 | */ |
1692 | int | 1692 | enum GNUNET_GenericReturnValue |
1693 | GNUNET_CRYPTO_eddsa_sign_ ( | 1693 | GNUNET_CRYPTO_eddsa_sign_ ( |
1694 | const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, | 1694 | const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, |
1695 | const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, | 1695 | const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, |
@@ -1736,7 +1736,7 @@ GNUNET_CRYPTO_eddsa_sign_ ( | |||
1736 | * @param[out] sig where to write the signature | 1736 | * @param[out] sig where to write the signature |
1737 | * @return #GNUNET_SYSERR on error, #GNUNET_OK on success | 1737 | * @return #GNUNET_SYSERR on error, #GNUNET_OK on success |
1738 | */ | 1738 | */ |
1739 | int | 1739 | enum GNUNET_GenericReturnValue |
1740 | GNUNET_CRYPTO_ecdsa_sign_ ( | 1740 | GNUNET_CRYPTO_ecdsa_sign_ ( |
1741 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, | 1741 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, |
1742 | const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, | 1742 | const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, |
@@ -2333,7 +2333,7 @@ GNUNET_CRYPTO_rsa_unblind (const struct GNUNET_CRYPTO_RsaSignature *sig, | |||
2333 | * @param public_key public key of the signer | 2333 | * @param public_key public key of the signer |
2334 | * @returns #GNUNET_YES if ok, #GNUNET_NO if RSA key is malicious, #GNUNET_SYSERR if signature | 2334 | * @returns #GNUNET_YES if ok, #GNUNET_NO if RSA key is malicious, #GNUNET_SYSERR if signature |
2335 | */ | 2335 | */ |
2336 | int | 2336 | enum GNUNET_GenericReturnValue |
2337 | GNUNET_CRYPTO_rsa_verify (const struct GNUNET_HashCode *hash, | 2337 | GNUNET_CRYPTO_rsa_verify (const struct GNUNET_HashCode *hash, |
2338 | const struct GNUNET_CRYPTO_RsaSignature *sig, | 2338 | const struct GNUNET_CRYPTO_RsaSignature *sig, |
2339 | const struct GNUNET_CRYPTO_RsaPublicKey *public_key); | 2339 | const struct GNUNET_CRYPTO_RsaPublicKey *public_key); |
diff --git a/src/include/gnunet_disk_lib.h b/src/include/gnunet_disk_lib.h index 3f29dc2e4..b794088c4 100644 --- a/src/include/gnunet_disk_lib.h +++ b/src/include/gnunet_disk_lib.h | |||
@@ -251,7 +251,7 @@ enum GNUNET_DISK_PipeEnd | |||
251 | * @param h handle to check | 251 | * @param h handle to check |
252 | * @return #GNUNET_YES if invalid, #GNUNET_NO if valid | 252 | * @return #GNUNET_YES if invalid, #GNUNET_NO if valid |
253 | */ | 253 | */ |
254 | int | 254 | enum GNUNET_GenericReturnValue |
255 | GNUNET_DISK_handle_invalid (const struct GNUNET_DISK_FileHandle *h); | 255 | GNUNET_DISK_handle_invalid (const struct GNUNET_DISK_FileHandle *h); |
256 | 256 | ||
257 | 257 | ||
@@ -263,7 +263,7 @@ GNUNET_DISK_handle_invalid (const struct GNUNET_DISK_FileHandle *h); | |||
263 | * @return #GNUNET_YES if yes, #GNUNET_NO if not a file, #GNUNET_SYSERR if something | 263 | * @return #GNUNET_YES if yes, #GNUNET_NO if not a file, #GNUNET_SYSERR if something |
264 | * else (will print an error message in that case, too). | 264 | * else (will print an error message in that case, too). |
265 | */ | 265 | */ |
266 | int | 266 | enum GNUNET_GenericReturnValue |
267 | GNUNET_DISK_file_test (const char *fil); | 267 | GNUNET_DISK_file_test (const char *fil); |
268 | 268 | ||
269 | 269 | ||
@@ -304,7 +304,7 @@ GNUNET_DISK_file_seek (const struct GNUNET_DISK_FileHandle *h, | |||
304 | * and return #GNUNET_SYSERR for directories. | 304 | * and return #GNUNET_SYSERR for directories. |
305 | * @return #GNUNET_SYSERR on error, #GNUNET_OK on success | 305 | * @return #GNUNET_SYSERR on error, #GNUNET_OK on success |
306 | */ | 306 | */ |
307 | int | 307 | enum GNUNET_GenericReturnValue |
308 | GNUNET_DISK_file_size (const char *filename, | 308 | GNUNET_DISK_file_size (const char *filename, |
309 | uint64_t *size, | 309 | uint64_t *size, |
310 | int include_symbolic_links, | 310 | int include_symbolic_links, |
@@ -326,7 +326,7 @@ GNUNET_DISK_file_size (const char *filename, | |||
326 | * @param ino set to the inode ID | 326 | * @param ino set to the inode ID |
327 | * @return #GNUNET_OK on success | 327 | * @return #GNUNET_OK on success |
328 | */ | 328 | */ |
329 | int | 329 | enum GNUNET_GenericReturnValue |
330 | GNUNET_DISK_file_get_identifiers (const char *filename, | 330 | GNUNET_DISK_file_get_identifiers (const char *filename, |
331 | uint64_t *dev, | 331 | uint64_t *dev, |
332 | uint64_t *ino); | 332 | uint64_t *ino); |
@@ -385,7 +385,7 @@ GNUNET_DISK_file_open (const char *fn, | |||
385 | * @param size where to write size of the file | 385 | * @param size where to write size of the file |
386 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 386 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
387 | */ | 387 | */ |
388 | int | 388 | enum GNUNET_GenericReturnValue |
389 | GNUNET_DISK_file_handle_size (struct GNUNET_DISK_FileHandle *fh, | 389 | GNUNET_DISK_file_handle_size (struct GNUNET_DISK_FileHandle *fh, |
390 | off_t *size); | 390 | off_t *size); |
391 | 391 | ||
@@ -447,7 +447,7 @@ GNUNET_DISK_pipe_from_fd (enum GNUNET_DISK_PipeFlags pf, | |||
447 | * @param p pipe | 447 | * @param p pipe |
448 | * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise | 448 | * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise |
449 | */ | 449 | */ |
450 | int | 450 | enum GNUNET_GenericReturnValue |
451 | GNUNET_DISK_pipe_close (struct GNUNET_DISK_PipeHandle *p); | 451 | GNUNET_DISK_pipe_close (struct GNUNET_DISK_PipeHandle *p); |
452 | 452 | ||
453 | 453 | ||
@@ -458,7 +458,7 @@ GNUNET_DISK_pipe_close (struct GNUNET_DISK_PipeHandle *p); | |||
458 | * @param end which end of the pipe to close | 458 | * @param end which end of the pipe to close |
459 | * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise | 459 | * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise |
460 | */ | 460 | */ |
461 | int | 461 | enum GNUNET_GenericReturnValue |
462 | GNUNET_DISK_pipe_close_end (struct GNUNET_DISK_PipeHandle *p, | 462 | GNUNET_DISK_pipe_close_end (struct GNUNET_DISK_PipeHandle *p, |
463 | enum GNUNET_DISK_PipeEnd end); | 463 | enum GNUNET_DISK_PipeEnd end); |
464 | 464 | ||
@@ -485,7 +485,7 @@ GNUNET_DISK_pipe_detach_end (struct GNUNET_DISK_PipeHandle *p, | |||
485 | * @param h file handle | 485 | * @param h file handle |
486 | * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise | 486 | * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise |
487 | */ | 487 | */ |
488 | int | 488 | enum GNUNET_GenericReturnValue |
489 | GNUNET_DISK_file_close (struct GNUNET_DISK_FileHandle *h); | 489 | GNUNET_DISK_file_close (struct GNUNET_DISK_FileHandle *h); |
490 | 490 | ||
491 | 491 | ||
@@ -609,16 +609,19 @@ GNUNET_DISK_file_write_blocking (const struct GNUNET_DISK_FileHandle *h, | |||
609 | 609 | ||
610 | 610 | ||
611 | /** | 611 | /** |
612 | * Write a buffer to a file. If the file is longer than | 612 | * Write a buffer to a file atomically. The directory is created if |
613 | * the given buffer size, it will be truncated. | 613 | * necessary. Fail if @a filename already exists or if not exactly @a buf |
614 | * with @a buf_size bytes could be written to @a filename. | ||
614 | * | 615 | * |
615 | * @param fn file name | 616 | * @param fn file name |
616 | * @param buffer the data to write | 617 | * @param buffer the data to write |
617 | * @param n number of bytes to write | 618 | * @param n number of bytes to write |
618 | * @param mode file permissions | 619 | * @param mode file permissions |
619 | * @return number of bytes written on success, #GNUNET_SYSERR on error | 620 | * @return #GNUNET_OK on success, |
621 | * #GNUNET_NO if a file existed under @a filename | ||
622 | * #GNUNET_SYSERR on failure | ||
620 | */ | 623 | */ |
621 | ssize_t | 624 | enum GNUNET_GenericReturnValue |
622 | GNUNET_DISK_fn_write (const char *fn, | 625 | GNUNET_DISK_fn_write (const char *fn, |
623 | const void *buffer, | 626 | const void *buffer, |
624 | size_t n, | 627 | size_t n, |
@@ -632,7 +635,7 @@ GNUNET_DISK_fn_write (const char *fn, | |||
632 | * @param dst destination file name | 635 | * @param dst destination file name |
633 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 636 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
634 | */ | 637 | */ |
635 | int | 638 | enum GNUNET_GenericReturnValue |
636 | GNUNET_DISK_file_copy (const char *src, | 639 | GNUNET_DISK_file_copy (const char *src, |
637 | const char *dst); | 640 | const char *dst); |
638 | 641 | ||
@@ -659,7 +662,7 @@ GNUNET_DISK_directory_scan (const char *dir_name, | |||
659 | * @returns #GNUNET_OK on success, #GNUNET_SYSERR on failure, | 662 | * @returns #GNUNET_OK on success, #GNUNET_SYSERR on failure, |
660 | * #GNUNET_NO if directory exists but is not writeable | 663 | * #GNUNET_NO if directory exists but is not writeable |
661 | */ | 664 | */ |
662 | int | 665 | enum GNUNET_GenericReturnValue |
663 | GNUNET_DISK_directory_create_for_file (const char *filename); | 666 | GNUNET_DISK_directory_create_for_file (const char *filename); |
664 | 667 | ||
665 | 668 | ||
@@ -675,8 +678,9 @@ GNUNET_DISK_directory_create_for_file (const char *filename); | |||
675 | * @return #GNUNET_YES if yes, #GNUNET_NO if not; #GNUNET_SYSERR if it | 678 | * @return #GNUNET_YES if yes, #GNUNET_NO if not; #GNUNET_SYSERR if it |
676 | * does not exist or `stat`ed | 679 | * does not exist or `stat`ed |
677 | */ | 680 | */ |
678 | int | 681 | enum GNUNET_GenericReturnValue |
679 | GNUNET_DISK_directory_test (const char *fil, int is_readable); | 682 | GNUNET_DISK_directory_test (const char *fil, |
683 | int is_readable); | ||
680 | 684 | ||
681 | 685 | ||
682 | /** | 686 | /** |
@@ -685,7 +689,7 @@ GNUNET_DISK_directory_test (const char *fil, int is_readable); | |||
685 | * @param filename the file to remove | 689 | * @param filename the file to remove |
686 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 690 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
687 | */ | 691 | */ |
688 | int | 692 | enum GNUNET_GenericReturnValue |
689 | GNUNET_DISK_directory_remove (const char *filename); | 693 | GNUNET_DISK_directory_remove (const char *filename); |
690 | 694 | ||
691 | 695 | ||
@@ -707,7 +711,7 @@ GNUNET_DISK_purge_cfg_dir (const char *cfg_filename, | |||
707 | * @param dir the directory to create | 711 | * @param dir the directory to create |
708 | * @returns #GNUNET_SYSERR on failure, #GNUNET_OK otherwise | 712 | * @returns #GNUNET_SYSERR on failure, #GNUNET_OK otherwise |
709 | */ | 713 | */ |
710 | int | 714 | enum GNUNET_GenericReturnValue |
711 | GNUNET_DISK_directory_create (const char *dir); | 715 | GNUNET_DISK_directory_create (const char *dir); |
712 | 716 | ||
713 | 717 | ||
@@ -725,7 +729,7 @@ GNUNET_DISK_filename_canonicalize (char *fn); | |||
725 | * @param user new owner of the file | 729 | * @param user new owner of the file |
726 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure | 730 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure |
727 | */ | 731 | */ |
728 | int | 732 | enum GNUNET_GenericReturnValue |
729 | GNUNET_DISK_file_change_owner (const char *filename, | 733 | GNUNET_DISK_file_change_owner (const char *filename, |
730 | const char *user); | 734 | const char *user); |
731 | 735 | ||
@@ -758,7 +762,7 @@ GNUNET_DISK_file_map (const struct GNUNET_DISK_FileHandle *h, | |||
758 | * @param h mapping handle | 762 | * @param h mapping handle |
759 | * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise | 763 | * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise |
760 | */ | 764 | */ |
761 | int | 765 | enum GNUNET_GenericReturnValue |
762 | GNUNET_DISK_file_unmap (struct GNUNET_DISK_MapHandle *h); | 766 | GNUNET_DISK_file_unmap (struct GNUNET_DISK_MapHandle *h); |
763 | 767 | ||
764 | 768 | ||
@@ -768,7 +772,7 @@ GNUNET_DISK_file_unmap (struct GNUNET_DISK_MapHandle *h); | |||
768 | * @param h handle to an open file | 772 | * @param h handle to an open file |
769 | * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise | 773 | * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise |
770 | */ | 774 | */ |
771 | int | 775 | enum GNUNET_GenericReturnValue |
772 | GNUNET_DISK_file_sync (const struct GNUNET_DISK_FileHandle *h); | 776 | GNUNET_DISK_file_sync (const struct GNUNET_DISK_FileHandle *h); |
773 | 777 | ||
774 | 778 | ||