s3-vfs: Use the system. namespace for fake ACLs
[kai/samba.git] / source3 / modules / vfs_prealloc.c
index 73f1a9322ff634cf3c5c0bb4b65057dd5d54df90..4ba27a6c8508cfb88c28622e8953e2e9c476bf02 100644 (file)
@@ -20,7 +20,6 @@
 #include "includes.h"
 #include "system/filesys.h"
 #include "smbd/smbd.h"
-#include "system/filesys.h"
 
 /* Extent preallocation module.
  *
@@ -57,7 +56,7 @@
 #define MODULE "prealloc"
 static int module_debug;
 
-static int preallocate_space(int fd, SMB_OFF_T size)
+static int preallocate_space(int fd, off_t size)
 {
        int err;
 #ifndef HAVE_GPFS
@@ -123,7 +122,7 @@ static int prealloc_open(vfs_handle_struct* handle,
                        mode_t              mode)
 {
        int fd;
-       off64_t size = 0;
+       off_t size = 0;
 
        const char * dot;
        char fext[10];
@@ -140,7 +139,9 @@ static int prealloc_open(vfs_handle_struct* handle,
        if (dot && *++dot) {
                if (strlen(dot) < sizeof(fext)) {
                        strncpy(fext, dot, sizeof(fext));
-                       strnorm(fext, CASE_LOWER);
+                       if (!strnorm(fext, CASE_LOWER)) {
+                               goto normal_open;
+                       }
                }
        }
 
@@ -171,9 +172,9 @@ static int prealloc_open(vfs_handle_struct* handle,
         * truncate calls specially.
         */
        if ((flags & O_CREAT) || (flags & O_TRUNC)) {
-               SMB_OFF_T * psize;
+               off_t * psize;
 
-               psize = VFS_ADD_FSP_EXTENSION(handle, fsp, SMB_OFF_T, NULL);
+               psize = VFS_ADD_FSP_EXTENSION(handle, fsp, off_t, NULL);
                if (psize == NULL || *psize == -1) {
                        return fd;
                }
@@ -202,9 +203,9 @@ normal_open:
 
 static int prealloc_ftruncate(vfs_handle_struct * handle,
                        files_struct *  fsp,
-                       SMB_OFF_T       offset)
+                       off_t   offset)
 {
-       SMB_OFF_T *psize;
+       off_t *psize;
        int ret = SMB_VFS_NEXT_FTRUNCATE(handle, fsp, offset);
 
        /* Maintain the allocated space even in the face of truncates. */
@@ -217,7 +218,7 @@ static int prealloc_ftruncate(vfs_handle_struct * handle,
 
 static struct vfs_fn_pointers prealloc_fns = {
        .open_fn = prealloc_open,
-       .ftruncate = prealloc_ftruncate,
+       .ftruncate_fn = prealloc_ftruncate,
        .connect_fn = prealloc_connect,
 };