Changeset 23189 in vbox for trunk/src/VBox/Additions/linux/sharedfolders/utils.c
- Timestamp:
- Sep 21, 2009 1:57:43 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/linux/sharedfolders/utils.c
r21014 r23189 294 294 295 295 memset(¶ms, 0, sizeof(params)); 296 memset(&info, 0, sizeof(info));297 296 298 297 params.CreateFlags = SHFL_CF_ACT_OPEN_IF_EXISTS … … 313 312 } 314 313 315 cbBuffer = sizeof(info); 316 314 /* Setting the file size and setting the other attributes has to be 315 * handled separately, see implementation of vbsfSetFSInfo() in 316 * vbsf.cpp */ 317 if (iattr->ia_valid & (ATTR_MODE | ATTR_ATIME | ATTR_MTIME)) 318 { 317 319 #define mode_set(r) ((iattr->ia_mode & (S_##r)) ? RTFS_UNIX_##r : 0) 318 320 319 if (iattr->ia_valid & ATTR_MODE) 320 { 321 info.Attr.fMode = mode_set (ISUID); 322 info.Attr.fMode |= mode_set (ISGID); 323 info.Attr.fMode |= mode_set (IRUSR); 324 info.Attr.fMode |= mode_set (IWUSR); 325 info.Attr.fMode |= mode_set (IXUSR); 326 info.Attr.fMode |= mode_set (IRGRP); 327 info.Attr.fMode |= mode_set (IWGRP); 328 info.Attr.fMode |= mode_set (IXGRP); 329 info.Attr.fMode |= mode_set (IROTH); 330 info.Attr.fMode |= mode_set (IWOTH); 331 info.Attr.fMode |= mode_set (IXOTH); 332 333 if (iattr->ia_mode & S_IFDIR) 334 info.Attr.fMode |= RTFS_TYPE_DIRECTORY; 335 else 336 info.Attr.fMode |= RTFS_TYPE_FILE; 337 } 338 339 if (iattr->ia_valid & ATTR_ATIME) 340 sf_timespec_from_ftime (&info.AccessTime, &iattr->ia_atime); 341 if (iattr->ia_valid & ATTR_MTIME) 342 sf_timespec_from_ftime (&info.ModificationTime, &iattr->ia_mtime); 343 /* ignore ctime (inode change time) as it can't be set from userland anyway */ 344 345 rc = vboxCallFSInfo(&client_handle, &sf_g->map, params.Handle, 346 SHFL_INFO_SET | SHFL_INFO_FILE, &cbBuffer, 347 (PSHFLDIRINFO)&info); 348 if (VBOX_FAILURE (rc)) { 349 LogFunc(("vboxCallFSInfo(%s) failed rc=%Rrc\n", 321 memset(&info, 0, sizeof(info)); 322 if (iattr->ia_valid & ATTR_MODE) 323 { 324 info.Attr.fMode = mode_set (ISUID); 325 info.Attr.fMode |= mode_set (ISGID); 326 info.Attr.fMode |= mode_set (IRUSR); 327 info.Attr.fMode |= mode_set (IWUSR); 328 info.Attr.fMode |= mode_set (IXUSR); 329 info.Attr.fMode |= mode_set (IRGRP); 330 info.Attr.fMode |= mode_set (IWGRP); 331 info.Attr.fMode |= mode_set (IXGRP); 332 info.Attr.fMode |= mode_set (IROTH); 333 info.Attr.fMode |= mode_set (IWOTH); 334 info.Attr.fMode |= mode_set (IXOTH); 335 336 if (iattr->ia_mode & S_IFDIR) 337 info.Attr.fMode |= RTFS_TYPE_DIRECTORY; 338 else 339 info.Attr.fMode |= RTFS_TYPE_FILE; 340 } 341 342 if (iattr->ia_valid & ATTR_ATIME) 343 sf_timespec_from_ftime (&info.AccessTime, &iattr->ia_atime); 344 if (iattr->ia_valid & ATTR_MTIME) 345 sf_timespec_from_ftime (&info.ModificationTime, &iattr->ia_mtime); 346 /* ignore ctime (inode change time) as it can't be set from userland anyway */ 347 348 cbBuffer = sizeof(info); 349 rc = vboxCallFSInfo(&client_handle, &sf_g->map, params.Handle, 350 SHFL_INFO_SET | SHFL_INFO_FILE, &cbBuffer, 351 (PSHFLDIRINFO)&info); 352 if (VBOX_FAILURE (rc)) { 353 LogFunc(("vboxCallFSInfo(%s, FILE) failed rc=%Rrc\n", 350 354 sf_i->path->String.utf8, rc)); 351 355 err = -RTErrConvertToErrno(rc); 352 356 goto fail1; 353 } 354 357 } 358 } 359 360 if (iattr->ia_valid & ATTR_SIZE) 361 { 362 memset(&info, 0, sizeof(info)); 363 info.cbObject = iattr->ia_size; 364 cbBuffer = sizeof(info); 365 rc = vboxCallFSInfo(&client_handle, &sf_g->map, params.Handle, 366 SHFL_INFO_SET | SHFL_INFO_SIZE, &cbBuffer, 367 (PSHFLDIRINFO)&info); 368 if (VBOX_FAILURE (rc)) { 369 LogFunc(("vboxCallFSInfo(%s, SIZE) failed rc=%Rrc\n", 370 sf_i->path->String.utf8, rc)); 371 err = -RTErrConvertToErrno(rc); 372 goto fail1; 373 } 374 } 375 355 376 rc = vboxCallClose (&client_handle, &sf_g->map, params.Handle); 356 if (VBOX_FAILURE (rc)) { 377 if (VBOX_FAILURE (rc)) 378 { 357 379 LogFunc(("vboxCallClose(%s) failed rc=%Rrc\n", 358 380 sf_i->path->String.utf8, rc)); … … 363 385 fail1: 364 386 rc = vboxCallClose (&client_handle, &sf_g->map, params.Handle); 365 if (VBOX_FAILURE (rc)) { 387 if (VBOX_FAILURE (rc)) 388 { 366 389 LogFunc(("vboxCallClose(%s) failed rc=%Rrc\n", 367 390 sf_i->path->String.utf8, rc));
Note:
See TracChangeset
for help on using the changeset viewer.