#include "vfs_gpfs.h"
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);
int smbd_gpfs_ftruncate(int fd, gpfs_off64_t length)
{
- if (!gpfs_do_ftruncate || (gpfs_ftruncate_fn == NULL)) {
+ if (gpfs_ftruncate_fn == NULL) {
errno = ENOSYS;
return -1;
}
gpfs_getrealfilename = lp_parm_bool(-1, "gpfs", "getrealfilename",
True);
- gpfs_do_ftruncate = lp_parm_bool(-1, "gpfs", "ftruncate", True);
return;
}
bool hsm;
bool syncio;
bool winattr;
+ bool ftruncate;
};
SMB_OFF_T len)
{
int result;
+ struct gpfs_config_data *config;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config,
+ struct gpfs_config_data,
+ return -1);
+
+ if (!config->ftruncate) {
+ return SMB_VFS_NEXT_FTRUNCATE(handle, fsp, len);
+ }
result = smbd_gpfs_ftruncate(fsp->fh->fd, len);
if ((result == -1) && (errno == ENOSYS)) {
config->winattr = lp_parm_bool(SNUM(handle->conn), "gpfs",
"winattr", false);
+ config->ftruncate = lp_parm_bool(SNUM(handle->conn), "gpfs",
+ "ftruncate", true);
+
SMB_VFS_HANDLE_SET_DATA(handle, config,
NULL, struct gpfs_config_data,
return -1);