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 |
|
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
EXPORT_C TInt RFormat::Open(RFs& aFs,const TDesC& aName,TUint aFormatMode,TInt& aCount)
|
|
24 |
/**
|
|
25 |
Opens a device for formatting.
|
|
26 |
|
|
27 |
The device may be formatted either at high or low density.
|
|
28 |
|
|
29 |
Devices which support read-only media may not be formatted. This includes
|
|
30 |
the ROM on drive Z:. All files on the drive must be closed otherwise
|
|
31 |
an error is returned.
|
|
32 |
|
|
33 |
@param aFs The file server session. Must be connected.
|
|
34 |
@param aName The drive to be formatted, specified as a drive letter
|
|
35 |
followed by a colon.
|
|
36 |
@param aFormatMode The format mode. See TFormatMode.
|
|
37 |
@param aCount On successful return, contains the number of tracks which
|
|
38 |
remain to be formatted. This value is passed to the first
|
|
39 |
iteration of Next(), which then decrements the value on
|
|
40 |
this and subsequent calls to Next().
|
|
41 |
|
|
42 |
@return KErrNone, if successful, otherwise one of the other system wide error
|
|
43 |
codes.
|
|
44 |
|
|
45 |
@see TFormatMode
|
|
46 |
|
|
47 |
@capability DiskAdmin
|
|
48 |
|
|
49 |
*/
|
|
50 |
{
|
44
|
51 |
TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFormat1Open, MODULEUID, aFs.Handle(), aName, aFormatMode);
|
0
|
52 |
|
|
53 |
TPtr8 c((TUint8*)&aCount,sizeof(TUint),sizeof(TUint));
|
|
54 |
TInt r = CreateSubSession(aFs,EFsFormatOpen,TIpcArgs(&aName,aFormatMode,&c));
|
|
55 |
|
44
|
56 |
TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFormatOpen1Return, MODULEUID, r, SubSessionHandle(), aCount);
|
0
|
57 |
return r;
|
|
58 |
}
|
|
59 |
|
|
60 |
|
|
61 |
EXPORT_C TInt RFormat::Open(RFs& aFs,const TDesC& aName,TUint aFormatMode,TInt& aCount,const TDesC8& aInfo)
|
|
62 |
/**
|
|
63 |
Opens a device for formatting. User can specify new format parameters by anInfo.
|
|
64 |
|
|
65 |
The device may be formatted either at high or low density.
|
|
66 |
|
|
67 |
Devices which support read-only media may not be formatted. This includes
|
|
68 |
the ROM on drive Z:. All files on the drive must be closed otherwise
|
|
69 |
an error is returned.
|
|
70 |
|
|
71 |
@param aFs The file server session. Must be connected.
|
|
72 |
@param aName The drive to be formatted, specified as a drive letter
|
|
73 |
followed by a colon.
|
|
74 |
@param aFormatMode The format mode. See TFormatMode.
|
|
75 |
@param aCount On successful return, contains the number of tracks which
|
|
76 |
remain to be formatted. This value is passed to the first
|
|
77 |
iteration of Next(), which then decrements the value on
|
|
78 |
this and subsequent calls to Next().
|
|
79 |
@param anInfo Special format information specified by user.
|
|
80 |
|
|
81 |
@return KErrNone, if successful, otherwise one of the other system wide error
|
|
82 |
codes.
|
|
83 |
|
|
84 |
@see TFormatMode
|
|
85 |
|
|
86 |
@capability DiskAdmin
|
|
87 |
*/
|
|
88 |
{
|
44
|
89 |
TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::EFormat2Open, MODULEUID, aFs.Handle(), aName, aFormatMode, TUint(&aInfo));
|
0
|
90 |
|
|
91 |
TInt size = sizeof(TUint)+aInfo.Length();
|
|
92 |
TUint8* buf = new TUint8[size];
|
|
93 |
|
|
94 |
TInt r;
|
|
95 |
if (!buf)
|
|
96 |
{
|
|
97 |
r = KErrNoMemory;
|
|
98 |
}
|
|
99 |
else
|
|
100 |
{
|
|
101 |
TPtr8 c(buf, size);
|
|
102 |
c.Append((TUint8*)&aCount, sizeof(TUint));
|
|
103 |
c.Append(aInfo);
|
|
104 |
r = CreateSubSession(aFs,EFsFormatOpen,TIpcArgs(&aName,aFormatMode,&c));
|
|
105 |
aCount = *(TInt*)(&c[0]);
|
|
106 |
delete[] buf;
|
|
107 |
}
|
|
108 |
|
44
|
109 |
TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFormatOpen2Return, MODULEUID, r, SubSessionHandle(), aCount);
|
0
|
110 |
return r;
|
|
111 |
}
|
|
112 |
|
|
113 |
|
|
114 |
|
|
115 |
EXPORT_C void RFormat::Close()
|
|
116 |
/**
|
|
117 |
Closes the Format subsession.
|
|
118 |
|
|
119 |
Any open files are closed when the file server session is closed.
|
|
120 |
|
|
121 |
Close() is guaranteed to return, and provides no indication whether
|
|
122 |
it completed successfully or not.
|
|
123 |
*/
|
|
124 |
{
|
44
|
125 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFormatClose, MODULEUID, Session().Handle(), SubSessionHandle());
|
0
|
126 |
|
|
127 |
CloseSubSession(EFsFormatSubClose);
|
|
128 |
|
44
|
129 |
TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFormatCloseReturn, MODULEUID);
|
0
|
130 |
}
|
|
131 |
|
|
132 |
|
|
133 |
|
|
134 |
EXPORT_C TInt RFormat::Next(TInt& aStep)
|
|
135 |
/**
|
|
136 |
Executes the next format step.
|
|
137 |
|
|
138 |
This is a synchronous function, which returns when the formatting step
|
|
139 |
is complete.
|
|
140 |
|
|
141 |
@param aStep The step number. On return, it is decremented to indicate what
|
|
142 |
stage the formatting has reached. Before the first call to this
|
|
143 |
function, this value is seeded with the number of tracks remaining
|
|
144 |
to be formatted as returned by RFormat::Open().
|
|
145 |
The function should be called repeatedly until aStep reaches zero.
|
|
146 |
|
|
147 |
@return KErrNone, if successful, otherwise one of the other system wide error codes.
|
|
148 |
|
|
149 |
@see RFormat::Open
|
|
150 |
|
|
151 |
@capability DiskAdmin
|
|
152 |
|
|
153 |
*/
|
|
154 |
{
|
44
|
155 |
TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFormatNext1, MODULEUID, Session().Handle(), SubSessionHandle());
|
0
|
156 |
|
|
157 |
TPckg<TInt> e(aStep);
|
|
158 |
TInt r = SendReceive(EFsFormatNext,TIpcArgs(&e));
|
|
159 |
|
44
|
160 |
TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFormatNext1Return, MODULEUID, r, aStep);
|
0
|
161 |
return r;
|
|
162 |
}
|
|
163 |
|
|
164 |
|
|
165 |
|
|
166 |
|
|
167 |
EXPORT_C void RFormat::Next(TPckgBuf<TInt>& aStep,TRequestStatus& aStatus)
|
|
168 |
/**
|
|
169 |
Executes the next format step.
|
|
170 |
|
|
171 |
This is an asynchronous function.
|
|
172 |
|
|
173 |
@param aStep The step number. On return, it is decremented to indicate what
|
|
174 |
stage the formatting has reached. Before the first call to this
|
|
175 |
function, this value is seeded with the number of tracks remaining
|
|
176 |
to be formatted as returned by RFormat::Open().
|
|
177 |
The function should be called repeatedly until aStep reaches zero.
|
|
178 |
|
|
179 |
@param aStatus The request status. On request completion, contains a completion
|
|
180 |
code:
|
|
181 |
KErrNone, if successful, otherwise one of the other system-wide
|
|
182 |
error codes.
|
|
183 |
|
|
184 |
@see RFormat::Open
|
|
185 |
|
|
186 |
@capability DiskAdmin
|
|
187 |
|
|
188 |
*/
|
|
189 |
{
|
44
|
190 |
TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFormatNext2, MODULEUID, Session().Handle(), SubSessionHandle(), &aStatus);
|
0
|
191 |
|
|
192 |
SendReceive(EFsFormatNext,TIpcArgs(&aStep),aStatus);
|
|
193 |
|
44
|
194 |
TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFormatNext2Return, MODULEUID);
|
0
|
195 |
}
|