/*********************************************************
- * 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
* 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;
}
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;
}
free(lockData);
}
#endif
-
/*********************************************************
- * 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
}
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * 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;
+}
+
+
/*
*-----------------------------------------------------------------------------
*