Changeset 745 for trunk/server/source3/modules/vfs_gpfs.c
- Timestamp:
- Nov 27, 2012, 4:43:17 PM (13 years ago)
- Location:
- trunk/server
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
source3/modules/vfs_gpfs.c (modified) (20 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/server
- Property svn:mergeinfo changed
/vendor/current merged: 581,587,591,594,597,600,615,618,740
- Property svn:mergeinfo changed
-
trunk/server/source3/modules/vfs_gpfs.c
r599 r745 23 23 24 24 #include "includes.h" 25 26 27 25 28 26 29 #undef DBGC_CLASS … … 30 33 #include "nfs4_acls.h" 31 34 #include "vfs_gpfs.h" 35 32 36 33 37 struct gpfs_config_data { 34 38 bool sharemodes; 35 39 bool leases; 40 36 41 }; 37 42 … … 117 122 char real_pathname[PATH_MAX+1]; 118 123 int buflen; 124 125 126 127 128 129 130 119 131 120 132 full_path = talloc_asprintf(talloc_tos(), "%s/%s", path, name); … … 323 335 static NTSTATUS gpfsacl_fget_nt_acl(vfs_handle_struct *handle, 324 336 files_struct *fsp, uint32 security_info, 325 SEC_DESC**ppdesc)337 **ppdesc) 326 338 { 327 339 SMB4ACL_T *pacl = NULL; … … 345 357 static NTSTATUS gpfsacl_get_nt_acl(vfs_handle_struct *handle, 346 358 const char *name, 347 uint32 security_info, SEC_DESC**ppdesc)359 uint32 security_info, **ppdesc) 348 360 { 349 361 SMB4ACL_T *pacl = NULL; … … 461 473 } 462 474 463 static NTSTATUS gpfsacl_set_nt_acl_internal(files_struct *fsp, uint32 security_info_sent, const SEC_DESC*psd)475 static NTSTATUS gpfsacl_set_nt_acl_internal(files_struct *fsp, uint32 security_info_sent, const *psd) 464 476 { 465 477 struct gpfs_acl *acl; … … 489 501 } 490 502 491 static NTSTATUS gpfsacl_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, uint32 security_info_sent, const SEC_DESC*psd)503 static NTSTATUS gpfsacl_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, uint32 security_info_sent, const *psd) 492 504 { 493 505 return gpfsacl_set_nt_acl_internal(fsp, security_info_sent, psd); … … 927 939 static int gpfs_set_xattr(struct vfs_handle_struct *handle, const char *path, 928 940 const char *name, const void *value, size_t size, int flags){ 941 942 943 929 944 const char *attrstr = value; 930 945 unsigned int dosmode=0; … … 940 955 } 941 956 942 if (size < 2 || attrstr[0] != '0' || attrstr[1] != 'x' || 943 sscanf(attrstr, "%x", &dosmode) != 1) { 944 DEBUG(1,("gpfs_set_xattr: Trying to set badly formed DOSATTRIB on file %s - %s\n", path, attrstr)); 945 return False; 946 } 957 blob.data = (uint8_t *)attrstr; 958 blob.length = size; 959 960 ndr_err = ndr_pull_struct_blob(&blob, talloc_tos(), &dosattrib, 961 (ndr_pull_flags_fn_t)ndr_pull_xattr_DOSATTRIB); 962 963 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { 964 DEBUG(1, ("gpfs_set_xattr: bad ndr decode " 965 "from EA on file %s: Error = %s\n", 966 path, ndr_errstr(ndr_err))); 967 return false; 968 } 969 970 if (dosattrib.version != 3) { 971 DEBUG(1, ("gpfs_set_xattr: expected dosattrib version 3, got " 972 "%d\n", (int)dosattrib.version)); 973 return false; 974 } 975 if (!(dosattrib.info.info3.valid_flags & XATTR_DOSINFO_ATTRIB)) { 976 DEBUG(10, ("gpfs_set_xattr: XATTR_DOSINFO_ATTRIB not " 977 "valid, ignoring\n")); 978 return true; 979 } 980 981 dosmode = dosattrib.info.info3.attrib; 947 982 948 983 attrs.winAttrs = 0; 949 /*Just map RD_ONLY, ARCHIVE, SYSTEM and HIDDEN. Ignore the others*/984 /*Just map RD_ONLY, ARCHIVE, SYSTEM . Ignore the others*/ 950 985 if (dosmode & FILE_ATTRIBUTE_ARCHIVE){ 951 986 attrs.winAttrs |= GPFS_WINATTR_ARCHIVE; … … 960 995 attrs.winAttrs |= GPFS_WINATTR_READONLY; 961 996 } 997 998 999 962 1000 963 1001 … … 984 1022 struct gpfs_winattr attrs; 985 1023 int ret = 0; 986 ssize_t result;987 1024 988 1025 DEBUG(10, ("gpfs_get_xattr: %s \n",path)); … … 1001 1038 } 1002 1039 1003 DEBUG(1, ("gpfs_get_xattr: Get GPFS attributes failed: %d\n",ret)); 1040 DEBUG(1, ("gpfs_get_xattr: Get GPFS attributes failed: " 1041 "%d (%s)\n", ret, strerror(errno))); 1004 1042 return -1; 1005 1043 } … … 1007 1045 DEBUG(10, ("gpfs_get_xattr:Got attributes: 0x%x\n",attrs.winAttrs)); 1008 1046 1009 /*Just map RD_ONLY, ARCHIVE, SYSTEM and HIDDEN. Ignore the others*/1047 /*Just map RD_ONLY, ARCHIVE, SYSTEM. Ignore the others*/ 1010 1048 if (attrs.winAttrs & GPFS_WINATTR_ARCHIVE){ 1011 1049 dosmode |= FILE_ATTRIBUTE_ARCHIVE; … … 1020 1058 dosmode |= FILE_ATTRIBUTE_READONLY; 1021 1059 } 1022 1023 result = snprintf(attrstr, size, "0x%x", 1024 dosmode & SAMBA_ATTRIBUTES_MASK) + 1; 1025 1060 if (attrs.winAttrs & GPFS_WINATTR_SPARSE_FILE) { 1061 dosmode |= FILE_ATTRIBUTE_SPARSE; 1062 } 1063 1064 snprintf(attrstr, size, "0x%2.2x", 1065 (unsigned int)(dosmode & SAMBA_ATTRIBUTES_MASK)); 1026 1066 DEBUG(10, ("gpfs_get_xattr: returning %s\n",attrstr)); 1027 return result;1067 return ; 1028 1068 } 1029 1069 … … 1050 1090 smb_fname->st.st_ex_btime.tv_sec = attrs.creationTime.tv_sec; 1051 1091 smb_fname->st.st_ex_btime.tv_nsec = attrs.creationTime.tv_nsec; 1092 1052 1093 } 1053 1094 return 0; … … 1097 1138 smb_fname->st.st_ex_btime.tv_sec = attrs.creationTime.tv_sec; 1098 1139 smb_fname->st.st_ex_btime.tv_nsec = attrs.creationTime.tv_nsec; 1140 1099 1141 } 1100 1142 return 0; … … 1142 1184 } 1143 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1144 1250 int vfs_gpfs_connect(struct vfs_handle_struct *handle, const char *service, 1145 1251 const char *user) 1146 1252 { 1147 1253 struct gpfs_config_data *config; 1254 1255 1256 1148 1257 int ret = SMB_VFS_NEXT_CONNECT(handle, service, user); 1149 1258 … … 1164 1273 "leases", true); 1165 1274 1275 1276 1277 1166 1278 SMB_VFS_HANDLE_SET_DATA(handle, config, 1167 1279 NULL, struct gpfs_config_data, … … 1171 1283 } 1172 1284 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 } 1285 static uint32_t vfs_gpfs_capabilities(struct vfs_handle_struct *handle, 1286 enum timestamp_set_resolution *p_ts_res) 1287 { 1288 struct gpfs_config_data *config; 1289 uint32_t next; 1290 1291 next = SMB_VFS_NEXT_FS_CAPABILITIES(handle, p_ts_res); 1292 1293 SMB_VFS_HANDLE_GET_DATA(handle, config, 1294 struct gpfs_config_data, 1295 return next); 1296 1297 if (config->hsm) { 1298 next |= FILE_SUPPORTS_REMOTE_STORAGE; 1299 } 1300 return next; 1301 } 1302 1303 static int vfs_gpfs_open(struct vfs_handle_struct *handle, 1304 struct smb_filename *smb_fname, files_struct *fsp, 1305 int flags, mode_t mode) 1306 { 1307 if (lp_parm_bool(fsp->conn->params->service, "gpfs", "syncio", 1308 false)) { 1309 flags |= O_SYNC; 1310 } 1311 return SMB_VFS_NEXT_OPEN(handle, smb_fname, fsp, flags, mode); 1312 } 1313 1186 1314 1187 1315 static struct vfs_fn_pointers vfs_gpfs_fns = { 1188 1316 .connect_fn = vfs_gpfs_connect, 1317 1189 1318 .kernel_flock = vfs_gpfs_kernel_flock, 1190 1319 .linux_setlease = vfs_gpfs_setlease, … … 1207 1336 .lstat = vfs_gpfs_lstat, 1208 1337 .ntimes = vfs_gpfs_ntimes, 1209 .ftruncate = vfs_gpfs_ftruncate, 1338 .is_offline = vfs_gpfs_is_offline, 1339 .aio_force = vfs_gpfs_aio_force, 1340 .sendfile = vfs_gpfs_sendfile, 1341 .open_fn = vfs_gpfs_open, 1342 .ftruncate = vfs_gpfs_ftruncate 1210 1343 }; 1211 1344
Note:
See TracChangeset
for help on using the changeset viewer.
