userlibandfileserver/fileserver/automounter/automounter.cpp
author William Roberts <williamr@symbian.org>
Tue, 05 Oct 2010 14:38:32 +0100
changeset 284 e76171403744
parent 271 dc268b18d709
permissions -rw-r--r--
Missing part of the workaround for Bug 2149 - need to remove bootstrap.xml as well to disable SBS use of bootstrap.flm
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
     1
// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
     2
// All rights reserved.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
     3
// This component and the accompanying materials are made available
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
     4
// under the terms of the License "Eclipse Public License v1.0"
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
     5
// which accompanies this distribution, and is available
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
     7
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
     8
// Initial Contributors:
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
     9
// Nokia Corporation - initial contribution.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    10
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    11
// Contributors:
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    12
//
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    13
// Description:
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    14
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    15
/**
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    16
@file
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    17
@internalTechnology
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    18
*/
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    19
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    20
#include <e32cmn.h>
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    21
#include <f32ver.h>
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    22
#include <u32std.h>
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    23
#include <f32file.h>
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    24
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    25
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    26
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    27
#include "filesystem_automounter.h"
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    28
#include "automounter.h"
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    29
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    30
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    31
//-----------------------------------------------------------------------------
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    32
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    33
void Fault(TFault aFault)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    34
    {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    35
    _LIT(KPanicName, "AutoMounter_fsy");
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    36
    User::Panic(KPanicName, aFault);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    37
    }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    38
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    39
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    40
//-----------------------------------------------------------------------------
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    41
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    42
/**
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    43
    Factory function, Create a new object of this file system 
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    44
*/
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    45
extern "C" 
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    46
{
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    47
EXPORT_C CFileSystem* CreateFileSystem()
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    48
    {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    49
    return CAutoMounterFileSystem::New();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    50
    }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    51
}
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    52
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    53
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    54
//#######################################################################################################################################
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    55
//#  CAutoMounterFileSystem class implementation
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    56
//#######################################################################################################################################
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    57
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    58
/**
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    59
    Factory method
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    60
*/
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    61
CAutoMounterFileSystem* CAutoMounterFileSystem::New()
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    62
    {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    63
    CAutoMounterFileSystem* pThis = new CAutoMounterFileSystem();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    64
    return pThis;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    65
    }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    66
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    67
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    68
CAutoMounterFileSystem::CAutoMounterFileSystem() 
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    69
    {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    70
    __PRINT1(_L("#<<- CAutoMounterFileSystem::CAutoMounterFileSystem() [0x%x]"), this);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    71
271
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
    72
    iChildFsForDefFmt = KErrNotFound;
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    73
    SetState(EInvalid);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    74
    }   
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    75
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    76
CAutoMounterFileSystem::~CAutoMounterFileSystem()
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    77
    {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    78
    __PRINT1(_L("#<<- CAutoMounterFileSystem::~CAutoMounterFileSystem() [0x%x]"), this);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    79
    }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    80
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    81
//-----------------------------------------------------------------------------
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    82
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    83
/**
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    84
    Install iand initialise file system.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    85
*/
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    86
TInt CAutoMounterFileSystem::Install()
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    87
    {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    88
   
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    89
    SetState(ENotInitialised);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    90
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    91
    __PRINT1(_L("#<<- CAutoMounterFileSystem::Install() [0x%x]"), this);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    92
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    93
    iVersion=TVersion(KF32MajorVersionNumber,KF32MinorVersionNumber,KF32BuildVersionNumber);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    94
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    95
    InitialiseFileSystem();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    96
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    97
    return SetName(&KFileSystemName_AutoMounter);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    98
    }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
    99
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   100
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   101
//-----------------------------------------------------------------------------
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   102
/** 
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   103
    Create a new mount control block. 
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   104
    This method migh be called by the file server in some unusual cases, when the actual mount is needed only temporarily to get access to the 
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   105
    corresponding media driver. E.g. TDrive::ForceRemountDrive()
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   106
    Produce the _default_ file system mount
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   107
*/
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   108
CMountCB* CAutoMounterFileSystem::NewMountL() const
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   109
    {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   110
    __PRINT1(_L("#<<- CAutoMounterFileSystem::NewMountL() [0x%x]"), this);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   111
    ASSERT(State() == EInitialised);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   112
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   113
    __PRINT1(_L("#<<- producing the _default_ filesystem:%S"), &iFSNames[KDefaultFSNo]);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   114
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   115
    CFileSystem* pFS = GetChildFileSystem(KDefaultFSNo);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   116
    ASSERT(pFS);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   117
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   118
    return pFS->NewMountL();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   119
    }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   120
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   121
//-----------------------------------------------------------------------------
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   122
/** 
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   123
    Create a new file. 
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   124
*/
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   125
CFileCB* CAutoMounterFileSystem::NewFileL() const
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   126
    {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   127
    __PRINT1(_L("#<<- CAutoMounterFileSystem::NewFileL() [0x%x]"), this);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   128
    Fault(EMustNotBeCalled);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   129
    return NULL;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   130
    }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   131
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   132
//-----------------------------------------------------------------------------
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   133
/** 
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   134
    Create a new directory object 
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   135
*/
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   136
CDirCB* CAutoMounterFileSystem::NewDirL() const
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   137
    {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   138
    __PRINT1(_L("#<<- CAutoMounterFileSystem::NewDirL() [0x%x]"), this);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   139
    Fault(EMustNotBeCalled);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   140
    return NULL;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   141
    }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   142
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   143
//-----------------------------------------------------------------------------
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   144
/** 
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   145
    Create a new media formatter 
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   146
*/
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   147
CFormatCB* CAutoMounterFileSystem::NewFormatL() const
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   148
    {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   149
    __PRINT1(_L("#<<- CAutoMounterFileSystem::NewFormatL() [0x%x]"), this);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   150
    Fault(EMustNotBeCalled);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   151
    return NULL;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   152
    }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   153
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   154
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   155
//-----------------------------------------------------------------------------
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   156
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   157
#ifdef _DEBUG
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   158
/**
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   159
    Called by File Server before deleting File System object.    
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   160
*/
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   161
TInt CAutoMounterFileSystem::Remove()
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   162
    {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   163
    __PRINT1(_L("#<<- CAutoMounterFileSystem::Remove() [0x%x]"), this);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   164
    return CFileSystem::Remove();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   165
    }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   166
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   167
//-----------------------------------------------------------------------------
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   168
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   169
/**
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   170
*/
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   171
TBool CAutoMounterFileSystem::QueryVersionSupported(const TVersion& aVer) const
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   172
    {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   173
    __PRINT1(_L("#<<- CAutoMounterFileSystem::QueryVersionSupported() [0x%x]"), this);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   174
    return CFileSystem::QueryVersionSupported(aVer);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   175
    }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   176
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   177
#endif
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   178
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   179
//-----------------------------------------------------------------------------
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   180
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   181
/**
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   182
    Find out if drive extensions are supported. In order to have consistent behaviour, _all_ child 
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   183
    file systems shall behave the same way.   
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   184
    
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   185
    @return ETrue if drive extensions are supported.    
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   186
*/
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   187
TBool CAutoMounterFileSystem::IsExtensionSupported() const
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   188
    {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   189
    __PRINT1(_L("#<<- CAutoMounterFileSystem::IsExtensionSupported() [0x%x]"), this);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   190
    
271
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   191
    ASSERT(State() == EInitialised && ChildFsNum() >= KMinChildFsNum);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   192
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   193
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   194
    //-- in debug mode check file systems compatibility: ALL childs must support this feature
271
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   195
    for(TUint i=0; i<ChildFsNum(); ++i)
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   196
        {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   197
        if( !(GetChildFileSystem(i)->IsExtensionSupported()))
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   198
            {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   199
            DBG_STATEMENT(Fault(EIncompatibleFileSystems));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   200
            __PRINT(_L("#<<- ::IsExtensionSupported(): Incompatible file sytems!"));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   201
            return EFalse;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   202
            }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   203
        }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   204
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   205
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   206
    return ETrue; 
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   207
    }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   208
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   209
//-----------------------------------------------------------------------------
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   210
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   211
/** 
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   212
    Return the initial default path. 
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   213
*/
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   214
TInt CAutoMounterFileSystem::DefaultPath(TDes& aPath) const
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   215
    {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   216
    __PRINT1(_L("#<<- CAutoMounterFileSystem::DefaultPath() [0x%x]"), this);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   217
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   218
    aPath=_L("?:\\");
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   219
    aPath[0] = (TUint8) RFs::GetSystemDriveChar();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   220
    return KErrNone;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   221
    }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   222
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   223
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   224
//-----------------------------------------------------------------------------
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   225
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   226
/**
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   227
    Additional interfaces support.    
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   228
*/
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   229
TInt CAutoMounterFileSystem::GetInterface(TInt aInterfaceId, TAny*& aInterface, TAny* aInput)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   230
    {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   231
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   232
    __PRINT2(_L("#<<- CAutoMounterFileSystem::GetInterface(id:%d) [0x%x]"), aInterfaceId, this);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   233
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   234
    switch(aInterfaceId)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   235
        {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   236
        //-- It is this filesystem private interface.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   237
        case EExtendedFunctionality:
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   238
        aInterface = (CFileSystem::MFileSystemExtInterface*)this;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   239
        return KErrNone;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   240
        
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   241
        //-- a special case for child filesystems.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   242
        //-- ALL of them must respond to this interface query exactly the same way. I.e. It is impossible
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   243
        //-- to have some of the child FS supporting it and some not.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   244
        case EProxyDriveSupport:
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   245
        return DoProcessProxyDriveSupport();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   246
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   247
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   248
        default:
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   249
        //-- This is the request to other (child file system) from the file server
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   250
        //-- Actually, this part must never be called. File Server shall query the file system interfaces _after_ mounting the concrete FS 
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   251
        //-- calling TDrive::iCurrentMount->FileSystem().GetInterface() 
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   252
        ASSERT(0);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   253
        return CFileSystem::GetInterface(aInterfaceId, aInterface, aInput);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   254
        
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   255
        }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   256
    }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   257
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   258
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   259
//-----------------------------------------------------------------------------
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   260
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   261
/**
271
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   262
    Find out if _all_ child file systems support the proxy drive. All child file systems shall behave exactly the same way.
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   263
    This is mostly for the USB host drives support. All child file systems should either support this feature or do not.
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   264
    Otherwise, it may lead to very obscured cases of susystem misbehaviour.
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   265
    
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   266
    @return KErrNone if all child file systems support proxy drives, or KErrNotSupported if all of them do not.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   267
*/
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   268
TInt CAutoMounterFileSystem::DoProcessProxyDriveSupport()
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   269
    {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   270
    __PRINT1(_L("#<<- CAutoMounterFileSystem::DoProcessProxyDriveSupport[0x%x]"), this);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   271
    ASSERT(State() == EInitialised);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   272
271
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   273
    const TUint cnt = ChildFsNum();
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   274
    ASSERT(cnt >= KMinChildFsNum);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   275
    
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   276
    //-- query the default filesystem #0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   277
    const TBool bRes = GetChildFileSystem(KDefaultFSNo)->IsProxyDriveSupported();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   278
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   279
    //-- query the rest of child filesystems
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   280
    for(TUint i=1; i<cnt; ++i)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   281
        {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   282
        const TBool b = GetChildFileSystem(i)->IsProxyDriveSupported();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   283
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   284
        if(BoolXOR(b, bRes))
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   285
            Fault(EIncompatibleFileSystems);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   286
        }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   287
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   288
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   289
    return  bRes ? KErrNone : KErrNotSupported;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   290
    }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   291
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   292
//-----------------------------------------------------------------------------
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   293
/**
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   294
    Get the child file system name by its index (enumerator).
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   295
    
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   296
    @param  aFsNumber   index of the child FS 0...KMaxTInt
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   297
    @param  aFsName     on success the child file system name will be placed into this buffer  
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   298
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   299
    @return KErrNone        if there is a child FS name with index 'aFsNumber' (child FS 'aFsNumber' is supported by automounter)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   300
            KErrNotFound    if child FS 'aFsNumber' is not supported
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   301
*/
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   302
TInt CAutoMounterFileSystem::GetSupportedFileSystemName(TInt aFsNumber, TDes& aFsName) const
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   303
    {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   304
    __PRINT2(_L("#<<- CAutoMounterFileSystem::GetSupportedFileSystemName[0x%x](%d)"), this, aFsNumber);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   305
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   306
    if(aFsNumber == RFs::KRootFileSystem)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   307
        {//-- this is a name query for "root filesystem" or automounter
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   308
        aFsName = Name(); //-- ourselves
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   309
        return KErrNone;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   310
        }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   311
    
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   312
    //-- this is a query for one of the child filesystems
271
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   313
    if((TUint)aFsNumber < ChildFsNum())
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   314
        {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   315
        aFsName = iFSNames[aFsNumber]; 
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   316
        return KErrNone;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   317
        }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   318
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   319
    
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   320
    return KErrNotFound;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   321
    }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   322
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   323
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   324
//-----------------------------------------------------------------------------
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   325
/**
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   326
    This is the only factory method that can be called by file server for this file system.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   327
    In this method the automounter sequentially tries to mount every child and on success produces the corresponding CMountCB object.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   328
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   329
    @param  apDrive         pointer to the TDrive, child FS will need this to access media.
271
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   330
    @param  apFileSystem    on return will contain the pointer to the CFileSystem that has produced the proper CMountCB if 
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   331
                            one of the child file system has recognised the volume layout.
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   332
    @param  aForceMount     if ETrue the appropriate child FS (designated by aFsNameHash) will be forcedly mounted on the volume. for volume formatting purposes.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   333
    @param  aFsNameHash     if !=0 specifies the file system name, see TVolFormatParam::CalcFSNameHash(). 0 means "file system name is not specified"
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   334
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   335
    @return pointer to the constructed CMountCB by one of the child file systems (and pointer to this child FS in apFileSystem)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   336
            NULL if it was impossible to produce proper CMountCB object.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   337
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   338
*/
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   339
CMountCB* CAutoMounterFileSystem::NewMountExL(TDrive* apDrive, CFileSystem** apFileSystem, TBool aForceMount, TUint32 aFsNameHash)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   340
    {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   341
    __PRINT4(_L("#<<- CAutoMounterFileSystem::NewMountExL[0x%x] drv:%d, ForceMount:%d, FSNameHash:0x%x"), this, apDrive->DriveNumber(), aForceMount, aFsNameHash);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   342
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   343
    ASSERT(State() == EInitialised && apDrive);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   344
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   345
    //-- This method is usually called from the appropriate drive thread; this file system is intended to be bound to
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   346
    //-- removable drives. Having removable drive runnind in the main file server thread means that something is terribly wrongly configured.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   347
    if(apDrive->IsSynchronous())
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   348
        Fault(EWrongDriveAttributes);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   349
271
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   350
    if(ChildFsNum() < KMinChildFsNum)
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   351
        Fault(EWrongConfiguration);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   352
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   353
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   354
    //-- if aForceMount is true, this means that the TDrive tries mount the filesystem by force for formatting because normal mounting has failed before. 
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   355
    //-- in our case it means that the file system on the volume hadn't been recognised by any child FS.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   356
    //-- aFsNameHash shall designate the file system to be forcedly mounted. Depending on this the appropriat CMounCB object will be produced.
271
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   357
    //-- if aFsNameHash is 0, i.e. not provided, this method will fail with KErrNotFound if it can't to select appropriate child FS to be used.
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   358
    if(aForceMount)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   359
        {
271
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   360
        CFileSystem *pFS = NULL; //-- the FS selected to produce CMountCB for media formatting
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   361
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   362
        if(aFsNameHash == 0)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   363
            {//-- the file system to mount forcedly is not specified
271
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   364
             //-- 1. check if we have only 1 child FS supported. Quite a weird case, but an easy choice.
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   365
             if(ChildFsNum() == 1)
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   366
                {//-- use the single known child FS
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   367
                __PRINT1(_L("#<<- only 1 child FS available for formatting: %S"), &iFSNames[KDefaultFSNo]);
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   368
                pFS = GetChildFileSystem(KDefaultFSNo);
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   369
                }
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   370
             else if(iChildFsForDefFmt >= 0)
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   371
                {//-- the parameter "child fs for default formatting" is defined. try using this
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   372
                __PRINT1(_L("#<<- using the default child FS for formatting: %S"), &iFSNames[iChildFsForDefFmt]);
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   373
                pFS = GetChildFileSystem(iChildFsForDefFmt);
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   374
                }
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   375
             else
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   376
                {
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   377
            __PRINT(_L("#<<- Unable to select appropriate child FS for formatting!"));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   378
            User::Leave(KErrNotFound);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   379
            }
271
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   380
            }
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   381
        else //if(aFsNameHash == 0)
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   382
            {//-- try to find appropriate child FS by its name hash provided by the upper level
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   383
            pFS = GetChildFileSysteByNameHash(aFsNameHash);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   384
            if(!pFS)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   385
                {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   386
                __PRINT(_L("#<<- no child FS found by its name hash!"));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   387
                ASSERT(0);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   388
                User::Leave(KErrNotFound);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   389
                }
271
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   390
            }
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   391
271
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   392
        //-- ask the selected FS to produce us a mount for media formating
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   393
        ASSERT(pFS);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   394
            CMountCB* pMount = pFS->NewMountL();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   395
            ASSERT(pMount);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   396
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   397
            *apFileSystem = pFS; 
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   398
            return pMount;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   399
        }//if(aForceMount)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   400
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   401
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   402
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   403
    //-- try instantiate a new CMountCB depending on the file system on the media
271
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   404
    ASSERT(!aForceMount);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   405
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   406
    CMountCB* pMatchedMount;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   407
    TInt nRes = TryMountFilesystem(apDrive, &pMatchedMount, apFileSystem);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   408
    
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   409
    if(nRes == KErrNone)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   410
        {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   411
        ASSERT(pMatchedMount);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   412
        return pMatchedMount;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   413
        }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   414
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   415
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   416
    User::Leave(nRes);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   417
    return NULL;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   418
    }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   419
271
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   420
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   421
//-----------------------------------------------------------------------------
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   422
/**
271
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   423
    Parse the string with child file system names. These names come from config, which can be either 
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   424
    estart.txt or a text debug property that can override it.
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   425
271
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   426
    @param  aList string descriptor with contents like "fat,exfat" i.e. it is comma separated file system names
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   427
*/
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   428
void CAutoMounterFileSystem::DoParseChildNames(const TDesC8& aList)
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   429
    {
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   430
    ASSERT(State() == EInitialising);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   431
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   432
    TBuf<0x100>  fsName;   
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   433
271
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   434
    fsName.Copy(aList);
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   435
    __PRINT1(_L("#<<- childFS list:'%S'"), &fsName);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   436
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   437
    //-- parse CSV config line and fill in the file system names array
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   438
    const TChar chDelim = ','; //-- token delimiter, comma
271
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   439
    TPtrC8 ptrCurrLine(aList);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   440
    for(TInt i=0; ;++i)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   441
        {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   442
        const TInt delimPos = ptrCurrLine.Locate(chDelim);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   443
        if(delimPos <= 0)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   444
            {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   445
            fsName.Copy(ptrCurrLine);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   446
            }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   447
        else
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   448
            {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   449
            TPtrC8 temp(ptrCurrLine.Ptr(), delimPos);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   450
            fsName.Copy(temp);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   451
            }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   452
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   453
        fsName.Trim();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   454
        __PRINT2(_L("#<<- child FS[%d]: '%S'"), i, &fsName);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   455
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   456
        
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   457
        if(fsName.Length() <= 0) 
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   458
            Fault(EPluginInitialise);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   459
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   460
        //-- check if the FS name being appended is unique
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   461
        for(TUint j=0; j<iFSNames.Count(); ++j)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   462
            {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   463
            if(iFSNames[j] == fsName)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   464
                {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   465
                Fault(EPluginInitialise);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   466
                }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   467
            }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   468
        
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   469
        
271
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   470
        TInt nRes = iFSNames.Append(fsName);
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   471
        (void)nRes;
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   472
        ASSERT(nRes ==KErrNone);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   473
        
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   474
        if(delimPos <=0 )
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   475
            break;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   476
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   477
        ptrCurrLine.Set(ptrCurrLine.Ptr()+delimPos+1, ptrCurrLine.Length()-delimPos-1);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   478
        }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   479
271
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   480
    }
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   481
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   482
//-----------------------------------------------------------------------------
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   483
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   484
//-- if this macro is defined, the automounter will use a default hard-coded list of child file systems if it is not found in the estart.txt
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   485
//-- and this list will consist of one filesystem "FAT".
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   486
//-- otherwise automounter will panic if it can't find appropriate config in estart.txt
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   487
#define ALLOW_CONFIGLESS
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   488
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   489
/**
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   490
    Process Automounter configuration
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   491
*/
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   492
void CAutoMounterFileSystem::ParseConfig()
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   493
    {
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   494
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   495
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   496
    ASSERT(State() == ENotInitialised);
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   497
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   498
    SetState(EInitialising);
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   499
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   500
    
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   501
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   502
    //-- 1. initialise the array of file system names. These names shall be listed in a config string.
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   503
    //-- the config string is taken from estart.txt usually and its format is like this: 
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   504
    //-- section: [AutoMounter] and property "AM_FSNames fat,exfat"
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   505
    //-- in debug version a special text property can override the config string. This allows controlling automounter from
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   506
    //-- the test environment.
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   507
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   508
    TBuf8<0x100> buf(0);   
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   509
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   510
    _LIT8(KSection,  "AutoMounter");        ///< section name
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   511
    _LIT8(KKey_ChildFsList, "AM_FSNames");     ///< a key for the CSV list of child file system names
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   512
    _LIT8(KProp_DefFmtFsIdx, "AM_DefFmtFsIdx");///< a key for the optional parameter that specifies the child file system index, which will be used for formatting unrecognised media
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   513
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   514
    TBool bUseEstart= ETrue;
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   515
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   516
#ifdef _DEBUG
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   517
    
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   518
    TInt nRes;
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   519
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   520
    const TUid KSID_Test1={0x10210EB3}; //-- SID of the test that will define and set test property to control volume mounting
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   521
    const TUint KPropKey = 0; //-- property key
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   522
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   523
    //-- in debug mode the property will override the estart.txt config
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   524
    if(RProperty::Get(KSID_Test1, KPropKey, buf) == KErrNone)
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   525
        {
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   526
        __PRINT(_L("#<<- reading config from the debug propery:"));
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   527
        TBuf<0x100> buf16(0);   
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   528
        buf16.Copy(buf);
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   529
        __PRINT(buf16);
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   530
        
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   531
        bUseEstart = EFalse;
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   532
        }
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   533
#endif //_DEBUG
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   534
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   535
    if(bUseEstart)
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   536
        {//-- need to read data from the estart.txt, section [AutoMounter]
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   537
        __PRINT(_L("#<<- reading config from estart.txt..."));
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   538
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   539
        //-- 1. read and parse a CSV list of child file system names
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   540
        //-- this is a mandatory parameter
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   541
        TBool bFound = F32Properties::GetString(KSection, KKey_ChildFsList, buf);
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   542
        if(!bFound)
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   543
            {
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   544
            __PRINT(_L("#<<- child FS list isn't found in config !"));
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   545
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   546
    #ifdef ALLOW_CONFIGLESS
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   547
            //-- let's use a default list of child file systems (consisting of only one: "FAT")
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   548
            //-- if it is allowed. FAT FS is suggested to be available and already loaded by file server.
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   549
            //-- otherwise it will panic later
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   550
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   551
            _LIT(KDefChildFS_Config, "fat"); //-- default list
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   552
            __PRINT1(_L("#<<- Using a default list:'%S'"), &KDefChildFS_Config());
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   553
            buf.Copy(KDefChildFS_Config);
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   554
    
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   555
    #else //ALLOW_CONFIGLESS
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   556
    
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   557
            Fault(EPluginInitialise);
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   558
    
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   559
    #endif //ALLOW_CONFIGLESS
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   560
            }
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   561
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   562
        DoParseChildNames(buf);    
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   563
        
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   564
        ASSERT(iFSNames.Count());
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   565
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   566
        //-- 2. read a child FS index that can be used for unrecognisable media default formatting
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   567
        //-- this is an optional parameter. If we have just 1 Child FS, this parameter doesn't make much sense.
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   568
        if(iFSNames.Count() > 1)
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   569
            {
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   570
            TInt32 nVal;
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   571
            bFound = F32Properties::GetInt(KSection, KProp_DefFmtFsIdx, nVal);
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   572
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   573
            if(!bFound) 
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   574
                iChildFsForDefFmt = KErrNotFound;
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   575
            else                    
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   576
                {//-- check the index validity
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   577
                if(nVal <0 || nVal >= (TInt)iFSNames.Count())
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   578
                    {
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   579
                    __PRINT1(_L("#<<- Bad DefFmtFsIdx value:%d"), nVal);
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   580
                    Fault(EPluginInitialise);    
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   581
                    }
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   582
                else
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   583
                    {
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   584
                    iChildFsForDefFmt = nVal;
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   585
                    }
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   586
                }    
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   587
            }
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   588
        else//if(iFSNames.Count() > 1)
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   589
            {//-- it looks like we have a weird case when the automounter is configured with just 1 child file system
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   590
            iChildFsForDefFmt = KDefaultFSNo;
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   591
            }
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   592
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   593
        }//if(bUseEstart)
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   594
    else
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   595
        {
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   596
#ifdef _DEBUG        
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   597
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   598
        //-- it looks like there is a test property that overrides the estart.txt settings. This property should contain 
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   599
        //-- a representation of a whole [AutoMounter] section in estart.txt and can have "multiple lines" separated by 0x0d,0x0a
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   600
        buf.TrimAll();
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   601
        
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   602
        TInt nPos1;
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   603
        TInt nPos2;
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   604
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   605
        //-- 1. process "AM_FSNames" key
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   606
        nPos1 = buf.FindF(KKey_ChildFsList);
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   607
        if(nPos1 < 0)
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   608
            {
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   609
            __PRINT(_L("#<<- child FS list isn't found!"));
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   610
            Fault(EPluginInitialise);
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   611
            }
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   612
        
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   613
        TPtrC8  ptr(buf.Mid(nPos1));
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   614
        nPos2 = ptr.Locate('\n');
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   615
        if(nPos2 > 0)
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   616
            ptr.Set(ptr.Left(nPos2));    
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   617
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   618
        TLex8 lex(ptr);
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   619
        
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   620
        lex.NextToken();
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   621
        lex.SkipSpace();
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   622
        ptr.Set(lex.Remainder());
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   623
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   624
        DoParseChildNames(ptr);    
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   625
        ASSERT(iFSNames.Count());
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   626
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   627
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   628
        //-- 2. process "DefFmtFsIdx" key
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   629
        nPos1 = buf.FindF(KProp_DefFmtFsIdx);
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   630
        if(nPos1 > 0 && iFSNames.Count() > 1)
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   631
            {
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   632
            ptr.Set(buf.Mid(nPos1));
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   633
            nPos2 = ptr.Locate('\n');
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   634
            if(nPos2 > 0)
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   635
                ptr.Set(ptr.Left(nPos2));    
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   636
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   637
            lex.Assign(ptr);
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   638
            lex.NextToken();
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   639
            lex.SkipSpace();
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   640
            
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   641
            nRes = lex.Val(nPos1);
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   642
            ASSERT(nRes == KErrNone);
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   643
            ASSERT(nPos1 >= 0 && nPos1 < (TInt)iFSNames.Count());
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   644
            
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   645
            iChildFsForDefFmt = nPos1;
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   646
            }
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   647
         else
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   648
            {
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   649
            iChildFsForDefFmt = KErrNotFound;
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   650
            }
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   651
        
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   652
#endif //_DEBUG
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   653
        }
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   654
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   655
    }
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   656
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   657
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   658
//-----------------------------------------------------------------------------
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   659
/**
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   660
    Initialise this file system. Reads and processes configuration, fills in file system names container, etc. 
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   661
*/
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   662
void CAutoMounterFileSystem::InitialiseFileSystem()
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   663
    {
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   664
    __PRINT1(_L("#<<- CAutoMounterFileSystem::InitialiseFileSystem() [0x%x]"), this);
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   665
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   666
    ASSERT(State() == ENotInitialised);
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   667
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   668
    ParseConfig();
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   669
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   670
    SetState(EInitialised);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   671
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   672
    //-- 2. check that the file server has all filesystems we need instantiated and stored in a global container
271
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   673
    TUint cnt = ChildFsNum();
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   674
    if(cnt < KMinChildFsNum)
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   675
        {
271
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   676
        __PRINT1(_L("#<<- ::InitialiseFileSystem(): too few File Systems bound: %d!"), cnt);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   677
        Fault(EPluginInitialise);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   678
        }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   679
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   680
    while(cnt--)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   681
        {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   682
        GetChildFileSystem(cnt);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   683
        }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   684
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   685
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   686
    }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   687
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   688
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   689
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   690
//-----------------------------------------------------------------------------
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   691
/**
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   692
    Tries to find out if some of the child file systems can be mounted on the given volume.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   693
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   694
    @param  apDrive         pointer to the TDrive, child FS will need this to access media.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   695
    @param                  on return will contain the pointer to the CMountCB object if some of the childs has decided that it can be mounted.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   696
    @param  apFS            on return will contain the pointer to the CFileSystem that has produced the proped CMountCB if 
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   697
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   698
    @return KErrNone on success, otherwise standard error code.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   699
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   700
*/
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   701
TInt CAutoMounterFileSystem::TryMountFilesystem(TDrive* apDrive, CMountCB** apMount, CFileSystem** apFS)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   702
    {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   703
    __PRINT1(_L("#<<- CAutoMounterFileSystem::TryMountFilesystem()[0x%x]"), this);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   704
271
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   705
    const TUint KNumFS = ChildFsNum(); //-- number of child file systems supported
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   706
    ASSERT(State() == EInitialised && (KNumFS >= KMinChildFsNum));
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   707
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   708
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   709
    *apMount = NULL;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   710
    *apFS    = NULL;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   711
    
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   712
    
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   713
    TInt nRes;
271
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   714
    TUint cntFS;
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   715
    CMountCB*       pMountCB = NULL;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   716
    CFileSystem*    pMatchedFS = NULL;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   717
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   718
    for(cntFS=0; cntFS < KNumFS; ++cntFS)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   719
        {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   720
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   721
        __PRINT2(_L("#<<-@@ trying FS[%d]:%S"), cntFS, &iFSNames[cntFS]);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   722
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   723
        CFileSystem* pFS = GetChildFileSystem(cntFS); //-- Find current filesystem object in the FileServer's global container
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   724
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   725
        //-- 2. create CMountCB instance and set it up
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   726
        pMountCB = NULL;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   727
        
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   728
        TRAP(nRes, pMountCB = pFS->NewMountL());
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   729
        if(nRes != KErrNone)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   730
            {
271
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   731
            return nRes;
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   732
            }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   733
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   734
        ASSERT(pMountCB);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   735
        pMountCB->SetDrive(apDrive);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   736
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   737
        
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   738
        //-- 2.1 Firstly try using special CMountCB interface to find out if current FS can be mounted on this media
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   739
        nRes = pMountCB->CheckFileSystemMountable();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   740
        if(nRes == KErrNotSupported)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   741
            {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   742
            //-- file system doesn't support this feature,
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   743
            //-- 2.2 try to check the file system by mounting and dismounting later. It can result in some long activity, like FAT scanning etc.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   744
            TRAP(nRes, pMountCB->MountL(EFalse));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   745
            pMountCB->Dismounted(); //-- dismount the mountCB, it will be required in dismounted state anyway 
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   746
            }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   747
        
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   748
        //-- 2.3 analyse the result of mounting 
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   749
        if(nRes != KErrNone)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   750
            {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   751
            if(nRes == KErrLocked)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   752
                {//-- this is a special case; The media (SD card for example) is locked. 
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   753
                //-- Pretend that everything is OK and return CMountCB instance that is produced by the _default_ file system.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   754
                //-- locked media case will be handled by the file server later.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   755
                ASSERT(cntFS == KDefaultFSNo); //-- the default FS is tried first and must detect the locked media
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   756
                pMatchedFS = pFS;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   757
                __PRINT(_L("#<<-@@ The media is LOCKED !"));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   758
                break;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   759
                }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   760
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   761
            //-- failed to mount the file system, most likey it is not recognised
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   762
            pMountCB->Close(); //-- this is a self-destructing object!
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   763
            pMountCB = NULL;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   764
            __PRINT(_L("#<<-@@ Mount FAILED !"));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   765
            }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   766
        else
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   767
            {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   768
            //-- mounted OK, the file system is recognised
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   769
            __PRINT(_L("#<<-@@ Mount OK!"));
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   770
            
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   771
            pMatchedFS = pFS;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   772
            break;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   773
            }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   774
    
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   775
        }//for(cntFS=0; cntFS<KNumFS; ++cntFS)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   776
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   777
    if(cntFS >= KNumFS)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   778
        {//-- no one from the FS factories recognised the file system
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   779
        __PRINT1(_L("#<<- ::TryMountFilesystem()[0x%x] No file system recognised!"), this);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   780
        
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   781
        SetName(&KFileSystemName_AutoMounter); 
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   782
        return KErrCorrupt;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   783
        }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   784
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   785
    ASSERT(pMountCB && pMatchedFS); 
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   786
    *apMount = pMountCB;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   787
    *apFS    = pMatchedFS;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   788
    
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   789
    //-- set this FS name to the name of recognised FS. In this case the automounter "pretends" to be one of the child file systems on 
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   790
    //-- successful mounting. This behaviour was considered to be incorrect.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   791
    //TPtrC fsName = pMatchedFS->Name();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   792
    //SetName(&fsName); 
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   793
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   794
    return KErrNone;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   795
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   796
    }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   797
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   798
//-----------------------------------------------------------------------------
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   799
/**
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   800
    get the child file system object by the index in file child system names container
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   801
    
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   802
    @param  aIndex  index in the iFSNames
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   803
    @return pointer to the FS object if it is found, NULL otherwise
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   804
*/
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   805
CFileSystem* CAutoMounterFileSystem::GetChildFileSystem(TUint aIndex) const
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   806
    {
271
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   807
    ASSERT(State() == EInitialised && (ChildFsNum() >= KMinChildFsNum) && aIndex < ChildFsNum());
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   808
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   809
    const TDesC& fsName = iFSNames[aIndex]; //-- registered child file system name
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   810
    CFileSystem* pFS = GetFileSystem(fsName); //-- Find filesystem object in the FileServer's global container
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   811
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   812
    if(!pFS)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   813
        {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   814
        __PRINT1(_L("#<<- CAutoMounterFileSystem::GetChildFileSystem() FileServer doesn't have FS:%S Added!"), &fsName);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   815
        Fault(EFileSysNotAdded);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   816
        }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   817
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   818
    return pFS;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   819
    }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   820
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   821
//-----------------------------------------------------------------------------
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   822
/**
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   823
    Find the child file system object by the file system name name hash. 
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   824
    @param  aFsNameHash FS name hash
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   825
    @return pointer to the FS object if it is found, NULL otherwise
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   826
*/
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   827
CFileSystem* CAutoMounterFileSystem::GetChildFileSysteByNameHash(TUint32 aFsNameHash) const
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   828
    {
271
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   829
    ASSERT(State() == EInitialised && (ChildFsNum() >= KMinChildFsNum) && aFsNameHash);
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   830
    
271
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   831
    const TUint cnt = ChildFsNum(); 
dc268b18d709 201037_07
hgs
parents: 33
diff changeset
   832
    for(TUint i=0; i<cnt; ++i)
0
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   833
        {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   834
        if(aFsNameHash == iFSNames.GetStringHash(i))
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   835
            {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   836
            const TDesC& fsName = iFSNames[i];        //-- registered child file system name
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   837
            __PRINT2(_L("#<<- ::GetChildFileSysteByNameHash() found FsName:%S by hash:0x%x"), &fsName, aFsNameHash);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   838
            CFileSystem* pFS = GetFileSystem(fsName); //-- Find filesystem object in the FileServer's global container
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   839
            ASSERT(pFS);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   840
            return pFS;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   841
            }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   842
   
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   843
        }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   844
   
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   845
    __PRINT1(_L("#<<- ::GetChildFileSysteByNameHash() No FS name found by hash:0x%x"), aFsNameHash);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   846
   
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   847
    return NULL;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   848
    }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   849
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   850
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   851
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   852
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   853
//#######################################################################################################################################
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   854
//#     XStringArray implementation
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   855
//#######################################################################################################################################
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   856
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   857
XStringArray::XStringArray()
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   858
    {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   859
    }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   860
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   861
XStringArray::~XStringArray()
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   862
    {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   863
    Reset();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   864
    iStrings.Close();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   865
    }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   866
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   867
//-----------------------------------------------------------------------------
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   868
void XStringArray::Reset()
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   869
    {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   870
    iStrings.ResetAndDestroy();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   871
    }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   872
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   873
//-----------------------------------------------------------------------------
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   874
const TDesC& XStringArray::operator[](TUint aIndex) const
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   875
    {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   876
    if(aIndex >= (TUint)iStrings.Count())
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   877
        Panic(EIndexOutOfRange);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   878
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   879
    HBufC* des=iStrings[aIndex];
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   880
    return *des;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   881
    }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   882
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   883
//-----------------------------------------------------------------------------
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   884
/**
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   885
    Append file system name to the container. The name is converted to upper case.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   886
    @param aString name descriptor.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   887
    @return standard error code
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   888
*/
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   889
TInt XStringArray::Append(const TDesC& aString)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   890
    {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   891
    HBufC* pBuf = aString.Alloc();
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   892
    if(!pBuf) 
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   893
        return KErrNoMemory;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   894
    
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   895
    //-- string being appended shall be unique
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   896
    for(TUint i=0; i<Count(); ++i)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   897
        {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   898
        if(operator[](i).CompareF(aString) == 0)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   899
            {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   900
            ASSERT(0);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   901
            return KErrNone;
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   902
            }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   903
        }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   904
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   905
    pBuf->Des().UpperCase(); //-- convert the FS name to upper-case in order to correctly calculate hash later
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   906
    return iStrings.Append(pBuf);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   907
    }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   908
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   909
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   910
//-----------------------------------------------------------------------------
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   911
/**
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   912
    Get child FS name hash by index in the names container.
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   913
    @param  aIndex name index in the container
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   914
    @return file system name hash (crc32)
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   915
*/
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   916
TUint32 XStringArray::GetStringHash(TUint aIndex) const
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   917
    {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   918
    const TDesC& des = operator[](aIndex);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   919
    return TVolFormatParam::CalcFSNameHash(des);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   920
    }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   921
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   922
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   923
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   924
void XStringArray::Panic(TPanicCode aPanicCode) const
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   925
    {
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   926
    _LIT(KPanicCat,"XStringArray");
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   927
    User::Panic(KPanicCat, aPanicCode);
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   928
    }
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   929
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   930
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   931
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   932
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   933
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   934
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   935
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   936
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   937
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   938
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   939
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   940
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   941
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   942
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   943
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   944
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   945
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   946
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   947
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   948
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   949
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   950
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   951
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   952
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   953
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   954
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   955
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   956
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   957
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   958
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   959
a41df078684a Convert Kernelhwsrv package from SFL to EPL
John Imhofe
parents:
diff changeset
   960