Update contrib.
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // f32\sfsrv\cl_fmt.cpp
23 EXPORT_C TInt RFormat::Open(RFs& aFs,const TDesC& aName,TUint aFormatMode,TInt& aCount)
25 Opens a device for formatting.
27 The device may be formatted either at high or low density.
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
33 @param aFs The file server session. Must be connected.
34 @param aName The drive to be formatted, specified as a drive letter
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().
42 @return KErrNone, if successful, otherwise one of the other system wide error
51 TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFormat1Open, MODULEUID, aFs.Handle(), aName, aFormatMode);
53 TPtr8 c((TUint8*)&aCount,sizeof(TUint),sizeof(TUint));
54 TInt r = CreateSubSession(aFs,EFsFormatOpen,TIpcArgs(&aName,aFormatMode,&c));
56 TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFormatOpen1Return, MODULEUID, r, SubSessionHandle(), aCount);
61 EXPORT_C TInt RFormat::Open(RFs& aFs,const TDesC& aName,TUint aFormatMode,TInt& aCount,const TDesC8& aInfo)
63 Opens a device for formatting. User can specify new format parameters by anInfo.
65 The device may be formatted either at high or low density.
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
71 @param aFs The file server session. Must be connected.
72 @param aName The drive to be formatted, specified as a drive letter
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.
81 @return KErrNone, if successful, otherwise one of the other system wide error
89 TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::EFormat2Open, MODULEUID, aFs.Handle(), aName, aFormatMode, TUint(&aInfo));
91 TInt size = sizeof(TUint)+aInfo.Length();
92 TUint8* buf = new TUint8[size];
102 c.Append((TUint8*)&aCount, sizeof(TUint));
104 r = CreateSubSession(aFs,EFsFormatOpen,TIpcArgs(&aName,aFormatMode,&c));
105 aCount = *(TInt*)(&c[0]);
109 TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFormatOpen2Return, MODULEUID, r, SubSessionHandle(), aCount);
115 EXPORT_C void RFormat::Close()
117 Closes the Format subsession.
119 Any open files are closed when the file server session is closed.
121 Close() is guaranteed to return, and provides no indication whether
122 it completed successfully or not.
125 TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFormatClose, MODULEUID, Session().Handle(), SubSessionHandle());
127 CloseSubSession(EFsFormatSubClose);
129 TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFormatCloseReturn, MODULEUID);
134 EXPORT_C TInt RFormat::Next(TInt& aStep)
136 Executes the next format step.
138 This is a synchronous function, which returns when the formatting step
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.
147 @return KErrNone, if successful, otherwise one of the other system wide error codes.
151 @capability DiskAdmin
155 TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFormatNext1, MODULEUID, Session().Handle(), SubSessionHandle());
157 TPckg<TInt> e(aStep);
158 TInt r = SendReceive(EFsFormatNext,TIpcArgs(&e));
160 TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFormatNext1Return, MODULEUID, r, aStep);
167 EXPORT_C void RFormat::Next(TPckgBuf<TInt>& aStep,TRequestStatus& aStatus)
169 Executes the next format step.
171 This is an asynchronous function.
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.
179 @param aStatus The request status. On request completion, contains a completion
181 KErrNone, if successful, otherwise one of the other system-wide
186 @capability DiskAdmin
190 TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFormatNext2, MODULEUID, Session().Handle(), SubSessionHandle(), &aStatus);
192 SendReceive(EFsFormatNext,TIpcArgs(&aStep),aStatus);
194 TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFormatNext2Return, MODULEUID);