Changeset 599 for trunk/server/source3/modules/vfs_gpfs.c
- Timestamp:
- Jul 6, 2011, 8:21:13 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server/source3/modules/vfs_gpfs.c
r596 r599 31 31 #include "vfs_gpfs.h" 32 32 33 struct gpfs_config_data { 34 bool sharemodes; 35 bool leases; 36 }; 37 38 33 39 static int vfs_gpfs_kernel_flock(vfs_handle_struct *handle, files_struct *fsp, 34 40 uint32 share_mode, uint32 access_mask) 35 41 { 36 42 43 struct gpfs_config_data *config; 44 45 SMB_VFS_HANDLE_GET_DATA(handle, config, 46 struct gpfs_config_data, 47 return -1); 48 37 49 START_PROFILE(syscall_kernel_flock); 38 50 39 51 kernel_flock(fsp->fh->fd, share_mode, access_mask); 40 52 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; 45 56 } 46 57 … … 52 63 static int vfs_gpfs_close(vfs_handle_struct *handle, files_struct *fsp) 53 64 { 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)) { 55 73 set_gpfs_sharemode(fsp, 0, 0); 56 74 } … … 62 80 int leasetype) 63 81 { 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); 65 88 66 89 START_PROFILE(syscall_linux_setlease); 67 90 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) { 74 99 /* This must have come from GPFS not being available */ 75 100 /* or some other error, hence call the default */ … … 959 984 struct gpfs_winattr attrs; 960 985 int ret = 0; 986 ssize_t result; 961 987 962 988 DEBUG(10, ("gpfs_get_xattr: %s \n",path)); … … 995 1021 } 996 1022 997 snprintf(attrstr, size, "0x%x", dosmode & SAMBA_ATTRIBUTES_MASK); 1023 result = snprintf(attrstr, size, "0x%x", 1024 dosmode & SAMBA_ATTRIBUTES_MASK) + 1; 1025 998 1026 DEBUG(10, ("gpfs_get_xattr: returning %s\n",attrstr)); 999 return size;1027 return result; 1000 1028 } 1001 1029 … … 1114 1142 } 1115 1143 1144 int 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 1174 static 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 1116 1187 static struct vfs_fn_pointers vfs_gpfs_fns = { 1188 .connect_fn = vfs_gpfs_connect, 1117 1189 .kernel_flock = vfs_gpfs_kernel_flock, 1118 1190 .linux_setlease = vfs_gpfs_setlease, … … 1135 1207 .lstat = vfs_gpfs_lstat, 1136 1208 .ntimes = vfs_gpfs_ntimes, 1209 .ftruncate = vfs_gpfs_ftruncate, 1137 1210 }; 1138 1211
Note:
See TracChangeset
for help on using the changeset viewer.