73
73
#include "cpName.h" // for HgfsNameStatus
74
74
#include "hgfsServerPolicy.h"
75
75
#include "hgfsUtil.h" // for HgfsInternalStatus
76
#include "syncMutex.h"
76
#include "vm_atomic.h"
79
* Locking: if requested, use glib's locking functions to avoid more bora
80
* dependencies. In other builds, stick with bora/lib/lock.
83
#if defined(VMTOOLS_USE_GLIB)
86
typedef GMutex HgfsLock;
87
# define HGFS_LOCK_NEW(name) g_mutex_new()
88
# define HGFS_LOCK_ACQUIRE(lock) g_mutex_lock(lock)
89
# define HGFS_LOCK_RELEASE(lock) g_mutex_unlock(lock)
90
# define HGFS_LOCK_DESTROY(lock) g_mutex_free(lock)
91
#else /* !VMTOOLS_USE_GLIB */
92
# include "userlock.h"
94
typedef MXUserExclLock HgfsLock;
95
# define HGFS_LOCK_NEW(name) MXUser_CreateExclLock(name, RANK_UNRANKED)
96
# define HGFS_LOCK_ACQUIRE(lock) MXUser_AcquireExclLock(lock)
97
# define HGFS_LOCK_RELEASE(lock) MXUser_ReleaseExclLock(lock)
98
# define HGFS_LOCK_DESTROY(lock) MXUser_DestroyExclLock(lock)
79
103
* Does this platform have oplock support? We define it here to avoid long
596
620
char **cpName, // OUT: cpName
597
621
size_t *cpNameSize, // OUT: cpName size
598
622
HgfsHandle *file, // OUT: file handle
599
uint32 *caseFlags); // OUT: case-sensitivity flags
623
uint32 *caseFlags); // OUT: case-sensitivity flags
602
626
HgfsUnpackDeleteRequest(char const *packetIn, // IN: request packet
603
627
size_t packetSize, // IN: request packet size
628
HgfsOp *op, // OUT: requested operation
604
629
char **cpName, // OUT: cpName
605
630
size_t *cpNameSize, // OUT: cpName size
606
631
HgfsDeleteHint *hints, // OUT: delete hints
607
632
HgfsHandle *file, // OUT: file handle
608
uint32 *caseFlags); // OUT: case-sensitivity flags
633
uint32 *caseFlags); // OUT: case-sensitivity flags
611
636
HgfsPackDeleteReply(char const *packetIn, // IN: incoming packet
612
637
HgfsInternalStatus status, // IN: reply status
638
HgfsOp op, // IN: requested operation
613
639
char **packetOut, // OUT: outgoing packet
614
640
size_t *packetSize); // OUT: size of packet
617
643
HgfsUnpackRenameRequest(char const *packetIn, // IN: request packet
618
644
size_t packetSize, // IN: request packet size
645
HgfsOp *op, // OUT: requested operation
619
646
char **cpOldName, // OUT: rename src
620
uint32 *cpOldNameLen, // OUT: rename src size
647
size_t *cpOldNameLen, // OUT: rename src size
621
648
char **cpNewName, // OUT: rename dst
622
uint32 *cpNewNameLen, // OUT: rename dst size
649
size_t *cpNewNameLen, // OUT: rename dst size
623
650
HgfsRenameHint *hints, // OUT: rename hints
624
651
HgfsHandle *srcFile, // OUT: src file handle
625
652
HgfsHandle *targetFile, // OUT: target file handle
626
uint32 *oldCaseFlags, // OUT: old case-sensitivity flags
627
uint32 *newCaseFlags); // OUT: new case-sensitivity flags
653
uint32 *oldCaseFlags, // OUT: old case-sensitivity flags
654
uint32 *newCaseFlags); // OUT: new case-sensitivity flags
630
HgfsPackRenameReply(char const *packetIn, // IN: incoming packet
631
HgfsInternalStatus status, // IN: reply status
632
char **packetOut, // OUT: outgoing packet
633
size_t *packetSize); // OUT: size of packet
657
HgfsPackRenameReply(char const *packetIn, // IN: incoming packet
658
HgfsInternalStatus status, // IN: reply status
659
HgfsOp op, // IN: requested operation
660
char **packetOut, // OUT: outgoing packet
661
size_t *packetSize); // OUT: size of packet
636
664
HgfsPackGetattrReply(char const *packetIn, // IN: incoming packet
665
693
char **cpName, // OUT: cpName
666
694
size_t *cpNameSize, // OUT: cpName size
667
695
HgfsHandle *file, // OUT: server file ID
668
uint32 *caseFlags); // OUT: case-sensitivity flags
696
uint32 *caseFlags); // OUT: case-sensitivity flags
671
699
HgfsPackSetattrReply(char const *packetIn, // IN: setattrOp operation version
672
700
HgfsInternalStatus status, // IN: reply status
701
HgfsOp op, // IN: request type
673
702
char **packetOut, // OUT: outgoing packet
674
703
size_t *packetSize); // OUT: size of packet
683
712
HgfsPackCreateDirReply(char const *packetIn, // IN: incoming packet
684
713
HgfsInternalStatus status, // IN: reply status
714
HgfsOp op, // IN: request type
685
715
char **packetOut, // OUT: outgoing packet
686
716
size_t *packetSize); // OUT: size of packet
689
719
HgfsUnpackWriteWin32StreamRequest(char const *packetIn, // IN: incoming packet
690
size_t packetSize, // IN: size of packet
691
HgfsHandle *file, // OUT: file to write to
692
char **payload, // OUT: data to write
693
size_t *requiredSize, // OUT: size of data
694
Bool *doSecurity); // OUT: restore sec.str.
720
size_t packetSize, // IN: size of packet
721
HgfsOp *op, // OUT: request type
722
HgfsHandle *file, // OUT: file to write to
723
char **payload, // OUT: data to write
724
size_t *requiredSize, // OUT: size of data
725
Bool *doSecurity); // OUT: restore sec.str.
697
728
HgfsPackWriteWin32StreamReply(char const *packetIn, // IN: incoming packet
698
HgfsInternalStatus status, // IN: reply status
699
uint32 actualSize, // IN: amount written
700
char **packetOut, // OUT: outgoing packet
701
size_t *packetSize); // OUT: size of packet
729
HgfsInternalStatus status, // IN: reply status
730
HgfsOp op, // IN: request type
731
uint32 actualSize, // IN: amount written
732
char **packetOut, // OUT: outgoing packet
733
size_t *packetSize); // OUT: size of packet
735
HgfsUnpackCloseRequest(char const *packetIn, // IN: request packet
736
size_t packetSize, // IN: request packet size
737
HgfsOp *op, // OUT: request type
738
HgfsHandle *file); // OUT: Handle to close
740
HgfsPackCloseReply(char const *packetIn, // IN: incoming packet
741
HgfsInternalStatus status, // IN: reply status
742
HgfsOp op, // IN: request type
743
char **packetOut, // OUT: outgoing packet
744
size_t *packetSize); // OUT: size of packet
746
HgfsUnpackSearchCloseRequest(char const *packetIn, // IN: request packet
747
size_t packetSize, // IN: request packet size
748
HgfsOp *op, // OUT: request type
749
HgfsHandle *file); // OUT: Handle to close
751
HgfsPackSearchCloseReply(char const *packetIn, // IN: incoming packet
752
HgfsInternalStatus status, // IN: reply status
753
HgfsOp op, // IN: request type
754
char **packetOut, // OUT: outgoing packet
755
size_t *packetSize); // OUT: size of packet
703
757
/* Node cache functions. */