diff options
author | David Barksdale <amatus.amongus@gmail.com> | 2013-06-19 16:09:59 +0000 |
---|---|---|
committer | David Barksdale <amatus.amongus@gmail.com> | 2013-06-19 16:09:59 +0000 |
commit | bc57020de71d96102c005cdef61b1d9f05e81cd6 (patch) | |
tree | 5f187c574cc6d11e937a01b1f4ae24cb44c1e009 /src/util/disk.c | |
parent | 03c704a6653a230d7d17a828e77613f0fac25080 (diff) | |
download | gnunet-bc57020de71d96102c005cdef61b1d9f05e81cd6.tar.gz gnunet-bc57020de71d96102c005cdef61b1d9f05e81cd6.zip |
Fix windows build, statfs is broken there.
Diffstat (limited to 'src/util/disk.c')
-rw-r--r-- | src/util/disk.c | 40 |
1 files changed, 21 insertions, 19 deletions
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 | |||
328 | GNUNET_DISK_file_get_identifiers (const char *filename, uint64_t * dev, | 328 | GNUNET_DISK_file_get_identifiers (const char *filename, uint64_t * dev, |
329 | uint64_t * ino) | 329 | uint64_t * ino) |
330 | { | 330 | { |
331 | #if WINDOWS | ||
332 | { | ||
333 | // FIXME NILS: test this | ||
334 | struct GNUNET_DISK_FileHandle *fh; | ||
335 | BY_HANDLE_FILE_INFORMATION info; | ||
336 | int succ; | ||
337 | |||
338 | fh = GNUNET_DISK_file_open (filename, GNUNET_DISK_OPEN_READ, 0); | ||
339 | if (fh == NULL) | ||
340 | return GNUNET_SYSERR; | ||
341 | succ = GetFileInformationByHandle (fh->h, &info); | ||
342 | GNUNET_DISK_file_close (fh); | ||
343 | if (!succ) | ||
344 | { | ||
345 | return GNUNET_SYSERR; | ||
346 | } | ||
347 | *dev = info.dwVolumeSerialNumber; | ||
348 | *ino = ((((uint64_t) info.nFileIndexHigh) << (sizeof (DWORD) * 8)) | info.nFileIndexLow); | ||
349 | } | ||
350 | #else /* !WINDOWS */ | ||
331 | #if HAVE_STAT | 351 | #if HAVE_STAT |
332 | { | 352 | { |
333 | struct stat sbuf; | 353 | struct stat sbuf; |
@@ -362,28 +382,10 @@ GNUNET_DISK_file_get_identifiers (const char *filename, uint64_t * dev, | |||
362 | *dev = ((uint64_t) fbuf.f_fsid.val[0]) << 32 || | 382 | *dev = ((uint64_t) fbuf.f_fsid.val[0]) << 32 || |
363 | ((uint64_t) fbuf.f_fsid.val[1]); | 383 | ((uint64_t) fbuf.f_fsid.val[1]); |
364 | } | 384 | } |
365 | #elif WINDOWS | ||
366 | { | ||
367 | // FIXME NILS: test this | ||
368 | struct GNUNET_DISK_FileHandle *fh; | ||
369 | BY_HANDLE_FILE_INFORMATION info; | ||
370 | int succ; | ||
371 | |||
372 | fh = GNUNET_DISK_file_open (filename, GNUNET_DISK_OPEN_READ, 0); | ||
373 | if (fh == NULL) | ||
374 | return GNUNET_SYSERR; | ||
375 | succ = GetFileInformationByHandle (fh->h, &info); | ||
376 | GNUNET_DISK_file_close (fh); | ||
377 | if (!succ) | ||
378 | { | ||
379 | return GNUNET_SYSERR; | ||
380 | } | ||
381 | *dev = info.dwVolumeSerialNumber; | ||
382 | *ino = ((((uint64_t) info.nFileIndexHigh) << (sizeof (DWORD) * 8)) | info.nFileIndexLow); | ||
383 | } | ||
384 | #else | 385 | #else |
385 | *dev = 0; | 386 | *dev = 0; |
386 | #endif | 387 | #endif |
388 | #endif /* !WINDOWS */ | ||
387 | return GNUNET_OK; | 389 | return GNUNET_OK; |
388 | } | 390 | } |
389 | 391 | ||