]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
[HGFS Server] Support oplock inside HGFS server for Windows host
authorJohn Wolfe <jwolfe@vmware.com>
Fri, 7 Aug 2020 19:03:25 +0000 (12:03 -0700)
committerJohn Wolfe <jwolfe@vmware.com>
Fri, 7 Aug 2020 19:03:25 +0000 (12:03 -0700)
Missed two source files for previous HGFS Server changeset.

open-vm-tools/lib/hgfsServer/hgfsServerOplock.c
open-vm-tools/lib/hgfsServer/hgfsServerOplockLinux.c

index 6f01caa314945792bfb13c2f2124a7c982119cff..fa63733b8cd3a4cc9ee297be815fc1185cd8fbc8 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * Copyright (C) 2012-2019 VMware, Inc. All rights reserved.
+ * Copyright (C) 2012-2020 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
@@ -43,6 +43,8 @@
  * Local data
  */
 
+/* Indicates if the oplock module is initialized. */
+static Bool gOplockInit = FALSE;
 
 /*
  * Global data
  *
  * HgfsServerOplockInit --
  *
- *      Set up any state needed to start HGFS server.
+ *      Set up any oplock related state used for HGFS server.
  *
  * Results:
- *      None.
+ *      TRUE on success, FALSE on failure.
  *
  * Side effects:
  *      None.
 Bool
 HgfsServerOplockInit(void)
 {
-   Bool result = FALSE;
-#ifdef HGFS_OPLOCKS
-   result = HgfsPlatformOplockInit();
-#endif
-   return result;
+   if (gOplockInit) {
+      return TRUE;
+   }
+
+   gOplockInit = HgfsPlatformOplockInit();
+   return gOplockInit;
 }
 
 
@@ -100,10 +103,37 @@ HgfsServerOplockInit(void)
 void
 HgfsServerOplockDestroy(void)
 {
-#ifdef HGFS_OPLOCKS
+   if (!gOplockInit) {
+      return;
+   }
+
    /* Tear down oplock state, so we no longer catch signals. */
    HgfsPlatformOplockDestroy();
-#endif
+
+   gOplockInit = FALSE;
+}
+
+
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * HgfsServerOplockIsInited --
+ *
+ *      Check if the oplock related state is set up.
+ *
+ * Results:
+ *      TRUE if the oplock related state is set up.
+ *
+ * Side effects:
+ *      None.
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+Bool
+HgfsServerOplockIsInited(void)
+{
+   return gOplockInit;
 }
 
 
@@ -374,4 +404,3 @@ HgfsServerOplockBreak(ServerLockData *lockData)
    free(lockData);
 }
 #endif
-
index 90098052f01079cb8b569ab00597775dfa8945e2..23611ba99207e51576be17ed3675deda4bfea52e 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * Copyright (C) 2012-2019 VMware, Inc. All rights reserved.
+ * Copyright (C) 2012-2020 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
@@ -114,6 +114,56 @@ HgfsPlatformOplockDestroy(void)
 }
 
 
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * HgfsRemoveAIOServerLock --
+ *
+ *      Remove an oplock for an open file.
+ *
+ * Results:
+ *      None.
+ *
+ * Side effects:
+ *      None.
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+void
+HgfsRemoveAIOServerLock(fileDesc fileDesc)  // IN:
+{
+}
+
+
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * HgfsAcquireAIOServerLock --
+ *
+ *    Acquire an oplock for an open file and register the break oplock event.
+ *
+ * Results:
+ *    TRUE on success. serverLock contains the type of the lock acquired.
+ *    FALSE on failure. serverLock is HGFS_LOCK_NONE.
+ *
+ * Side effects:
+ *    None.
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+Bool
+HgfsAcquireAIOServerLock(fileDesc fileDesc,            // IN:
+                         HgfsSessionInfo *session,     // IN: Session info
+                         HgfsLockType *serverLock,     // IN/OUT: Oplock asked for/granted
+                         HgfsOplockCallback callback,  // IN: call back
+                         void *data)                   // IN: parameter for call back
+{
+   return FALSE;
+}
+
+
 /*
  *-----------------------------------------------------------------------------
  *