aboutsummaryrefslogtreecommitdiff
path: root/src/util/disk.c
diff options
context:
space:
mode:
authorDavid Barksdale <amatus.amongus@gmail.com>2013-06-18 23:46:15 +0000
committerDavid Barksdale <amatus.amongus@gmail.com>2013-06-18 23:46:15 +0000
commita5ec32f96c44672b83ddadfe6a9bfa750273333f (patch)
tree7412c5804a33c1643c773ad9d35c104d8d8d6fdf /src/util/disk.c
parentab47616dbca27ca5c9ccb40532a7b59ac9dcaad7 (diff)
downloadgnunet-a5ec32f96c44672b83ddadfe6a9bfa750273333f.tar.gz
gnunet-a5ec32f96c44672b83ddadfe6a9bfa750273333f.zip
Removed GNUNET_DISK_get_blocks_available since it's not used and it would
be hard to port to emscripten.
Diffstat (limited to 'src/util/disk.c')
-rw-r--r--src/util/disk.c59
1 files changed, 0 insertions, 59 deletions
diff --git a/src/util/disk.c b/src/util/disk.c
index 6dca6db54..6da5c8c1d 100644
--- a/src/util/disk.c
+++ b/src/util/disk.c
@@ -560,65 +560,6 @@ GNUNET_DISK_mktemp (const char *t)
560 560
561 561
562/** 562/**
563 * Get the number of blocks that are left on the partition that
564 * contains the given file (for normal users).
565 *
566 * @param part a file on the partition to check
567 * @return -1 on errors, otherwise the number of free blocks
568 */
569long
570GNUNET_DISK_get_blocks_available (const char *part)
571{
572#ifdef SOLARIS
573 struct statvfs buf;
574
575 if (0 != statvfs (part, &buf))
576 {
577 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "statfs", part);
578 return -1;
579 }
580 return buf.f_bavail;
581#elif MINGW
582 DWORD dwDummy;
583 DWORD dwBlocks;
584 wchar_t szDrive[4];
585 wchar_t wpath[MAX_PATH + 1];
586 char *path;
587
588 path = GNUNET_STRINGS_filename_expand (part);
589 if (path == NULL)
590 return -1;
591 /* "part" was in UTF-8, and so is "path" */
592 if (ERROR_SUCCESS != plibc_conv_to_win_pathwconv(path, wpath))
593 {
594 GNUNET_free (path);
595 return -1;
596 }
597 GNUNET_free (path);
598 wcsncpy (szDrive, wpath, 3);
599 szDrive[3] = 0;
600 if (!GetDiskFreeSpaceW (szDrive, &dwDummy, &dwDummy, &dwBlocks, &dwDummy))
601 {
602 LOG (GNUNET_ERROR_TYPE_WARNING, _("`%s' failed for drive `%S': %u\n"),
603 "GetDiskFreeSpace", szDrive, GetLastError ());
604
605 return -1;
606 }
607 return dwBlocks;
608#else
609 struct statfs s;
610
611 if (0 != statfs (part, &s))
612 {
613 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "statfs", part);
614 return -1;
615 }
616 return s.f_bavail;
617#endif
618}
619
620
621/**
622 * Test if "fil" is a directory and listable. Optionally, also check if the 563 * Test if "fil" is a directory and listable. Optionally, also check if the
623 * directory is readable. Will not print an error message if the directory does 564 * directory is readable. Will not print an error message if the directory does
624 * not exist. Will log errors if GNUNET_SYSERR is returned (i.e., a file exists 565 * not exist. Will log errors if GNUNET_SYSERR is returned (i.e., a file exists