gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r27470 - in gnunet/src: include util


From: gnunet
Subject: [GNUnet-SVN] r27470 - in gnunet/src: include util
Date: Wed, 19 Jun 2013 01:46:15 +0200

Author: amatus
Date: 2013-06-19 01:46:15 +0200 (Wed, 19 Jun 2013)
New Revision: 27470

Modified:
   gnunet/src/include/gnunet_disk_lib.h
   gnunet/src/util/disk.c
   gnunet/src/util/test_disk.c
Log:
Removed GNUNET_DISK_get_blocks_available since it's not used and it would
be hard to port to emscripten.


Modified: gnunet/src/include/gnunet_disk_lib.h
===================================================================
--- gnunet/src/include/gnunet_disk_lib.h        2013-06-18 13:49:59 UTC (rev 
27469)
+++ gnunet/src/include/gnunet_disk_lib.h        2013-06-18 23:46:15 UTC (rev 
27470)
@@ -268,17 +268,6 @@
 
 
 /**
- * Get the number of blocks that are left on the partition that
- * contains the given file (for normal users).
- *
- * @param part a file on the partition to check
- * @return -1 on errors, otherwise the number of free blocks
- */
-long
-GNUNET_DISK_get_blocks_available (const char *part);
-
-
-/**
  * Checks whether a handle is invalid
  *
  * @param h handle to check

Modified: gnunet/src/util/disk.c
===================================================================
--- gnunet/src/util/disk.c      2013-06-18 13:49:59 UTC (rev 27469)
+++ gnunet/src/util/disk.c      2013-06-18 23:46:15 UTC (rev 27470)
@@ -560,65 +560,6 @@
 
 
 /**
- * Get the number of blocks that are left on the partition that
- * contains the given file (for normal users).
- *
- * @param part a file on the partition to check
- * @return -1 on errors, otherwise the number of free blocks
- */
-long
-GNUNET_DISK_get_blocks_available (const char *part)
-{
-#ifdef SOLARIS
-  struct statvfs buf;
-
-  if (0 != statvfs (part, &buf))
-  {
-    LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "statfs", part);
-    return -1;
-  }
-  return buf.f_bavail;
-#elif MINGW
-  DWORD dwDummy;
-  DWORD dwBlocks;
-  wchar_t szDrive[4];
-  wchar_t wpath[MAX_PATH + 1];
-  char *path;
-
-  path = GNUNET_STRINGS_filename_expand (part);
-  if (path == NULL)
-    return -1;
-  /* "part" was in UTF-8, and so is "path" */
-  if (ERROR_SUCCESS != plibc_conv_to_win_pathwconv(path, wpath))
-  {
-    GNUNET_free (path);
-    return -1;
-  }
-  GNUNET_free (path);
-  wcsncpy (szDrive, wpath, 3);
-  szDrive[3] = 0;
-  if (!GetDiskFreeSpaceW (szDrive, &dwDummy, &dwDummy, &dwBlocks, &dwDummy))
-  {
-    LOG (GNUNET_ERROR_TYPE_WARNING, _("`%s' failed for drive `%S': %u\n"),
-         "GetDiskFreeSpace", szDrive, GetLastError ());
-
-    return -1;
-  }
-  return dwBlocks;
-#else
-  struct statfs s;
-
-  if (0 != statfs (part, &s))
-  {
-    LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "statfs", part);
-    return -1;
-  }
-  return s.f_bavail;
-#endif
-}
-
-
-/**
  * Test if "fil" is a directory and listable. Optionally, also check if the
  * directory is readable.  Will not print an error message if the directory 
does
  * not exist.  Will log errors if GNUNET_SYSERR is returned (i.e., a file 
exists

Modified: gnunet/src/util/test_disk.c
===================================================================
--- gnunet/src/util/test_disk.c 2013-06-18 13:49:59 UTC (rev 27469)
+++ gnunet/src/util/test_disk.c 2013-06-18 23:46:15 UTC (rev 27470)
@@ -86,7 +86,6 @@
 {
   struct GNUNET_DISK_FileHandle *fh;
   uint64_t size;
-  long avail;
 
   fh = GNUNET_DISK_file_open (".testfile",
                               GNUNET_DISK_OPEN_READWRITE |
@@ -102,27 +101,6 @@
     return 1;
   GNUNET_break (0 == UNLINK (".testfile"));
 
-  /* test that avail goes down as we fill the disk... */
-  GNUNET_log_skip (1, GNUNET_NO);
-  avail = GNUNET_DISK_get_blocks_available (".testfile");
-  GNUNET_log_skip (0, GNUNET_NO);
-  fh = GNUNET_DISK_file_open (".testfile",
-                              GNUNET_DISK_OPEN_READWRITE |
-                              GNUNET_DISK_OPEN_CREATE,
-                              GNUNET_DISK_PERM_USER_WRITE |
-                              GNUNET_DISK_PERM_USER_READ);
-  GNUNET_assert (GNUNET_NO == GNUNET_DISK_handle_invalid (fh));
-  while ((avail == GNUNET_DISK_get_blocks_available (".testfile")) &&
-         (avail != -1))
-    if (16 != GNUNET_DISK_file_write (fh, "HelloWorld123456", 16))
-    {
-      GNUNET_DISK_file_close (fh);
-      GNUNET_break (0 == UNLINK (".testfile"));
-      return 1;
-    }
-  GNUNET_DISK_file_close (fh);
-  GNUNET_break (0 == UNLINK (".testfile"));
-
   return 0;
 }
 




reply via email to

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