diff options
author | Christian Grothoff <christian@grothoff.org> | 2009-08-30 19:24:21 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2009-08-30 19:24:21 +0000 |
commit | 4f64cda2fd1594d6fcb419707e652d0811111086 (patch) | |
tree | 0453a103fa43ddbe7363b32168e9bb886a39bcc8 /src/fs/fs_directory.c | |
parent | 53fa6b097734a4545ac4bc02a9f058446434e45f (diff) | |
download | gnunet-4f64cda2fd1594d6fcb419707e652d0811111086.tar.gz gnunet-4f64cda2fd1594d6fcb419707e652d0811111086.zip |
clarification
Diffstat (limited to 'src/fs/fs_directory.c')
-rw-r--r-- | src/fs/fs_directory.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/fs/fs_directory.c b/src/fs/fs_directory.c index be7c0d3e5..d67c6e8ef 100644 --- a/src/fs/fs_directory.c +++ b/src/fs/fs_directory.c | |||
@@ -173,11 +173,11 @@ GNUNET_FS_directory_list_contents (size_t size, | |||
173 | /* URI is never empty, must be end of block, | 173 | /* URI is never empty, must be end of block, |
174 | skip to next alignment */ | 174 | skip to next alignment */ |
175 | align = | 175 | align = |
176 | ((pos / GNUNET_FS_DBLOCK_SIZE) + 1) * GNUNET_FS_DBLOCK_SIZE; | 176 | ((pos / DBLOCK_SIZE) + 1) * DBLOCK_SIZE; |
177 | if (align == pos) | 177 | if (align == pos) |
178 | { | 178 | { |
179 | /* if we were already aligned, still skip a block! */ | 179 | /* if we were already aligned, still skip a block! */ |
180 | align += GNUNET_FS_DBLOCK_SIZE; | 180 | align += DBLOCK_SIZE; |
181 | } | 181 | } |
182 | pos = align; | 182 | pos = align; |
183 | if (pos >= size) | 183 | if (pos >= size) |
@@ -333,7 +333,7 @@ GNUNET_FS_directory_builder_add (struct GNUNET_FS_DirectoryBuilder *bld, | |||
333 | fsize = GNUNET_FS_uri_chk_get_file_size (GNUNET_FS_uri_loc_get_uri (uri)); | 333 | fsize = GNUNET_FS_uri_chk_get_file_size (GNUNET_FS_uri_loc_get_uri (uri)); |
334 | else | 334 | else |
335 | fsize = 0; /* not given */ | 335 | fsize = 0; /* not given */ |
336 | if (fsize > GNUNET_FS_MAX_INLINE_SIZE) | 336 | if (fsize > MAX_INLINE_SIZE) |
337 | fsize = 0; /* too large */ | 337 | fsize = 0; /* too large */ |
338 | if (NULL != memchr (data, 0, fsize)) | 338 | if (NULL != memchr (data, 0, fsize)) |
339 | fsize = 0; /* must not have 0's in data! */ | 339 | fsize = 0; /* must not have 0's in data! */ |
@@ -353,8 +353,8 @@ GNUNET_FS_directory_builder_add (struct GNUNET_FS_DirectoryBuilder *bld, | |||
353 | mdxs = | 353 | mdxs = |
354 | GNUNET_CONTAINER_meta_data_get_serialized_size (meta, | 354 | GNUNET_CONTAINER_meta_data_get_serialized_size (meta, |
355 | GNUNET_CONTAINER_META_DATA_SERIALIZE_FULL); | 355 | GNUNET_CONTAINER_META_DATA_SERIALIZE_FULL); |
356 | if ( (slen + sizeof (uint32_t) + mdxs - 1) / GNUNET_FS_DBLOCK_SIZE == | 356 | if ( (slen + sizeof (uint32_t) + mdxs - 1) / DBLOCK_SIZE == |
357 | (slen + sizeof (uint32_t) + mds - 1) / GNUNET_FS_DBLOCK_SIZE) | 357 | (slen + sizeof (uint32_t) + mds - 1) / DBLOCK_SIZE) |
358 | { | 358 | { |
359 | /* adding full data would not cause us to cross | 359 | /* adding full data would not cause us to cross |
360 | additional blocks, so add it! */ | 360 | additional blocks, so add it! */ |
@@ -392,7 +392,7 @@ GNUNET_FS_directory_builder_add (struct GNUNET_FS_DirectoryBuilder *bld, | |||
392 | /** | 392 | /** |
393 | * Given the start and end position of a block of | 393 | * Given the start and end position of a block of |
394 | * data, return the end position of that data | 394 | * data, return the end position of that data |
395 | * after alignment to the GNUNET_FS_DBLOCK_SIZE. | 395 | * after alignment to the DBLOCK_SIZE. |
396 | */ | 396 | */ |
397 | static size_t | 397 | static size_t |
398 | do_align (size_t start_position, | 398 | do_align (size_t start_position, |
@@ -400,7 +400,7 @@ do_align (size_t start_position, | |||
400 | { | 400 | { |
401 | size_t align; | 401 | size_t align; |
402 | 402 | ||
403 | align = (end_position / GNUNET_FS_DBLOCK_SIZE) * GNUNET_FS_DBLOCK_SIZE; | 403 | align = (end_position / DBLOCK_SIZE) * DBLOCK_SIZE; |
404 | if ((start_position < align) && (end_position > align)) | 404 | if ((start_position < align) && (end_position > align)) |
405 | return align + end_position - start_position; | 405 | return align + end_position - start_position; |
406 | return end_position; | 406 | return end_position; |
@@ -442,28 +442,28 @@ block_align (size_t start, | |||
442 | { | 442 | { |
443 | cval = perm[j]; | 443 | cval = perm[j]; |
444 | cend = cpos + sizes[cval]; | 444 | cend = cpos + sizes[cval]; |
445 | if (cpos % GNUNET_FS_DBLOCK_SIZE == 0) | 445 | if (cpos % DBLOCK_SIZE == 0) |
446 | { | 446 | { |
447 | /* prefer placing the largest blocks first */ | 447 | /* prefer placing the largest blocks first */ |
448 | cbad = -(cend % GNUNET_FS_DBLOCK_SIZE); | 448 | cbad = -(cend % DBLOCK_SIZE); |
449 | } | 449 | } |
450 | else | 450 | else |
451 | { | 451 | { |
452 | if (cpos / GNUNET_FS_DBLOCK_SIZE == | 452 | if (cpos / DBLOCK_SIZE == |
453 | cend / GNUNET_FS_DBLOCK_SIZE) | 453 | cend / DBLOCK_SIZE) |
454 | { | 454 | { |
455 | /* Data fits into the same block! Prefer small left-overs! */ | 455 | /* Data fits into the same block! Prefer small left-overs! */ |
456 | cbad = | 456 | cbad = |
457 | GNUNET_FS_DBLOCK_SIZE - cend % GNUNET_FS_DBLOCK_SIZE; | 457 | DBLOCK_SIZE - cend % DBLOCK_SIZE; |
458 | } | 458 | } |
459 | else | 459 | else |
460 | { | 460 | { |
461 | /* Would have to waste space to re-align, add big factor, this | 461 | /* Would have to waste space to re-align, add big factor, this |
462 | case is a real loss (proportional to space wasted)! */ | 462 | case is a real loss (proportional to space wasted)! */ |
463 | cbad = | 463 | cbad = |
464 | GNUNET_FS_DBLOCK_SIZE * (GNUNET_FS_DBLOCK_SIZE - | 464 | DBLOCK_SIZE * (DBLOCK_SIZE - |
465 | cpos % | 465 | cpos % |
466 | GNUNET_FS_DBLOCK_SIZE); | 466 | DBLOCK_SIZE); |
467 | } | 467 | } |
468 | } | 468 | } |
469 | if (cbad < badness) | 469 | if (cbad < badness) |