From: John Wolfe Date: Fri, 7 Aug 2020 19:03:25 +0000 (-0700) Subject: [HGFS Server] Support oplock inside HGFS server for Windows host X-Git-Tag: stable-11.2.0~93 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ac7098903f510f69b8aefdd9ae2625f691389ba8;p=thirdparty%2Fopen-vm-tools.git [HGFS Server] Support oplock inside HGFS server for Windows host Missed two source files for previous HGFS Server changeset. --- diff --git a/open-vm-tools/lib/hgfsServer/hgfsServerOplock.c b/open-vm-tools/lib/hgfsServer/hgfsServerOplock.c index 6f01caa31..fa63733b8 100644 --- a/open-vm-tools/lib/hgfsServer/hgfsServerOplock.c +++ b/open-vm-tools/lib/hgfsServer/hgfsServerOplock.c @@ -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 @@ -59,10 +61,10 @@ * * 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. @@ -73,11 +75,12 @@ 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 - diff --git a/open-vm-tools/lib/hgfsServer/hgfsServerOplockLinux.c b/open-vm-tools/lib/hgfsServer/hgfsServerOplockLinux.c index 90098052f..23611ba99 100644 --- a/open-vm-tools/lib/hgfsServer/hgfsServerOplockLinux.c +++ b/open-vm-tools/lib/hgfsServer/hgfsServerOplockLinux.c @@ -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; +} + + /* *----------------------------------------------------------------------------- *