From: David Barksdale Date: Wed, 19 Jun 2013 16:09:59 +0000 (+0000) Subject: Fix windows build, statfs is broken there. X-Git-Tag: initial-import-from-subversion-38251~8722 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=bc57020de71d96102c005cdef61b1d9f05e81cd6;p=oweals%2Fgnunet.git Fix windows build, statfs is broken there. --- diff --git a/src/util/disk.c b/src/util/disk.c index 4a7aa0b31..cda28ce6d 100644 --- a/src/util/disk.c +++ b/src/util/disk.c @@ -328,6 +328,26 @@ int GNUNET_DISK_file_get_identifiers (const char *filename, uint64_t * dev, uint64_t * ino) { +#if WINDOWS + { + // FIXME NILS: test this + struct GNUNET_DISK_FileHandle *fh; + BY_HANDLE_FILE_INFORMATION info; + int succ; + + fh = GNUNET_DISK_file_open (filename, GNUNET_DISK_OPEN_READ, 0); + if (fh == NULL) + return GNUNET_SYSERR; + succ = GetFileInformationByHandle (fh->h, &info); + GNUNET_DISK_file_close (fh); + if (!succ) + { + return GNUNET_SYSERR; + } + *dev = info.dwVolumeSerialNumber; + *ino = ((((uint64_t) info.nFileIndexHigh) << (sizeof (DWORD) * 8)) | info.nFileIndexLow); + } +#else /* !WINDOWS */ #if HAVE_STAT { struct stat sbuf; @@ -362,28 +382,10 @@ GNUNET_DISK_file_get_identifiers (const char *filename, uint64_t * dev, *dev = ((uint64_t) fbuf.f_fsid.val[0]) << 32 || ((uint64_t) fbuf.f_fsid.val[1]); } -#elif WINDOWS - { - // FIXME NILS: test this - struct GNUNET_DISK_FileHandle *fh; - BY_HANDLE_FILE_INFORMATION info; - int succ; - - fh = GNUNET_DISK_file_open (filename, GNUNET_DISK_OPEN_READ, 0); - if (fh == NULL) - return GNUNET_SYSERR; - succ = GetFileInformationByHandle (fh->h, &info); - GNUNET_DISK_file_close (fh); - if (!succ) - { - return GNUNET_SYSERR; - } - *dev = info.dwVolumeSerialNumber; - *ino = ((((uint64_t) info.nFileIndexHigh) << (sizeof (DWORD) * 8)) | info.nFileIndexLow); - } #else *dev = 0; #endif +#endif /* !WINDOWS */ return GNUNET_OK; }