|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <f32file.h> |
|
19 #include <e32test.h> |
|
20 #include <e32hal.h> |
|
21 #include <f32dbg.h> |
|
22 |
|
23 #include "svphostfsy.h" |
|
24 |
|
25 #ifdef DP |
|
26 #undef DP |
|
27 #define DP(f...) |
|
28 #endif |
|
29 |
|
30 _LIT(KSVPHOSTFSY, "SVPHOSTFSY"); |
|
31 |
|
32 #if 1 |
|
33 GLDEF_C TInt E32Main() |
|
34 { |
|
35 CTrapCleanup* cleanup; |
|
36 cleanup=CTrapCleanup::New(); |
|
37 |
|
38 RSVPHostFsDriver driver; |
|
39 |
|
40 TInt r = driver.Open(); |
|
41 |
|
42 if (r != KErrNone) |
|
43 { |
|
44 delete cleanup; |
|
45 return(r); |
|
46 } |
|
47 |
|
48 TUint32 driveMap[DRIVE_MAP_SIZE]; |
|
49 |
|
50 r = driver.GetDriveMap(driveMap); |
|
51 |
|
52 driver.Close(); |
|
53 |
|
54 if (r != KErrNone) |
|
55 { |
|
56 delete cleanup; |
|
57 return(r); |
|
58 } |
|
59 |
|
60 RFs aFs; |
|
61 r=aFs.Connect(); |
|
62 |
|
63 if (r != KErrNone) goto fail; |
|
64 |
|
65 r=aFs.AddFileSystem(KSVPHOSTFSY); |
|
66 |
|
67 if (r != KErrNone) goto close; |
|
68 |
|
69 for (TInt i = 0; i < DRIVE_MAP_SIZE ; i++ ) |
|
70 { |
|
71 if (driveMap[i]) |
|
72 { |
|
73 char driveLetter = LOWEST_DRIVE + i; |
|
74 TInt driveNumber = driveLetter - 'A'; |
|
75 DP(_L(" Drive %c to be mounted\n"), driveLetter); |
|
76 r = aFs.MountFileSystem(KSVPHOSTFSY,driveNumber); |
|
77 DP(_L("aFs.MountFileSystem(KSVPHOSTFSY, %c) -> %d"), driveNumber, r); |
|
78 if (r != KErrNone) goto close; |
|
79 } |
|
80 } |
|
81 |
|
82 close: |
|
83 aFs.Close(); |
|
84 |
|
85 fail: |
|
86 delete cleanup; |
|
87 return(r); |
|
88 } |
|
89 |
|
90 #else |
|
91 |
|
92 GLDEF_C TInt E32Main() |
|
93 { |
|
94 CTrapCleanup* cleanup; |
|
95 cleanup=CTrapCleanup::New(); |
|
96 |
|
97 RSVPHostFsDriver driver; |
|
98 |
|
99 TInt r = driver.Open(); |
|
100 |
|
101 if (r != KErrNone){ |
|
102 delete cleanup; |
|
103 return(r); |
|
104 } |
|
105 |
|
106 RFs aFs; |
|
107 r=aFs.Connect(); |
|
108 |
|
109 r=aFs.AddFileSystem(KSVPHOSTFSY); |
|
110 DP(_L("r=aFs.AddFileSystem(KSVPHOSTFSY) -> %d\n"), r); |
|
111 |
|
112 // !@! |
|
113 // Until we have 'platform' device driver that we can use hardcode single virtual host drive as 'S' |
|
114 // !@! |
|
115 char driveLetter = 'S'; |
|
116 TInt driveNumber = driveLetter - 'A'; |
|
117 DP(_L(" Drive %c to be mounted\n"), driveLetter); |
|
118 r = aFs.MountFileSystem(KSVPHOSTFSY,driveNumber); |
|
119 DP(_L("aFs.MountFileSystem(KSVPHOSTFSY, %d) -> %d"), driveNumber, r); |
|
120 |
|
121 aFs.Close(); |
|
122 |
|
123 delete cleanup; |
|
124 return(KErrNone); |
|
125 } |
|
126 |
|
127 #endif |