The branch, v3-2-ctdb has been updated
       via  f321f0937e27467b4b3a5d8e2a4336acc95b0efd (commit)
      from  f96db2a7501c994ff370ad182a095fc784e1826b (commit)

http://gitweb.samba.org/?p=obnox/samba-ctdb.git;a=shortlog;h=v3-2-ctdb


- Log -----------------------------------------------------------------
commit f321f0937e27467b4b3a5d8e2a4336acc95b0efd
Author: Volker Lendecke <[email protected]>
Date:   Tue Sep 15 02:19:14 2009 +0200

    s3:gpfs: Add support for the gpfs_ftruncate call

-----------------------------------------------------------------------

Summary of changes:
 source/modules/gpfs.c     |   14 ++++++++++++++
 source/modules/vfs_gpfs.c |   16 ++++++++++++++++
 source/modules/vfs_gpfs.h |    1 +
 3 files changed, 31 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/modules/gpfs.c b/source/modules/gpfs.c
index 96bce00..e154402 100644
--- a/source/modules/gpfs.c
+++ b/source/modules/gpfs.c
@@ -27,6 +27,7 @@
 static bool gpfs_share_modes;
 static bool gpfs_leases;
 static bool gpfs_getrealfilename;
+static bool gpfs_do_ftruncate;
 
 static int (*gpfs_set_share_fn)(int fd, unsigned int allow, unsigned int deny);
 static int (*gpfs_set_lease_fn)(int fd, unsigned int leaseType);
@@ -34,6 +35,7 @@ static int (*gpfs_getacl_fn)(char *pathname, int flags, void 
*acl);
 static int (*gpfs_putacl_fn)(char *pathname, int flags, void *acl);
 static int (*gpfs_get_realfilename_path_fn)(char *pathname, char *filenamep,
                                            int *buflen);
+static int (*gpfs_ftruncate_fn)(int fd, gpfs_off64_t length);
 
 
 bool set_gpfs_sharemode(files_struct *fsp, uint32 access_mask,
@@ -137,6 +139,16 @@ int smbd_gpfs_putacl(char *pathname, int flags, void *acl)
        return gpfs_putacl_fn(pathname, flags, acl);
 }
 
+int smbd_gpfs_ftrunctate(int fd, gpfs_off64_t length)
+{
+       if (!gpfs_do_ftruncate || (gpfs_ftruncate_fn == NULL)) {
+               errno = ENOSYS;
+               return -1;
+       }
+
+       return gpfs_ftruncate_fn(fd, length);
+}
+
 int smbd_gpfs_get_realfilename_path(char *pathname, char *filenamep,
                                    int *buflen)
 {
@@ -207,11 +219,13 @@ void init_gpfs(void)
        init_gpfs_function(&gpfs_putacl_fn, "gpfs_putacl");
        init_gpfs_function(&gpfs_get_realfilename_path_fn,
                           "gpfs_get_realfilename_path");
+        init_gpfs_function(&gpfs_ftruncate_fn,"gpfs_ftruncate");
 
        gpfs_share_modes = lp_parm_bool(-1, "gpfs", "sharemodes", True);
        gpfs_leases      = lp_parm_bool(-1, "gpfs", "leases", True);
        gpfs_getrealfilename = lp_parm_bool(-1, "gpfs", "getrealfilename",
                                            True);
+       gpfs_do_ftruncate = lp_parm_bool(-1, "gpfs", "ftruncate", True);
 
        return;
 }
diff --git a/source/modules/vfs_gpfs.c b/source/modules/vfs_gpfs.c
index 0b1f52c..9e6f6ed 100644
--- a/source/modules/vfs_gpfs.c
+++ b/source/modules/vfs_gpfs.c
@@ -888,6 +888,18 @@ static int vfs_gpfs_fchmod(vfs_handle_struct *handle, 
files_struct *fsp, mode_t
                 return rc;
 }
 
+static int vfs_gpfs_ftruncate(vfs_handle_struct *handle, files_struct *fsp,
+                             SMB_OFF_T len)
+{
+       int result;
+
+       result = smbd_gpfs_ftrunctate(fsp->fh->fd, len);
+       if ((result == -1) && (errno == ENOSYS)) {
+               return SMB_VFS_NEXT_FTRUNCATE(handle, fsp, len);
+       }
+       return result;
+}
+
 /* VFS operations structure */
 
 static vfs_op_tuple gpfs_op_tuples[] = {
@@ -952,6 +964,10 @@ static vfs_op_tuple gpfs_op_tuples[] = {
          SMB_VFS_OP_CLOSE,
          SMB_VFS_LAYER_TRANSPARENT },
 
+        { SMB_VFS_OP(vfs_gpfs_ftruncate),
+          SMB_VFS_OP_FTRUNCATE,
+          SMB_VFS_LAYER_TRANSPARENT },
+
         { SMB_VFS_OP(NULL), SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP }
 
 };
diff --git a/source/modules/vfs_gpfs.h b/source/modules/vfs_gpfs.h
index 3c499b0..a100bef 100644
--- a/source/modules/vfs_gpfs.h
+++ b/source/modules/vfs_gpfs.h
@@ -29,4 +29,5 @@ bool set_gpfs_sharemode(files_struct *fsp, uint32 access_mask,
 int set_gpfs_lease(int fd, int leasetype);
 int smbd_gpfs_getacl(char *pathname, int flags, void *acl);
 int smbd_gpfs_putacl(char *pathname, int flags, void *acl);
+int smbd_gpfs_ftrunctate(int fd, gpfs_off64_t length);
 void init_gpfs(void);


-- 
SAMBA-CTDB repository

Reply via email to