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