changeset 4552:ef71b2fdd433 HEAD

Put back specific checks for struct dqblk.dqb_curblocks vs curspace. The removal broke compiling for some OSes such as OSX.
author Timo Sirainen <tss@iki.fi>
date Thu, 10 Aug 2006 20:46:05 +0300
parents 2643a46322a6
children d1c0514754d5
files configure.in src/plugins/quota/quota-fs.c src/plugins/quota/quota-fs.h
diffstat 3 files changed, 38 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/configure.in	Thu Aug 10 20:28:31 2006 +0300
+++ b/configure.in	Thu Aug 10 20:46:05 2006 +0300
@@ -1141,6 +1141,36 @@
   AC_MSG_RESULT(no)
 ])
 
+dnl * Check if we have struct dqblk.dqb_curblocks
+AC_MSG_CHECKING([if struct dqblk.dqb_curblocks exists])
+AC_TRY_COMPILE([
+  #include <sys/types.h>
+  #include "$srcdir/src/plugins/quota/quota-fs.h"
+], [
+  struct dqblk dqblk;
+  unsigned int x = dqblk.dqb_curblocks;
+], [
+  AC_DEFINE(HAVE_STRUCT_DQBLK_CURBLOCKS,, Define if struct sqblk.dqb_curblocks exists)
+  AC_MSG_RESULT(yes)
+], [
+  AC_MSG_RESULT(no)
+])
+
+dnl * Check if we have struct dqblk.dqb_curspace
+AC_MSG_CHECKING([if struct dqblk.dqb_curspace exists])
+AC_TRY_COMPILE([
+  #include <sys/types.h>
+  #include "$srcdir/src/plugins/quota/quota-fs.h"
+], [
+  struct dqblk dqblk;
+  unsigned int x = dqblk.dqb_curspace;
+], [
+  AC_DEFINE(HAVE_STRUCT_DQBLK_CURSPACE,, Define if struct sqblk.dqb_curspace exists)
+  AC_MSG_RESULT(yes)
+], [
+  AC_MSG_RESULT(no)
+])
+
 dnl * Check if we have Q_QUOTACTL ioctl (Solaris)
 AC_MSG_CHECKING([if struct Q_QUOTACTL ioctl exists])
 AC_TRY_COMPILE([
--- a/src/plugins/quota/quota-fs.c	Thu Aug 10 20:28:31 2006 +0300
+++ b/src/plugins/quota/quota-fs.c	Thu Aug 10 20:46:05 2006 +0300
@@ -24,6 +24,10 @@
 #  define DEV_BSIZE 512
 #endif
 
+#ifdef HAVE_STRUCT_DQBLK_CURSPACE
+#  define dqb_curblocks dqb_curspace
+#endif
+
 /* Older sys/quota.h doesn't define _LINUX_QUOTA_VERSION at all, which means
    it supports only v1 quota */
 #ifndef _LINUX_QUOTA_VERSION
@@ -233,11 +237,7 @@
 			return -1;
 		}
 
-#if _LINUX_QUOTA_VERSION < 2
 		*value_r = dqblk.dqb_curblocks / 1024;
-#else
-		*value_r = dqblk.dqb_curspace / 1024;
-#endif
 		*limit_r = dqblk.dqb_bsoftlimit;
 	}
 #elif defined(HAVE_QUOTACTL)
--- a/src/plugins/quota/quota-fs.h	Thu Aug 10 20:28:31 2006 +0300
+++ b/src/plugins/quota/quota-fs.h	Thu Aug 10 20:46:05 2006 +0300
@@ -1,7 +1,10 @@
 #ifndef __QUOTA_FS_H
 #define __QUOTA_FS_H
 
-#define HAVE_FS_QUOTA
+#if defined (HAVE_STRUCT_DQBLK_CURBLOCKS) || \
+	defined (HAVE_STRUCT_DQBLK_CURSPACE)
+#  define HAVE_FS_QUOTA
+#endif
 
 #ifdef HAVE_SYS_QUOTA_H
 #  include <sys/quota.h> /* Linux */