1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-22 22:04:08 +03:00

s3:gpfs: Add support for the gpfs_ftruncate call

ported from the v3-4-ctdb branch to master
This used to be commit 1f138cc9f4a

Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Wed Oct 13 13:34:25 UTC 2010 on sn-devel-104
This commit is contained in:
Christian Ambach 2010-10-08 13:43:17 +02:00 committed by Volker Lendecke
parent 22018b8b88
commit beb5afea54
3 changed files with 28 additions and 2 deletions

View File

@ -26,6 +26,7 @@
static bool gpfs_getrealfilename;
static bool gpfs_winattr;
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);
@ -36,7 +37,7 @@ static int (*gpfs_get_realfilename_path_fn)(char *pathname, char *filenamep,
static int (*gpfs_set_winattrs_path_fn)(char *pathname, int flags, struct gpfs_winattr *attrs);
static int (*gpfs_get_winattrs_path_fn)(char *pathname, struct gpfs_winattr *attrs);
static int (*gpfs_get_winattrs_fn)(int fd, struct gpfs_winattr *attrs);
static int (*gpfs_ftruncate_fn)(int fd, gpfs_off64_t length);
bool set_gpfs_sharemode(files_struct *fsp, uint32 access_mask,
uint32 share_access)
@ -131,6 +132,16 @@ int smbd_gpfs_putacl(char *pathname, int flags, void *acl)
return gpfs_putacl_fn(pathname, flags, acl);
}
int smbd_gpfs_ftruncate(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)
{
@ -237,11 +248,12 @@ void init_gpfs(void)
init_gpfs_function(&gpfs_get_winattrs_path_fn,"gpfs_get_winattrs_path");
init_gpfs_function(&gpfs_set_winattrs_path_fn,"gpfs_set_winattrs_path");
init_gpfs_function(&gpfs_get_winattrs_fn,"gpfs_get_winattrs");
init_gpfs_function(&gpfs_ftruncate_fn, "gpfs_ftruncate");
gpfs_getrealfilename = lp_parm_bool(-1, "gpfs", "getrealfilename",
True);
gpfs_winattr = lp_parm_bool(-1, "gpfs", "winattr", False);
gpfs_do_ftruncate = lp_parm_bool(-1, "gpfs", "ftruncate", True);
return;
}

View File

@ -1128,6 +1128,18 @@ static int vfs_gpfs_ntimes(struct vfs_handle_struct *handle,
}
static int vfs_gpfs_ftruncate(vfs_handle_struct *handle, files_struct *fsp,
SMB_OFF_T len)
{
int result;
result = smbd_gpfs_ftruncate(fsp->fh->fd, len);
if ((result == -1) && (errno == ENOSYS)) {
return SMB_VFS_NEXT_FTRUNCATE(handle, fsp, len);
}
return result;
}
int vfs_gpfs_connect(struct vfs_handle_struct *handle, const char *service,
const char *user)
{
@ -1180,6 +1192,7 @@ static struct vfs_fn_pointers vfs_gpfs_fns = {
.fstat = vfs_gpfs_fstat,
.lstat = vfs_gpfs_lstat,
.ntimes = vfs_gpfs_ntimes,
.ftruncate = vfs_gpfs_ftruncate
};
NTSTATUS vfs_gpfs_init(void);

View File

@ -34,4 +34,5 @@ int smbd_gpfs_get_realfilename_path(char *pathname, char *filenamep,
int smbd_fget_gpfs_winattrs(int fd, struct gpfs_winattr *attrs);
int get_gpfs_winattrs(char * pathname,struct gpfs_winattr *attrs);
int set_gpfs_winattrs(char * pathname,int flags,struct gpfs_winattr *attrs);
int smbd_gpfs_ftruncate(int fd, gpfs_off64_t length);
void init_gpfs(void);