diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-08-15 21:54:06 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-08-15 21:54:06 +0000 |
commit | 5746309cb4be2073d550ad7a6885e918631dbc38 (patch) | |
tree | 89455bc4aadf977816b38df13f990372cd81d71a /src/fs/fs_unindex.c | |
parent | 6fd3e715cae09fa6e657c96f1c6f9711ee51f42f (diff) | |
download | gnunet-5746309cb4be2073d550ad7a6885e918631dbc38.tar.gz gnunet-5746309cb4be2073d550ad7a6885e918631dbc38.zip |
indentation
Diffstat (limited to 'src/fs/fs_unindex.c')
-rw-r--r-- | src/fs/fs_unindex.c | 57 |
1 files changed, 24 insertions, 33 deletions
diff --git a/src/fs/fs_unindex.c b/src/fs/fs_unindex.c index 130b2eae2..a992c5ff6 100644 --- a/src/fs/fs_unindex.c +++ b/src/fs/fs_unindex.c | |||
@@ -84,8 +84,8 @@ GNUNET_FS_unindex_make_status_ (struct GNUNET_FS_ProgressInfo *pi, | |||
84 | pi->value.unindex.cctx = uc->client_info; | 84 | pi->value.unindex.cctx = uc->client_info; |
85 | pi->value.unindex.filename = uc->filename; | 85 | pi->value.unindex.filename = uc->filename; |
86 | pi->value.unindex.size = uc->file_size; | 86 | pi->value.unindex.size = uc->file_size; |
87 | pi->value.unindex.eta | 87 | pi->value.unindex.eta = |
88 | = GNUNET_TIME_calculate_eta (uc->start_time, offset, uc->file_size); | 88 | GNUNET_TIME_calculate_eta (uc->start_time, offset, uc->file_size); |
89 | pi->value.unindex.duration = | 89 | pi->value.unindex.duration = |
90 | GNUNET_TIME_absolute_get_duration (uc->start_time); | 90 | GNUNET_TIME_absolute_get_duration (uc->start_time); |
91 | pi->value.unindex.completed = offset; | 91 | pi->value.unindex.completed = offset; |
@@ -105,9 +105,8 @@ GNUNET_FS_unindex_make_status_ (struct GNUNET_FS_ProgressInfo *pi, | |||
105 | * @param depth depth of the block in the tree, 0 for DBLOCK | 105 | * @param depth depth of the block in the tree, 0 for DBLOCK |
106 | */ | 106 | */ |
107 | static void | 107 | static void |
108 | unindex_progress (void *cls, | 108 | unindex_progress (void *cls, uint64_t offset, const void *pt_block, |
109 | uint64_t offset, | 109 | size_t pt_size, unsigned int depth) |
110 | const void *pt_block, size_t pt_size, unsigned int depth) | ||
111 | { | 110 | { |
112 | struct GNUNET_FS_UnindexContext *uc = cls; | 111 | struct GNUNET_FS_UnindexContext *uc = cls; |
113 | struct GNUNET_FS_ProgressInfo pi; | 112 | struct GNUNET_FS_ProgressInfo pi; |
@@ -181,11 +180,8 @@ process_cont (void *cls, int success, const char *msg) | |||
181 | * @param block_size size of block (in bytes) | 180 | * @param block_size size of block (in bytes) |
182 | */ | 181 | */ |
183 | static void | 182 | static void |
184 | unindex_process (void *cls, | 183 | unindex_process (void *cls, const struct ContentHashKey *chk, uint64_t offset, |
185 | const struct ContentHashKey *chk, | 184 | unsigned int depth, enum GNUNET_BLOCK_Type type, |
186 | uint64_t offset, | ||
187 | unsigned int depth, | ||
188 | enum GNUNET_BLOCK_Type type, | ||
189 | const void *block, uint16_t block_size) | 185 | const void *block, uint16_t block_size) |
190 | { | 186 | { |
191 | struct GNUNET_FS_UnindexContext *uc = cls; | 187 | struct GNUNET_FS_UnindexContext *uc = cls; |
@@ -209,11 +205,7 @@ unindex_process (void *cls, | |||
209 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 205 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
210 | "Sending REMOVE request to DATASTORE service\n"); | 206 | "Sending REMOVE request to DATASTORE service\n"); |
211 | #endif | 207 | #endif |
212 | GNUNET_DATASTORE_remove (uc->dsh, | 208 | GNUNET_DATASTORE_remove (uc->dsh, &chk->query, size, data, -2, 1, |
213 | &chk->query, | ||
214 | size, | ||
215 | data, | ||
216 | -2, 1, | ||
217 | GNUNET_CONSTANTS_SERVICE_TIMEOUT, &process_cont, uc); | 209 | GNUNET_CONSTANTS_SERVICE_TIMEOUT, &process_cont, uc); |
218 | } | 210 | } |
219 | 211 | ||
@@ -341,8 +333,9 @@ GNUNET_FS_unindex_do_remove_ (struct GNUNET_FS_UnindexContext *uc) | |||
341 | signal_unindex_error (uc); | 333 | signal_unindex_error (uc); |
342 | return; | 334 | return; |
343 | } | 335 | } |
344 | uc->fh = GNUNET_DISK_file_open (uc->filename, | 336 | uc->fh = |
345 | GNUNET_DISK_OPEN_READ, GNUNET_DISK_PERM_NONE); | 337 | GNUNET_DISK_file_open (uc->filename, GNUNET_DISK_OPEN_READ, |
338 | GNUNET_DISK_PERM_NONE); | ||
346 | if (NULL == uc->fh) | 339 | if (NULL == uc->fh) |
347 | { | 340 | { |
348 | GNUNET_DATASTORE_disconnect (uc->dsh, GNUNET_NO); | 341 | GNUNET_DATASTORE_disconnect (uc->dsh, GNUNET_NO); |
@@ -353,12 +346,10 @@ GNUNET_FS_unindex_do_remove_ (struct GNUNET_FS_UnindexContext *uc) | |||
353 | signal_unindex_error (uc); | 346 | signal_unindex_error (uc); |
354 | return; | 347 | return; |
355 | } | 348 | } |
356 | uc->tc = GNUNET_FS_tree_encoder_create (uc->h, | 349 | uc->tc = |
357 | uc->file_size, | 350 | GNUNET_FS_tree_encoder_create (uc->h, uc->file_size, uc, &unindex_reader, |
358 | uc, | 351 | &unindex_process, &unindex_progress, |
359 | &unindex_reader, | 352 | &unindex_finish); |
360 | &unindex_process, | ||
361 | &unindex_progress, &unindex_finish); | ||
362 | GNUNET_FS_tree_encoder_next (uc->tc); | 353 | GNUNET_FS_tree_encoder_next (uc->tc); |
363 | } | 354 | } |
364 | 355 | ||
@@ -436,8 +427,8 @@ GNUNET_FS_unindex_signal_suspend_ (void *cls) | |||
436 | GNUNET_FS_end_top (uc->h, uc->top); | 427 | GNUNET_FS_end_top (uc->h, uc->top); |
437 | pi.status = GNUNET_FS_STATUS_UNINDEX_SUSPEND; | 428 | pi.status = GNUNET_FS_STATUS_UNINDEX_SUSPEND; |
438 | GNUNET_FS_unindex_make_status_ (&pi, uc, | 429 | GNUNET_FS_unindex_make_status_ (&pi, uc, |
439 | (uc->state == UNINDEX_STATE_COMPLETE) | 430 | (uc->state == |
440 | ? uc->file_size : 0); | 431 | UNINDEX_STATE_COMPLETE) ? uc->file_size : 0); |
441 | GNUNET_break (NULL == uc->client_info); | 432 | GNUNET_break (NULL == uc->client_info); |
442 | GNUNET_free (uc->filename); | 433 | GNUNET_free (uc->filename); |
443 | GNUNET_free_non_null (uc->serialization); | 434 | GNUNET_free_non_null (uc->serialization); |
@@ -455,8 +446,8 @@ GNUNET_FS_unindex_signal_suspend_ (void *cls) | |||
455 | * @return NULL on error, otherwise handle | 446 | * @return NULL on error, otherwise handle |
456 | */ | 447 | */ |
457 | struct GNUNET_FS_UnindexContext * | 448 | struct GNUNET_FS_UnindexContext * |
458 | GNUNET_FS_unindex_start (struct GNUNET_FS_Handle *h, | 449 | GNUNET_FS_unindex_start (struct GNUNET_FS_Handle *h, const char *filename, |
459 | const char *filename, void *cctx) | 450 | void *cctx) |
460 | { | 451 | { |
461 | struct GNUNET_FS_UnindexContext *ret; | 452 | struct GNUNET_FS_UnindexContext *ret; |
462 | struct GNUNET_FS_ProgressInfo pi; | 453 | struct GNUNET_FS_ProgressInfo pi; |
@@ -474,10 +465,10 @@ GNUNET_FS_unindex_start (struct GNUNET_FS_Handle *h, | |||
474 | pi.status = GNUNET_FS_STATUS_UNINDEX_START; | 465 | pi.status = GNUNET_FS_STATUS_UNINDEX_START; |
475 | pi.value.unindex.eta = GNUNET_TIME_UNIT_FOREVER_REL; | 466 | pi.value.unindex.eta = GNUNET_TIME_UNIT_FOREVER_REL; |
476 | GNUNET_FS_unindex_make_status_ (&pi, ret, 0); | 467 | GNUNET_FS_unindex_make_status_ (&pi, ret, 0); |
477 | ret->fhc = GNUNET_CRYPTO_hash_file (GNUNET_SCHEDULER_PRIORITY_IDLE, | 468 | ret->fhc = |
478 | filename, | 469 | GNUNET_CRYPTO_hash_file (GNUNET_SCHEDULER_PRIORITY_IDLE, filename, |
479 | HASHING_BLOCKSIZE, | 470 | HASHING_BLOCKSIZE, |
480 | &GNUNET_FS_unindex_process_hash_, ret); | 471 | &GNUNET_FS_unindex_process_hash_, ret); |
481 | ret->top = GNUNET_FS_make_top (h, &GNUNET_FS_unindex_signal_suspend_, ret); | 472 | ret->top = GNUNET_FS_make_top (h, &GNUNET_FS_unindex_signal_suspend_, ret); |
482 | return ret; | 473 | return ret; |
483 | } | 474 | } |
@@ -529,8 +520,8 @@ GNUNET_FS_unindex_stop (struct GNUNET_FS_UnindexContext *uc) | |||
529 | pi.status = GNUNET_FS_STATUS_UNINDEX_STOPPED; | 520 | pi.status = GNUNET_FS_STATUS_UNINDEX_STOPPED; |
530 | pi.value.unindex.eta = GNUNET_TIME_UNIT_ZERO; | 521 | pi.value.unindex.eta = GNUNET_TIME_UNIT_ZERO; |
531 | GNUNET_FS_unindex_make_status_ (&pi, uc, | 522 | GNUNET_FS_unindex_make_status_ (&pi, uc, |
532 | (uc->state == UNINDEX_STATE_COMPLETE) | 523 | (uc->state == |
533 | ? uc->file_size : 0); | 524 | UNINDEX_STATE_COMPLETE) ? uc->file_size : 0); |
534 | GNUNET_break (NULL == uc->client_info); | 525 | GNUNET_break (NULL == uc->client_info); |
535 | GNUNET_free (uc->filename); | 526 | GNUNET_free (uc->filename); |
536 | GNUNET_free (uc); | 527 | GNUNET_free (uc); |