summaryrefslogtreecommitdiffstats
path: root/daemon/stat.c
diff options
context:
space:
mode:
authorRichard Jones <rjones@redhat.com>2009-11-20 10:38:07 +0000
committerRichard Jones <rjones@redhat.com>2009-11-20 10:38:07 +0000
commitedb9b3abc03c0a0f84b1cbd9cf5920e3c84e5c18 (patch)
tree61a6ab919ea233f6a37098302beabaefaabdafbb /daemon/stat.c
parent7d8a3404b27fcd71f84dbe4c022c4435d0070d6b (diff)
downloadlibguestfs-edb9b3abc03c0a0f84b1cbd9cf5920e3c84e5c18.tar.gz
libguestfs-edb9b3abc03c0a0f84b1cbd9cf5920e3c84e5c18.tar.xz
libguestfs-edb9b3abc03c0a0f84b1cbd9cf5920e3c84e5c18.zip
daemon/Win32: make some functions and fields optional.
inotify: Make this optional on platforms that don't have this interface. mknod, mkfifo etc.: Make these optional on non-Unix platforms. readdir: If d_type field is missing on the platform, set the corresponding field to 'u'. stat: st_blocks and st_blksize are missing on non-Unix platforms, so set these fields to -1 in the corresponding structures.
Diffstat (limited to 'daemon/stat.c')
-rw-r--r--daemon/stat.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/daemon/stat.c b/daemon/stat.c
index 2441c9fe..45d2cb88 100644
--- a/daemon/stat.c
+++ b/daemon/stat.c
@@ -61,8 +61,16 @@ do_stat (const char *path)
ret->gid = statbuf.st_gid;
ret->rdev = statbuf.st_rdev;
ret->size = statbuf.st_size;
+#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
ret->blksize = statbuf.st_blksize;
+#else
+ ret->blksize = -1;
+#endif
+#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
ret->blocks = statbuf.st_blocks;
+#else
+ ret->blocks = -1;
+#endif
ret->atime = statbuf.st_atime;
ret->mtime = statbuf.st_mtime;
ret->ctime = statbuf.st_ctime;
@@ -100,8 +108,16 @@ do_lstat (const char *path)
ret->gid = statbuf.st_gid;
ret->rdev = statbuf.st_rdev;
ret->size = statbuf.st_size;
+#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
ret->blksize = statbuf.st_blksize;
+#else
+ ret->blksize = -1;
+#endif
+#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
ret->blocks = statbuf.st_blocks;
+#else
+ ret->blocks = -1;
+#endif
ret->atime = statbuf.st_atime;
ret->mtime = statbuf.st_mtime;
ret->ctime = statbuf.st_ctime;
@@ -158,8 +174,16 @@ do_lstatlist (const char *path, char *const *names)
ret->guestfs_int_stat_list_val[i].gid = statbuf.st_gid;
ret->guestfs_int_stat_list_val[i].rdev = statbuf.st_rdev;
ret->guestfs_int_stat_list_val[i].size = statbuf.st_size;
+#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
ret->guestfs_int_stat_list_val[i].blksize = statbuf.st_blksize;
+#else
+ ret->guestfs_int_stat_list_val[i].blksize = -1;
+#endif
+#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
ret->guestfs_int_stat_list_val[i].blocks = statbuf.st_blocks;
+#else
+ ret->guestfs_int_stat_list_val[i].blocks = -1;
+#endif
ret->guestfs_int_stat_list_val[i].atime = statbuf.st_atime;
ret->guestfs_int_stat_list_val[i].mtime = statbuf.st_mtime;
ret->guestfs_int_stat_list_val[i].ctime = statbuf.st_ctime;