author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Fri, 11 Jun 2010 15:02:23 +0300 | |
changeset 152 | 657f875b013e |
parent 0 | a41df078684a |
child 257 | 3e88ff8f41d5 |
permissions | -rw-r--r-- |
0 | 1 |
// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 |
// All rights reserved. |
|
3 |
// This component and the accompanying materials are made available |
|
4 |
// under the terms of the License "Eclipse Public License v1.0" |
|
5 |
// which accompanies this distribution, and is available |
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 |
// |
|
8 |
// Initial Contributors: |
|
9 |
// Nokia Corporation - initial contribution. |
|
10 |
// |
|
11 |
// Contributors: |
|
12 |
// |
|
13 |
// Description: |
|
14 |
// f32\sfsrv\cl_fmt.cpp |
|
15 |
// |
|
16 |
// |
|
17 |
||
18 |
#include "cl_std.h" |
|
19 |
||
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
20 |
#ifdef OST_TRACE_COMPILER_IN_USE |
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
21 |
#include "cl_fmtTraces.h" |
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
22 |
#endif |
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
23 |
|
0 | 24 |
|
25 |
||
26 |
||
27 |
EXPORT_C TInt RFormat::Open(RFs& aFs,const TDesC& aName,TUint aFormatMode,TInt& aCount) |
|
28 |
/** |
|
29 |
Opens a device for formatting. |
|
30 |
||
31 |
The device may be formatted either at high or low density. |
|
32 |
||
33 |
Devices which support read-only media may not be formatted. This includes |
|
34 |
the ROM on drive Z:. All files on the drive must be closed otherwise |
|
35 |
an error is returned. |
|
36 |
||
37 |
@param aFs The file server session. Must be connected. |
|
38 |
@param aName The drive to be formatted, specified as a drive letter |
|
39 |
followed by a colon. |
|
40 |
@param aFormatMode The format mode. See TFormatMode. |
|
41 |
@param aCount On successful return, contains the number of tracks which |
|
42 |
remain to be formatted. This value is passed to the first |
|
43 |
iteration of Next(), which then decrements the value on |
|
44 |
this and subsequent calls to Next(). |
|
45 |
||
46 |
@return KErrNone, if successful, otherwise one of the other system wide error |
|
47 |
codes. |
|
48 |
||
49 |
@see TFormatMode |
|
50 |
||
51 |
@capability DiskAdmin |
|
52 |
||
53 |
*/ |
|
54 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
55 |
OstTraceExt2(TRACE_BORDER, EFSRV_EFORMAT1OPEN, "sess %x aFormatMode %x", (TUint) aFs.Handle(), (TUint) aFormatMode); |
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
56 |
OstTraceData(TRACE_BORDER, EFSRV_EFORMAT1OPEN_EDRIVENAME, "DriveName %S", aName.Ptr(), aName.Length()<<1); |
0 | 57 |
|
58 |
TPtr8 c((TUint8*)&aCount,sizeof(TUint),sizeof(TUint)); |
|
59 |
TInt r = CreateSubSession(aFs,EFsFormatOpen,TIpcArgs(&aName,aFormatMode,&c)); |
|
60 |
||
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
61 |
OstTraceExt3(TRACE_BORDER, EFSRV_EFORMATOPEN1RETURN, "r %d subs %x aCount %d", (TUint) r, (TUint) SubSessionHandle(), (TUint) aCount); |
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
62 |
|
0 | 63 |
return r; |
64 |
} |
|
65 |
||
66 |
||
67 |
EXPORT_C TInt RFormat::Open(RFs& aFs,const TDesC& aName,TUint aFormatMode,TInt& aCount,const TDesC8& aInfo) |
|
68 |
/** |
|
69 |
Opens a device for formatting. User can specify new format parameters by anInfo. |
|
70 |
||
71 |
The device may be formatted either at high or low density. |
|
72 |
||
73 |
Devices which support read-only media may not be formatted. This includes |
|
74 |
the ROM on drive Z:. All files on the drive must be closed otherwise |
|
75 |
an error is returned. |
|
76 |
||
77 |
@param aFs The file server session. Must be connected. |
|
78 |
@param aName The drive to be formatted, specified as a drive letter |
|
79 |
followed by a colon. |
|
80 |
@param aFormatMode The format mode. See TFormatMode. |
|
81 |
@param aCount On successful return, contains the number of tracks which |
|
82 |
remain to be formatted. This value is passed to the first |
|
83 |
iteration of Next(), which then decrements the value on |
|
84 |
this and subsequent calls to Next(). |
|
85 |
@param anInfo Special format information specified by user. |
|
86 |
||
87 |
@return KErrNone, if successful, otherwise one of the other system wide error |
|
88 |
codes. |
|
89 |
||
90 |
@see TFormatMode |
|
91 |
||
92 |
@capability DiskAdmin |
|
93 |
*/ |
|
94 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
95 |
OstTraceExt3(TRACE_BORDER, EFSRV_EFORMAT2OPEN, "sess %x aFormatMode %x aInfo %x", (TUint) aFs.Handle(), (TUint) aFormatMode, (TUint) TUint(&aInfo)); |
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
96 |
OstTraceData(TRACE_BORDER, EFSRV_EFORMAT2OPEN_EDRIVENAME, "DriveName %S", aName.Ptr(), aName.Length()<<1); |
0 | 97 |
|
98 |
TInt size = sizeof(TUint)+aInfo.Length(); |
|
99 |
TUint8* buf = new TUint8[size]; |
|
100 |
||
101 |
TInt r; |
|
102 |
if (!buf) |
|
103 |
{ |
|
104 |
r = KErrNoMemory; |
|
105 |
} |
|
106 |
else |
|
107 |
{ |
|
108 |
TPtr8 c(buf, size); |
|
109 |
c.Append((TUint8*)&aCount, sizeof(TUint)); |
|
110 |
c.Append(aInfo); |
|
111 |
r = CreateSubSession(aFs,EFsFormatOpen,TIpcArgs(&aName,aFormatMode,&c)); |
|
112 |
aCount = *(TInt*)(&c[0]); |
|
113 |
delete[] buf; |
|
114 |
} |
|
115 |
||
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
116 |
OstTraceExt3(TRACE_BORDER, EFSRV_EFORMATOPEN2RETURN, "r %d subs %x aCount %d", (TUint) r, (TUint) SubSessionHandle(), (TUint) aCount); |
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
117 |
|
0 | 118 |
return r; |
119 |
} |
|
120 |
||
121 |
||
122 |
||
123 |
EXPORT_C void RFormat::Close() |
|
124 |
/** |
|
125 |
Closes the Format subsession. |
|
126 |
||
127 |
Any open files are closed when the file server session is closed. |
|
128 |
||
129 |
Close() is guaranteed to return, and provides no indication whether |
|
130 |
it completed successfully or not. |
|
131 |
*/ |
|
132 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
133 |
OstTraceExt2(TRACE_BORDER, EFSRV_EFORMATCLOSE, "sess %x subs %x", (TUint) Session().Handle(), (TUint) SubSessionHandle()); |
0 | 134 |
|
135 |
CloseSubSession(EFsFormatSubClose); |
|
136 |
||
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
137 |
OstTrace0(TRACE_BORDER, EFSRV_EFORMATCLOSERETURN, ""); |
0 | 138 |
} |
139 |
||
140 |
||
141 |
||
142 |
EXPORT_C TInt RFormat::Next(TInt& aStep) |
|
143 |
/** |
|
144 |
Executes the next format step. |
|
145 |
||
146 |
This is a synchronous function, which returns when the formatting step |
|
147 |
is complete. |
|
148 |
||
149 |
@param aStep The step number. On return, it is decremented to indicate what |
|
150 |
stage the formatting has reached. Before the first call to this |
|
151 |
function, this value is seeded with the number of tracks remaining |
|
152 |
to be formatted as returned by RFormat::Open(). |
|
153 |
The function should be called repeatedly until aStep reaches zero. |
|
154 |
||
155 |
@return KErrNone, if successful, otherwise one of the other system wide error codes. |
|
156 |
||
157 |
@see RFormat::Open |
|
158 |
||
159 |
@capability DiskAdmin |
|
160 |
||
161 |
*/ |
|
162 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
163 |
OstTraceExt2(TRACE_BORDER, EFSRV_EFORMATNEXT1, "sess %x subs %x", (TUint) Session().Handle(), (TUint) SubSessionHandle()); |
0 | 164 |
|
165 |
TPckg<TInt> e(aStep); |
|
166 |
TInt r = SendReceive(EFsFormatNext,TIpcArgs(&e)); |
|
167 |
||
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
168 |
OstTraceExt2(TRACE_BORDER, EFSRV_EFORMATNEXT1RETURN, "r %d aStep %d", (TUint) r, (TUint) aStep); |
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
169 |
|
0 | 170 |
return r; |
171 |
} |
|
172 |
||
173 |
||
174 |
||
175 |
||
176 |
EXPORT_C void RFormat::Next(TPckgBuf<TInt>& aStep,TRequestStatus& aStatus) |
|
177 |
/** |
|
178 |
Executes the next format step. |
|
179 |
||
180 |
This is an asynchronous function. |
|
181 |
||
182 |
@param aStep The step number. On return, it is decremented to indicate what |
|
183 |
stage the formatting has reached. Before the first call to this |
|
184 |
function, this value is seeded with the number of tracks remaining |
|
185 |
to be formatted as returned by RFormat::Open(). |
|
186 |
The function should be called repeatedly until aStep reaches zero. |
|
187 |
||
188 |
@param aStatus The request status. On request completion, contains a completion |
|
189 |
code: |
|
190 |
KErrNone, if successful, otherwise one of the other system-wide |
|
191 |
error codes. |
|
192 |
||
193 |
@see RFormat::Open |
|
194 |
||
195 |
@capability DiskAdmin |
|
196 |
||
197 |
*/ |
|
198 |
{ |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
199 |
OstTraceExt3(TRACE_BORDER, EFSRV_EFORMATNEXT2, "sess %x subs %x status %x", (TUint) Session().Handle(), (TUint) SubSessionHandle(), (TUint) &aStatus); |
0 | 200 |
|
201 |
SendReceive(EFsFormatNext,TIpcArgs(&aStep),aStatus); |
|
202 |
||
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
203 |
OstTrace0(TRACE_BORDER, EFSRV_EFORMATNEXT2RETURN, ""); |
0 | 204 |
} |