s3: fine tune and clean up statvfs tests
[samba.git] / source3 / smbd / statvfs.c
index 1e72a8e48b73675acbd123244382ec49a9aaf803..918867f7aad4c8253247ee9298a1241158dde5c7 100644 (file)
@@ -97,7 +97,7 @@ static int darwin_statvfs(const char *path, vfs_statvfs_struct *statbuf)
 
        return 0;
 }
-#elif defined(BSD) && defined(BSD_STATVFS_BSIZE)
+#elif defined(BSD_STYLE_STATVFS)
 static int bsd_statvfs(const char *path, vfs_statvfs_struct *statbuf)
 {
        struct statfs statfs_buf;
@@ -151,12 +151,17 @@ static int linux_statvfs(const char *path, vfs_statvfs_struct *statbuf)
                statbuf->TotalFileNodes = statvfs_buf.f_files;
                statbuf->FreeFileNodes = statvfs_buf.f_ffree;
                statbuf->FsIdentifier = statvfs_buf.f_fsid;
-
-               /* Good defaults for Linux filesystems are case sensitive
-                * and case preserving.
+               /* Try to extrapolate some of the fs flags into the
+                * capabilities
                 */
                statbuf->FsCapabilities =
                    FILE_CASE_SENSITIVE_SEARCH | FILE_CASE_PRESERVED_NAMES;
+#ifdef ST_QUOTA
+               if (statvfs_buf.f_flag & ST_QUOTA)
+                       statbuf->FsCapabilities |= FILE_VOLUME_QUOTAS;
+#endif
+               if (statvfs_buf.f_flag & ST_RDONLY)
+                       statbuf->FsCapabilities |= FILE_READ_ONLY_VOLUME;
        }
        return result;
 }
@@ -172,7 +177,7 @@ int sys_statvfs(const char *path, vfs_statvfs_struct *statbuf)
 {
 #if defined(DARWINOS)
        return darwin_statvfs(path, statbuf);
-#elif defined(BSD) && defined(BSD_STATVFS_BSIZE)
+#elif defined(BSD_STYLE_STATVFS)
        return bsd_statvfs(path, statbuf);
 #elif defined(STAT_STATVFS) && defined(HAVE_FSID_INT)
        return linux_statvfs(path, statbuf);