os/kernelhwsrv/kerneltest/f32test/fileshare/handshareint.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // f32test\handle sharing\interface.cpp
    15 // 
    16 //
    17 
    18 
    19 #include "handshare.h"
    20 
    21 
    22 _LIT(KServerName, "FHServer");
    23 _LIT(KServerName2, "FHServer2");
    24 
    25 
    26 TInt RFileHandleSharer::Connect()
    27 	{
    28 	return CreateSession(KServerName, TVersion(1,0,0));
    29 	}
    30 
    31 TInt RFileHandleSharer::SetTestDrive(TInt aDrive)
    32 	{
    33 	return SendReceive(EMsgDrive, TIpcArgs(aDrive));
    34 	}
    35 
    36 TInt RFileHandleSharer::GetFileHandle(TInt &aHandle, TFileMode aFileMode)
    37 	{
    38 	TPckgBuf<TInt> fh;
    39 	TInt fsh = SendReceive(EMsgGetFileHandle, TIpcArgs(&fh, aFileMode));
    40 	aHandle = fh();
    41 	return fsh;
    42 	}
    43 
    44 TInt RFileHandleSharer::GetFileHandle2(TInt &aHandle, TFileMode aFileMode)
    45 	{
    46 	TPckgBuf<TInt> fh;
    47 	TInt fsh = SendReceive(EMsgGetFileHandle2, TIpcArgs(&fh, aFileMode));
    48 	aHandle = fh();
    49 	Sync(); // avoid race condition with server does further tests after giving use the handle
    50 	return fsh;
    51 	}
    52 
    53 TInt RFileHandleSharer::PassFileHandle(TIpcArgs& aIpcArgs)
    54 	{
    55 	return SendReceive(EMsgPassFileHandle, aIpcArgs);
    56 	}
    57 
    58 
    59 TInt RFileHandleSharer::PassInvalidFileHandle(TIpcArgs& aIpcArgs)
    60 	{
    61 	return SendReceive(EMsgPassInvalidFileHandle, aIpcArgs);
    62 	}
    63 
    64 
    65 TInt RFileHandleSharer::PassFileHandleProcess()
    66 	{
    67 	return SendReceive(EMsgPassFileHandleProcess);
    68 	}
    69 
    70 
    71 TInt RFileHandleSharer::Exit()
    72 	{
    73 	return SendReceive(EMsgExit, TIpcArgs(NULL));
    74 	}
    75 
    76 void RFileHandleSharer::Sync()
    77 	{
    78 	SendReceive(EMsgSync, TIpcArgs());
    79 	}
    80 
    81 // file handle server 2 functions
    82 TInt RFileHandleSharer2::Connect()
    83 	{
    84 	return CreateSession(KServerName2, TVersion(1,0,0));
    85 	}
    86 
    87 TInt RFileHandleSharer2::GetFileHandle(TInt &aHandle, TFileMode aFileMode)
    88 	{
    89 	TPckgBuf<TInt> fh;
    90 	TInt fsh = SendReceive(EMsgGetFileHandle, TIpcArgs(&fh, aFileMode));
    91 	aHandle = fh();
    92 	return fsh;
    93 	}
    94 
    95 TInt RFileHandleSharer2::PassFileHandleNew(TIpcArgs& aIpcArgs)
    96 	{
    97 	return SendReceive(EMsgPassFileHandle, aIpcArgs);
    98 	}
    99 
   100 TInt RFileHandleSharer2::Exit()
   101 	{
   102 	return SendReceive(EMsgExit, TIpcArgs(NULL));
   103 	}
   104