]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
HGFS: Clean up server transport session usage
authorVMware, Inc <>
Wed, 18 Sep 2013 03:17:02 +0000 (20:17 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Mon, 23 Sep 2013 05:01:54 +0000 (22:01 -0700)
The transport session is only ever used in the common HGFS server code.
The scope should be constrained to that file and beyond that treated as
an opaque type.

Make some of the transport session functions static to the common HGFS
server file and remove the declarations from the common header file.

Signed-off-by: Dmitry Torokhov <dtor@vmware.com>
open-vm-tools/lib/hgfsServer/hgfsServer.c
open-vm-tools/lib/hgfsServer/hgfsServerInt.h
open-vm-tools/lib/hgfsServer/hgfsServerParameters.h

index 1835bb81820bf2f02cfe74ce014028ca2f98ff7d..fc34c277d6e1302f33c3699bfa0f8df54b95732b 100644 (file)
 #define MAX_LOCKED_FILENODES 10
 
 
+struct HgfsTransportSessionInfo {
+   /* Default session id. */
+   uint64 defaultSessionId;
+
+   /* Lock to manipulate the list of sessions */
+   MXUserExclLock *sessionArrayLock;
+
+   /* List of sessions */
+   DblLnkLst_Links sessionArray;
+
+   /* Max packet size that is supported by both client and server. */
+   uint32 maxPacketSize;
+
+   /* Total number of sessions present this transport session*/
+   uint32 numSessions;
+
+   /* Transport session context. */
+   void *transportData;
+
+   /* Current state of the session. */
+   HgfsSessionInfoState state;
+
+   /* Session is dynamic or internal. */
+   HgfsSessionInfoType type;
+
+   /* Function callbacks into Hgfs Channels. */
+   HgfsServerChannelCallbacks *channelCbTable;
+
+   Atomic_uint32 refCount;    /* Reference count for session. */
+
+   HgfsServerChannelData channelCapabilities;
+};
+
 /* The input request paramaters object. */
 typedef struct HgfsInputParam {
    const void *request;          /* Hgfs header followed by operation request */
@@ -240,8 +273,21 @@ typedef struct HgfsSharedFolderProperties {
    Bool markedForDeletion;
 } HgfsSharedFolderProperties;
 
-static void HgfsServerTransportRemoveSessionFromList(HgfsTransportSessionInfo *transportSession,
-                                                     HgfsSessionInfo *sessionInfo);
+
+/* Allocate/Add sessions helper functions. */
+
+static Bool
+HgfsServerAllocateSession(HgfsTransportSessionInfo *transportSession,
+                          HgfsSessionInfo **sessionData);
+static HgfsInternalStatus
+HgfsServerTransportAddSessionToList(HgfsTransportSessionInfo *transportSession,
+                                    HgfsSessionInfo *sessionInfo);
+static void
+HgfsServerTransportRemoveSessionFromList(HgfsTransportSessionInfo *transportSession,
+                                         HgfsSessionInfo *sessionInfo);
+static HgfsSessionInfo *
+HgfsServerTransportGetSessionInfo(HgfsTransportSessionInfo *transportSession,
+                                  uint64 sessionId);
 
 /* Local functions. */
 static void HgfsInvalidateSessionObjects(DblLnkLst_Links *shares,
@@ -347,7 +393,7 @@ static void HgfsServerRemoveDirNotifyWatch(HgfsInputParam *input);
  *----------------------------------------------------------------------------
  */
 
-void
+static void
 HgfsServerSessionGet(HgfsSessionInfo *session)   // IN: session context
 {
    ASSERT(session);
@@ -3276,7 +3322,7 @@ HgfsServerSessionReceive(HgfsPacket *packet,      // IN: Hgfs Packet
  *-----------------------------------------------------------------------------
  */
 
-HgfsSessionInfo *
+static HgfsSessionInfo *
 HgfsServerTransportGetSessionInfo(HgfsTransportSessionInfo *transportSession,       // IN: transport session info
                                   uint64 sessionId)                                 // IN: session id
 {
@@ -3415,7 +3461,7 @@ HgfsServerTransportRemoveSessionFromList(HgfsTransportSessionInfo *transportSess
  *-----------------------------------------------------------------------------
  */
 
-HgfsInternalStatus
+static HgfsInternalStatus
 HgfsServerTransportAddSessionToList(HgfsTransportSessionInfo *transportSession,       // IN: transport session info
                                     HgfsSessionInfo *session)                         // IN: session info
 {
@@ -4006,7 +4052,7 @@ HgfsServerSessionConnect(void *transportData,                         // IN: tra
  *-----------------------------------------------------------------------------
  */
 
-Bool
+static Bool
 HgfsServerAllocateSession(HgfsTransportSessionInfo *transportSession, // IN:
                           HgfsSessionInfo **sessionData)              // OUT:
 {
index c66f0c8efc1552fe5ec704b0863b6eceac7a6931..a282a378433c4090b0319f24ffc3f0101436e6e4 100644 (file)
@@ -42,6 +42,7 @@ struct DirectoryEntry;
 
 #define HGFS_DEBUG_ASYNC   (0)
 
+typedef struct HgfsTransportSessionInfo HgfsTransportSessionInfo;
 
 /* Identifier for a local file */
 typedef struct HgfsLocalId {
@@ -247,39 +248,6 @@ typedef enum {
    HGFS_SESSION_STATE_CLOSED,
 } HgfsSessionInfoState;
 
-typedef struct HgfsTransportSessionInfo {
-   /* Default session id. */
-   uint64 defaultSessionId;
-
-   /* Lock to manipulate the list of sessions */
-   MXUserExclLock *sessionArrayLock;
-
-   /* List of sessions */
-   DblLnkLst_Links sessionArray;
-
-   /* Max packet size that is supported by both client and server. */
-   uint32 maxPacketSize;
-
-   /* Total number of sessions present this transport session*/
-   uint32 numSessions;
-
-   /* Transport session context. */
-   void *transportData;
-
-   /* Current state of the session. */
-   HgfsSessionInfoState state;
-
-   /* Session is dynamic or internal. */
-   HgfsSessionInfoType type;
-
-   /* Function callbacks into Hgfs Channels. */
-   HgfsServerChannelCallbacks *channelCbTable;
-
-   Atomic_uint32 refCount;    /* Reference count for session. */
-
-   HgfsServerChannelData channelCapabilities;
-} HgfsTransportSessionInfo;
-
 typedef struct HgfsSessionInfo {
 
    DblLnkLst_Links links;
@@ -566,15 +534,6 @@ HgfsServerRestartSearchVirtualDir(HgfsGetNameFunc *getName,     // IN: Name enum
                                   HgfsSessionInfo *session,     // IN: Session info
                                   HgfsHandle searchHandle);     // IN: search to restart
 
-/* Allocate/Add sessions helper functions. */
-
-Bool HgfsServerAllocateSession(HgfsTransportSessionInfo *transportSession,
-                               HgfsSessionInfo **sessionData);
-
-void HgfsServerSessionGet(HgfsSessionInfo *session);
-
-HgfsInternalStatus HgfsServerTransportAddSessionToList(HgfsTransportSessionInfo *transportSession,
-                                                       HgfsSessionInfo *sessionInfo);
 
 void *
 HgfsAllocInitReply(HgfsPacket *packet,           // IN/OUT: Hgfs Packet
@@ -685,10 +644,6 @@ HgfsServerGetTargetRelativePath(const char* source,    // IN: source file name
                                 const char* target);   // IN: target file name
 
 
-/* Get the session with a specific session id */
-HgfsSessionInfo *
-HgfsServerTransportGetSessionInfo(HgfsTransportSessionInfo *transportSession,   // IN: transport session info
-                                  uint64 sessionId);                            // IN: session id
 
 Bool
 HgfsPacketSend(HgfsPacket *packet,            // IN/OUT: Hgfs Packet
index bcfe8590e4a55e6b803b46fa7ce49f225393bef7..91efcf579e4f81d2ff487077d45b086fc2414f5b 100644 (file)
@@ -29,7 +29,7 @@
 #include "hgfsServer.h"    // for HgfsPacket type
 #include "hgfsProto.h"     // for the HGFS protocol request, reply and types
 #include "hgfsUtil.h"      // for HgfsInternalStatus
-#include "hgfsServerInt.h" // for HgfsSessionInfo, HgfsInputParam, HgfsTransportSessionInfo
+#include "hgfsServerInt.h" // for HgfsSessionInfo
 
 
 /*