1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kerneltest/f32test/fileshare/handshareint.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,104 @@
1.4 +// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// f32test\handle sharing\interface.cpp
1.18 +//
1.19 +//
1.20 +
1.21 +
1.22 +#include "handshare.h"
1.23 +
1.24 +
1.25 +_LIT(KServerName, "FHServer");
1.26 +_LIT(KServerName2, "FHServer2");
1.27 +
1.28 +
1.29 +TInt RFileHandleSharer::Connect()
1.30 + {
1.31 + return CreateSession(KServerName, TVersion(1,0,0));
1.32 + }
1.33 +
1.34 +TInt RFileHandleSharer::SetTestDrive(TInt aDrive)
1.35 + {
1.36 + return SendReceive(EMsgDrive, TIpcArgs(aDrive));
1.37 + }
1.38 +
1.39 +TInt RFileHandleSharer::GetFileHandle(TInt &aHandle, TFileMode aFileMode)
1.40 + {
1.41 + TPckgBuf<TInt> fh;
1.42 + TInt fsh = SendReceive(EMsgGetFileHandle, TIpcArgs(&fh, aFileMode));
1.43 + aHandle = fh();
1.44 + return fsh;
1.45 + }
1.46 +
1.47 +TInt RFileHandleSharer::GetFileHandle2(TInt &aHandle, TFileMode aFileMode)
1.48 + {
1.49 + TPckgBuf<TInt> fh;
1.50 + TInt fsh = SendReceive(EMsgGetFileHandle2, TIpcArgs(&fh, aFileMode));
1.51 + aHandle = fh();
1.52 + Sync(); // avoid race condition with server does further tests after giving use the handle
1.53 + return fsh;
1.54 + }
1.55 +
1.56 +TInt RFileHandleSharer::PassFileHandle(TIpcArgs& aIpcArgs)
1.57 + {
1.58 + return SendReceive(EMsgPassFileHandle, aIpcArgs);
1.59 + }
1.60 +
1.61 +
1.62 +TInt RFileHandleSharer::PassInvalidFileHandle(TIpcArgs& aIpcArgs)
1.63 + {
1.64 + return SendReceive(EMsgPassInvalidFileHandle, aIpcArgs);
1.65 + }
1.66 +
1.67 +
1.68 +TInt RFileHandleSharer::PassFileHandleProcess()
1.69 + {
1.70 + return SendReceive(EMsgPassFileHandleProcess);
1.71 + }
1.72 +
1.73 +
1.74 +TInt RFileHandleSharer::Exit()
1.75 + {
1.76 + return SendReceive(EMsgExit, TIpcArgs(NULL));
1.77 + }
1.78 +
1.79 +void RFileHandleSharer::Sync()
1.80 + {
1.81 + SendReceive(EMsgSync, TIpcArgs());
1.82 + }
1.83 +
1.84 +// file handle server 2 functions
1.85 +TInt RFileHandleSharer2::Connect()
1.86 + {
1.87 + return CreateSession(KServerName2, TVersion(1,0,0));
1.88 + }
1.89 +
1.90 +TInt RFileHandleSharer2::GetFileHandle(TInt &aHandle, TFileMode aFileMode)
1.91 + {
1.92 + TPckgBuf<TInt> fh;
1.93 + TInt fsh = SendReceive(EMsgGetFileHandle, TIpcArgs(&fh, aFileMode));
1.94 + aHandle = fh();
1.95 + return fsh;
1.96 + }
1.97 +
1.98 +TInt RFileHandleSharer2::PassFileHandleNew(TIpcArgs& aIpcArgs)
1.99 + {
1.100 + return SendReceive(EMsgPassFileHandle, aIpcArgs);
1.101 + }
1.102 +
1.103 +TInt RFileHandleSharer2::Exit()
1.104 + {
1.105 + return SendReceive(EMsgExit, TIpcArgs(NULL));
1.106 + }
1.107 +