equal
deleted
inserted
replaced
1 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of the License "Eclipse Public License v1.0" |
4 // under the terms of the License "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
15 |
15 |
16 #include <f32file.h> |
16 #include <f32file.h> |
17 |
17 |
18 #include "rusbhostmsdevice.h" |
18 #include "rusbhostmsdevice.h" |
19 #include "rextfilesystem.h" |
19 #include "rextfilesystem.h" |
20 #include "tmslog.h" |
20 #include "debug.h" |
21 |
21 |
22 |
22 |
23 _LIT(KFsNm, "elocal"); |
23 _LIT(KFsNm, "elocal"); |
24 |
24 |
25 RExtFileSystem::RExtFileSystem() |
25 RExtFileSystem::RExtFileSystem() |
26 { |
26 { |
27 __MSFNLOG |
|
28 } |
27 } |
29 |
28 |
30 RExtFileSystem::~RExtFileSystem() |
29 RExtFileSystem::~RExtFileSystem() |
31 { |
30 { |
32 __MSFNLOG |
|
33 } |
31 } |
34 |
32 |
35 |
33 |
36 void RExtFileSystem::OpenL() |
34 void RExtFileSystem::OpenL() |
37 { |
35 { |
38 __MSFNLOG |
|
39 RFs fs; |
36 RFs fs; |
40 User::LeaveIfError(fs.Connect()); |
37 User::LeaveIfError(fs.Connect()); |
41 CleanupClosePushL(fs); |
38 CleanupClosePushL(fs); |
42 |
39 |
43 TInt err; |
40 TInt err; |
57 } |
54 } |
58 |
55 |
59 |
56 |
60 void RExtFileSystem::CloseL() |
57 void RExtFileSystem::CloseL() |
61 { |
58 { |
62 __MSFNLOG |
|
63 RFs fs; |
59 RFs fs; |
64 User::LeaveIfError(fs.Connect()); |
60 User::LeaveIfError(fs.Connect()); |
65 CleanupClosePushL(fs); |
61 CleanupClosePushL(fs); |
66 TInt err = fs.RemoveProxyDrive(_L("usbhostms")); |
62 TInt err = fs.RemoveProxyDrive(_L("usbhostms")); |
67 CleanupStack::PopAndDestroy(&fs); |
63 CleanupStack::PopAndDestroy(&fs); |
71 void RExtFileSystem::MountL(RUsbHostMsDevice& aDevice, |
67 void RExtFileSystem::MountL(RUsbHostMsDevice& aDevice, |
72 TDriveNumber aDriveNumber, |
68 TDriveNumber aDriveNumber, |
73 TToken aToken, |
69 TToken aToken, |
74 TLun aLun) |
70 TLun aLun) |
75 { |
71 { |
76 __MSFNLOG |
|
77 |
|
78 TTime start; |
72 TTime start; |
79 TTime end; |
73 TTime end; |
80 |
74 |
81 start.HomeTime(); |
75 start.HomeTime(); |
82 |
76 |
83 RFs fs; |
77 RFs fs; |
84 User::LeaveIfError(fs.Connect()); |
78 User::LeaveIfError(fs.Connect()); |
85 CleanupClosePushL(fs); |
79 CleanupClosePushL(fs); |
86 |
80 |
87 TInt err; |
81 TInt err; |
88 err = aDevice.MountLun(aLun, aDriveNumber); |
82 err = aDevice.MountLun(aLun, aDriveNumber); |
89 if (!(KErrAlreadyExists == err || KErrNotReady == err)) |
83 if (!(KErrAlreadyExists == err || KErrNotReady == err)) |
90 { |
84 { |
91 __PRINT1(_L("** Error: MountLun returned %d **"), err); |
85 __PRINT1(_L("** Error: MountLun returned %d **"), err); |
92 RDebug::Print(_L("** Error: MountLun returned %d **"), err); |
86 RDebug::Print(_L("** Error: MountLun returned %d **"), err); |
93 User::LeaveIfError(err); |
87 User::LeaveIfError(err); |
94 } |
88 } |
95 |
89 |
96 CleanupStack::PopAndDestroy(&fs); |
90 CleanupStack::PopAndDestroy(&fs); |
97 |
91 |
98 end.HomeTime(); |
92 end.HomeTime(); |
99 |
93 |
107 } |
101 } |
108 |
102 |
109 |
103 |
110 void RExtFileSystem::DismountL(RUsbHostMsDevice& aDevice, TDriveNumber aDriveNumber) |
104 void RExtFileSystem::DismountL(RUsbHostMsDevice& aDevice, TDriveNumber aDriveNumber) |
111 { |
105 { |
112 __MSFNLOG |
|
113 RFs fs; |
106 RFs fs; |
114 User::LeaveIfError(fs.Connect()); |
107 User::LeaveIfError(fs.Connect()); |
115 __PRINT(_L("DismountFileSystem")); |
108 __PRINT(_L("DismountFileSystem")); |
116 //TInt err = aDevice.DismountLun(aDriveNumber); |
109 //TInt err = aDevice.DismountLun(aDriveNumber); |
117 aDevice.DismountLun(aDriveNumber); |
110 aDevice.DismountLun(aDriveNumber); |
118 fs.Close(); |
111 fs.Close(); |
119 } |
112 } |
120 |
113 |
121 |
114 |
127 fs.DriveList(driveList); |
120 fs.DriveList(driveList); |
128 fs.Close(); |
121 fs.Close(); |
129 |
122 |
130 TInt drive; |
123 TInt drive; |
131 for (drive = EDriveG; drive <= EDriveZ; drive++) |
124 for (drive = EDriveG; drive <= EDriveZ; drive++) |
132 { |
125 { |
133 // Skip K drive which is reserved for LFFS but shows as being free |
126 // Skip K drive which is reserved for LFFS but shows as being free |
134 if (drive == EDriveK) |
127 if (drive == EDriveK) |
135 { |
128 { |
136 continue; |
129 continue; |
137 } |
130 } |