]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/lib/mntent_cache.c
Reverted the change of TRU64 to OSF1 for the OS detection rules. Although Compaq...
[bacula/bacula] / bacula / src / lib / mntent_cache.c
index a564709c5f545861a896254bcd10ab6ccb6b51af..14b304da5290e3530948ca55aabed4bd36562dd6 100644 (file)
@@ -1,12 +1,12 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2009 Free Software Foundation Europe e.V.
+   Copyright (C) 2009-2010 Free Software Foundation Europe e.V.
 
    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
    This program is Free Software; you can redistribute it and/or
-   modify it under the terms of version two of the GNU General Public
+   modify it under the terms of version three of the GNU Affero General Public
    License as published by the Free Software Foundation and included
    in the file LICENSE.
 
@@ -15,7 +15,7 @@
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    General Public License for more details.
 
-   You should have received a copy of the GNU General Public License
+   You should have received a copy of the GNU Affero General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
@@ -41,7 +41,7 @@
  * - DARWIN (OSX)
  * - IRIX
  * - AIX
- * - OSF1 (True64)
+ * - OSF1 (Tru64)
  * - Solaris
  *
  * Currently we only use this code for Linux and OSF1 based fstype determination.
 #include <sys/stat.h>
 
 #if defined(HAVE_GETMNTENT)
-#if defined(HAVE_LINUX_OS) || defined(HAVE_HPUX_OS)
+#if defined(HAVE_LINUX_OS) || defined(HAVE_HPUX_OS) || defined(HAVE_AIX_OS)
 #include <mntent.h>
 #elif defined(HAVE_SUN_OS)
 #include <sys/mnttab.h>
 #endif /* HAVE_GETMNTENT */
 #elif defined(HAVE_GETMNTINFO)
-#if defined(HAVE_DARWIN_OS)
+#if defined(HAVE_OPENBSD_OS)
 #include <sys/param.h>
-#include <sys/ucred.h> 
-#include <sys/mount.h> 
-#else
+#include <sys/mount.h>
+#elif defined(HAVE_NETBSD_OS)
 #include <sys/types.h>
 #include <sys/statvfs.h>
+#else
+#include <sys/param.h>
+#include <sys/ucred.h>
+#include <sys/mount.h>
 #endif
 #elif defined(HAVE_AIX_OS)
 #include <fshelp.h>
@@ -156,7 +159,7 @@ static void refresh_mount_cache(void)
 #if defined(HAVE_GETMNTENT)
    FILE *fp;
    struct stat st;
-#if defined(HAVE_LINUX_OS) || defined(HAVE_HPUX_OS) || defined(HAVE_IRIX_OS)
+#if defined(HAVE_LINUX_OS) || defined(HAVE_HPUX_OS) || defined(HAVE_IRIX_OS) || defined(HAVE_AIX_OS)
    struct mntent *mnt;
 
 #if defined(HAVE_LINUX_OS)
@@ -173,6 +176,10 @@ static void refresh_mount_cache(void)
    if ((fp = setmntent(MOUNTED, "r")) == (FILE *)NULL) {
       return;
    }
+#elif defined(HAVE_AIX_OS)
+   if ((fp = setmntent(MNTTAB, "r")) == (FILE *)NULL) {
+      return;
+   }
 #endif
 
    while ((mnt = getmntent(fp)) != (struct mntent *)NULL) {
@@ -203,13 +210,20 @@ static void refresh_mount_cache(void)
 #elif defined(HAVE_GETMNTINFO)
    int cnt;
    struct stat st;
-#if defined(HAVE_DARWIN_OS)
+#if defined(HAVE_NETBSD_OS)
+   struct statvfs *mntinfo;
+#else
    struct statfs *mntinfo;
+#endif
+#if defined(ST_NOWAIT)
+   int flags = ST_NOWAIT;
+#elif defined(MNT_NOWAIT)
+   int flags = MNT_NOWAIT;
 #else
-   struct statvfs *mntinfo;
+   int flags = 0;
 #endif
 
-   if ((cnt = getmntinfo(&mntinfo, MNT_NOWAIT)) > 0) {
+   if ((cnt = getmntinfo(&mntinfo, flags)) > 0) {
       while (cnt > 0) {
          if (stat(mntinfo->f_mntonname, &st) == 0) {
             add_mntent_mapping(st.st_dev,