Changeset 30504 in vbox for trunk/src/VBox/Additions/solaris/SharedFolders
- Timestamp:
- Jun 29, 2010 2:06:52 PM (14 years ago)
- Location:
- trunk/src/VBox/Additions/solaris/SharedFolders
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/solaris/SharedFolders/vboxfs_prov.c
r30496 r30504 408 408 * get information about a file (or directory) 409 409 */ 410 static void 411 sfprov_mode_from_fmode(mode_t *mode, RTFMODE fMode) 412 { 413 mode_t m = 0; 414 415 if (RTFS_IS_DIRECTORY(fMode)) 416 m |= S_IFDIR; 417 else if (RTFS_IS_FILE(fMode)) 418 m |= S_IFREG; 419 else if (RTFS_IS_FIFO(fMode)) 420 m |= S_IFIFO; 421 else if (RTFS_IS_DEV_CHAR(fMode)) 422 m |= S_IFCHR; 423 else if (RTFS_IS_DEV_BLOCK(fMode)) 424 m |= S_IFBLK; 425 else if (RTFS_IS_SYMLINK(fMode)) 426 m |= S_IFLNK; 427 else if (RTFS_IS_SOCKET(fMode)) 428 m |= S_IFSOCK; 429 430 if (fMode & RTFS_UNIX_IRUSR) 431 m |= S_IRUSR; 432 if (fMode & RTFS_UNIX_IWUSR) 433 m |= S_IWUSR; 434 if (fMode & RTFS_UNIX_IXUSR) 435 m |= S_IXUSR; 436 if (fMode & RTFS_UNIX_IRGRP) 437 m |= S_IRGRP; 438 if (fMode & RTFS_UNIX_IWGRP) 439 m |= S_IWGRP; 440 if (fMode & RTFS_UNIX_IXGRP) 441 m |= S_IXGRP; 442 if (fMode & RTFS_UNIX_IROTH) 443 m |= S_IROTH; 444 if (fMode & RTFS_UNIX_IWOTH) 445 m |= S_IWOTH; 446 if (fMode & RTFS_UNIX_IXOTH) 447 m |= S_IXOTH; 448 if (fMode & RTFS_UNIX_ISUID) 449 m |= S_ISUID; 450 if (fMode & RTFS_UNIX_ISGID) 451 m |= S_ISGID; 452 if (fMode & RTFS_UNIX_ISTXT) 453 m |= S_ISVTX; 454 *mode = m; 455 } 456 457 /* 458 * get information about a file (or directory) 459 */ 410 460 int 411 461 sfprov_get_mode(sfp_mount_t *mnt, char *path, mode_t *mode) … … 413 463 int rc; 414 464 RTFSOBJINFO info; 415 mode_t m = 0;416 465 417 466 rc = sfprov_getinfo(mnt, path, &info); 418 467 if (rc) 419 468 return (rc); 420 if (RTFS_IS_DIRECTORY(info.Attr.fMode)) 421 m |= S_IFDIR; 422 else if (RTFS_IS_FILE(info.Attr.fMode)) 423 m |= S_IFREG; 424 else if (RTFS_IS_FIFO(info.Attr.fMode)) 425 m |= S_IFIFO; 426 else if (RTFS_IS_DEV_CHAR(info.Attr.fMode)) 427 m |= S_IFCHR; 428 else if (RTFS_IS_DEV_BLOCK(info.Attr.fMode)) 429 m |= S_IFBLK; 430 else if (RTFS_IS_SYMLINK(info.Attr.fMode)) 431 m |= S_IFLNK; 432 else if (RTFS_IS_SOCKET(info.Attr.fMode)) 433 m |= S_IFSOCK; 434 435 if (info.Attr.fMode & RTFS_UNIX_IRUSR) 436 m |= S_IRUSR; 437 if (info.Attr.fMode & RTFS_UNIX_IWUSR) 438 m |= S_IWUSR; 439 if (info.Attr.fMode & RTFS_UNIX_IXUSR) 440 m |= S_IXUSR; 441 if (info.Attr.fMode & RTFS_UNIX_IRGRP) 442 m |= S_IRGRP; 443 if (info.Attr.fMode & RTFS_UNIX_IWGRP) 444 m |= S_IWGRP; 445 if (info.Attr.fMode & RTFS_UNIX_IXGRP) 446 m |= S_IXGRP; 447 if (info.Attr.fMode & RTFS_UNIX_IROTH) 448 m |= S_IROTH; 449 if (info.Attr.fMode & RTFS_UNIX_IWOTH) 450 m |= S_IWOTH; 451 if (info.Attr.fMode & RTFS_UNIX_IXOTH) 452 m |= S_IXOTH; 453 if (info.Attr.fMode & RTFS_UNIX_ISUID) 454 m |= S_ISUID; 455 if (info.Attr.fMode & RTFS_UNIX_ISGID) 456 m |= S_ISGID; 457 if (info.Attr.fMode & RTFS_UNIX_ISTXT) 458 m |= S_ISVTX; 459 *mode = m; 469 sfprov_mode_from_fmode(mode, info.Attr.fMode); 460 470 return (0); 461 471 } … … 474 484 } 475 485 486 static void 487 sfprov_ftime_from_timespec(timestruc_t *time, RTTIMESPEC *ts) 488 { 489 uint64_t nanosec = RTTimeSpecGetNano(ts); 490 time->tv_sec = nanosec / UINT64_C(1000000000); 491 time->tv_nsec = nanosec % UINT64_C(1000000000); 492 } 493 476 494 int 477 495 sfprov_get_atime(sfp_mount_t *mnt, char *path, timestruc_t *time) … … 479 497 int rc; 480 498 RTFSOBJINFO info; 481 uint64_t nanosec;482 499 483 500 rc = sfprov_getinfo(mnt, path, &info); 484 501 if (rc) 485 502 return (rc); 486 nanosec = RTTimeSpecGetNano(&info.AccessTime); 487 time->tv_sec = nanosec / 1000000000; 488 time->tv_nsec = nanosec % 1000000000; 503 sfprov_ftime_from_timespec(time, &info.AccessTime); 489 504 return (0); 490 505 } … … 495 510 int rc; 496 511 RTFSOBJINFO info; 497 uint64_t nanosec;498 512 499 513 rc = sfprov_getinfo(mnt, path, &info); 500 514 if (rc) 501 515 return (rc); 502 nanosec = RTTimeSpecGetNano(&info.ModificationTime); 503 time->tv_sec = nanosec / 1000000000; 504 time->tv_nsec = nanosec % 1000000000; 516 sfprov_ftime_from_timespec(time, &info.ModificationTime); 505 517 return (0); 506 518 } … … 511 523 int rc; 512 524 RTFSOBJINFO info; 513 uint64_t nanosec;514 525 515 526 rc = sfprov_getinfo(mnt, path, &info); 516 527 if (rc) 517 528 return (rc); 518 nanosec = RTTimeSpecGetNano(&info.ChangeTime); 519 time->tv_sec = nanosec / 1000000000; 520 time->tv_nsec = nanosec % 1000000000; 529 sfprov_ftime_from_timespec(time, &info.ChangeTime); 530 return (0); 531 } 532 533 int 534 sfprov_get_attr( 535 sfp_mount_t *mnt, 536 char *path, 537 mode_t *mode, 538 uint64_t *size, 539 timestruc_t *atime, 540 timestruc_t *mtime, 541 timestruc_t *ctime) 542 { 543 int rc; 544 RTFSOBJINFO info; 545 546 rc = sfprov_getinfo(mnt, path, &info); 547 if (rc) 548 return (rc); 549 550 if (mode) 551 sfprov_mode_from_fmode(mode, info.Attr.fMode); 552 if (size != NULL) 553 *size = info.cbObject; 554 if (atime != NULL) 555 sfprov_ftime_from_timespec(atime, &info.AccessTime); 556 if (mtime != NULL) 557 sfprov_ftime_from_timespec(mtime, &info.ModificationTime); 558 if (ctime != NULL) 559 sfprov_ftime_from_timespec(ctime, &info.ChangeTime); 560 521 561 return (0); 522 562 } -
trunk/src/VBox/Additions/solaris/SharedFolders/vboxfs_prov.h
r30446 r30504 94 94 extern int sfprov_get_mtime(sfp_mount_t *, char *, timestruc_t *); 95 95 extern int sfprov_get_ctime(sfp_mount_t *, char *, timestruc_t *); 96 extern int sfprov_get_attr(sfp_mount_t *, char *, mode_t *, uint64_t *, 97 timestruc_t *, timestruc_t *, timestruc_t *); 96 98 extern int sfprov_set_attr(sfp_mount_t *, char *, uint_t, mode_t, 97 99 timestruc_t, timestruc_t, timestruc_t); -
trunk/src/VBox/Additions/solaris/SharedFolders/vboxfs_vnode.c
r30446 r30504 726 726 sffs_data_t *sffs = node->sf_sffs; 727 727 mode_t mode; 728 timestruc_t time;729 728 uint64_t x; 730 729 int error; … … 740 739 vap->va_seq = 0; 741 740 742 error = sfprov_get_mode(node->sf_sffs->sf_handle, node->sf_path, &mode); 741 error = sfprov_get_attr(node->sf_sffs->sf_handle, node->sf_path, &mode, 742 &x, &vap->va_atime, &vap->va_mtime, &vap->va_ctime); 743 743 if (error == ENOENT) 744 744 sfnode_make_stale(node); … … 761 761 vap->va_type = VSOCK; 762 762 763 error = sfprov_get_size(node->sf_sffs->sf_handle, node->sf_path, &x);764 if (error == ENOENT)765 sfnode_make_stale(node);766 if (error != 0)767 goto done;768 763 vap->va_size = x; 769 764 vap->va_blksize = 512; 770 765 vap->va_nblocks = (x + 511) / 512; 771 772 error =773 sfprov_get_atime(node->sf_sffs->sf_handle, node->sf_path, &time);774 if (error == ENOENT)775 sfnode_make_stale(node);776 if (error != 0)777 goto done;778 vap->va_atime = time;779 780 error =781 sfprov_get_mtime(node->sf_sffs->sf_handle, node->sf_path, &time);782 if (error == ENOENT)783 sfnode_make_stale(node);784 if (error != 0)785 goto done;786 vap->va_mtime = time;787 788 error =789 sfprov_get_ctime(node->sf_sffs->sf_handle, node->sf_path, &time);790 if (error == ENOENT)791 sfnode_make_stale(node);792 if (error != 0)793 goto done;794 vap->va_ctime = time;795 766 796 767 done:
Note:
See TracChangeset
for help on using the changeset viewer.