gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r345 - in GNUnet: . src/applications/fs/ecrs


From: grothoff
Subject: [GNUnet-SVN] r345 - in GNUnet: . src/applications/fs/ecrs
Date: Sun, 27 Feb 2005 18:55:43 -0800 (PST)

Author: grothoff
Date: 2005-02-27 18:55:42 -0800 (Sun, 27 Feb 2005)
New Revision: 345

Modified:
   GNUnet/src/applications/fs/ecrs/check.conf
   GNUnet/src/applications/fs/ecrs/download.c
   GNUnet/src/applications/fs/ecrs/ecrs.c
   GNUnet/src/applications/fs/ecrs/ecrstest.c
   GNUnet/src/applications/fs/ecrs/meta.c
   GNUnet/src/applications/fs/ecrs/tree.c
   GNUnet/src/applications/fs/ecrs/tree.h
   GNUnet/src/applications/fs/ecrs/uritest.c
   GNUnet/todo
Log:
fixing ecrstest

Modified: GNUnet/src/applications/fs/ecrs/check.conf
===================================================================
--- GNUnet/src/applications/fs/ecrs/check.conf  2005-02-28 00:38:59 UTC (rev 
344)
+++ GNUnet/src/applications/fs/ecrs/check.conf  2005-02-28 02:55:42 UTC (rev 
345)
@@ -6,7 +6,7 @@
 [GNUNETD]
 # VALGRIND        = 300
 HELOEXPIRES     = 60
-LOGLEVEL        = DEBUG
+LOGLEVEL        = NOTHING
 LOGFILE         = $GNUNETD_HOME/logs
 KEEPLOG         = 0
 PIDFILE         = $GNUNETD_HOME/gnunetd.pid

Modified: GNUnet/src/applications/fs/ecrs/download.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/download.c  2005-02-28 00:38:59 UTC (rev 
344)
+++ GNUnet/src/applications/fs/ecrs/download.c  2005-02-28 02:55:42 UTC (rev 
345)
@@ -583,18 +583,30 @@
     if (node->offset + (unsigned long long) ret
        > node->ctx->total)
       ret = (unsigned int) (node->ctx->total - node->offset);
+#if 0
+    printf("Node at offset %llu and level %d has size %u\n",
+          node->offset,
+          node->level,
+          ret);
+#endif
     return ret;
   }
   rsize = DBLOCK_SIZE;
-  for (i=0;i<node->level;i++)
+  for (i=0;i<node->level-1;i++)
     rsize *= CHK_PER_INODE;
-  spos = rsize * (node->offset / sizeof(CHK));
-  epos = spos + rsize;
+  spos = rsize * CHK_PER_INODE * (node->offset / sizeof(CHK));
+  epos = spos + rsize * CHK_PER_INODE;
   if (epos > node->ctx->total)
     epos = node->ctx->total;
   ret = (epos - spos) / rsize;
   if (ret * rsize < epos - spos)
     ret++; /* need to round up! */
+#if 0
+  printf("Node at offset %llu and level %d has size %u\n",
+        node->offset,
+        node->level,
+        ret * sizeof(CHK));
+#endif
   return ret * sizeof(CHK);
 }
 
@@ -760,18 +772,23 @@
     BREAK();
     return;
   }
-  if (node->level == 1)
+  if (node->level == 1) {
     levelSize = DBLOCK_SIZE;
-  else
+    baseOffset = node->offset / sizeof(CHK) * CHK_PER_INODE * DBLOCK_SIZE;
+  } else {
     levelSize = sizeof(CHK);
-  baseOffset = node->offset * CHK_PER_INODE;
+    baseOffset = node->offset * CHK_PER_INODE;
+  }
   chks = (CHK*) data;
   for (i=0;i<childcount;i++) {
     child = MALLOC(sizeof(NodeClosure));
     child->ctx = node->ctx;
     child->chk = chks[i];
     child->offset = baseOffset + i * levelSize;
+    GNUNET_ASSERT(child->offset < node->ctx->total);
     child->level = node->level - 1;
+    GNUNET_ASSERT( (child->level != 0) ||
+                  ( (child->offset % DBLOCK_SIZE) == 0) );
     if (NO == checkPresent(child))
       addRequest(node->ctx->rm,
                 child);
@@ -841,7 +858,7 @@
   if ( (size <= sizeof(DBlock)) ||
        (size - sizeof(DBlock) != getNodeSize(node)) ) {
     printf("Received %u bytes, expected %u\n",
-          size,
+          size - sizeof(DBlock),
           getNodeSize(node));
     BREAK();
     return SYSERR; /* invalid size! */

Modified: GNUnet/src/applications/fs/ecrs/ecrs.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/ecrs.c      2005-02-28 00:38:59 UTC (rev 
344)
+++ GNUnet/src/applications/fs/ecrs/ecrs.c      2005-02-28 02:55:42 UTC (rev 
345)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     (C) 2004 Christian Grothoff (and other contributing authors)
+     (C) 2004, 2005 Christian Grothoff (and other contributing authors)
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published

Modified: GNUnet/src/applications/fs/ecrs/ecrstest.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/ecrstest.c  2005-02-28 00:38:59 UTC (rev 
344)
+++ GNUnet/src/applications/fs/ecrs/ecrstest.c  2005-02-28 02:55:42 UTC (rev 
345)
@@ -1,3 +1,23 @@
+/*
+     This file is part of GNUnet.
+     (C) 2004, 2005 Christian Grothoff (and other contributing authors)
+
+     GNUnet is free software; you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published
+     by the Free Software Foundation; either version 2, or (at your
+     option) any later version.
+
+     GNUnet is distributed in the hope that it will be useful, but
+     WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+     General Public License for more details.
+
+     You should have received a copy of the GNU General Public License
+     along with GNUnet; see the file COPYING.  If not, write to the
+     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+     Boston, MA 02111-1307, USA.
+*/
+
 /** 
  * @file applications/fs/ecrs/ecrstest.c
  * @brief testcase for ecrs (upload-download)
@@ -22,7 +42,7 @@
                                     NULL));
   FREENONNULL(setConfigurationString("GNUNET",
                                     "LOGLEVEL",
-                                    "DEBUG"));
+                                    "NOTHING"));
   return OK;
 }
 
@@ -217,12 +237,6 @@
 
 int main(int argc, char * argv[]){
   static unsigned int filesizes[] = {
-/*    1,
-    2,
-    4,
-    16,
-    32, */ 
-    1024,
     DBLOCK_SIZE - 1,
     DBLOCK_SIZE,
     DBLOCK_SIZE + 1,
@@ -232,6 +246,12 @@
     DBLOCK_SIZE * CHK_PER_INODE * CHK_PER_INODE - 1,
     DBLOCK_SIZE * CHK_PER_INODE * CHK_PER_INODE,
     DBLOCK_SIZE * CHK_PER_INODE * CHK_PER_INODE + 1,
+    1,
+    2,
+    4,
+    16,
+    32, 
+    1024, 
     0
   };
   pid_t daemon;

Modified: GNUnet/src/applications/fs/ecrs/meta.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/meta.c      2005-02-28 00:38:59 UTC (rev 
344)
+++ GNUnet/src/applications/fs/ecrs/meta.c      2005-02-28 02:55:42 UTC (rev 
345)
@@ -118,15 +118,16 @@
   int sub;
 
   sub = 0;
-  if (iterator != NULL) 
-    for (i=md->itemCount-1;i>=0;i--) {
-      if (md->items[i].type !=  EXTRACTOR_THUMBNAIL_DATA) {
-       if (OK != iterator(md->items[i].type,
+  for (i=md->itemCount-1;i>=0;i--) {
+    if (md->items[i].type !=  EXTRACTOR_THUMBNAIL_DATA) {
+      if ( (iterator != NULL) &&
+          (OK != iterator(md->items[i].type,
                           md->items[i].data,
-                          closure))
-         return SYSERR;
-      } else
-       sub++;
+                          closure)) )
+       return SYSERR;
+    } else
+      sub++;
+  }
   return md->itemCount - sub;
 }
 

Modified: GNUnet/src/applications/fs/ecrs/tree.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/tree.c      2005-02-28 00:38:59 UTC (rev 
344)
+++ GNUnet/src/applications/fs/ecrs/tree.c      2005-02-28 02:55:42 UTC (rev 
345)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     (C) 2001, 2002, 2003, 2004 Christian Grothoff (and other contributing 
authors)
+     (C) 2001, 2002, 2003, 2004, 2005 Christian Grothoff (and other 
contributing authors)
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -31,7 +31,7 @@
 
   treeDepth = 0;
   fl = DBLOCK_SIZE;
-  while (fl < (unsigned long long)flen) {
+  while (fl < flen) {
     treeDepth++;
     if (fl * CHK_PER_INODE < fl) {
       /* integer overflow, this is a HUGE file... */

Modified: GNUnet/src/applications/fs/ecrs/tree.h
===================================================================
--- GNUnet/src/applications/fs/ecrs/tree.h      2005-02-28 00:38:59 UTC (rev 
344)
+++ GNUnet/src/applications/fs/ecrs/tree.h      2005-02-28 02:55:42 UTC (rev 
345)
@@ -25,9 +25,10 @@
 
 /**
  * Size of a DBlock.  Currently set for debugging.
- * Should be a multiple of 8. [ 32768? ]
+ * Should be a multiple of 8 and larger than 
+ * sizeof(CHK). [ 32768? ]
  */
-#define DBLOCK_SIZE 32
+#define DBLOCK_SIZE (sizeof(CHK) * 2 + 8)
 
 /**
  * Pick a multiple of 2 here to achive 8-byte alignment!

Modified: GNUnet/src/applications/fs/ecrs/uritest.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/uritest.c   2005-02-28 00:38:59 UTC (rev 
344)
+++ GNUnet/src/applications/fs/ecrs/uritest.c   2005-02-28 02:55:42 UTC (rev 
345)
@@ -113,16 +113,31 @@
   return 0;
 }
 
+static int parseCommandLine(int argc, 
+                           char * argv[]) {
+  FREENONNULL(setConfigurationString("GNUNETD",
+                                    "_MAGIC_",
+                                    "NO"));
+  FREENONNULL(setConfigurationString("GNUNETD",
+                                    "LOGFILE",
+                                    NULL));
+  FREENONNULL(setConfigurationString("GNUNET",
+                                    "LOGLEVEL",
+                                    "NOTHING"));
+  return OK;
+}
+
 int main(int argc, char * argv[]) {
   int failureCount = 0;
   int i;
-  
+
+  initUtil(argc, argv, &parseCommandLine);
   failureCount += testKeyword();
   for (i=0;i<255;i++) {
     failureCount += testNamespace(i);
     failureCount += testFile(i);
   }
-
+  doneUtil();
   if (failureCount == 0)
     return 0;
   else 

Modified: GNUnet/todo
===================================================================
--- GNUnet/todo 2005-02-28 00:38:59 UTC (rev 344)
+++ GNUnet/todo 2005-02-28 02:55:42 UTC (rev 345)
@@ -1,18 +1,11 @@
-0.6.6b [2?'05] (aka "bugfixes"):
-- 833!
-- 832?
-- 829!
-- 828?
-- 827??
-- 823?
-- 770?
-- 765?
-- 704?
-- 593???
+0.6.7 [3?'05] (aka "features"):
+- 835??  [ unknown crash ]
+- 770?   [ use freedback (LOG) in gnunet-gtk via show-messages ]
+- 704?   [ auto-reindex downloaded files ]
+- 678?   [ directory browser ]
+- 593??? [ gnunet-setup ]
 
-0.7.0pre0 [3'05] (aka "pre-preview"):
-- Known bugs:
-  * strange ecrstest bug(s?)
+0.7.0pre0 [2'05] (aka "pre-preview"):
 - Need testing:
   * ECRS-directories (build, iterate)
   * gnunet-directory





reply via email to

[Prev in Thread] Current Thread [Next in Thread]