aboutsummaryrefslogtreecommitdiff
path: root/src/fs
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-03-31 13:21:24 +0000
committerChristian Grothoff <christian@grothoff.org>2011-03-31 13:21:24 +0000
commit672d4cc8c0d9d2f7420e837511bffac88777345b (patch)
treefd087cd175dceb4d41b71334cf6d9f0fcadb24c2 /src/fs
parent664f658ddc0b302cc7b04d31319dba1e26f5f603 (diff)
downloadgnunet-672d4cc8c0d9d2f7420e837511bffac88777345b.tar.gz
gnunet-672d4cc8c0d9d2f7420e837511bffac88777345b.zip
fixes
Diffstat (limited to 'src/fs')
-rw-r--r--src/fs/Makefile.am6
-rw-r--r--src/fs/fs_download.c35
-rw-r--r--src/fs/gnunet-service-fs_cp.c12
-rw-r--r--src/fs/gnunet-service-fs_pe.c6
-rw-r--r--src/fs/gnunet-service-fs_push.c1
5 files changed, 19 insertions, 41 deletions
diff --git a/src/fs/Makefile.am b/src/fs/Makefile.am
index 49d424825..94970019f 100644
--- a/src/fs/Makefile.am
+++ b/src/fs/Makefile.am
@@ -217,6 +217,7 @@ endif
217test_fs_directory_SOURCES = \ 217test_fs_directory_SOURCES = \
218 test_fs_directory.c 218 test_fs_directory.c
219test_fs_directory_LDADD = \ 219test_fs_directory_LDADD = \
220 -lextractor \
220 $(top_builddir)/src/fs/libgnunetfs.la \ 221 $(top_builddir)/src/fs/libgnunetfs.la \
221 $(top_builddir)/src/util/libgnunetutil.la 222 $(top_builddir)/src/util/libgnunetutil.la
222 223
@@ -241,6 +242,7 @@ test_fs_download_persistence_LDADD = \
241test_fs_file_information_SOURCES = \ 242test_fs_file_information_SOURCES = \
242 test_fs_file_information.c 243 test_fs_file_information.c
243test_fs_file_information_LDADD = \ 244test_fs_file_information_LDADD = \
245 -lextractor \
244 $(top_builddir)/src/fs/libgnunetfs.la \ 246 $(top_builddir)/src/fs/libgnunetfs.la \
245 $(top_builddir)/src/util/libgnunetutil.la 247 $(top_builddir)/src/util/libgnunetutil.la
246 248
@@ -342,6 +344,7 @@ perf_gnunet_service_fs_p2p_SOURCES = \
342 perf_gnunet_service_fs_p2p.c 344 perf_gnunet_service_fs_p2p.c
343perf_gnunet_service_fs_p2p_LDADD = \ 345perf_gnunet_service_fs_p2p_LDADD = \
344 $(top_builddir)/src/fs/libgnunetfstest.a \ 346 $(top_builddir)/src/fs/libgnunetfstest.a \
347 $(top_builddir)/src/statistics/libgnunetstatistics.la \
345 $(top_builddir)/src/testing/libgnunettesting.la \ 348 $(top_builddir)/src/testing/libgnunettesting.la \
346 $(top_builddir)/src/fs/libgnunetfs.la \ 349 $(top_builddir)/src/fs/libgnunetfs.la \
347 $(top_builddir)/src/util/libgnunetutil.la 350 $(top_builddir)/src/util/libgnunetutil.la
@@ -350,6 +353,7 @@ perf_gnunet_service_fs_p2p_index_SOURCES = \
350 perf_gnunet_service_fs_p2p.c 353 perf_gnunet_service_fs_p2p.c
351perf_gnunet_service_fs_p2p_index_LDADD = \ 354perf_gnunet_service_fs_p2p_index_LDADD = \
352 $(top_builddir)/src/fs/libgnunetfstest.a \ 355 $(top_builddir)/src/fs/libgnunetfstest.a \
356 $(top_builddir)/src/statistics/libgnunetstatistics.la \
353 $(top_builddir)/src/testing/libgnunettesting.la \ 357 $(top_builddir)/src/testing/libgnunettesting.la \
354 $(top_builddir)/src/fs/libgnunetfs.la \ 358 $(top_builddir)/src/fs/libgnunetfs.la \
355 $(top_builddir)/src/util/libgnunetutil.la 359 $(top_builddir)/src/util/libgnunetutil.la
@@ -358,6 +362,7 @@ perf_gnunet_service_fs_p2p_dht_SOURCES = \
358 perf_gnunet_service_fs_p2p.c 362 perf_gnunet_service_fs_p2p.c
359perf_gnunet_service_fs_p2p_dht_LDADD = \ 363perf_gnunet_service_fs_p2p_dht_LDADD = \
360 $(top_builddir)/src/fs/libgnunetfstest.a \ 364 $(top_builddir)/src/fs/libgnunetfstest.a \
365 $(top_builddir)/src/statistics/libgnunetstatistics.la \
361 $(top_builddir)/src/testing/libgnunettesting.la \ 366 $(top_builddir)/src/testing/libgnunettesting.la \
362 $(top_builddir)/src/fs/libgnunetfs.la \ 367 $(top_builddir)/src/fs/libgnunetfs.la \
363 $(top_builddir)/src/util/libgnunetutil.la 368 $(top_builddir)/src/util/libgnunetutil.la
@@ -366,6 +371,7 @@ perf_gnunet_service_fs_p2p_trust_SOURCES = \
366 perf_gnunet_service_fs_p2p_trust.c 371 perf_gnunet_service_fs_p2p_trust.c
367perf_gnunet_service_fs_p2p_trust_LDADD = \ 372perf_gnunet_service_fs_p2p_trust_LDADD = \
368 $(top_builddir)/src/fs/libgnunetfstest.a \ 373 $(top_builddir)/src/fs/libgnunetfstest.a \
374 $(top_builddir)/src/statistics/libgnunetstatistics.la \
369 $(top_builddir)/src/testing/libgnunettesting.la \ 375 $(top_builddir)/src/testing/libgnunettesting.la \
370 $(top_builddir)/src/fs/libgnunetfs.la \ 376 $(top_builddir)/src/fs/libgnunetfs.la \
371 $(top_builddir)/src/util/libgnunetutil.la 377 $(top_builddir)/src/util/libgnunetutil.la
diff --git a/src/fs/fs_download.c b/src/fs/fs_download.c
index 22fdd2141..8192b8c1f 100644
--- a/src/fs/fs_download.c
+++ b/src/fs/fs_download.c
@@ -98,38 +98,6 @@ compute_disk_offset (uint64_t fsize,
98 98
99 99
100/** 100/**
101 * Given a block at the given offset and depth, calculate the offset
102 * for the CHK at the given index.
103 *
104 * @param offset the offset of the first
105 * DBLOCK in the subtree of the
106 * identified IBLOCK
107 * @param depth the depth of the IBLOCK in the tree, 0 for DBLOCK
108 * @param k which CHK in the IBLOCK are we
109 * talking about
110 * @return offset if k=0, otherwise an appropriately
111 * larger value (i.e., if depth = 1,
112 * the returned value should be offset+k*DBLOCK_SIZE)
113 */
114static uint64_t
115compute_dblock_offset (uint64_t offset,
116 unsigned int depth,
117 unsigned int k)
118{
119 unsigned int i;
120 uint64_t lsize; /* what is the size of the sum of all DBlocks
121 that a CHK at depth i corresponds to? */
122
123 if (depth == 0)
124 return offset;
125 lsize = DBLOCK_SIZE;
126 for (i=1;i<depth;i++)
127 lsize *= CHK_PER_INODE;
128 return offset + k * lsize;
129}
130
131
132/**
133 * Fill in all of the generic fields for a download event and call the 101 * Fill in all of the generic fields for a download event and call the
134 * callback. 102 * callback.
135 * 103 *
@@ -1277,9 +1245,6 @@ process_result_with_request (void *cls,
1277 chk = (struct ContentHashKey*) pt; 1245 chk = (struct ContentHashKey*) pt;
1278 for (i=(prc->size / sizeof(struct ContentHashKey))-1;i>=0;i--) 1246 for (i=(prc->size / sizeof(struct ContentHashKey))-1;i>=0;i--)
1279 { 1247 {
1280 off = compute_dblock_offset (dr->offset,
1281 dr->depth,
1282 i);
1283 drc = dr->children[i]; 1248 drc = dr->children[i];
1284 switch (drc->state) 1249 switch (drc->state)
1285 { 1250 {
diff --git a/src/fs/gnunet-service-fs_cp.c b/src/fs/gnunet-service-fs_cp.c
index 0452b7332..3298a5216 100644
--- a/src/fs/gnunet-service-fs_cp.c
+++ b/src/fs/gnunet-service-fs_cp.c
@@ -939,6 +939,18 @@ GSF_handle_p2p_query_ (const struct GNUNET_PeerIdentity *other,
939 (unsigned int) bm); 939 (unsigned int) bm);
940#endif 940#endif
941 namespace = (0 != (bm & GET_MESSAGE_BIT_SKS_NAMESPACE)) ? &opt[bits++] : NULL; 941 namespace = (0 != (bm & GET_MESSAGE_BIT_SKS_NAMESPACE)) ? &opt[bits++] : NULL;
942 if ( (type == GNUNET_BLOCK_TYPE_FS_SBLOCK) &&
943 (namespace == NULL) )
944 {
945 GNUNET_break_op (0);
946 return NULL;
947 }
948 if ( (type != GNUNET_BLOCK_TYPE_FS_SBLOCK) &&
949 (namespace != NULL) )
950 {
951 GNUNET_break_op (0);
952 return NULL;
953 }
942 target = (0 != (bm & GET_MESSAGE_BIT_TRANSMIT_TO)) ? ((const struct GNUNET_PeerIdentity*) &opt[bits++]) : NULL; 954 target = (0 != (bm & GET_MESSAGE_BIT_TRANSMIT_TO)) ? ((const struct GNUNET_PeerIdentity*) &opt[bits++]) : NULL;
943 options = 0; 955 options = 0;
944 spid = 0; 956 spid = 0;
diff --git a/src/fs/gnunet-service-fs_pe.c b/src/fs/gnunet-service-fs_pe.c
index c193c1472..e09a8567b 100644
--- a/src/fs/gnunet-service-fs_pe.c
+++ b/src/fs/gnunet-service-fs_pe.c
@@ -217,7 +217,6 @@ schedule_peer_transmission (void *cls,
217{ 217{
218 struct PeerPlan *pp = cls; 218 struct PeerPlan *pp = cls;
219 struct GSF_RequestPlan *rp; 219 struct GSF_RequestPlan *rp;
220 struct GSF_PendingRequestData *prd;
221 size_t msize; 220 size_t msize;
222 221
223 pp->task = GNUNET_SCHEDULER_NO_TASK; 222 pp->task = GNUNET_SCHEDULER_NO_TASK;
@@ -226,12 +225,10 @@ schedule_peer_transmission (void *cls,
226 while ( (NULL != (rp = GNUNET_CONTAINER_heap_peek (pp->delay_heap))) && 225 while ( (NULL != (rp = GNUNET_CONTAINER_heap_peek (pp->delay_heap))) &&
227 (GNUNET_TIME_absolute_get_remaining (rp->earliest_transmission).rel_value == 0) ) 226 (GNUNET_TIME_absolute_get_remaining (rp->earliest_transmission).rel_value == 0) )
228 { 227 {
229 rp = GNUNET_CONTAINER_heap_remove_root (pp->delay_heap); 228 GNUNET_assert (rp == GNUNET_CONTAINER_heap_remove_root (pp->delay_heap));
230 rp->hn = GNUNET_CONTAINER_heap_insert (pp->priority_heap, 229 rp->hn = GNUNET_CONTAINER_heap_insert (pp->priority_heap,
231 rp, 230 rp,
232 rp->priority); 231 rp->priority);
233 if (NULL == (rp = GNUNET_CONTAINER_heap_peek (pp->delay_heap)))
234 break;
235 } 232 }
236 if (0 == GNUNET_CONTAINER_heap_get_size (pp->priority_heap)) 233 if (0 == GNUNET_CONTAINER_heap_get_size (pp->priority_heap))
237 { 234 {
@@ -247,7 +244,6 @@ schedule_peer_transmission (void *cls,
247 /* process from priority heap */ 244 /* process from priority heap */
248 rp = GNUNET_CONTAINER_heap_peek (pp->priority_heap); 245 rp = GNUNET_CONTAINER_heap_peek (pp->priority_heap);
249 GNUNET_assert (NULL != rp); 246 GNUNET_assert (NULL != rp);
250 prd = GSF_pending_request_get_data_ (rp->pr);
251 msize = GSF_pending_request_get_message_ (rp->pr, 0, NULL); 247 msize = GSF_pending_request_get_message_ (rp->pr, 0, NULL);
252 pp->pth = GSF_peer_transmit_ (pp->cp, 248 pp->pth = GSF_peer_transmit_ (pp->cp,
253 GNUNET_YES, 249 GNUNET_YES,
diff --git a/src/fs/gnunet-service-fs_push.c b/src/fs/gnunet-service-fs_push.c
index 65b15f356..b96ee3d1c 100644
--- a/src/fs/gnunet-service-fs_push.c
+++ b/src/fs/gnunet-service-fs_push.c
@@ -404,7 +404,6 @@ find_content (struct MigrationReadyPeer *mrp)
404 /* failed to find migration target AND 404 /* failed to find migration target AND
405 queue is full, purge most-forwarded 405 queue is full, purge most-forwarded
406 block from queue to make room for more */ 406 block from queue to make room for more */
407 score = 0;
408 pos = mig_head; 407 pos = mig_head;
409 while (NULL != pos) 408 while (NULL != pos)
410 { 409 {