~n-muench/ubuntu/oneiric/open-vm-tools/open-vm-tools.fix-836277

« back to all changes in this revision

Viewing changes to lib/hgfsServer/hgfsServerInt.h

  • Committer: Evan Broder
  • Date: 2010-03-21 23:26:53 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: broder@mit.edu-20100321232653-5a57r7v7ch4o6byv
Merging shared upstream rev into target branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
      uint64 d_off;
51
51
      uint16 d_reclen;
52
52
      uint8  d_type;
53
 
      int8   d_name[256];
 
53
      char   d_name[256];
54
54
   } DirectoryEntry;
55
55
#  else
56
56
#    include <dirent.h>
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"
 
77
 
 
78
/*
 
79
 * Locking: if requested, use glib's locking functions to avoid more bora
 
80
 * dependencies. In other builds, stick with bora/lib/lock.
 
81
 */
 
82
 
 
83
#if defined(VMTOOLS_USE_GLIB)
 
84
#  include <glib.h>
 
85
 
 
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"
 
93
 
 
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)
 
99
#endif
 
100
 
77
101
 
78
102
/*
79
103
 * Does this platform have oplock support? We define it here to avoid long
285
309
   HgfsSessionSendFunc *send;
286
310
 
287
311
   /* Lock to ensure some fileIO requests are atomic for a handle. */
288
 
   SyncMutex fileIOLock;
 
312
   HgfsLock *fileIOLock;
289
313
 
290
314
   Atomic_uint32 refCount;    /* Reference count for session. */
291
315
 
295
319
    * Lock for the following 6 fields: the node array,
296
320
    * counters and lists for this session.
297
321
    */
298
 
   SyncMutex nodeArrayLock;
 
322
   HgfsLock *nodeArrayLock;
299
323
 
300
324
   /* Open file nodes of this session. */
301
325
   HgfsFileNode *nodeArray;
322
346
    * Lock for the following three fields: for the search array
323
347
    * and it's counter and list, for this session.
324
348
    */
325
 
   SyncMutex searchArrayLock;
 
349
   HgfsLock *searchArrayLock;
326
350
 
327
351
   /* Directory entry cache for this session. */
328
352
   HgfsSearch *searchArray;
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
600
624
 
601
625
Bool
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
609
634
 
610
635
Bool
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
615
641
 
616
642
Bool
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
628
655
 
629
656
Bool
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
634
662
 
635
663
Bool
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
669
697
 
670
698
Bool
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
675
704
 
682
711
Bool
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
687
717
 
688
718
Bool
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.
695
726
 
696
727
Bool
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
 
734
Bool
 
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
 
739
Bool
 
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
 
745
Bool
 
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
 
750
Bool
 
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
702
756
 
703
757
/* Node cache functions. */
704
758