Ignore:
Timestamp:
Jul 6, 2011, 8:21:13 PM (14 years ago)
Author:
Herwig Bauernfeind
Message:

Samba 3.5: Update trunk to 3.5.9

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/server/source3/modules/vfs_gpfs.c

    r596 r599  
    3131#include "vfs_gpfs.h"
    3232
     33struct gpfs_config_data {
     34        bool sharemodes;
     35        bool leases;
     36};
     37
     38
    3339static int vfs_gpfs_kernel_flock(vfs_handle_struct *handle, files_struct *fsp,
    3440                                 uint32 share_mode, uint32 access_mask)
    3541{
    3642
     43        struct gpfs_config_data *config;
     44
     45        SMB_VFS_HANDLE_GET_DATA(handle, config,
     46                                struct gpfs_config_data,
     47                                return -1);
     48
    3749        START_PROFILE(syscall_kernel_flock);
    3850
    3951        kernel_flock(fsp->fh->fd, share_mode, access_mask);
    4052
    41         if (!set_gpfs_sharemode(fsp, access_mask, fsp->share_access)) {
    42 
    43                 return -1;
    44 
     53        if (config->sharemodes
     54                && !set_gpfs_sharemode(fsp, access_mask, fsp->share_access)) {
     55                return -1;
    4556        }
    4657
     
    5263static int vfs_gpfs_close(vfs_handle_struct *handle, files_struct *fsp)
    5364{
    54         if ((fsp->fh != NULL) && (fsp->fh->fd != -1)) {
     65
     66        struct gpfs_config_data *config;
     67
     68        SMB_VFS_HANDLE_GET_DATA(handle, config,
     69                                struct gpfs_config_data,
     70                                return -1);
     71
     72        if (config->sharemodes && (fsp->fh != NULL) && (fsp->fh->fd != -1)) {
    5573                set_gpfs_sharemode(fsp, 0, 0);
    5674        }
     
    6280                             int leasetype)
    6381{
    64         int ret;
     82        struct gpfs_config_data *config;
     83        int ret=0;
     84
     85        SMB_VFS_HANDLE_GET_DATA(handle, config,
     86                                struct gpfs_config_data,
     87                                return -1);
    6588
    6689        START_PROFILE(syscall_linux_setlease);
    6790
    68         if ( linux_set_lease_sighandler(fsp->fh->fd) == -1)
    69                 return -1;
    70 
    71         ret = set_gpfs_lease(fsp->fh->fd,leasetype);
    72 
    73         if ( ret < 0 ) {
     91        if (linux_set_lease_sighandler(fsp->fh->fd) == -1)
     92                return -1;
     93
     94        if (config->leases) {
     95                ret = set_gpfs_lease(fsp->fh->fd,leasetype);
     96        }
     97
     98        if (ret < 0) {
    7499                /* This must have come from GPFS not being available */
    75100                /* or some other error, hence call the default */
     
    959984        struct gpfs_winattr attrs;
    960985        int ret = 0;
     986        ssize_t result;
    961987
    962988        DEBUG(10, ("gpfs_get_xattr: %s \n",path));
     
    9951021        }
    9961022
    997         snprintf(attrstr, size, "0x%x", dosmode & SAMBA_ATTRIBUTES_MASK);
     1023        result = snprintf(attrstr, size, "0x%x",
     1024                          dosmode & SAMBA_ATTRIBUTES_MASK) + 1;
     1025
    9981026        DEBUG(10, ("gpfs_get_xattr: returning %s\n",attrstr));
    999         return size;
     1027        return result;
    10001028}
    10011029
     
    11141142}
    11151143
     1144int vfs_gpfs_connect(struct vfs_handle_struct *handle, const char *service,
     1145                        const char *user)
     1146{
     1147        struct gpfs_config_data *config;
     1148        int ret = SMB_VFS_NEXT_CONNECT(handle, service, user);
     1149
     1150        if (ret < 0) {
     1151                return ret;
     1152        }
     1153
     1154        config = talloc_zero(handle->conn, struct gpfs_config_data);
     1155        if (!config) {
     1156                SMB_VFS_NEXT_DISCONNECT(handle);
     1157                DEBUG(0, ("talloc_zero() failed\n")); return -1;
     1158        }
     1159
     1160        config->sharemodes = lp_parm_bool(SNUM(handle->conn), "gpfs",
     1161                                        "sharemodes", true);
     1162
     1163        config->leases = lp_parm_bool(SNUM(handle->conn), "gpfs",
     1164                                        "leases", true);
     1165
     1166        SMB_VFS_HANDLE_SET_DATA(handle, config,
     1167                                NULL, struct gpfs_config_data,
     1168                                return -1);
     1169
     1170        return 0;
     1171}
     1172
     1173
     1174static int vfs_gpfs_ftruncate(struct vfs_handle_struct *handle,
     1175                              struct files_struct *fsp,
     1176                              SMB_OFF_T len)
     1177{
     1178       int result;
     1179
     1180       result = smbd_gpfs_ftrunctate(fsp->fh->fd, len);
     1181       if ((result == -1) && (errno == ENOSYS)) {
     1182               return SMB_VFS_NEXT_FTRUNCATE(handle, fsp, len);
     1183       }
     1184       return result;
     1185}
     1186
    11161187static struct vfs_fn_pointers vfs_gpfs_fns = {
     1188        .connect_fn = vfs_gpfs_connect,
    11171189        .kernel_flock = vfs_gpfs_kernel_flock,
    11181190        .linux_setlease = vfs_gpfs_setlease,
     
    11351207        .lstat = vfs_gpfs_lstat,
    11361208        .ntimes = vfs_gpfs_ntimes,
     1209        .ftruncate = vfs_gpfs_ftruncate,
    11371210};
    11381211
Note: See TracChangeset for help on using the changeset viewer.