baseport/syborg/svphostfs/fs/svphostfsy.cpp
changeset 2 d55eb581a87c
parent 0 ffa851df0825
equal deleted inserted replaced
1:2fb8b9db1c86 2:d55eb581a87c
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 #include <f32file.h>
       
    19 #include <f32fsys.h>
       
    20 #include <f32ver.h>
       
    21 #include <e32uid.h>
       
    22 
       
    23 #include "svphostfsy.h"
       
    24 
       
    25 //////////////////////////////////////////////////////////////////////////
       
    26 // CSVPHostFileSystem	                                                //
       
    27 //////////////////////////////////////////////////////////////////////////	
       
    28 
       
    29 CSVPHostFileSystem::CSVPHostFileSystem()
       
    30 //
       
    31 // Constructor
       
    32 //
       
    33 	{
       
    34 	DP(_L("** (SVPHOSTFSY) CSVPHostFileSystem::CSVPHostFileSystem()"));
       
    35 	__DECLARE_NAME(_S("CSVPHostFileSystem"));
       
    36 	}
       
    37 
       
    38 CSVPHostFileSystem::~CSVPHostFileSystem()
       
    39 //
       
    40 // Destructor
       
    41 //
       
    42 	{
       
    43 	DP(_L("** (SVPHOSTFSY) CSVPHostFileSystem::~CSVPHostFileSystem"));
       
    44 	iDevice.Close();
       
    45 	}
       
    46 
       
    47 
       
    48 
       
    49 TInt CSVPHostFileSystem::Install()
       
    50 //
       
    51 // Install the file system.
       
    52 //
       
    53 	{
       
    54 	DP(_L("** (SVPHOSTFSY) CSVPHostFileSystem::Install()"));
       
    55 
       
    56 	// Open the device
       
    57 	RSVPHostFsDriver device;
       
    58 	TInt err = device.Open();
       
    59 
       
    60 	if (KErrNone != err)
       
    61 		return err;
       
    62 
       
    63 	iVersion=TVersion(KMajorVersionNumber,KMinorVersionNumber,KF32BuildVersionNumber);
       
    64 	TPtrC name=_L("SVPHOSTFSY");
       
    65 	
       
    66 	return(SetName(&name));
       
    67 	}
       
    68 
       
    69 CMountCB* CSVPHostFileSystem::NewMountL(/*CSessionFs* aSession*/) const
       
    70 //
       
    71 // Create a new mount control block.
       
    72 //
       
    73 	{
       
    74 	DP(_L("** (SVPHOSTFSY) CSVPHostFileSystem::NewMountL()"));
       
    75 	return(new(ELeave) CSVPHostMountCB);
       
    76 	}
       
    77 
       
    78 CFileCB* CSVPHostFileSystem::NewFileL(/*CSessionFs* aSession*/) const
       
    79 //
       
    80 // Create a new file.
       
    81 //
       
    82 	{
       
    83 	DP(_L("** (SVPHOSTFSY) CSVPHostFileSystem::NewFileL()"));
       
    84 	return(new(ELeave) CSVPHostFileCB);
       
    85 	}
       
    86 
       
    87 CDirCB* CSVPHostFileSystem::NewDirL(/*CSessionFs* aSession*/) const
       
    88 //
       
    89 // Create a new directory lister.
       
    90 //
       
    91 	{
       
    92 	DP(_L("** (SVPHOSTFSY) CSVPHostFileSystem::NewDirL()"));
       
    93 	return(new(ELeave) CSVPHostDirCB(/*aSession*/));
       
    94 	}
       
    95 
       
    96 CFormatCB* CSVPHostFileSystem::NewFormatL(/*CSessionFs* aSession*/) const
       
    97 //
       
    98 // Create a new media formatter.
       
    99 //
       
   100 	{
       
   101 	DP(_L("** (SVPHOSTFSY) CSVPHostFileSystem::NewFormatL()"));
       
   102 	return(new(ELeave) CSVPHostFormatCB(/*aSession*/));
       
   103 	}
       
   104 
       
   105 TInt CSVPHostFileSystem::DefaultPath(TDes& aPath) const
       
   106 //
       
   107 // Return the initial default path.
       
   108 //
       
   109 	{
       
   110 	DP(_L("** (SVPHOSTFSY) CSVPHostFileSystem::DefaultPath()"));
       
   111 	aPath=_L("\\");
       
   112 	return(KErrNone);
       
   113 	}
       
   114 
       
   115 
       
   116 CFileSystem* CSVPHostFileSystem::NewL()
       
   117 //
       
   118 //	Factory for CSVPHostFileSystem
       
   119 //
       
   120 	{
       
   121 	DP(_L("** (SVPHOSTFSY) CSVPHostFileSystem::NewL()"));
       
   122 	CSVPHostFileSystem* svpHostFsy=new(ELeave) CSVPHostFileSystem();
       
   123 	return svpHostFsy;
       
   124 	}
       
   125 
       
   126 
       
   127 void CSVPHostFileSystem::DriveInfo(TDriveInfo& anInfo,TInt aDriveNumber) const
       
   128 //
       
   129 // Return the drive info iDriveAtt  && iBatteryState already set
       
   130 //
       
   131 	{
       
   132 	DP(_L("** (SVPHOSTFSY) CSVPHostFileSystem::DriveInfo()"));
       
   133 
       
   134 	/* !@! TODO: are these the best values? */
       
   135 	anInfo.iMediaAtt=KMediaAttVariableSize;
       
   136 	anInfo.iType=EMediaRam;
       
   137 #if 0
       
   138 	// !@! can't execute from remote drives
       
   139 	anInfo.iDriveAtt=KDriveAttRemote;
       
   140 #endif
       
   141 	anInfo.iDriveAtt=KDriveAttLocal|KDriveAttInternal;
       
   142 	}
       
   143 
       
   144 
       
   145 extern "C" {
       
   146 
       
   147 EXPORT_C CFileSystem* CreateFileSystem()
       
   148 //
       
   149 // Create a new file system
       
   150 //
       
   151 	{
       
   152 	DP(_L("** (SVPHOSTFSY) CreateFileSystem()"));
       
   153 
       
   154 	return(CSVPHostFileSystem::NewL());
       
   155 	}
       
   156 }
       
   157 
       
   158