#include "util.h"
#include "wiper.h"
#include "hgfsServer.h"
+#include "hgfsServerOplock.h"
#include "hgfsDirNotify.h"
#include "hgfsTransport.h"
#include "userlock.h"
#define HGFS_DEBUG_ASYNC (0)
-/*
- * Does this platform have oplock support? We define it here to avoid long
- * ifdefs all over the code. For now, Linux and Windows hosts only.
- *
- * XXX: Just kidding, no oplock support yet.
- */
-#if 0
-#define HGFS_OPLOCKS
-#endif
/* Identifier for a local file */
typedef struct HgfsLocalId {
} HgfsCreateSessionInfo;
-/* Server lock related structure */
-typedef struct {
- fileDesc fileDesc;
- int32 event;
- HgfsLockType serverLock;
-} ServerLockData;
-
typedef struct HgfsInputParam {
const char *metaPacket;
size_t metaPacketSize;
HgfsSessionInfo *session, // IN: session info
HgfsLocalId *localId); // OUT: Local id info
-Bool
-HgfsHandle2ServerLock(HgfsHandle handle, // IN: Hgfs file handle
- HgfsSessionInfo *session, // IN: session info
- HgfsLockType *lock); // OUT: Server lock
Bool
HgfsUpdateNodeFileDesc(HgfsHandle handle, // IN: Hgfs file handle
Bool appendFlag); // OUT: Append flag
Bool
-HgfsFileHasServerLock(const char *utf8Name, // IN: Name in UTF8
- HgfsSessionInfo *session, // IN: Session info
- HgfsLockType *serverLock, // OUT: Existing oplock
- fileDesc *fileDesc); // OUT: Existing fd
-Bool
HgfsGetNodeCopy(HgfsHandle handle, // IN: Hgfs file handle
HgfsSessionInfo *session, // IN: session info
Bool copyName, // IN: Should we copy the name?
HgfsServerGetOpenMode(HgfsFileOpenInfo *openInfo, // IN: Open info to examine
uint32 *modeOut); // OUT: Local mode
-Bool
-HgfsAcquireServerLock(fileDesc fileDesc, // IN: OS handle
- HgfsSessionInfo *session, // IN: Session info
- HgfsLockType *serverLock); // IN/OUT: Oplock asked for/granted
char*
HgfsServerGetTargetRelativePath(const char* source, // IN: source file name
const char* target); // IN: target file name
-/* All oplock-specific functionality is defined here. */
-#ifdef HGFS_OPLOCKS
-void
-HgfsServerOplockBreak(ServerLockData *data); // IN: server lock info
-
-void
-HgfsAckOplockBreak(ServerLockData *lockData, // IN: server lock info
- HgfsLockType replyLock); // IN: client has this lock
-
-#endif
-
/* Transport related functions. */
Bool
HgfsPackAndSendPacket(HgfsPacket *packet, // IN/OUT: Hgfs Packet
#include "vmware.h"
#include "hgfsServerPolicy.h" // for security policy
#include "hgfsServerInt.h"
+#include "hgfsServerOplock.h"
#include "hgfsEscape.h"
#include "str.h"
#include "cpNameLite.h"
#include "cpName.h"
#include "cpNameLite.h"
#include "hgfsServerInt.h"
+#include "hgfsServerOplockInt.h"
Bool
HgfsServerOplockInit(void)
{
- Bool result = TRUE;
+ Bool result = FALSE;
#ifdef HGFS_OPLOCKS
result = HgfsPlatformOplockInit();
#endif
--- /dev/null
+/*********************************************************
+ * Copyright (C) 2013 VMware, Inc. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation version 2.1 and no later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ *********************************************************/
+
+/*
+ * hgfsServerOplock.h --
+ *
+ * Header file for public common data types used in the HGFS
+ * opportunistic lock routines.
+ */
+
+#ifndef _HGFS_SERVER_OPLOCK_H_
+#define _HGFS_SERVER_OPLOCK_H_
+
+#include "hgfsProto.h" // for protocol types
+#include "hgfsServerInt.h" // for common server types e.g. HgfsSessionInfo
+
+
+/*
+ * Data structures
+ */
+
+
+
+/*
+ * Global variables
+ */
+
+
+
+/*
+ * Global functions
+ */
+
+Bool HgfsServerOplockInit(void);
+void HgfsServerOplockDestroy(void);
+Bool HgfsHandle2ServerLock(HgfsHandle handle,
+ HgfsSessionInfo *session,
+ HgfsLockType *lock);
+Bool HgfsFileHasServerLock(const char *utf8Name,
+ HgfsSessionInfo *session,
+ HgfsLockType *serverLock,
+ fileDesc *fileDesc);
+
+Bool HgfsAcquireServerLock(fileDesc fileDesc,
+ HgfsSessionInfo *session,
+ HgfsLockType *serverLock);
+
+
+#endif // ifndef _HGFS_SERVER_OPLOCK_H_
--- /dev/null
+/*********************************************************
+ * Copyright (C) 2013 VMware, Inc. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation version 2.1 and no later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ *********************************************************/
+
+/*
+ * hgfsServerOplock.h --
+ *
+ * Header file for private common data types used in the HGFS
+ * opportunistic lock routines.
+ */
+
+#ifndef _HGFS_SERVER_OPLOCKINT_H_
+#define _HGFS_SERVER_OPLOCKINT_H_
+
+#include "hgfsProto.h" // for protocol types
+#include "hgfsServerInt.h" // for common server types e.g. HgfsSessionInfo
+
+/*
+ * Does this platform have oplock support? We define it here to avoid long
+ * ifdefs all over the code. For now, Linux and Windows hosts only.
+ *
+ * XXX: Just kidding, no oplock support yet.
+ */
+#if 0
+#define HGFS_OPLOCKS
+#endif
+
+/*
+ * XXX describe the data structure
+ */
+
+/* Server lock related structure */
+typedef struct {
+ fileDesc fileDesc;
+ int32 event;
+ HgfsLockType serverLock;
+} ServerLockData;
+
+
+/*
+ * Global variables
+ */
+
+
+
+/*
+ * Global functions
+ */
+
+#ifdef HGFS_OPLOCKS
+void
+HgfsServerOplockBreak(ServerLockData *data);
+
+void
+HgfsAckOplockBreak(ServerLockData *lockData,
+ HgfsLockType replyLock);
+
+#endif
+
+#endif // ifndef _HGFS_SERVER_OPLOCKINT_H_
#include "vmware.h"
#include "hgfsServerInt.h"
+#include "hgfsServerOplockInt.h"
#ifdef HGFS_OPLOCKS
# include <signal.h>