diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-07-02 08:32:20 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-07-02 08:32:20 +0000 |
commit | 555214089c7045298f23fea9e060ea931804e75f (patch) | |
tree | 46a931f5ba6da92c9e350b808fee0f617e5d0f10 /src/util | |
parent | 56aff3f29aa8cabb5e085610f1df50d537de1d9d (diff) | |
download | gnunet-555214089c7045298f23fea9e060ea931804e75f.tar.gz gnunet-555214089c7045298f23fea9e060ea931804e75f.zip |
trying to port statvfs call to BSD
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/disk.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/util/disk.c b/src/util/disk.c index 2474f0f2a..ef4e33cd2 100644 --- a/src/util/disk.c +++ b/src/util/disk.c | |||
@@ -248,7 +248,7 @@ GNUNET_DISK_file_size (const char *filename, | |||
248 | */ | 248 | */ |
249 | int | 249 | int |
250 | GNUNET_DISK_file_get_identifiers (const char *filename, | 250 | GNUNET_DISK_file_get_identifiers (const char *filename, |
251 | uint32_t * dev, uint64_t * ino) | 251 | uint64_t * dev, uint64_t * ino) |
252 | { | 252 | { |
253 | #if LINUX | 253 | #if LINUX |
254 | struct stat sbuf; | 254 | struct stat sbuf; |
@@ -256,10 +256,21 @@ GNUNET_DISK_file_get_identifiers (const char *filename, | |||
256 | 256 | ||
257 | if ((0 == stat (filename, &sbuf)) && (0 == statvfs (filename, &fbuf))) | 257 | if ((0 == stat (filename, &sbuf)) && (0 == statvfs (filename, &fbuf))) |
258 | { | 258 | { |
259 | *dev = (uint32_t) fbuf.f_fsid; | 259 | *dev = (uint64_t) fbuf.f_fsid; |
260 | *ino = (uint64_t) sbuf.st_ino; | 260 | *ino = (uint64_t) sbuf.st_ino; |
261 | return GNUNET_OK; | 261 | return GNUNET_OK; |
262 | } | 262 | } |
263 | #elif SOMEBSD | ||
264 | struct stat sbuf; | ||
265 | struct statfs fbuf; | ||
266 | |||
267 | if ( (0 == stat (filename, &sbuf)) && | ||
268 | (0 == statfs (filename, &fbuf) ) ) | ||
269 | { | ||
270 | *dev = ((uint64_t) fbuf.f_fsid[0]) << 32 || ((uint64_t) fbuf.f_fsid[1]); | ||
271 | *ino = (uint64_t) sbuf.st_ino; | ||
272 | return GNUNET_OK; | ||
273 | } | ||
263 | #elif WINDOWS | 274 | #elif WINDOWS |
264 | // FIXME NILS: test this | 275 | // FIXME NILS: test this |
265 | struct GNUNET_DISK_FileHandle *fh; | 276 | struct GNUNET_DISK_FileHandle *fh; |