summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src
diff options
context:
space:
mode:
authorXavier Hernandez <xhernandez@datalab.es>2017-01-09 13:10:19 +0100
committerKaleb KEITHLEY <kkeithle@redhat.com>2017-01-14 05:43:48 -0800
commit5771c7d5a2986661487d1b37cfdce0645bb93f98 (patch)
tree2676c63026b146326797dc383ae702b537bb785f /libglusterfs/src
parentef341819eaedb703bc2f7bc1cd2e5ac855fed42b (diff)
libglusterfs: fix statvfs in FreeBSD
FreeBSD interprets statvfs' f_bsize field in a different way than Linux. This fix modifies the value returned by statvfs() on FreeBSD to match the expected value by Gluster. > Change-Id: I930dab6e895671157238146d333e95874ea28a08 > BUG: 1356076 > Signed-off-by: Xavier Hernandez <xhernandez@datalab.es> > Reviewed-on: http://review.gluster.org/16361 > Smoke: Gluster Build System <jenkins@build.gluster.org> > NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> > Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> > CentOS-regression: Gluster Build System <jenkins@build.gluster.org> > Reviewed-by: Jeff Darcy <jdarcy@redhat.com> Change-Id: I3c470eaa326fd975ac26ff5917c7c01580f86676 BUG: 1411901 Signed-off-by: Xavier Hernandez <xhernandez@datalab.es> Reviewed-on: http://review.gluster.org/16401 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'libglusterfs/src')
-rw-r--r--libglusterfs/src/syscall.c35
-rw-r--r--libglusterfs/src/syscall.h3
2 files changed, 37 insertions, 1 deletions
diff --git a/libglusterfs/src/syscall.c b/libglusterfs/src/syscall.c
index 0828b8a64fa..3683488edb6 100644
--- a/libglusterfs/src/syscall.c
+++ b/libglusterfs/src/syscall.c
@@ -283,7 +283,40 @@ sys_lseek (int fd, off_t offset, int whence)
int
sys_statvfs (const char *path, struct statvfs *buf)
{
- return statvfs (path, buf);
+ int ret;
+
+ ret = statvfs (path, buf);
+#ifdef __FreeBSD__
+ /* FreeBSD doesn't return the expected vaule in buf->f_bsize. It
+ * contains the optimal I/O size instead of the file system block
+ * size. Gluster expects that this field contains the block size.
+ */
+ if (ret == 0) {
+ buf->f_bsize = buf->f_frsize;
+ }
+#endif /* __FreeBSD__ */
+
+ return ret;
+}
+
+
+int
+sys_fstatvfs (int fd, struct statvfs *buf)
+{
+ int ret;
+
+ ret = fstatvfs (fd, buf);
+#ifdef __FreeBSD__
+ /* FreeBSD doesn't return the expected vaule in buf->f_bsize. It
+ * contains the optimal I/O size instead of the file system block
+ * size. Gluster expects this field to contain the block size.
+ */
+ if (ret == 0) {
+ buf->f_bsize = buf->f_frsize;
+ }
+#endif /* __FreeBSD__ */
+
+ return ret;
}
diff --git a/libglusterfs/src/syscall.h b/libglusterfs/src/syscall.h
index bbf23bef07b..a9f6a7eb1cc 100644
--- a/libglusterfs/src/syscall.h
+++ b/libglusterfs/src/syscall.h
@@ -142,6 +142,9 @@ int
sys_statvfs (const char *path, struct statvfs *buf);
int
+sys_fstatvfs (int fd, struct statvfs *buf);
+
+int
sys_close (int fd);
int