1.1 --- a/epoc32/include/f32file.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/f32file.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,3017 @@
1.4 -f32file.h
1.5 +// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +// All rights reserved.
1.7 +// This component and the accompanying materials are made available
1.8 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.9 +// which accompanies this distribution, and is available
1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.11 +//
1.12 +// Initial Contributors:
1.13 +// Nokia Corporation - initial contribution.
1.14 +//
1.15 +// Contributors:
1.16 +//
1.17 +// Description:
1.18 +//
1.19 +
1.20 +
1.21 +
1.22 +/**
1.23 + @file
1.24 + @publishedAll
1.25 + @released
1.26 +*/
1.27 +
1.28 +#if !defined(__F32FILE_H__)
1.29 +#define __F32FILE_H__
1.30 +
1.31 +#if !defined(__E32BASE_H__)
1.32 +#include <e32base.h>
1.33 +#endif
1.34 +
1.35 +#if !defined(__E32SVR_H__)
1.36 +#include <e32svr.h>
1.37 +#endif
1.38 +
1.39 +#include <e32ldr.h>
1.40 +
1.41 +
1.42 +/**
1.43 +@publishedAll
1.44 +@released
1.45 +
1.46 +The session default drive.
1.47 +*/
1.48 +const TInt KDefaultDrive=KMaxTInt;
1.49 +
1.50 +
1.51 +
1.52 +
1.53 +/**
1.54 +@publishedAll
1.55 +@released
1.56 +
1.57 +Indicates a drive letter which is not in use.
1.58 +
1.59 +This is useful when scanning a drive list to find which drives are available.
1.60 +*/
1.61 +const TInt KDriveAbsent=0x00;
1.62 +
1.63 +
1.64 +
1.65 +
1.66 +/**
1.67 +@publishedAll
1.68 +@released
1.69 +
1.70 +The default value for the number of message slots passed to RFs::Connect().
1.71 +
1.72 +@see RFs::Connect
1.73 +*/
1.74 +const TInt KFileServerDefaultMessageSlots=-1;
1.75 +
1.76 +
1.77 +
1.78 +
1.79 +/**
1.80 +@publishedAll
1.81 +@released
1.82 +
1.83 +The size of the array of TEntry items contained in a TEntryArray object.
1.84 +
1.85 +@see TEntryArray
1.86 +@see TEntry
1.87 +*/
1.88 +const TInt KEntryArraySize=(0x200*sizeof(TText));
1.89 +
1.90 +
1.91 +
1.92 +
1.93 +/**
1.94 +@publishedAll
1.95 +@released
1.96 +
1.97 +The character used to separate directories in the path name.
1.98 +*/
1.99 +const TInt KPathDelimiter='\\';
1.100 +
1.101 +
1.102 +
1.103 +
1.104 +/**
1.105 +@publishedAll
1.106 +@released
1.107 +
1.108 +The character used to separate the drive letter from the path.
1.109 +*/
1.110 +const TInt KDriveDelimiter=':';
1.111 +
1.112 +
1.113 +
1.114 +
1.115 +/**
1.116 +@publishedAll
1.117 +@released
1.118 +
1.119 +The character used to separate the filename from the extension.
1.120 +*/
1.121 +const TInt KExtDelimiter='.';
1.122 +
1.123 +
1.124 +
1.125 +
1.126 +/**
1.127 +@publishedAll
1.128 +@released
1.129 +
1.130 +The maximum number of available drives.
1.131 +*/
1.132 +const TInt KMaxDrives=26;
1.133 +
1.134 +
1.135 +/**
1.136 +@publishedAll
1.137 +@released
1.138 +
1.139 +Defines a modifiable buffer descriptor to contain a drive list.
1.140 +
1.141 +The descriptor has maximum length KMaxDrives, sufficient to contain
1.142 +all possible drive letters.
1.143 +
1.144 +@see RFs::DriveList
1.145 +@see KMaxDrives
1.146 +*/
1.147 +typedef TBuf8<KMaxDrives> TDriveList;
1.148 +
1.149 +
1.150 +
1.151 +/**
1.152 +@publishedAll
1.153 +@released
1.154 +
1.155 +The maximum length of a drivename.
1.156 +
1.157 +Sufficient for a drive letter and colon.
1.158 +*/
1.159 +const TInt KMaxDriveName=0x02;
1.160 +
1.161 +
1.162 +
1.163 +
1.164 +/**
1.165 +@publishedAll
1.166 +@released
1.167 +
1.168 +Defines a modifiable buffer descriptor to contain a drive name.
1.169 +
1.170 +A drive name comprises a drive letter (A through Z) and a colon.
1.171 +KMaxDriveName (2 bytes) is sufficient for a drive letter and colon.
1.172 +
1.173 +@see TDriveUnit::Name
1.174 +@see KMaxDriveName
1.175 +*/
1.176 +typedef TBuf<KMaxDriveName> TDriveName;
1.177 +
1.178 +
1.179 +
1.180 +
1.181 +/**
1.182 +@publishedAll
1.183 +@released
1.184 +
1.185 +The maximum length of a file system name or file system sub type name.
1.186 +32 characters is sufficient for a file system or sub type name.
1.187 +*/
1.188 +const TInt KMaxFSNameLength=0x0020;
1.189 +
1.190 +
1.191 +
1.192 +
1.193 +/**
1.194 +@publishedAll
1.195 +@released
1.196 +
1.197 +Defines a modifiable buffer descriptor to contain a file system or file system sub type name.
1.198 +
1.199 +@see KMaxFSNameLength
1.200 +*/
1.201 +typedef TBuf<KMaxFSNameLength> TFSName;
1.202 +
1.203 +
1.204 +
1.205 +
1.206 +/**
1.207 +@publishedAll
1.208 +@released
1.209 +
1.210 +File/directory attribute: any file without the hidden or system attribute.
1.211 +*/
1.212 +const TUint KEntryAttNormal=0x0000;
1.213 +
1.214 +
1.215 +
1.216 +
1.217 +/**
1.218 +@publishedAll
1.219 +@released
1.220 +
1.221 +File/directory attribute: read-only file or directory.
1.222 +*/
1.223 +const TUint KEntryAttReadOnly=0x0001;
1.224 +
1.225 +
1.226 +
1.227 +
1.228 +/**
1.229 +@publishedAll
1.230 +@released
1.231 +
1.232 +File/directory attribute: hidden file or directory.
1.233 +*/
1.234 +const TUint KEntryAttHidden=0x0002;
1.235 +
1.236 +
1.237 +
1.238 +
1.239 +/**
1.240 +@publishedAll
1.241 +@released
1.242 +
1.243 +File/directory attribute: system file.
1.244 +*/
1.245 +const TUint KEntryAttSystem=0x0004;
1.246 +
1.247 +
1.248 +
1.249 +
1.250 +/**
1.251 +@publishedAll
1.252 +@released
1.253 +
1.254 +File/directory attribute: volume name directory.
1.255 +*/
1.256 +const TUint KEntryAttVolume=0x0008;
1.257 +
1.258 +
1.259 +
1.260 +
1.261 +/**
1.262 +@publishedAll
1.263 +@released
1.264 +
1.265 +File/directory attribute: a directory without the hidden or system attribute.
1.266 +*/
1.267 +const TUint KEntryAttDir=0x0010;
1.268 +
1.269 +
1.270 +
1.271 +
1.272 +/**
1.273 +@publishedAll
1.274 +@released
1.275 +
1.276 +File/directory attribute: an archive file.
1.277 +*/
1.278 +const TUint KEntryAttArchive=0x0020;
1.279 +
1.280 +
1.281 +
1.282 +
1.283 +/**
1.284 +@publishedAll
1.285 +@released
1.286 +
1.287 +File/directory attribute: ROM eXecute In Place file
1.288 +*/
1.289 +const TUint KEntryAttXIP=0x0080;
1.290 +
1.291 +
1.292 +
1.293 +
1.294 +/**
1.295 +@publishedAll
1.296 +@released
1.297 +
1.298 +This file attribute bit is set if the file exists only on a remote file
1.299 +system and is not locally cached.
1.300 +
1.301 +Due to the potential high-latency of remote file systems, applications
1.302 +(or users of applications) may make use of this bit to modify their
1.303 +behaviour when working with remote files.
1.304 +
1.305 +This is a read-only attribute, so any attempt to set this attribute will
1.306 +will be ignored.
1.307 +*/
1.308 +const TUint KEntryAttRemote=0x0100;
1.309 +
1.310 +
1.311 +
1.312 +
1.313 +/**
1.314 +@publishedAll
1.315 +@released
1.316 +
1.317 +The range of entry attributes reserved for file-system specific meanings.
1.318 +File systems may assign meaning to these bits, but their definition will
1.319 +not be supported nor maintained by Symbian.
1.320 +
1.321 +All other file attribute bits are reserved for use by Symbian.
1.322 +
1.323 +The following table summarises the assignment of attribute bits:
1.324 +
1.325 + 0 - KEntryAttReadOnly
1.326 + 1 - KEntryAttHidden
1.327 + 2 - KEntryAttSystem
1.328 + 3 - KEntryAttVolume
1.329 +
1.330 + 4 - KEntryAttDir
1.331 + 6 - KEntryAttArchive
1.332 + 7 - KEntryAttXIP
1.333 +
1.334 + 8 - KEntryAttRemote
1.335 + 9 - Reserved
1.336 + 10 - Reserved
1.337 + 11 - Reserved
1.338 +
1.339 + 12 - Reserved
1.340 + 13 - Reserved
1.341 + 14 - Reserved
1.342 + 15 - Reserved
1.343 +
1.344 + 16 - File System Specific
1.345 + 17 - File System Specific
1.346 + 18 - File System Specific
1.347 + 19 - File System Specific
1.348 +
1.349 + 20 - File System Specific
1.350 + 22 - File System Specific
1.351 + 22 - File System Specific
1.352 + 23 - File System Specific
1.353 +
1.354 + 24 - Reserved
1.355 + 25 - Reserved
1.356 + 26 - Reserved
1.357 + 27 - KEntryAttMatchExclude
1.358 +
1.359 + 28 - KEntryAttAllowUid
1.360 + 29 - Reserved
1.361 + 30 - KEntryAttMatchExclusive
1.362 + 31 - Reserved
1.363 +*/
1.364 +const TUint KEntryAttMaskFileSystemSpecific=0x00FF0000;
1.365 +
1.366 +
1.367 +
1.368 +
1.369 +/**
1.370 +@publishedAll
1.371 +@released
1.372 +
1.373 +Bit mask for matching file and directory entries.
1.374 +
1.375 +This mask ensures that directories and hidden and
1.376 +system files are matched.
1.377 +
1.378 +(Note that KEntryAttNormal matches all entry types except directories, hidden
1.379 +and system entries).
1.380 +
1.381 +@see RFs::GetDir
1.382 +*/
1.383 +const TUint KEntryAttMatchMask=(KEntryAttHidden|KEntryAttSystem|KEntryAttDir);
1.384 +
1.385 +
1.386 +
1.387 +
1.388 +
1.389 +/**
1.390 +@publishedAll
1.391 +@released
1.392 +
1.393 +Bit mask for matching file and directory entries.
1.394 +
1.395 +This is used when all entry types, including hidden and system files,
1.396 +but excluding the volume entry are to be matched.
1.397 +
1.398 +@see RFs::GetDir
1.399 +*/
1.400 +const TUint KEntryAttMaskSupported=0x3f;
1.401 +
1.402 +
1.403 +
1.404 +
1.405 +/**
1.406 +@publishedAll
1.407 +@released
1.408 +
1.409 +Bit mask for matching file and directory entries.
1.410 +
1.411 +This is used for exclusive matching. When OR'ed with one or more file attribute
1.412 +constants, for example, KEntryAttNormal, it ensures that only the files with
1.413 +those attributes are matched.
1.414 +When OR’ed with KEntryAttDir, directories only (not hidden or system) are matched.
1.415 +
1.416 +@see KEntryAttDir
1.417 +@see KEntryAttNormal
1.418 +@see RFs::GetDir
1.419 +*/
1.420 +const TUint KEntryAttMatchExclusive=0x40000000;
1.421 +
1.422 +
1.423 +
1.424 +
1.425 +/**
1.426 +@publishedAll
1.427 +@released
1.428 +
1.429 +Bit mask for feature manager file entries.
1.430 +
1.431 +It is used in order to identify each ROM feature set data file
1.432 +uniquely in the mount order of ROM sections.
1.433 +
1.434 +*/
1.435 +const TUint KEntryAttUnique=0x01000000;
1.436 +
1.437 +
1.438 +
1.439 +
1.440 +/**
1.441 +@publishedAll
1.442 +@released
1.443 +
1.444 +Bit mask for matching file and directory entries.
1.445 +
1.446 +It is used to exclude files or directories with certain attributes from
1.447 +directory listings. This bitmask has the opposite effect
1.448 +to KEntryAttMatchExclusive. For example:
1.449 +
1.450 +@code
1.451 +KEntryAttMatchExclude|KEntryAttReadOnly
1.452 +@endcode
1.453 +
1.454 +excludes all read only entries from the directory listing.
1.455 +
1.456 +@code
1.457 +KEntryAttMatchExclusive|KEntryAttReadOnly
1.458 +@endcode
1.459 +lists only read only entries.
1.460 +
1.461 +@see KEntryAttMatchExclusive
1.462 +@see RFs::GetDir
1.463 +*/
1.464 +const TUint KEntryAttMatchExclude=0x08000000;
1.465 +
1.466 +
1.467 +
1.468 +
1.469 +/**
1.470 +@publishedAll
1.471 +@released
1.472 +
1.473 +Bit mask for matching file and directory entries.
1.474 +
1.475 +Bit mask flag used when UID information should be included in the directory
1.476 +entry listing.
1.477 +
1.478 +@see RFs::GetDir
1.479 +*/
1.480 +const TUint KEntryAttAllowUid=0x10000000;
1.481 +
1.482 +
1.483 +
1.484 +
1.485 +/**
1.486 +@publishedPartner
1.487 +@released
1.488 +
1.489 +Bit mask used when evaluating whether or not a session gets notified of a
1.490 +debug event.
1.491 +
1.492 +@see DebugNotifySessions
1.493 +*/
1.494 +const TUint KDebugNotifyMask=0xFF000000; // Reserved for debug notification
1.495 +
1.496 +/**
1.497 +
1.498 +*/
1.499 +const TUint KMaxMapsPerCall = 0x8;
1.500 +
1.501 +
1.502 +
1.503 +
1.504 +/**
1.505 +@publishedPartner
1.506 +@released
1.507 +
1.508 +The default blocksize value.
1.509 +
1.510 +This value is returned when you query the blocksize for a media type that does not
1.511 +support the concept of 'block' (e.g. NOR flash media).
1.512 +
1.513 +@see TVolumeIOParamInfo
1.514 +*/
1.515 +const TUint KDefaultVolumeBlockSize = 512;
1.516 +
1.517 +
1.518 +
1.519 +
1.520 +enum TNotifyType
1.521 +/**
1.522 +@publishedAll
1.523 +@released
1.524 +
1.525 +A set of change notification flags.
1.526 +
1.527 +These flags indicate the kind of change that should result in notification.
1.528 +
1.529 +This is useful for programs that maintain displays of file lists that
1.530 +must be dynamically updated.
1.531 +
1.532 +@see RFs::NotifyChange
1.533 +@see RFs
1.534 +@see RFile
1.535 +@see RRawDisk
1.536 +*/
1.537 + {
1.538 + /**
1.539 + Any change, including mounting and unmounting drives.
1.540 + */
1.541 + ENotifyAll=0x01,
1.542 +
1.543 +
1.544 + /**
1.545 + Addition or deletion of a directory entry, or changing or formatting a disk.
1.546 + */
1.547 + ENotifyEntry=0x02,
1.548 +
1.549 +
1.550 + /**
1.551 + Change resulting from file requests:
1.552 + RFile::Create(), RFile::Replace(), RFile::Rename(), RFs::Delete(),
1.553 + RFs::Replace(), and RFs::Rename().
1.554 + */
1.555 + ENotifyFile=0x04,
1.556 +
1.557 +
1.558 + /**
1.559 + Change resulting from directory requests:
1.560 + RFs::MkDir(), RFs::RmDir(), and RFs::Rename().
1.561 + */
1.562 + ENotifyDir=0x08,
1.563 +
1.564 +
1.565 + /**
1.566 + Change resulting from: RFs::SetEntry(), RFile::Set(), RFile::SetAtt(),
1.567 + RFile::SetModified() and RFile::SetSize() requests.
1.568 + */
1.569 + ENotifyAttributes=0x10,
1.570 +
1.571 +
1.572 + /**
1.573 + Change resulting from the RFile::Write() request.
1.574 + */
1.575 + ENotifyWrite=0x20,
1.576 +
1.577 +
1.578 + /**
1.579 + Change resulting from the RRawDisk::Write() request.
1.580 + */
1.581 + ENotifyDisk=0x40
1.582 + };
1.583 +
1.584 +enum TNotifyDismountMode
1.585 +/**
1.586 +@publishedAll
1.587 +@released
1.588 +
1.589 +Notification modes for safe media removal notification API
1.590 +
1.591 +@see RFs::NotifyDismount
1.592 +*/
1.593 + {
1.594 + /**
1.595 + Used by a client to register for notification of pending dismount.
1.596 + - This is the default behaviour for RFs::NotifyDismount
1.597 + */
1.598 + EFsDismountRegisterClient=0x01,
1.599 +
1.600 + /**
1.601 + Used to notify clients of a pending dismount.
1.602 + */
1.603 + EFsDismountNotifyClients=0x02,
1.604 +
1.605 + /**
1.606 + Used to forcibly dismount the file system without notifying clients.
1.607 + */
1.608 + EFsDismountForceDismount=0x03,
1.609 + };
1.610 +
1.611 +
1.612 +enum TFileCacheFlags
1.613 +/**
1.614 +@publishedPartner
1.615 +@released
1.616 +
1.617 +Flags used to enable file server drive-specific caching
1.618 +*/
1.619 + {
1.620 + /**
1.621 + Enable read caching - if file explicitly opened in EFileReadBuffered mode
1.622 + */
1.623 + EFileCacheReadEnabled = 0x01,
1.624 +
1.625 + /**
1.626 + Enable read caching for all files, regardless of file open mode
1.627 + */
1.628 + EFileCacheReadOn = 0x02,
1.629 +
1.630 + /**
1.631 + Enable read-ahead caching - if file explicitly opened in EFileReadAheadOn mode
1.632 + */
1.633 + EFileCacheReadAheadEnabled = 0x04,
1.634 +
1.635 + /**
1.636 + Enable read-ahead caching, regardless of file open mode
1.637 + */
1.638 + EFileCacheReadAheadOn = 0x08,
1.639 +
1.640 + /**
1.641 + Enable write caching, if file explicitly opened in EFileWriteBuffered mode
1.642 + */
1.643 + EFileCacheWriteEnabled = 0x10,
1.644 +
1.645 + /**
1.646 + Enable write caching for all files, regardless of file open mode
1.647 + */
1.648 + EFileCacheWriteOn = 0x20,
1.649 + };
1.650 +
1.651 +
1.652 +enum TStartupConfigurationCmd
1.653 +/**
1.654 +@publishedPartner
1.655 +@released
1.656 +
1.657 +Command used to set file server configuration at startup.
1.658 +
1.659 +@see RFs::SetStartupConfiguration()
1.660 +*/
1.661 + {
1.662 + /**
1.663 + Set loader thread priority
1.664 + */
1.665 + ELoaderPriority,
1.666 +
1.667 + /**
1.668 + Set TDrive flags. Value should be ETrue or EFalse
1.669 + */
1.670 + ESetRugged,
1.671 + /**
1.672 + Command upper boundary
1.673 + */
1.674 + EMaxStartupConfigurationCmd
1.675 + };
1.676 +
1.677 +/**
1.678 +@publishedPartner
1.679 +@released
1.680 +
1.681 +Commands to query specific volume information.
1.682 +
1.683 +@see TVolumeIOParamInfo
1.684 +*/
1.685 +enum TQueryVolumeInfoExtCmd
1.686 + {
1.687 + /**
1.688 + Queries the sub type of the file system mounted on a specified volume.
1.689 + For example, FAT12, FAT16 or FAT32.
1.690 + */
1.691 + EFileSystemSubType,
1.692 +
1.693 + /**
1.694 + Queries the I/O parameters of a specificed volume.
1.695 + This includes the block size, the cluster size and the recommended read and write sizes for the media.
1.696 + */
1.697 + EIOParamInfo,
1.698 +
1.699 + /**
1.700 + This command determines whether the volume is synchronous or asynchronous.
1.701 + A boolean value is returned within the buffer defined as TPckgBuf<TBool>.
1.702 + ETrue for Synchronous and EFalse for Asynchronous.
1.703 + */
1.704 + EIsDriveSync,
1.705 +
1.706 + /**
1.707 + Query if the given drive is finalised. See RFs::FinaliseDrive()
1.708 + Not all file systems may support this query.
1.709 + A boolean value is returned within the buffer defined as TPckgBuf<TBool>.
1.710 + ETrue value means that the drive is finalised
1.711 + */
1.712 + EIsDriveFinalised,
1.713 + };
1.714 +
1.715 +/**
1.716 +@publishedAll
1.717 +@released
1.718 +
1.719 +Volume IO parameter information.
1.720 +
1.721 +This class is used to return IO parameter information for a specified volume.
1.722 +
1.723 +The volume parameter information holds recommended buffer sizes for the creation of efficient buffers for
1.724 +reading and writing.
1.725 +
1.726 +@see RFs::VolumeIOParam()
1.727 +*/
1.728 +class TVolumeIOParamInfo
1.729 + {
1.730 +public:
1.731 + /**
1.732 + The size of a block in bytes.
1.733 +
1.734 + Reads and writes that are aligned on block boundaries are up to twice as fast as when
1.735 + mis-aligned.
1.736 +
1.737 + Read and write operations on certain underlying media is done in blocks.
1.738 + A write operation that modifies only part of a block is less efficient, in general, than
1.739 + one that modifies an entire block. Data throughput degrades linearly for reads and writes in smaller
1.740 + sized units.
1.741 + */
1.742 + TInt iBlockSize;
1.743 + /**
1.744 + The size in bytes of a single disk cluster.
1.745 +
1.746 + Read and write operations that are aligned on cluster boundaries are more efficient.
1.747 +
1.748 + The file system organises and allocates the file data on the disk in clusters where each cluster is
1.749 + one or more blocks. Files that are not zero length occupy at least one cluster of the disk,
1.750 + so large numbers of very small files use up more disk space than expected.
1.751 + */
1.752 + TInt iClusterSize;
1.753 + /**
1.754 + The recommended buffer size for optimised reading performance.
1.755 +
1.756 + The given buffer size is based on sensible benchmark testing results produced by the mobile device vendor.
1.757 + The buffer size is then added to the estart.txt file
1.758 +
1.759 + The figure is included in the estart.txt file along with the drive number and the variable name.
1.760 + The example below shows the required format:
1.761 +
1.762 + [DriveC]
1.763 + RecReadBufSize 8192
1.764 +
1.765 + When no value is provided, value KErrNotSupported is returned.
1.766 + */
1.767 + TInt iRecReadBufSize;
1.768 + /**
1.769 + The recommended buffer size for optimised writing performance.
1.770 +
1.771 + The given buffer size is based on sensible benchmark testing results produced by the mobile device vendor.
1.772 + The buffer size is then added to the estart.txt file
1.773 +
1.774 + The figure is included in the estart.txt file along with the drive number and the variable name.
1.775 + The example below shows the required format:
1.776 +
1.777 + [DriveC]
1.778 + RecWriteBufSize 16384
1.779 +
1.780 + When no value is provided, value KErrNotSupported is returned.
1.781 + */
1.782 + TInt iRecWriteBufSize;
1.783 +
1.784 +private:
1.785 + /*
1.786 + Reserved space for future use
1.787 + */
1.788 + TInt iReserved[4];
1.789 + };
1.790 +
1.791 +enum TDriveNumber
1.792 +/**
1.793 +@publishedAll
1.794 +@released
1.795 +
1.796 +The drive number enumeration.
1.797 +*/
1.798 + {
1.799 + EDriveA, EDriveB, EDriveC, EDriveD, EDriveE,
1.800 + EDriveF, EDriveG, EDriveH, EDriveI, EDriveJ,
1.801 + EDriveK, EDriveL, EDriveM, EDriveN, EDriveO,
1.802 + EDriveP, EDriveQ, EDriveR, EDriveS, EDriveT,
1.803 + EDriveU, EDriveV, EDriveW, EDriveX, EDriveY,
1.804 + EDriveZ
1.805 + };
1.806 +
1.807 +
1.808 +
1.809 +
1.810 +enum TEntryKey
1.811 +/**
1.812 +@publishedAll
1.813 +@released
1.814 +
1.815 +Flags indicating the order in which directory entries are to be sorted.
1.816 +
1.817 +@see RFs::GetDir
1.818 +@see CDirScan::SetScanDataL
1.819 +@see CDir::Sort
1.820 +*/
1.821 + {
1.822 + /**
1.823 + The default; no sorting takes place
1.824 + */
1.825 + ESortNone=0,
1.826 +
1.827 +
1.828 + /**
1.829 + Sort according to alphabetic order of file and directory name.
1.830 +
1.831 + This setting is mutually exclusive with ESortByExt, ESortBySize,
1.832 + ESortByDate and ESortByUid.
1.833 + */
1.834 + ESortByName,
1.835 +
1.836 +
1.837 + /**
1.838 + Sort according to alphabetic order of file extension.
1.839 +
1.840 + Files without an extension take precedence over files with an extension.
1.841 + For files with the same extension or without an extension, the default is
1.842 + to sort by name.
1.843 +
1.844 + This setting is mutually exclusive with ESortByName, ESortBySize,
1.845 + ESortByDate and ESortByUid.
1.846 + */
1.847 + ESortByExt,
1.848 +
1.849 +
1.850 + /**
1.851 + Sort according to file size.
1.852 +
1.853 + This setting is mutually exclusive with ESortByName, ESortByExt,
1.854 + ESortByDate and ESortByUid.
1.855 + */
1.856 + ESortBySize,
1.857 +
1.858 +
1.859 + /**
1.860 + Sort according to files' last modified time and date.
1.861 +
1.862 + By default, most recent last.
1.863 +
1.864 + This setting is mutually exclusive with ESortByName, ESortByExt,
1.865 + ESortBySize and ESortByUid.
1.866 + */
1.867 + ESortByDate,
1.868 +
1.869 +
1.870 + /**
1.871 + Sort according to file UID.
1.872 +
1.873 + This setting is mutually exclusive with ESortByName, ESortByExt,
1.874 + ESortBySize and ESortByDate.
1.875 + */
1.876 + ESortByUid,
1.877 +
1.878 +
1.879 + /**
1.880 + Qualifies the sort order; if set, directories are listed in the order in
1.881 + which they occur.
1.882 +
1.883 + This is the default.
1.884 +
1.885 + This flag is mutually exclusive with EDirsFirst and EDirslast.
1.886 + */
1.887 + EDirsAnyOrder=0,
1.888 +
1.889 +
1.890 + /**
1.891 + Qualifies the sort order; if set, directories come before files in sort order.
1.892 +
1.893 + This flag is mutually exclusive with EDirsAnyOrder and EDirsLast.
1.894 + */
1.895 + EDirsFirst=0x100,
1.896 +
1.897 +
1.898 + /**
1.899 + Qualifies the sort order; if set, files come before directories in sort order.
1.900 +
1.901 + This flag is mutually exclusive with EDirsAnyOrder and EDirsFirst.
1.902 + */
1.903 + EDirsLast=0x200,
1.904 +
1.905 +
1.906 + /**
1.907 + Qualifies the sort order; files are sorted in ascending order, i.e. from A to Z.
1.908 + This is the default behaviour.
1.909 +
1.910 + This flag is mutually exclusive with EDescending and EDirDescending.
1.911 + */
1.912 + EAscending=0,
1.913 +
1.914 +
1.915 + /**
1.916 + Qualifies the sort order; files are sorted in descending order, i.e. from Z to A.
1.917 +
1.918 + This flag is mutually exclusive with EAscending and EDirDescending.
1.919 + */
1.920 + EDescending=0x400,
1.921 +
1.922 +
1.923 + /**
1.924 + Qualifies the sort order; directories are sorted in descending order, i.e. from Z to A.
1.925 +
1.926 + This flag shall be used in combination with either EDirsFirst or EDirsLast.
1.927 + This flag is mutually exclusive with EAscending and EDescending.
1.928 + */
1.929 + EDirDescending=0x800
1.930 + };
1.931 +
1.932 +
1.933 +
1.934 +
1.935 +enum TFileMode
1.936 +/**
1.937 +@publishedAll
1.938 +@released
1.939 +
1.940 +Access and share modes available when opening a file.
1.941 +
1.942 +The access mode indicates whether the file is opened just for reading or
1.943 +for writing.
1.944 +
1.945 +The share mode indicates whether other RFile objects can access the
1.946 +open file, and whether this access is read only.
1.947 +
1.948 +Use EFileShareReadersOrWriters if a client does not care whether the file has
1.949 +been previously opened for ReadOnly or Read/Write access.
1.950 +
1.951 +If EFileShareReadersOrWriters is not used, then a client needs to cooperate with
1.952 +other clients in order to open the file with the correct share mode, either
1.953 +EFileShareReadersOnly or EFileShareAny, depending on the share mode used when
1.954 +the file was originally opened.
1.955 +
1.956 +To open a file for reading and writing with read and write shared access,
1.957 +use:
1.958 +
1.959 +@code
1.960 +_LIT(KFilename, "filename.ext");
1.961 +RFile file;
1.962 +file.Open(theFs, KFilename, EFileShareAny|EFileWrite);
1.963 +@endcode
1.964 +
1.965 +If another instance of RFile tries to open this file in EFileShareExclusive
1.966 +or EFileShareReadersOnly mode, access is denied. However, it can be opened
1.967 +in EFileShareAny mode or EFileShareReadersOrWriters mode.
1.968 +
1.969 +If a file is opened with EFileShareReadersOrWriters, and the file is opened for
1.970 +sharing by another client, then the file share mode is promoted to the new share
1.971 +mode. When the file handle is closed then the share mode is demoted back to
1.972 +EFileShareReadersOrWriters.
1.973 +
1.974 +@code
1.975 +
1.976 +Table of FileShare promotion rules
1.977 +----------------------------------
1.978 +
1.979 +Client A Client B Resultant Share Mode
1.980 +-------- -------- --------------------
1.981 +ReadersOnly ReadersOnly ReadersOnly
1.982 +ReadersOnly ReadersOrWriters|EFileRead ReadersOnly
1.983 +ReadersOnly ReadersOrWriters|EFileWrite INCOMPATIBLE
1.984 +ReadersOnly Any INCOMPATIBLE
1.985 +
1.986 +ReadersOrWriters|EFileRead ReadersOnly ReadersOnly
1.987 +ReadersOrWriters|EFileRead ReadersOrWriters|EFileRead ReadersOrWriters
1.988 +ReadersOrWriters|EFileRead ReadersOrWriters|EFileWrite ReadersOrWriters
1.989 +ReadersOrWriters|EFileRead Any Any
1.990 +
1.991 +ReadersOrWriters|EFileWrite ReadersOnly INCOMPATIBLE
1.992 +ReadersOrWriters|EFileWrite ReadersOrWriters|EFileRead ReadersOrWriters
1.993 +ReadersOrWriters|EFileWrite ReadersOrWriters|EFileWrite ReadersOrWriters
1.994 +ReadersOrWriters|EFileWrite Any Any
1.995 +
1.996 +Any ReadersOnly INCOMPATIBLE
1.997 +Any ReadersOrWriters|EFileRead Any
1.998 +Any ReadersOrWriters|EFileWrite Any
1.999 +Any Any Any
1.1000 +@endcode
1.1001 +
1.1002 +Use the following guidance notes for selecting FileShare mode with shared RFile objects:
1.1003 +
1.1004 +EFileShareAny
1.1005 +- Use this mode to request both read and write access when another client needs
1.1006 +to write to the file and respective client access to the file is coordinated.
1.1007 +- To open a file for non-exclusive write, use EFileShareAny | EFileWrite.
1.1008 +- It is recommended that either EFileShareAny or EFileShareAny | EFileRead are
1.1009 +not used. These combinations will block users attempting to use the
1.1010 +EFileShareReadersOnly mode even if all the EFileShareAny handles do not have
1.1011 +the EFileWrite bit set as the EFileRead and EFileWrite bits have no affect on
1.1012 +sharing. Use either EFileShareReadersOnly or EFileShareReadersOrWriters.
1.1013 +
1.1014 +EFileShareReadersOrWriters
1.1015 +- Use this mode when it does not matter if another file writes to the file and
1.1016 +file access can not be coordinated as other clients are unknown.
1.1017 +- To open a file for shared read access whilst permitting writers, use
1.1018 +EFileShareReadersOrWriters | EFileRead.
1.1019 +
1.1020 +- For write access with unrestricted share mode,
1.1021 +EFileShareReadersOrWriters | EFileWrite may be used however
1.1022 +EFilesShareAny | EFileWrite is preferred.
1.1023 +
1.1024 +EFileShareReadersOnly
1.1025 +- Use this mode to get read access to the file and deny write access for any
1.1026 +other handles on this file.
1.1027 +- To open a file for shared read access whilst disallowing writers use
1.1028 +EFileShareReadersOnly.
1.1029 +
1.1030 +
1.1031 +Files may be opened in text or binary mode. Native Symbian OS application
1.1032 +files are nearly all binary, (so they will usually be opened in binary mode).
1.1033 +However, they can be opened in text mode (to support testing, and to make them
1.1034 +compatible with text formats on remote systems).
1.1035 +Symbian OS native text format uses CR-LF (ASCII 0x0d, 0x0a) to denote the end of
1.1036 +a line. When reading, however, any combination of CR, LF, LF-CR or CR-LF is
1.1037 +recognised as the end of a line. Where a remote file system uses a different
1.1038 +format, it is the responsibility of the installable file system to present
1.1039 +an interface for text files which conforms with this format.
1.1040 +
1.1041 +The share mode may be OR’ed with either EFileStream or EFileStreamText.
1.1042 +
1.1043 +Additionally, it may be OR’ed with either EFileRead or EFileWrite.
1.1044 +*/
1.1045 + {
1.1046 + /**
1.1047 + Exclusive access for the program opening the file.
1.1048 +
1.1049 + No other program can access the file until it is closed.
1.1050 + If another program is already accessing the file in any share mode, then
1.1051 + an attempt to open it with an EFileShareExclusive will fail.
1.1052 + */
1.1053 + EFileShareExclusive,
1.1054 +
1.1055 +
1.1056 + /**
1.1057 + Read-only sharing.
1.1058 +
1.1059 + This means that the file may only be accessed for reading.
1.1060 + A file cannot be opened using a share mode of EFileShareReadersOnly with
1.1061 + an EFileWrite flag.
1.1062 + */
1.1063 + EFileShareReadersOnly,
1.1064 +
1.1065 +
1.1066 + /**
1.1067 + Shared access for reading and writing.
1.1068 +
1.1069 + This means that other programs may share access to the file for reading
1.1070 + and writing with the program which opened the file.
1.1071 +
1.1072 + When using this mode, the program is expecting another program to be able
1.1073 + to write to the file, so is not compatible with EFileShareReadersOnly.
1.1074 + */
1.1075 + EFileShareAny,
1.1076 +
1.1077 +
1.1078 + /**
1.1079 + Shared access for reading and writing.
1.1080 +
1.1081 + This means that other programs may share access to the file for reading
1.1082 + and writing with the program which opened the file.
1.1083 +
1.1084 + When using this mode, the program does not care if another program has
1.1085 + the file open for read or write access.
1.1086 + */
1.1087 + EFileShareReadersOrWriters,
1.1088 +
1.1089 +
1.1090 + /**
1.1091 + For files to be opened in binary mode.
1.1092 + */
1.1093 + EFileStream=0,
1.1094 +
1.1095 +
1.1096 + /**
1.1097 + For files to be opened in text mode.
1.1098 + */
1.1099 + EFileStreamText=0x100,
1.1100 +
1.1101 +
1.1102 + /**
1.1103 + The file may be read from but not written to.
1.1104 + */
1.1105 + EFileRead=0,
1.1106 +
1.1107 +
1.1108 + /**
1.1109 + The file may be read from and written to
1.1110 +
1.1111 + Cannot be combined with a share mode of EFileShareReadersOnly.
1.1112 + */
1.1113 + EFileWrite=0x200,
1.1114 +
1.1115 + /**
1.1116 + Specifies that an asynchronous read request should not be completed
1.1117 + until all requested data becomes available.
1.1118 +
1.1119 + Cannot be combined with the EFileShareExclusive or EFileShareReadersOnly
1.1120 + share modes as this will prohibit a writer from updating the file.
1.1121 + */
1.1122 + EFileReadAsyncAll=0x400,
1.1123 +
1.1124 + /**
1.1125 + Enables write buffering
1.1126 + */
1.1127 + EFileWriteBuffered =0x00000800,
1.1128 +
1.1129 + /**
1.1130 + Disables write buffering
1.1131 + */
1.1132 + EFileWriteDirectIO =0x00001000,
1.1133 +
1.1134 + /**
1.1135 + Enables read buffering
1.1136 + */
1.1137 + EFileReadBuffered =0x00002000,
1.1138 +
1.1139 + /**
1.1140 + Disables read buffering
1.1141 + */
1.1142 + EFileReadDirectIO =0x00004000,
1.1143 +
1.1144 + /**
1.1145 + Enables read ahead.
1.1146 + */
1.1147 + EFileReadAheadOn =0x00008000,
1.1148 +
1.1149 + /**
1.1150 + Disables read ahead.
1.1151 + */
1.1152 + EFileReadAheadOff =0x00010000
1.1153 + };
1.1154 +
1.1155 +
1.1156 +
1.1157 +
1.1158 +/**
1.1159 +@publishedAll
1.1160 +@released
1.1161 +
1.1162 +Bit mask provided for retrieving a file's share mode.
1.1163 +
1.1164 +@see TFileMode
1.1165 +*/
1.1166 +const TUint KFileShareMask=0xff;
1.1167 +
1.1168 +
1.1169 +
1.1170 +
1.1171 +enum TFormatMode
1.1172 +/**
1.1173 +@publishedAll
1.1174 +@released
1.1175 +
1.1176 +The format method.
1.1177 +*/
1.1178 + {
1.1179 + /**
1.1180 + Indicates a high density floppy disk to be formatted.
1.1181 + */
1.1182 + EHighDensity,
1.1183 +
1.1184 +
1.1185 + /**
1.1186 + Indicates a standard floppy disk to be formatted.
1.1187 + */
1.1188 + ELowDensity,
1.1189 +
1.1190 +
1.1191 + /**
1.1192 + Performs a full format, erasing existing content and resetting the FAT
1.1193 + and root directory.
1.1194 +
1.1195 + This is the default, and can be ORed with bit EHighDensity or ELowDensity.
1.1196 + */
1.1197 + EFullFormat=0,
1.1198 +
1.1199 +
1.1200 + /**
1.1201 + Does the minimum required to format the device, only resetting the FAT
1.1202 + and root directory.
1.1203 +
1.1204 + This is the default, and can be ORed with bit EHighDensity or ELowDensity.
1.1205 + */
1.1206 + EQuickFormat=0x100,
1.1207 +
1.1208 +
1.1209 + /**
1.1210 + Indicates a custom formatting mode.
1.1211 + */
1.1212 + ESpecialFormat=0x200,
1.1213 +
1.1214 + /**
1.1215 + Forced erase of locked media
1.1216 + */
1.1217 + EForceErase=0x400
1.1218 + };
1.1219 +
1.1220 +
1.1221 +
1.1222 +
1.1223 +enum TSeek
1.1224 +/**
1.1225 +@publishedAll
1.1226 +@released
1.1227 +
1.1228 +Flags indicating the destination of a seek operation.
1.1229 +
1.1230 +File locations are specified as a 32-bit signed integer,
1.1231 +allowing offsets of ?GB from the origin of the seek.
1.1232 +
1.1233 +@see RFile::Seek
1.1234 +*/
1.1235 + {
1.1236 + /**
1.1237 + This can only be used for file systems with execute-in-place facilities,
1.1238 + such as the ROM file system: the offset specifies the absolute address of
1.1239 + the data.
1.1240 + */
1.1241 + ESeekAddress,
1.1242 +
1.1243 +
1.1244 + /**
1.1245 + Destination is the start of file.
1.1246 + */
1.1247 + ESeekStart,
1.1248 +
1.1249 +
1.1250 + /**
1.1251 + Destination is the current position in file.
1.1252 + */
1.1253 + ESeekCurrent,
1.1254 +
1.1255 +
1.1256 + /**
1.1257 + Destination is the end of file.
1.1258 + */
1.1259 + ESeekEnd
1.1260 + };
1.1261 +
1.1262 +/**
1.1263 +
1.1264 +*/
1.1265 +class TBlockMapEntry : public TBlockMapEntryBase
1.1266 + {
1.1267 +public:
1.1268 + IMPORT_C TBlockMapEntry();
1.1269 + IMPORT_C void SetNumberOfBlocks( TUint aNumberOfBlocks );
1.1270 + IMPORT_C void SetStartBlock( TUint aStartBlock );
1.1271 + };
1.1272 +
1.1273 +/**
1.1274 +
1.1275 +*/
1.1276 +typedef TBuf8<KMaxMapsPerCall*sizeof(TBlockMapEntry)> TBlockArrayDes;
1.1277 +
1.1278 +struct SBlockMapInfo : public SBlockMapInfoBase
1.1279 + {
1.1280 + TBlockArrayDes iMap;
1.1281 + };
1.1282 +
1.1283 +/**
1.1284 +
1.1285 +*/
1.1286 +enum TBlockMapUsage
1.1287 + {
1.1288 + /* */
1.1289 + EBlockMapUsagePaging,
1.1290 + /* */
1.1291 + ETestDebug
1.1292 + };
1.1293 +
1.1294 +class TEntry
1.1295 +/**
1.1296 +@publishedAll
1.1297 +@released
1.1298 +
1.1299 +Encapsulates an entry in a directory, which can be another (nested) directory,
1.1300 +a file or a volume label.
1.1301 +
1.1302 +Each directory entry has a name which is relative to its owning directory
1.1303 +and a type, which is indicated by its unique identifier (UID).
1.1304 +
1.1305 +An entry can be interrogated for the following properties:
1.1306 +
1.1307 +1. the kind of entry: stored in the entry UIDs, stored in iType
1.1308 +
1.1309 +2. the entry attributes, stored in iAtt
1.1310 +
1.1311 +3. the size of entry
1.1312 +
1.1313 +4. the time the entry was last modified.
1.1314 +
1.1315 +@see RDir
1.1316 +@see RFs::Entry
1.1317 +@see RFs::SetEntry
1.1318 +@see CfileBase::CurrentEntry
1.1319 +*/
1.1320 + {
1.1321 +public:
1.1322 + IMPORT_C TEntry();
1.1323 + IMPORT_C TEntry(const TEntry& aEntry);
1.1324 + IMPORT_C TEntry& operator=(const TEntry& aEntry);
1.1325 + IMPORT_C TBool IsReadOnly() const;
1.1326 + IMPORT_C TBool IsHidden() const;
1.1327 + IMPORT_C TBool IsSystem() const;
1.1328 + IMPORT_C TBool IsDir() const;
1.1329 + IMPORT_C TBool IsArchive() const;
1.1330 + inline const TUid& operator[](TInt anIndex) const;
1.1331 + inline TBool IsUidPresent(TUid aUid) const;
1.1332 + inline TBool IsTypeValid() const;
1.1333 + inline TUid MostDerivedUid() const;
1.1334 +public:
1.1335 + /**
1.1336 + The individual bits within this byte indicate which attributes
1.1337 + have been set.
1.1338 +
1.1339 + @see KEntryAttNormal
1.1340 + @see KEntryAttReadOnly
1.1341 + @see KEntryAttHidden
1.1342 + @see KEntryAttSystem
1.1343 + */
1.1344 + TUint iAtt;
1.1345 +
1.1346 +
1.1347 + /**
1.1348 + The size of the file in bytes.
1.1349 + For files larger that 2G it must be cast to TUint in order to avoid looking like negative signed.
1.1350 + */
1.1351 + TInt iSize;
1.1352 +
1.1353 +
1.1354 + /**
1.1355 + The local time of last modification.
1.1356 + */
1.1357 + TTime iModified;
1.1358 +
1.1359 +
1.1360 + /**
1.1361 + The file's UIDtype
1.1362 + */
1.1363 + TUidType iType;
1.1364 +
1.1365 +
1.1366 + /**
1.1367 + The name of the file relative to the owning directory,
1.1368 + with a maximum of KMaxFileName characters.
1.1369 +
1.1370 + @see KMaxFileName
1.1371 + */
1.1372 + TBufC<KMaxFileName> iName;
1.1373 +
1.1374 +private:
1.1375 + /**
1.1376 + Reserved for future expansion
1.1377 + */
1.1378 + TUint32 iReserved[2];
1.1379 + };
1.1380 +
1.1381 +
1.1382 +
1.1383 +
1.1384 +class RDir;
1.1385 +class TEntryArray
1.1386 +/**
1.1387 +@publishedAll
1.1388 +@released
1.1389 +
1.1390 +Array of directory entries.
1.1391 +
1.1392 +It contains the results of a call to RDir::Read(): it will contain all
1.1393 +the TEntry items in the directory. Thus, a directory can be read in
1.1394 +a single call, minimising client/server communication overheads.
1.1395 +
1.1396 +@see TEntry
1.1397 +@see RDir::Read
1.1398 +*/
1.1399 + {
1.1400 +public:
1.1401 + IMPORT_C TEntryArray();
1.1402 + IMPORT_C TInt Count() const;
1.1403 + IMPORT_C const TEntry& operator[](TInt anIndex) const;
1.1404 +private:
1.1405 + TInt iCount;
1.1406 + TInt iIndex;
1.1407 + const TEntry* iPos;
1.1408 + TBuf8<KEntryArraySize> iBuf;
1.1409 + friend class RDir;
1.1410 + friend class RFs;
1.1411 + };
1.1412 +
1.1413 +
1.1414 +
1.1415 +
1.1416 +class TDriveInfo
1.1417 +/**
1.1418 +@publishedAll
1.1419 +@released
1.1420 +
1.1421 +Contains drive information.
1.1422 +
1.1423 +@see RFs::Drive
1.1424 +*/
1.1425 + {
1.1426 +public:
1.1427 + /**
1.1428 + The type of media mounted on the drive.
1.1429 + */
1.1430 + TMediaType iType;
1.1431 +
1.1432 +
1.1433 + /**
1.1434 + Indicates whether the drive supports a battery, and if so, its state.
1.1435 + */
1.1436 + TBatteryState iBattery;
1.1437 +
1.1438 +
1.1439 + /**
1.1440 + The drive attributes.
1.1441 +
1.1442 + @see KDriveAttLocal
1.1443 + @see KDriveAttRom
1.1444 + @see KDriveAttRedirected
1.1445 + @see KDriveAttSubsted
1.1446 + @see KDriveAttInternal
1.1447 + @see KDriveAttRemovable
1.1448 + */
1.1449 + TUint iDriveAtt;
1.1450 +
1.1451 +
1.1452 + /**
1.1453 + The attributes of the media mounted on the drive.
1.1454 +
1.1455 + @see KMediaAttVariableSize
1.1456 + @see KMediaAttDualDensity
1.1457 + @see KMediaAttFormattable
1.1458 + @see KMediaAttWriteProtected
1.1459 + @see KMediaAttLockable
1.1460 + @see KMediaAttLocked
1.1461 + */
1.1462 + TUint iMediaAtt;
1.1463 +private:
1.1464 + /**
1.1465 + Reserved for future expansion
1.1466 + */
1.1467 + TUint32 iReserved;
1.1468 + };
1.1469 +
1.1470 +
1.1471 +
1.1472 +
1.1473 +class TVolumeInfo
1.1474 +/**
1.1475 +@publishedAll
1.1476 +@released
1.1477 +
1.1478 +Contains information about a volume mounted on a drive. Use RFs::Drive() if only
1.1479 +the drive information is required.
1.1480 +
1.1481 +If a drive supports removable media it may contain different volumes over time.
1.1482 +
1.1483 +Volume information is made up of information concerning the drive on which it is mounted,
1.1484 +which can also be accessed through RFs::Drive(), and the volume information, this is made
1.1485 +up of the size of the volume, the free space, its unique identifying number and a name.
1.1486 +
1.1487 +TVolumeInfo is initialised by RFs::Volume().
1.1488 +
1.1489 +@see RFs::Volume()
1.1490 +@see RFs::Drive()
1.1491 +*/
1.1492 + {
1.1493 +public:
1.1494 + IMPORT_C TVolumeInfo();
1.1495 +
1.1496 + /**
1.1497 + Information about the drive on which the volume is mounted.
1.1498 +
1.1499 + @see TDriveInfo
1.1500 + */
1.1501 + TDriveInfo iDrive;
1.1502 +
1.1503 +
1.1504 + /**
1.1505 + The volume’s unique identifying number.
1.1506 + */
1.1507 + TUint iUniqueID;
1.1508 +
1.1509 +
1.1510 + /**
1.1511 + The maximum size of the volume in bytes. The current amount of memory
1.1512 + in use plus the amount of free memory.
1.1513 + */
1.1514 + TInt64 iSize;
1.1515 +
1.1516 +
1.1517 + /**
1.1518 + The amount of free space on the volume in bytes.
1.1519 + */
1.1520 + TInt64 iFree;
1.1521 +
1.1522 +
1.1523 + /**
1.1524 + Name of the volume, with a maximum of KMaxFileName characters.
1.1525 +
1.1526 + This field is optional.
1.1527 +
1.1528 + @see KMaxFileName
1.1529 + */
1.1530 + TBufC<KMaxFileName> iName;
1.1531 +
1.1532 + /**
1.1533 + Flags which define the default file-caching behaviour for this volume
1.1534 +
1.1535 + @see TFileCacheFlags
1.1536 + */
1.1537 + TFileCacheFlags iFileCacheFlags;
1.1538 +
1.1539 + /**
1.1540 + @prototype
1.1541 + @internalTechnology
1.1542 + Internal flag, used in the case of non-blocking getting volume information.
1.1543 + @see RFs::Volume(TVolumeInfo& aVol,TInt aDrive, TRequestStatus& aStat)
1.1544 +
1.1545 + If this flag is set, it means that the volume information will be obtained
1.1546 + asynchronously. More specific, on return iFree will reflect the _current_ amount of free space on volume at the moment of
1.1547 + RFs::Volume() call, not the exact final value. This is because in this case getting volume information will be asynchronous,
1.1548 + and the client will not be suspended until the mount finish calculating free space. At present appicable to FAT32 file system only.
1.1549 + */
1.1550 + TUint8 iVolSizeAsync : 1;
1.1551 +
1.1552 +private:
1.1553 + /**
1.1554 + Reserved for future expansion
1.1555 + */
1.1556 + TUint8 i8Reserved1;
1.1557 + TUint16 i16Reserved1;
1.1558 + TUint32 i32Reserved1;
1.1559 + TUint32 i32Reserved2;
1.1560 + };
1.1561 +
1.1562 +
1.1563 +
1.1564 +
1.1565 +class TDriveUnit
1.1566 +/**
1.1567 +@publishedAll
1.1568 +@released
1.1569 +
1.1570 +Drive numbers and letters.
1.1571 +
1.1572 +A drive may be represented by either an integer between zero and twenty five
1.1573 +inclusive, or by a buffer descriptor containing a character between "A" and "Z"
1.1574 +inclusive, followed by a colon.
1.1575 +This class encapsulates both representations.
1.1576 +An instance of this class is constructed specifying either the drive number
1.1577 +or the drive letter and may be converted between the two representations.
1.1578 +*/
1.1579 + {
1.1580 +public:
1.1581 + inline TDriveUnit() {};
1.1582 + IMPORT_C TDriveUnit(TInt aDrive);
1.1583 + IMPORT_C TDriveUnit(const TDesC& aDrive);
1.1584 + IMPORT_C TDriveUnit& operator=(TInt aDrive);
1.1585 + IMPORT_C TDriveUnit& operator=(const TDesC& aDrive);
1.1586 + inline operator TInt() const;
1.1587 + IMPORT_C TDriveName Name() const;
1.1588 +private:
1.1589 + TInt iDrive;
1.1590 + };
1.1591 +
1.1592 +
1.1593 +
1.1594 +
1.1595 +class RFs;
1.1596 +//
1.1597 +class TParseBase
1.1598 +/**
1.1599 +@publishedAll
1.1600 +@released
1.1601 +
1.1602 +Base class for file name parsing.
1.1603 +
1.1604 +You first need to set up the path to be parsed using either a TParse, TParsePtr
1.1605 +or TParsePtrC object.
1.1606 +
1.1607 +The interrogation and extraction functions in this class allow you to test
1.1608 +whether a component has been specified in the pathname, and if so,
1.1609 +to extract it. If a component is not present in the pathname,
1.1610 +the extraction function returns an empty string.
1.1611 +
1.1612 +This class also allows directories to be added to, and popped from the path.
1.1613 +
1.1614 +Notes:
1.1615 +
1.1616 +1. the filename modification functions cannot be used by the TParsePtrC class.
1.1617 +
1.1618 +2. navigation using .. and . is not supported.
1.1619 +
1.1620 +@see TParse
1.1621 +@see TParsePtr
1.1622 +@see TParsePtrC
1.1623 +*/
1.1624 + {
1.1625 +private:
1.1626 + struct SField {TUint8 pos;TUint8 len;TUint8 present;TUint8 filler;};
1.1627 + enum TField {EDrive,EPath,EName,EExt,EMaxFields};
1.1628 + enum TWild {EWildName=0x01,EWildExt=0x02,EWildEither=0x04,EIsRoot=0x08,EWildIsKMatchOne=0x10,EWildIsKMatchAny=0x20};
1.1629 +public:
1.1630 + IMPORT_C TParseBase();
1.1631 + IMPORT_C TInt PopDir();
1.1632 + IMPORT_C TInt AddDir(const TDesC& aName);
1.1633 + IMPORT_C const TDesC& FullName() const;
1.1634 + IMPORT_C TPtrC Drive() const;
1.1635 + IMPORT_C TPtrC Path() const;
1.1636 + IMPORT_C TPtrC DriveAndPath() const;
1.1637 + IMPORT_C TPtrC Name() const;
1.1638 + IMPORT_C TPtrC Ext() const;
1.1639 + IMPORT_C TPtrC NameAndExt() const;
1.1640 + IMPORT_C TBool DrivePresent() const;
1.1641 + IMPORT_C TBool PathPresent() const;
1.1642 + IMPORT_C TBool NamePresent() const;
1.1643 + IMPORT_C TBool ExtPresent() const;
1.1644 + IMPORT_C TBool NameOrExtPresent() const;
1.1645 + IMPORT_C TBool IsRoot() const;
1.1646 + IMPORT_C TBool IsWild() const;
1.1647 + IMPORT_C TBool IsKMatchOne() const;
1.1648 + IMPORT_C TBool IsKMatchAny() const;
1.1649 + IMPORT_C TBool IsNameWild() const;
1.1650 + IMPORT_C TBool IsExtWild() const;
1.1651 +protected:
1.1652 + virtual TDes& NameBuf() = 0; // Reference to derived class descriptor containing the filename.
1.1653 + virtual const TDesC& NameBufC() const = 0; // const reference to derived class descriptor containing the filename.
1.1654 + TInt Set(const TDesC* aName,const TDesC* aRelated,const TDesC* aDefault,TBool allowWild);
1.1655 +private:
1.1656 + TInt ParseDrive(TLex& aName,TBool& aDone);
1.1657 + TInt ParsePath(TLex& aName,TBool& aDone);
1.1658 + TInt ParseName(TLex& aName,TBool& aDone);
1.1659 + TInt ParseExt(TLex& aName,TBool& aDone);
1.1660 +protected:
1.1661 + TInt16 iMod; // Non-zero indicates File name modification functionality is enabled.
1.1662 +private:
1.1663 + TInt16 iWild;
1.1664 + SField iField[EMaxFields];
1.1665 + };
1.1666 +
1.1667 +
1.1668 +
1.1669 +
1.1670 +class TParsePtr : public TParseBase
1.1671 +/**
1.1672 +@publishedAll
1.1673 +@released
1.1674 +
1.1675 +Parses filenames using less space on the stack than TParse.
1.1676 +
1.1677 +Stores a reference to a filename, unlike TParse, which uses
1.1678 +a 512 byte TFileName object as an internal buffer to store
1.1679 +a copy of the filename.
1.1680 +The filename's components (drive, path, etc.) can be retrieved using
1.1681 +the functions provided by the base class, TParseBase.
1.1682 +This class should be used in preference to TParse when minimising stack
1.1683 +usage is a priority.
1.1684 +
1.1685 +@see TParse
1.1686 +@see TFileName
1.1687 +*/
1.1688 + {
1.1689 +public:
1.1690 + IMPORT_C TParsePtr(TDes& aName);
1.1691 +protected:
1.1692 + IMPORT_C TDes& NameBuf();
1.1693 + IMPORT_C const TDesC& NameBufC() const;
1.1694 +private:
1.1695 + TPtr iNameBuf;
1.1696 + };
1.1697 +
1.1698 +
1.1699 +
1.1700 +
1.1701 +class TParsePtrC : public TParseBase
1.1702 +/**
1.1703 +@publishedAll
1.1704 +@released
1.1705 +
1.1706 +Parses, but cannot modify, filenames using less space on the stack than TParse.
1.1707 +
1.1708 +Stores a reference to a filename, unlike TParse, which uses
1.1709 +a 512 byte TFileName object as an internal buffer to store
1.1710 +a copy of the filename.
1.1711 +The filename's components (drive, path, etc.) can be retrieved using
1.1712 +the functions provided by the base class, TParseBase.
1.1713 +Note that because the filename cannot be modified through this class,
1.1714 +the base class functions PopDir() and AddDir() cannot be called, because
1.1715 +a panic will be raised.
1.1716 +
1.1717 +@see TParse
1.1718 +@see TFileName
1.1719 +*/
1.1720 + {
1.1721 +public:
1.1722 + IMPORT_C TParsePtrC(const TDesC& aName);
1.1723 +protected:
1.1724 + IMPORT_C TDes& NameBuf();
1.1725 + IMPORT_C const TDesC& NameBufC() const;
1.1726 +private:
1.1727 + TPtrC iNameBuf;
1.1728 + };
1.1729 +
1.1730 +
1.1731 +
1.1732 +
1.1733 +class TParse : public TParseBase
1.1734 +/**
1.1735 +@publishedAll
1.1736 +@released
1.1737 +
1.1738 +Parses filenames.
1.1739 +
1.1740 +The class uses the full filename structure supported by Symbian OS.
1.1741 +
1.1742 +TParse works by using the Set() function to set up the filename to be parsed.
1.1743 +Then, various getter functions defined in the base class, TParseBase, such as:
1.1744 +FullName(), Drive(), Path(), DriveAndPath(), Name(), Ext() and NameAndExt()
1.1745 +may be used to retrieve path components.
1.1746 +
1.1747 +There are a number of restrictions to valid path components, which are
1.1748 +described in guide documentation.
1.1749 +*/
1.1750 + {
1.1751 +public:
1.1752 + IMPORT_C TParse();
1.1753 + IMPORT_C TInt Set(const TDesC& aName,const TDesC* aRelated,const TDesC* aDefault);
1.1754 + IMPORT_C TInt SetNoWild(const TDesC& aName,const TDesC* aRelated,const TDesC* aDefault);
1.1755 +protected:
1.1756 + IMPORT_C TDes& NameBuf();
1.1757 + IMPORT_C const TDesC& NameBufC() const;
1.1758 +private:
1.1759 + TFileName iNameBuf;
1.1760 + };
1.1761 +
1.1762 +
1.1763 +
1.1764 +
1.1765 +class CDir : public CBase
1.1766 +/**
1.1767 +@publishedAll
1.1768 +@released
1.1769 +
1.1770 +Array of directory entries that has been read into memory from the file system.
1.1771 +
1.1772 +It can be read and sorted by user programs, but cannot be created by them.
1.1773 +*/
1.1774 + {
1.1775 +public:
1.1776 + IMPORT_C virtual ~CDir();
1.1777 + IMPORT_C TInt Count() const;
1.1778 + IMPORT_C const TEntry& operator[](TInt anIndex) const;
1.1779 + IMPORT_C TInt Sort(TUint aEntrySortKey);
1.1780 +protected:
1.1781 + IMPORT_C CDir();
1.1782 + IMPORT_C static CDir* NewL();
1.1783 + IMPORT_C void AddL(const TEntry& anEntry);
1.1784 + IMPORT_C void ExtractL(TBool aRemove,CDir*& aDir);
1.1785 + IMPORT_C void Compress();
1.1786 +protected:
1.1787 + CArrayPakFlat<TEntry>* iArray;
1.1788 + friend class RFs;
1.1789 + friend class TOpenFileScan;
1.1790 + };
1.1791 +
1.1792 +
1.1793 +
1.1794 +
1.1795 +class RFs : public RSessionBase
1.1796 +/**
1.1797 +@publishedAll
1.1798 +@released
1.1799 +
1.1800 +A handle to a file server session.
1.1801 +
1.1802 +A program or thread may have arbitrarily many sessions open simultaneously.
1.1803 +
1.1804 +Use this class for all file system manipulation, including:
1.1805 +
1.1806 +1. adding, removing, moving and renaming files and directories
1.1807 +
1.1808 +2. inspecting and changing file attributes and directory entry details.
1.1809 + These include the time and date when the file or directory was last
1.1810 + written to, its size and various attribute flags such as read-only,
1.1811 + hidden, archive or system.
1.1812 +
1.1813 +3. finding a file’s real name; if the file system on which it is stored
1.1814 + has to "mangle" the name into a shorter format
1.1815 +
1.1816 +4. getting directory listings
1.1817 +
1.1818 +5. maintaining a default path; unlike some other systems, there is a single
1.1819 + system default path, rather than one for each drive: the default path
1.1820 + consists of a drive and a path specification.
1.1821 +
1.1822 +6. performing context-sensitive parses using TParse objects, and
1.1823 + the session path
1.1824 +
1.1825 +7. obtaining information on drives and volumes
1.1826 +
1.1827 +8. formatting and labelling volumes
1.1828 +
1.1829 +9. obtaining a list of valid drives
1.1830 +
1.1831 +10. emulating the DOS subst command, which allows any directory to appear
1.1832 + as if it were a separate drive
1.1833 +
1.1834 +11. requesting notification of when significant change occurs.
1.1835 + This can be used for programs which maintain file lists, but must
1.1836 + update those lists when change occurs.
1.1837 +
1.1838 +12. finding the version number of the file server
1.1839 +
1.1840 +13. resource counting to ensure that all resources are closed when
1.1841 + the session terminates.
1.1842 +
1.1843 +This class is not intended for user derivation.
1.1844 +
1.1845 +The following restrictions apply when a path is specified:
1.1846 +
1.1847 +1. its total length must not exceed 256 characters
1.1848 +
1.1849 +2. wildcards cannot be used in the drive or in any directory name,
1.1850 + although they may be allowed in the filename and extension.
1.1851 +
1.1852 +3. double backslashes are not allowed in the path.
1.1853 +
1.1854 +4. the following characters must not be included anywhere in the path: < > " / |
1.1855 +
1.1856 +5. a colon may only be included between the drive and path
1.1857 +
1.1858 +6. no directory name or filename plus extension may consist solely
1.1859 + of space characters, or of a single or double dot.
1.1860 +
1.1861 +7. spaces between the drive, if specified, and the first directory in
1.1862 + the path are illegal, although there may be spaces between other
1.1863 + path components, for instance between directories.
1.1864 +*/
1.1865 + {
1.1866 +public:
1.1867 + IMPORT_C TInt Connect(TInt aMessageSlots=KFileServerDefaultMessageSlots);
1.1868 + IMPORT_C TVersion Version() const;
1.1869 + IMPORT_C TInt AddFileSystem(const TDesC& aFileName) const;
1.1870 + IMPORT_C TInt MountFileSystem(const TDesC& aFileSystemName,TInt aDrive) const;
1.1871 + IMPORT_C TInt MountFileSystem(const TDesC& aFileSystemName,TInt aDrive, TBool aIsSync) const;
1.1872 + IMPORT_C TInt MountFileSystemAndScan(const TDesC& aFileSystemName,TInt aDrive,TBool& aIsMountSuccess) const;
1.1873 + IMPORT_C TInt MountFileSystem(const TDesC& aFileSystemName,const TDesC& aExtensionName,TInt aDrive);
1.1874 + IMPORT_C TInt MountFileSystem(const TDesC& aFileSystemName,const TDesC& aExtensionName,TInt aDrive, TBool aIsSync);
1.1875 + IMPORT_C TInt MountFileSystemAndScan(const TDesC& aFileSystemName,const TDesC& aExtensionName,TInt aDrive,TBool& aIsMountSuccess) const;
1.1876 + IMPORT_C TInt DismountFileSystem(const TDesC& aFileSystemName,TInt aDrive) const;
1.1877 + IMPORT_C TInt RemoveFileSystem(const TDesC& aFileSystemName) const;
1.1878 + IMPORT_C TInt FileSystemName(TDes& aName,TInt aDrive) const;
1.1879 + IMPORT_C TInt AddExtension(const TDesC& aFileName);
1.1880 + IMPORT_C TInt MountExtension(const TDesC& aExtensionName,TInt aDrive);
1.1881 + IMPORT_C TInt DismountExtension(const TDesC& aExtensionName,TInt aDrive);
1.1882 + IMPORT_C TInt RemoveExtension(const TDesC& aExtensionName);
1.1883 + IMPORT_C TInt ExtensionName(TDes& aExtensionName,TInt aDrive,TInt aPos);
1.1884 + IMPORT_C TInt RemountDrive(TInt aDrive,const TDesC8* aMountInfo=NULL,TUint aFlags=0);
1.1885 + IMPORT_C void NotifyChange(TNotifyType aType,TRequestStatus& aStat);
1.1886 + IMPORT_C void NotifyChange(TNotifyType aType,TRequestStatus& aStat,const TDesC& aPathName);
1.1887 + IMPORT_C void NotifyChangeCancel();
1.1888 + IMPORT_C void NotifyChangeCancel(TRequestStatus& aStat);
1.1889 + IMPORT_C void NotifyDiskSpace(TInt64 aThreshold,TInt aDrive,TRequestStatus& aStat);
1.1890 + IMPORT_C void NotifyDiskSpaceCancel(TRequestStatus& aStat);
1.1891 + IMPORT_C void NotifyDiskSpaceCancel();
1.1892 + IMPORT_C TInt DriveList(TDriveList& aList) const;
1.1893 + IMPORT_C TInt DriveList(TDriveList& aList, TUint aFlags) const;
1.1894 + IMPORT_C TInt Drive(TDriveInfo& anInfo,TInt aDrive=KDefaultDrive) const;
1.1895 + IMPORT_C TInt Volume(TVolumeInfo& aVol,TInt aDrive=KDefaultDrive) const;
1.1896 + IMPORT_C void Volume(TVolumeInfo& aVol,TInt aDrive, TRequestStatus& aStat) const;
1.1897 + IMPORT_C TInt SetVolumeLabel(const TDesC& aName,TInt aDrive=KDefaultDrive);
1.1898 + IMPORT_C TInt Subst(TDes& aPath,TInt aDrive=KDefaultDrive) const;
1.1899 + IMPORT_C TInt SetSubst(const TDesC& aPath,TInt aDrive=KDefaultDrive);
1.1900 + IMPORT_C TInt RealName(const TDesC& aName,TDes& aResult) const;
1.1901 + IMPORT_C TInt GetMediaSerialNumber(TMediaSerialNumber& aSerialNum, TInt aDrive);
1.1902 + IMPORT_C TInt SessionPath(TDes& aPath) const;
1.1903 + IMPORT_C TInt SetSessionPath(const TDesC& aPath);
1.1904 + IMPORT_C TInt Parse(const TDesC& aName,TParse& aParse) const;
1.1905 + IMPORT_C TInt Parse(const TDesC& aName,const TDesC& aRelated,TParse& aParse) const;
1.1906 + IMPORT_C TInt MkDir(const TDesC& aPath);
1.1907 + IMPORT_C TInt MkDirAll(const TDesC& aPath);
1.1908 + IMPORT_C TInt RmDir(const TDesC& aPath);
1.1909 + IMPORT_C TInt GetDir(const TDesC& aName,TUint anEntryAttMask,TUint anEntrySortKey,CDir*& anEntryList) const;
1.1910 + IMPORT_C TInt GetDir(const TDesC& aName,TUint anEntryAttMask,TUint anEntrySortKey,CDir*& anEntryList,CDir*& aDirList) const;
1.1911 + IMPORT_C TInt GetDir(const TDesC& aName,const TUidType& anEntryUid,TUint anEntrySortKey,CDir*& aFileList) const;
1.1912 + IMPORT_C TInt Delete(const TDesC& aName);
1.1913 + IMPORT_C TInt Rename(const TDesC& anOldName,const TDesC& aNewName);
1.1914 + IMPORT_C TInt Replace(const TDesC& anOldName,const TDesC& aNewName);
1.1915 + IMPORT_C TInt Att(const TDesC& aName,TUint& aAttValue) const;
1.1916 + IMPORT_C TInt SetAtt(const TDesC& aName,TUint aSetAttMask,TUint aClearAttMask);
1.1917 + IMPORT_C TInt Modified(const TDesC& aName,TTime& aTime) const;
1.1918 + IMPORT_C TInt SetModified(const TDesC& aName,const TTime& aTime);
1.1919 + IMPORT_C TInt Entry(const TDesC& aName,TEntry& anEntry) const;
1.1920 + IMPORT_C TInt SetEntry(const TDesC& aName,const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask);
1.1921 + IMPORT_C TInt ReadFileSection(const TDesC& aName,TInt aPos,TDes8& aDes,TInt aLength) const;
1.1922 + IMPORT_C static TBool IsValidDrive(TInt aDrive);
1.1923 + IMPORT_C static TInt CharToDrive(TChar aChar,TInt& aDrive);
1.1924 + IMPORT_C static TInt DriveToChar(TInt aDrive,TChar& aChar);
1.1925 + IMPORT_C static TBool IsRomAddress(TAny* aAny);
1.1926 + IMPORT_C static TDriveNumber GetSystemDrive();
1.1927 + IMPORT_C static TChar GetSystemDriveChar();
1.1928 + IMPORT_C TInt SetSystemDrive(TDriveNumber aSystemDrive);
1.1929 + IMPORT_C void ResourceCountMarkStart() const;
1.1930 + IMPORT_C void ResourceCountMarkEnd() const;
1.1931 + IMPORT_C TInt ResourceCount() const;
1.1932 + IMPORT_C TInt IsFileOpen(const TDesC& aFile,TBool& anAnswer) const;
1.1933 + IMPORT_C TInt CheckDisk(const TDesC& aDrive) const;
1.1934 + IMPORT_C TInt ScanDrive(const TDesC& aDrive) const;
1.1935 + IMPORT_C TInt GetShortName(const TDesC& aLongName,TDes& aShortName) const;
1.1936 + IMPORT_C TInt GetLongName(const TDesC& aShortName,TDes& aLongName) const;
1.1937 + IMPORT_C TBool GetNotifyUser();
1.1938 + IMPORT_C void SetNotifyUser(TBool aValue);
1.1939 + IMPORT_C TUint8* IsFileInRom(const TDesC& aFileName) const;
1.1940 + IMPORT_C TBool IsValidName(const TDesC& anEntryName) const;
1.1941 + IMPORT_C TBool IsValidName(const TDesC& aFileName,TText& aBadChar) const;
1.1942 + IMPORT_C TInt GetDriveName(TInt aDrive,TDes& aDriveName) const;
1.1943 + IMPORT_C TInt SetDriveName(TInt aDrive,const TDesC& aDriveName);
1.1944 + IMPORT_C TInt LoaderHeapFunction(TInt aFunction, TAny *aArg1=NULL, TAny *aArg2=NULL);
1.1945 + IMPORT_C TInt SetErrorCondition(TInt anError,TInt aCount=0);
1.1946 + IMPORT_C TInt SetDebugRegister(TInt aVal);
1.1947 + IMPORT_C TInt SetAllocFailure(TInt aAllocNum);
1.1948 + IMPORT_C void DebugNotify(TInt aDrive,TUint aNotifyType,TRequestStatus& aStat);
1.1949 + IMPORT_C TInt ControlIo(TInt aDrive,TInt aCommand);
1.1950 + IMPORT_C TInt ControlIo(TInt aDrive,TInt aCommand,TDes8& aParam1);
1.1951 + IMPORT_C TInt ControlIo(TInt aDrive,TInt aCommand,TDes8& aParam1,TDes8& aParam2);
1.1952 + IMPORT_C TInt ControlIo(TInt aDrive,TInt aCommand,TAny* aParam1,TAny* aParam2);
1.1953 + IMPORT_C TInt LockDrive(TInt aDrv, const TMediaPassword &aOld, const TMediaPassword &aNew, TBool aStr);
1.1954 + IMPORT_C TInt UnlockDrive(TInt aDrv, const TMediaPassword &Pswd, TBool aStr);
1.1955 + IMPORT_C TInt ClearPassword(TInt aDrv, const TMediaPassword &aPswd);
1.1956 + IMPORT_C TInt ErasePassword(TInt aDrv);
1.1957 + IMPORT_C TInt SetSessionToPrivate(TInt aDrive);
1.1958 + IMPORT_C TInt PrivatePath(TDes& aPath);
1.1959 + IMPORT_C TInt CreatePrivatePath(TInt aDrive);
1.1960 + IMPORT_C void StartupInitComplete(TRequestStatus& aStat);
1.1961 + IMPORT_C TInt SetLocalDriveMapping(const TDesC8& aMapping);
1.1962 +
1.1963 + IMPORT_C TInt FinaliseDrives();
1.1964 +
1.1965 + /** specifies drive finalisation modes */
1.1966 + enum TFinaliseDrvMode
1.1967 + {
1.1968 + EFinal_RW, ///< after successful finalisation the drive remains writable and will become "not finalised" after the first write operation.
1.1969 + EFinal_RO, ///< after successful finalisation the drive becomes read-only
1.1970 + EForceUnfinalise///< @internalComponent mark the drive as "not finalised" can result in KErrAbort if the dive is in inconsistent state.
1.1971 + };
1.1972 +
1.1973 + IMPORT_C TInt FinaliseDrive(TInt aDriveNo, TFinaliseDrvMode aMode) const;
1.1974 +
1.1975 + IMPORT_C TInt SwapFileSystem(const TDesC& aOldFileSystemName,const TDesC& aNewFileSystemName,TInt aDrive) const;
1.1976 + IMPORT_C TInt ReserveDriveSpace(TInt aDriveNo, TInt aSpace);
1.1977 + IMPORT_C TInt GetReserveAccess(TInt aDriveNo);
1.1978 + IMPORT_C TInt ReleaseReserveAccess(TInt aDriveNo);
1.1979 +
1.1980 + IMPORT_C TInt AddPlugin(const TDesC& aFileName) const;
1.1981 + IMPORT_C TInt RemovePlugin(const TDesC& aPluginName) const;
1.1982 + IMPORT_C TInt PluginName(TDes& aPluginName,TInt aDrive,TInt aPos);
1.1983 +
1.1984 + IMPORT_C TInt MountPlugin(const TDesC& aPluginName) const;
1.1985 + IMPORT_C TInt MountPlugin(const TDesC& aPluginName,TInt aDrive) const;
1.1986 + IMPORT_C TInt MountPlugin(const TDesC& aPluginName,TInt aDrive, TInt aPos) const;
1.1987 +
1.1988 + IMPORT_C TInt DismountPlugin(const TDesC& aPluginName) const;
1.1989 + IMPORT_C TInt DismountPlugin(const TDesC& aPluginName,TInt aDrive) const;
1.1990 + IMPORT_C TInt DismountPlugin(const TDesC& aPluginName,TInt aDrive,TInt aPos) const;
1.1991 +
1.1992 + IMPORT_C void NotifyDismount(TInt aDrive, TRequestStatus& aStat, TNotifyDismountMode aMode=EFsDismountRegisterClient) const;
1.1993 + IMPORT_C void NotifyDismountCancel(TRequestStatus& aStat) const;
1.1994 + IMPORT_C void NotifyDismountCancel() const;
1.1995 + IMPORT_C TInt AllowDismount(TInt aDrive) const;
1.1996 + IMPORT_C TInt SetStartupConfiguration(TInt aCommand,TAny* aParam1,TAny* aParam2) const;
1.1997 + IMPORT_C TInt AddCompositeMount(const TDesC& aFileSystemName,TInt aLocalDriveToMount,TInt aCompositeDrive, TBool aSync) const;
1.1998 + IMPORT_C TInt SetNotifyChange(TBool aNotifyChange);
1.1999 + IMPORT_C TInt QueryVolumeInfoExt(TInt aDrive, TQueryVolumeInfoExtCmd aCommand, TDes8& aInfo) const;
1.2000 + IMPORT_C TInt VolumeIOParam(TInt aDriveNo, TVolumeIOParamInfo& aParamInfo) const;
1.2001 + IMPORT_C TInt FileSystemSubType(TInt aDriveNo, TDes& aName) const;
1.2002 + IMPORT_C TInt InitialisePropertiesFile(const TPtrC8& aPtr) const;
1.2003 +
1.2004 + TInt Unclamp(const RFileClamp& aHandle);
1.2005 +
1.2006 +private:
1.2007 + void GetDirL(const TDesC& aMatchName,TUint anEntryAttMask,TUint anEntrySortKey,CDir*& anEntryList,CDir*& aDirList,RDir& aDir) const;
1.2008 + void GetDirL(const TDesC& aMatchName,TUint anEntryAttMask,TUint anEntrySortKey,CDir*& anEntryList,RDir& aDir) const;
1.2009 + void GetDirL(const TDesC& aMatchName,const TUidType& aUidType,TUint anEntrySortKey,CDir*& anEntryList,RDir& aDir) const;
1.2010 + void DoGetDirL(TUint anEntrySortKey,CDir*& anEntryList,RDir& aDir) const;
1.2011 + TInt GetOpenFileList(TInt& aSessionNum,TInt& aLocalPos,TThreadId& aThreadId,TEntryArray& anArray) const;
1.2012 + friend class TOpenFileScan;
1.2013 + };
1.2014 +
1.2015 +
1.2016 +
1.2017 +
1.2018 +
1.2019 +
1.2020 +
1.2021 +/**
1.2022 +@publishedAll
1.2023 +@released
1.2024 +
1.2025 +Creates and opens a file, and performs all operations on a single open file.
1.2026 +
1.2027 +These include:
1.2028 +
1.2029 +- reading from and writing to the file
1.2030 +
1.2031 +- seeking to a position within the file
1.2032 +
1.2033 +- locking and unlocking within the file
1.2034 +
1.2035 +- setting file attributes
1.2036 +
1.2037 +Before using any of these services, a connection to a file server session must
1.2038 +have been made, and the file must be open.
1.2039 +
1.2040 +Opening Files:
1.2041 +
1.2042 +- use Open() to open an existing file for reading or writing; an error is
1.2043 + returned if it does not already exist.
1.2044 + To open an existing file for reading only, use Open() with an access mode of
1.2045 + EFileRead, and a share mode of EFileShareReadersOnly.
1.2046 +
1.2047 +- use Create() to create and open a new file for writing; an error is returned
1.2048 + if it already exists.
1.2049 +
1.2050 +- use Replace() to open a file for writing, replacing any existing file of
1.2051 + the same name if one exists, or creating a new file if one does not exist.
1.2052 + Note that if a file exists, its length is reset to zero.
1.2053 +
1.2054 +- use Temp() to create and open a temporary file with a unique name,
1.2055 + for writing and reading.
1.2056 +
1.2057 +When opening a file, you must specify the file server session to use for
1.2058 +operations with that file. If you do not close the file explicitly, it is
1.2059 +closed when the server session associated with it is closed.
1.2060 +
1.2061 +Reading and Writing:
1.2062 +
1.2063 +There are several variants of both Read() and Write().
1.2064 +The basic Read(TDes8& aDes) and Write(const TDesC8& aDes) are supplemented
1.2065 +by variants allowing the descriptor length to be overridden, or the seek
1.2066 +position of the first byte to be specified, or asynchronous completion,
1.2067 +or any combination.
1.2068 +
1.2069 +Reading transfers data from a file to a descriptor, and writing transfers
1.2070 +data from a descriptor to a file. In all cases, the file data is treated
1.2071 +as binary and byte descriptors are used (TDes8, TDesC8).
1.2072 +
1.2073 +@see TDes8
1.2074 +@see TDesC8
1.2075 +*/
1.2076 +class RFile : public RSubSessionBase
1.2077 + {
1.2078 +public:
1.2079 + IMPORT_C TInt Open(RFs& aFs,const TDesC& aName,TUint aFileMode);
1.2080 + IMPORT_C void Close();
1.2081 + IMPORT_C TInt Create(RFs& aFs,const TDesC& aName,TUint aFileMode);
1.2082 + IMPORT_C TInt Replace(RFs& aFs,const TDesC& aName,TUint aFileMode);
1.2083 + IMPORT_C TInt Temp(RFs& aFs,const TDesC& aPath,TFileName& aName,TUint aFileMode);
1.2084 + IMPORT_C TInt Read(TDes8& aDes) const;
1.2085 + IMPORT_C void Read(TDes8& aDes,TRequestStatus& aStatus) const;
1.2086 + IMPORT_C TInt Read(TDes8& aDes,TInt aLength) const;
1.2087 + IMPORT_C void Read(TDes8& aDes,TInt aLength,TRequestStatus& aStatus) const;
1.2088 + IMPORT_C TInt Read(TInt aPos,TDes8& aDes) const;
1.2089 + IMPORT_C void Read(TInt aPos,TDes8& aDes,TRequestStatus& aStatus) const;
1.2090 + IMPORT_C TInt Read(TInt aPos,TDes8& aDes,TInt aLength) const;
1.2091 + IMPORT_C void Read(TInt aPos,TDes8& aDes,TInt aLength,TRequestStatus& aStatus) const;
1.2092 + IMPORT_C void ReadCancel(TRequestStatus& aStatus) const;
1.2093 + IMPORT_C void ReadCancel() const;
1.2094 + IMPORT_C TInt Write(const TDesC8& aDes);
1.2095 + IMPORT_C void Write(const TDesC8& aDes,TRequestStatus& aStatus);
1.2096 + IMPORT_C TInt Write(const TDesC8& aDes,TInt aLength);
1.2097 + IMPORT_C void Write(const TDesC8& aDes,TInt aLength,TRequestStatus& aStatus);
1.2098 + IMPORT_C TInt Write(TInt aPos,const TDesC8& aDes);
1.2099 + IMPORT_C void Write(TInt aPos,const TDesC8& aDes,TRequestStatus& aStatus);
1.2100 + IMPORT_C TInt Write(TInt aPos,const TDesC8& aDes,TInt aLength);
1.2101 + IMPORT_C void Write(TInt aPos,const TDesC8& aDes,TInt aLength,TRequestStatus& aStatus);
1.2102 + IMPORT_C TInt Lock(TInt aPos,TInt aLength) const;
1.2103 + IMPORT_C TInt UnLock(TInt aPos,TInt aLength) const;
1.2104 + IMPORT_C TInt Seek(TSeek aMode,TInt& aPos) const;
1.2105 + IMPORT_C TInt Flush();
1.2106 + IMPORT_C void Flush(TRequestStatus& aStatus);
1.2107 + IMPORT_C TInt Size(TInt& aSize) const;
1.2108 + IMPORT_C TInt SetSize(TInt aSize);
1.2109 + IMPORT_C TInt Att(TUint& aAttValue) const;
1.2110 + IMPORT_C TInt SetAtt(TUint aSetAttMask,TUint aClearAttMask);
1.2111 + IMPORT_C TInt Modified(TTime& aTime) const;
1.2112 + IMPORT_C TInt SetModified(const TTime& aTime);
1.2113 + IMPORT_C TInt Set(const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask);
1.2114 + IMPORT_C TInt ChangeMode(TFileMode aNewMode);
1.2115 + IMPORT_C TInt Rename(const TDesC& aNewName);
1.2116 + IMPORT_C TInt Drive(TInt &aDriveNumber, TDriveInfo &aDriveInfo) const;
1.2117 + IMPORT_C TInt Adopt(RFs& aFs, TInt aHandle);
1.2118 + IMPORT_C TInt AdoptFromClient(const RMessage2& aMsg, TInt aFsHandleIndex, TInt aFileHandleIndex);
1.2119 + IMPORT_C TInt AdoptFromServer(TInt aFsHandle, TInt aFileHandle);
1.2120 + IMPORT_C TInt AdoptFromCreator(TInt aFsIndex, TInt aFileHandleIndex);
1.2121 + IMPORT_C TInt Name(TDes& aName) const;
1.2122 + IMPORT_C TInt TransferToServer(TIpcArgs& aIpcArgs, TInt aFsHandleIndex, TInt aFileHandleIndex) const;
1.2123 + IMPORT_C TInt TransferToClient(const RMessage2& aMsg, TInt aFileHandleIndex) const;
1.2124 + IMPORT_C TInt TransferToProcess(RProcess& aProcess, TInt aFsHandleIndex, TInt aFileHandleIndex) const;
1.2125 + IMPORT_C TInt Duplicate(const RFile& aFile, TOwnerType aType=EOwnerProcess);
1.2126 + IMPORT_C TInt FullName(TDes& aName) const;
1.2127 + IMPORT_C TInt BlockMap(SBlockMapInfo& aInfo, TInt64& aStartPos, TInt64 aEndPos=-1, TInt aBlockMapusage=EBlockMapUsagePaging) const;
1.2128 +// IMPORT_C TInt Clamp(RFileClamp& aHandle);
1.2129 + TInt Clamp(RFileClamp& aHandle);
1.2130 +
1.2131 +private:
1.2132 + TInt DuplicateHandle(TInt& aSubSessionHandle) const;
1.2133 + };
1.2134 +
1.2135 +
1.2136 +
1.2137 +class RDir : public RSubSessionBase
1.2138 +/**
1.2139 +@publishedAll
1.2140 +@released
1.2141 +
1.2142 +Reads the entries contained in a directory.
1.2143 +
1.2144 +You must first open the directory, specifying an attribute mask which is used
1.2145 +by Read() calls to filter the entry types required. Then, use one of
1.2146 +the Read() functions to read the filtered entries. When the operation
1.2147 +is complete, the directory should be closed using Close()
1.2148 +
1.2149 +There are two types of Read(): one works with a single entry at a time,
1.2150 +requiring programs to iterate through the entries explicitly.
1.2151 +The other works with an entire TEntryArray, allowing multiple entries to be
1.2152 +read in one call.
1.2153 +As well as making application program logic somewhat simpler, this type
1.2154 +uses fewer calls to the server, and is more efficient.
1.2155 +
1.2156 +Each type of Read() can be performed either synchronously or asynchronously.
1.2157 +
1.2158 +It may be more convenient to use RFs::GetDir() than the Read() calls supported
1.2159 +by this class.
1.2160 +RFs::GetDir() has the advantage that it allows a directory’s entries to be
1.2161 +sorted in various ways.
1.2162 +However, it does not provide asynchronous as well as synchronous variants
1.2163 +and does not allow entries to be read individually.
1.2164 +
1.2165 +@see RFs
1.2166 +*/
1.2167 + {
1.2168 +public:
1.2169 + IMPORT_C TInt Open(RFs& aFs,const TDesC& aMatchName,const TUidType& aUidType);
1.2170 + IMPORT_C TInt Open(RFs& aFs,const TDesC& aMatchName,TUint anAttMask);
1.2171 + IMPORT_C void Close();
1.2172 + IMPORT_C TInt Read(TEntryArray& anArray) const;
1.2173 + IMPORT_C void Read(TEntryArray& anArray,TRequestStatus& aStatus) const;
1.2174 + IMPORT_C TInt Read(TEntry& anEntry) const;
1.2175 + IMPORT_C void Read(TPckg<TEntry>& anEntry,TRequestStatus& aStatus) const;
1.2176 + };
1.2177 +
1.2178 +
1.2179 +class RFormat : public RSubSessionBase
1.2180 +/**
1.2181 +@publishedAll
1.2182 +@released
1.2183 +
1.2184 +Formats a device, one step at a time.
1.2185 +
1.2186 +RFormat must first be opened on a device before formatting each
1.2187 +track using Next().
1.2188 +
1.2189 +There is also an asynchronous version of Next() which, if encapsulated into
1.2190 +a suitable active object, can be used to implement a
1.2191 +user-interruptible formatting process.
1.2192 +*/
1.2193 + {
1.2194 +public:
1.2195 + IMPORT_C TInt Open(RFs& aFs,const TDesC& aName,TUint aFormatMode,TInt& aCount);
1.2196 + IMPORT_C TInt Open(RFs& aFs,const TDesC& aName,TUint aFormatMode,TInt& aCount,const TDesC8& anInfo);
1.2197 + IMPORT_C void Close();
1.2198 + IMPORT_C TInt Next(TInt& aStep);
1.2199 + IMPORT_C void Next(TPckgBuf<TInt>& aStep,TRequestStatus& aStatus);
1.2200 + };
1.2201 +
1.2202 +
1.2203 +
1.2204 +
1.2205 +class RRawDisk : public RSubSessionBase
1.2206 +/**
1.2207 +@publishedAll
1.2208 +@released
1.2209 +
1.2210 +Enables direct disk access.
1.2211 +
1.2212 +No other resources can access the disk while direct access to it is in effect.
1.2213 +
1.2214 +This class is not intended for user derivation.
1.2215 +*/
1.2216 + {
1.2217 +public:
1.2218 + IMPORT_C TInt Open(RFs& aFs,TInt aDrive);
1.2219 + IMPORT_C void Close();
1.2220 + IMPORT_C TInt Read(TInt64 aPos,TDes8& aDes);
1.2221 + IMPORT_C TInt Write(TInt64 aPos,TDesC8& aDes);
1.2222 +private:
1.2223 + TInt iDrive;
1.2224 + };
1.2225 +
1.2226 +
1.2227 +
1.2228 +
1.2229 +class CDirStack;
1.2230 +NONSHARABLE_CLASS(CDirScan) : public CBase
1.2231 +/**
1.2232 +@publishedAll
1.2233 +@released
1.2234 +
1.2235 +Scans a directory structure.
1.2236 +
1.2237 +The scan moves from directory to directory through the hierarchy, returning
1.2238 +a list of the entries contained in each. The order in which the directories
1.2239 +are scanned is determined by a sort key which is specified when setting up
1.2240 +the scan. The base directory to be scanned and the entry types of interest
1.2241 +must also be specified before performing the scan.
1.2242 +
1.2243 +This class is not intended for user derivation
1.2244 +*/
1.2245 + {
1.2246 +public:
1.2247 + /**
1.2248 + Defines the scan direction.
1.2249 + */
1.2250 + enum TScanDirection
1.2251 + {
1.2252 + /**
1.2253 + Scan upwards from the lowest level directory in the hierarchy to
1.2254 + the top level directory.
1.2255 + */
1.2256 + EScanUpTree,
1.2257 +
1.2258 + /**
1.2259 + Scan downwards from the top level directory in the hierarchy to
1.2260 + the bottom level directory.
1.2261 + */
1.2262 + EScanDownTree
1.2263 + };
1.2264 +public:
1.2265 + IMPORT_C static CDirScan* NewL(RFs& aFs);
1.2266 + IMPORT_C static CDirScan* NewLC(RFs& aFs);
1.2267 + IMPORT_C ~CDirScan();
1.2268 + IMPORT_C void SetScanDataL(const TDesC& aMatchName,TUint anEntryAttMask,TUint anEntrySortMask,TScanDirection aScanDir=EScanDownTree);
1.2269 + IMPORT_C void NextL(CDir*& aDirEntries);
1.2270 + IMPORT_C TPtrC AbbreviatedPath();
1.2271 + IMPORT_C TPtrC FullPath();
1.2272 +protected:
1.2273 + CDirScan(RFs& aFs);
1.2274 +private:
1.2275 + inline RFs& Fs();
1.2276 + void UpdateAbbreviatedPath();
1.2277 + void ScanUpTreeL(CDir*& aDirEntries);
1.2278 + void ScanDownTreeL(CDir*& aDirEntries);
1.2279 + void GetDirEntriesL(CDir*& aDirEntries);
1.2280 +private:
1.2281 + RFs* const iFs;
1.2282 + TParse iFullPath;
1.2283 + TPtrC iAbbreviatedPath;
1.2284 + TInt iAbbreviatedPathPos;
1.2285 + TUint iEntryAttMask;
1.2286 + TUint iEntrySortMask;
1.2287 + TBool iScanning;
1.2288 + TScanDirection iScanDir;
1.2289 + CDirStack* iStack;
1.2290 + };
1.2291 +
1.2292 +
1.2293 +
1.2294 +
1.2295 +enum TFileManError
1.2296 +/**
1.2297 +@publishedAll
1.2298 +@released
1.2299 +
1.2300 +A list of CFileMan error codes.
1.2301 +
1.2302 +@see CFileMan
1.2303 +*/
1.2304 + {
1.2305 + /**
1.2306 + No additional error information is available, either because
1.2307 + the latest CFileMan operation did not return an error, or if it did,
1.2308 + the error was not one for which additional information is available.
1.2309 + */
1.2310 + ENoExtraInformation,
1.2311 +
1.2312 +
1.2313 + /**
1.2314 + A leave occurred while setting up the initial scan.
1.2315 +
1.2316 + This indicates that the operation did not begin.
1.2317 +
1.2318 + @see CDirScan.
1.2319 + */
1.2320 + EInitializationFailed,
1.2321 +
1.2322 +
1.2323 + /**
1.2324 + A leave occurred while scanning the next directory in the course of a file
1.2325 + management function.
1.2326 +
1.2327 + This indicates that the operation did begin.
1.2328 +
1.2329 + @see CDirScan.
1.2330 + */
1.2331 + EScanNextDirectoryFailed,
1.2332 +
1.2333 +
1.2334 + /**
1.2335 + Error occurred when attempting to open the source file for a file copy
1.2336 + or move.
1.2337 + */
1.2338 + ESrcOpenFailed,
1.2339 +
1.2340 +
1.2341 + /**
1.2342 + Error occurred while attempting to create, or, if overwriting is in effect,
1.2343 + replace the target file for a file copy or move.
1.2344 + */
1.2345 + ETrgOpenFailed,
1.2346 +
1.2347 +
1.2348 + /**
1.2349 + The operation completed without processing any files because no matching
1.2350 + files were found.
1.2351 + */
1.2352 + ENoFilesProcessed
1.2353 + };
1.2354 +
1.2355 +
1.2356 +
1.2357 +
1.2358 +class MFileManObserver
1.2359 +/**
1.2360 +@publishedAll
1.2361 +@released
1.2362 +
1.2363 +Provides notification of the progress of synchronous or asynchronous
1.2364 +file management operations.
1.2365 +
1.2366 +It should be inherited by classes which implement this protocol.
1.2367 +
1.2368 +The enquiry functions provided by CFileBase and CFileMan may be used by
1.2369 +the observer to display information about the progress of the operation
1.2370 +such as error messages, the names of the target and destination files,
1.2371 +and the number of bytes transferred during a copy operation.
1.2372 +Notification may take place before or after an entry has been processed,
1.2373 +or during a file copy or move.
1.2374 +Each notification function returns a value which can be used to enable
1.2375 +the user to control the progress of the operation, for example to cancel
1.2376 +a long-running multiple file copy.
1.2377 +To use this class, pass a pointer to an instance of the class to
1.2378 +the CFileMan constructor, or use SetObserver(), defined in CFileBase.
1.2379 +*/
1.2380 + {
1.2381 +public:
1.2382 + /**
1.2383 + Control for the current CFileMan operation.
1.2384 + */
1.2385 + enum TControl
1.2386 + {
1.2387 + /**
1.2388 + Proceed with the current or the next entry.
1.2389 + */
1.2390 + EContinue,
1.2391 +
1.2392 +
1.2393 + /**
1.2394 + Retry processing the previous entry.
1.2395 + */
1.2396 + ERetry,
1.2397 +
1.2398 +
1.2399 + /**
1.2400 + Abort operation, causes function to return KErrCancel.
1.2401 + */
1.2402 + EAbort,
1.2403 +
1.2404 +
1.2405 + /**
1.2406 + Cancel processing the current entry.
1.2407 + */
1.2408 + ECancel
1.2409 + };
1.2410 +public:
1.2411 + IMPORT_C virtual TControl NotifyFileManStarted();
1.2412 + IMPORT_C virtual TControl NotifyFileManOperation();
1.2413 + IMPORT_C virtual TControl NotifyFileManEnded();
1.2414 + };
1.2415 +
1.2416 +
1.2417 +
1.2418 +
1.2419 +class CFileBase : public CBase
1.2420 +/**
1.2421 +@publishedAll
1.2422 +@released
1.2423 +
1.2424 +Abstract base class for file management.
1.2425 +
1.2426 +It provides functions to set an observer for the derived class
1.2427 +CFileMan, and to get information about the entry being processed.
1.2428 +
1.2429 +@see CFileMan
1.2430 +*/
1.2431 + {
1.2432 +public:
1.2433 + IMPORT_C void SetObserver(MFileManObserver* anObserver);
1.2434 +public:
1.2435 + IMPORT_C const TEntry& CurrentEntry();
1.2436 + IMPORT_C TPtrC AbbreviatedPath();
1.2437 + IMPORT_C TPtrC FullPath();
1.2438 + IMPORT_C TInt GetLastError();
1.2439 + IMPORT_C TFileManError GetMoreInfoAboutError();
1.2440 +protected:
1.2441 + IMPORT_C CFileBase(RFs& anFs);
1.2442 + IMPORT_C void ConstructL();
1.2443 + IMPORT_C ~CFileBase();
1.2444 + IMPORT_C void RunL();
1.2445 + IMPORT_C void RunInSeparateThreadL(TThreadFunction aThreadFunction);
1.2446 +// virtual
1.2447 + /**
1.2448 + Called from RunL to perform tidy up after an operation.
1.2449 +
1.2450 + @see CFileMan
1.2451 + @see CFileBase::RunL
1.2452 + */
1.2453 + virtual void CompleteOperationL() {};
1.2454 +
1.2455 +//pure virtual
1.2456 + /**
1.2457 + Called from RunL to perform the requested operation.
1.2458 +
1.2459 + @see CFileMan
1.2460 + @see CFileBase::RunL
1.2461 + */
1.2462 + virtual void DoOperationL() = 0;
1.2463 +protected:
1.2464 + RFs iFs;
1.2465 + RFs iFsOld;
1.2466 + RThread iFManThread;
1.2467 + RSemaphore iSynchronizer;
1.2468 + CDirScan* iScanner;
1.2469 + CDir* iDirList;
1.2470 + TInt iCurrentEntry;
1.2471 + TUint iMatchEntry;
1.2472 + TUint iSwitches;
1.2473 + TParse iSrcFile;
1.2474 + MFileManObserver* iObserver;
1.2475 + TInt iLastError;
1.2476 + TFileManError iErrorInfo;
1.2477 + TRequestStatus* iStatus;
1.2478 + HBufC* iSessionPath;
1.2479 + TInt iNumberOfFilesProcessed;
1.2480 +
1.2481 +
1.2482 +
1.2483 +
1.2484 +friend void DoFManBaseOperationL(TAny* aPtr);
1.2485 +friend TInt FManBaseThreadFunction(TAny* aPtr);
1.2486 + };
1.2487 +
1.2488 +
1.2489 +
1.2490 +
1.2491 +NONSHARABLE_CLASS(CFileMan) : public CFileBase
1.2492 +/**
1.2493 +@publishedAll
1.2494 +@released
1.2495 +
1.2496 +Offers file management services which accept the use of wildcards;
1.2497 +synchronous and asynchronous.
1.2498 +
1.2499 +It also provides enquiry functions, which, like those provided by
1.2500 +the base class CFileBase, may be used by an observer class object
1.2501 +to provide the user with information about the progress of the operation.
1.2502 +
1.2503 +All of the file management functions provided by this class accept the use of
1.2504 +wildcards, and may operate either synchronously or asynchronously.
1.2505 +When CFileMan is operating asynchronously, the operation takes place in
1.2506 +a separate thread from the calling code.
1.2507 +
1.2508 +A file notification observer (an instance of a class deriving
1.2509 +from MFileManObserver) may optionally be used by CFileMan when operating
1.2510 +synchronously or asynchronously. If provided, the appropriate notification
1.2511 +function is called before or after each entry has been processed,
1.2512 +or during a file copy or move.
1.2513 +This notification can be used to provide information about the state of
1.2514 +the operation, such as the number of bytes transferred during a
1.2515 +large-scale file copy. It can also be used to allow the user to cancel,
1.2516 +retry or continue processing an entry, or to abort the whole operation.
1.2517 +If such notification is required, specify an object deriving from
1.2518 +MFileManObserver class in the constructor, or call SetObserver(),
1.2519 +defined in the base class, CFileBase.
1.2520 +
1.2521 +All of the file manipulation functions except Rename() may operate recursively,
1.2522 +and all can operate non-recursively. When operating recursively,
1.2523 +these functions will act on all matching files located throughout
1.2524 +the source directory’s hierarchy. When operating non-recursively,
1.2525 +these functions act upon files contained in the single top level source
1.2526 +directory only. Recursion is set or unset using the switch parameter to
1.2527 +these functions.
1.2528 +
1.2529 +This class is not intended for user derivation.
1.2530 +
1.2531 +@see MFileManObserver
1.2532 +*/
1.2533 + {
1.2534 +public:
1.2535 + /**
1.2536 + An enumeration that identifies CFileMan tasks. This enumeration is used
1.2537 + by CurrentAction() to identify which task currently being carried out.
1.2538 +
1.2539 + @see CFileMan::CurrentAction
1.2540 + */
1.2541 + enum TAction
1.2542 + {
1.2543 + /**
1.2544 + Inactive
1.2545 + */
1.2546 + ENone,
1.2547 +
1.2548 +
1.2549 + /**
1.2550 + Setting attributes
1.2551 + */
1.2552 + EAttribs,
1.2553 +
1.2554 +
1.2555 + /**
1.2556 + Copying files
1.2557 + */
1.2558 + ECopy,
1.2559 +
1.2560 +
1.2561 + /**
1.2562 + Deleting files
1.2563 + */
1.2564 + EDelete,
1.2565 +
1.2566 +
1.2567 + /**
1.2568 + Moving files
1.2569 + */
1.2570 + EMove,
1.2571 +
1.2572 +
1.2573 + /**
1.2574 + Renaming files
1.2575 + */
1.2576 + ERename,
1.2577 +
1.2578 +
1.2579 + /**
1.2580 + Deleting a directory and all contents
1.2581 + */
1.2582 + ERmDir,
1.2583 +
1.2584 +
1.2585 + /**
1.2586 + Renaming component to VFAT short name (guaranteed to be unique)
1.2587 + */
1.2588 + ERenameInvalidEntry,
1.2589 +
1.2590 + /**
1.2591 + Copying file from open file handle
1.2592 + */
1.2593 + ECopyFromHandle,
1.2594 + };
1.2595 +
1.2596 +
1.2597 + /**
1.2598 + Overwriting and recursion switch.
1.2599 +
1.2600 + Used in CFileMan functions to set whether operations are applied to
1.2601 + the specified directory and all directories below it, or
1.2602 + the specified directory only.
1.2603 + */
1.2604 + enum TSwitch
1.2605 + {
1.2606 + /**
1.2607 + Any files in the destination directory that have the same name as
1.2608 + the source files in a rename, move or copy operation, will
1.2609 + be overwritten.
1.2610 + */
1.2611 + EOverWrite=1,
1.2612 +
1.2613 +
1.2614 + /**
1.2615 + Recursive operation.
1.2616 + */
1.2617 + ERecurse=2
1.2618 + };
1.2619 +public:
1.2620 + IMPORT_C static CFileMan* NewL(RFs& aFs);
1.2621 + IMPORT_C static CFileMan* NewL(RFs& aFs,MFileManObserver* anObserver);
1.2622 + ~CFileMan();
1.2623 + IMPORT_C TAction CurrentAction();
1.2624 + IMPORT_C void GetCurrentTarget(TFileName& aFile);
1.2625 + IMPORT_C void GetCurrentSource(TFileName& aFile);
1.2626 + IMPORT_C TInt BytesTransferredByCopyStep();
1.2627 +public:
1.2628 + IMPORT_C TInt Attribs(const TDesC& aName,TUint aSetMask,TUint aClearMask,const TTime& aTime,TUint aSwitch=0);
1.2629 + IMPORT_C TInt Attribs(const TDesC& aName,TUint aSetMask,TUint aClearMask,const TTime& aTime,TUint aSwitch,TRequestStatus& aStatus);
1.2630 + IMPORT_C TInt Copy(const TDesC& anOld,const TDesC& aNew,TUint aSwitch=EOverWrite);
1.2631 + IMPORT_C TInt Copy(const TDesC& anOld,const TDesC& aNew,TUint aSwitch,TRequestStatus& aStatus);
1.2632 + IMPORT_C TInt Delete(const TDesC& aName,TUint aSwitch=0);
1.2633 + IMPORT_C TInt Delete(const TDesC& aName,TUint aSwitch,TRequestStatus& aStatus);
1.2634 + IMPORT_C TInt Move(const TDesC& anOld,const TDesC& aNew,TUint aSwitch=EOverWrite);
1.2635 + IMPORT_C TInt Move(const TDesC& anOld,const TDesC& aNew,TUint aSwitch,TRequestStatus& aStatus);
1.2636 + IMPORT_C TInt Rename(const TDesC& anOld,const TDesC& aNew,TUint aSwitch=EOverWrite);
1.2637 + IMPORT_C TInt Rename(const TDesC& anOld,const TDesC& aNew,TUint aSwitch,TRequestStatus& aStatus);
1.2638 + IMPORT_C TInt RmDir(const TDesC& aDirName);
1.2639 + IMPORT_C TInt RmDir(const TDesC& aDirName,TRequestStatus& aStatus);
1.2640 + IMPORT_C TInt Copy(const RFile& anOld,const TDesC& aNew,TUint aSwitches=EOverWrite);
1.2641 + IMPORT_C TInt Copy(const RFile& anOld,const TDesC& aNew,TUint aSwitches,TRequestStatus& aStatus);
1.2642 +protected:
1.2643 + CFileMan(RFs& aFs);
1.2644 + TInt RenameInvalidEntry(const TDesC& anOld,const TDesC& aNew,TUint aSwitch=EOverWrite);
1.2645 +private:
1.2646 + /**
1.2647 + This is an internal enumeration for CFileMan implementation.
1.2648 + THis enumeration is mapped into TAction when user wants to identify the current
1.2649 + task of CFileMan by CurrentAction().
1.2650 +
1.2651 + @see CFileMan::TAction
1.2652 + @see CFileMan::CurrentAction
1.2653 + */
1.2654 + enum TInternalAction
1.2655 + {
1.2656 + /**
1.2657 + Internal indicator for None operation.
1.2658 + This is mapped to CFileMan::ENone.
1.2659 + */
1.2660 + EInternalNone,
1.2661 +
1.2662 + /**
1.2663 + Internal indicator for Attribs() operation.
1.2664 + This is mapped to CFileMan::EAttribs.
1.2665 + */
1.2666 + EInternalAttribs,
1.2667 +
1.2668 + /**
1.2669 + Internal indicator for Copy() operation.
1.2670 + This is mapped to CFileMan::ECopy.
1.2671 + */
1.2672 + EInternalCopy,
1.2673 +
1.2674 + /**
1.2675 + Internal indicator for Delete() operation.
1.2676 + This is mapped to CFileMan::EDelete.
1.2677 + */
1.2678 + EInternalDelete,
1.2679 +
1.2680 + /**
1.2681 + Internal indicator for Move() operation on different drives.
1.2682 + This is mapped to CFileMan::Move.
1.2683 + */
1.2684 + EInternalCopyForMove,
1.2685 +
1.2686 + /**
1.2687 + Internal indicator for Move() operation on the same drive.
1.2688 + This is mapped to CFileMan::Rename.
1.2689 + Note for compatibility reasons, it is not mapped to CFileMan::Move.
1.2690 + */
1.2691 + EInternalRenameForMove,
1.2692 +
1.2693 + /**
1.2694 + Internal indicator for Rename() operation.
1.2695 + This is mapped to CFileMan::ERename.
1.2696 + */
1.2697 + EInternalRename,
1.2698 +
1.2699 + /**
1.2700 + Internal indicator for RmDir() operation.
1.2701 + This is mapped to CFileMan::ERmDir.
1.2702 + */
1.2703 + EInternalRmDir,
1.2704 +
1.2705 + /**
1.2706 + Internal indicator for RenameInvalidEntry() operation.
1.2707 + This is mapped to CFileMan::ERenameInvalidEntry.
1.2708 + */
1.2709 + EInternalRenameInvalidEntry,
1.2710 +
1.2711 + /**
1.2712 + Internal indicator for CopyFromHandle() operation.
1.2713 + This is mapped to CFileMan::ECopyFromHandle.
1.2714 + */
1.2715 + EInternalCopyFromHandle,
1.2716 + };
1.2717 +
1.2718 + void CompleteOperationL();
1.2719 + void DoOperationL();
1.2720 + void CheckForDirectory();
1.2721 + void SetFlags(TBool aOverWrite,TBool aRecurse,TBool aScanDirection,TBool aMoveRename);
1.2722 + void GetSrcAndTrg(TParse& aSrcName,TFileName& aTrgName);
1.2723 + void DoSynchronize(TInt aRetVal);
1.2724 + TInt CheckRenameAllowed(const TDesC& aSrcName,const TDesC& aTrgName);
1.2725 + TInt SetupMoveOnSameDrive(TUint aSwitches, TBool& aComplete);
1.2726 + TInt SetupMoveAcrossDrives(TUint aSwitches);
1.2727 + TInt SetupTargetDirectory(TBool aOverWrite, TBool& aComplete);
1.2728 + TBool SrcTrgDrivesIdentical();
1.2729 + TBool SetupDirectoryForMove();
1.2730 +private:
1.2731 + void DoAttribsL();
1.2732 + void DoCopyOrMoveL();
1.2733 + void DoDeleteL();
1.2734 + void DoRenameL();
1.2735 + void DoRmDirL();
1.2736 + void DoCopyFromHandleL();
1.2737 + TInt DoCopy(const RFile& aSrcFile, RFile& aDstFile, TInt& aRet);
1.2738 +private:
1.2739 + TParse iTrgFile;
1.2740 + TInternalAction iAction;
1.2741 + TUint iSetMask;
1.2742 + TUint iClearMask;
1.2743 + TTime iTime;
1.2744 + TInt iBytesTransferred;
1.2745 + RFile iSrcFileHandle;
1.2746 + TBool iMovingContents;
1.2747 + TEntry iTmpEntry;
1.2748 + TParse iTmpParse;
1.2749 + TFileName iTmpName1;
1.2750 + TFileName iTmpName2;
1.2751 +
1.2752 +friend void RenameInvalidEntryL(RFs& aFs,TParse& aSrcFile);
1.2753 + };
1.2754 +
1.2755 +
1.2756 +
1.2757 +
1.2758 +class TFindFile
1.2759 +/**
1.2760 +@publishedAll
1.2761 +@released
1.2762 +
1.2763 +Searches for files and directories.
1.2764 +
1.2765 +Each function has a variant which searches for multiple files/directories,
1.2766 +using one or more wildcard characters in the filename.
1.2767 +If an initial search is successful, further searches can be carried out
1.2768 +using Find() or FindWild().
1.2769 +You can also retrieve the fully qualified file specification,
1.2770 +and manipulate and interrogate it using the TParse class (or related classes).
1.2771 +
1.2772 +Note that when specifying the path of a directory to search, the path should
1.2773 +always end with a backslash character.When trailing backslash is not present
1.2774 +then it is considered as file. And path will be taken till last backslash.
1.2775 +The client must have appropriate capabilities for the directory to be searched.
1.2776 +For example without ALL FILES Capability, it is not possible to successfully
1.2777 +find any files under \sys\bin directory.
1.2778 +
1.2779 +By default if the file is not found in the current drive the rest of the drives,
1.2780 +excluding the remote ones, will be searched. Using function SetFindMask it is
1.2781 +possible to specify a combination of drive attributes(aMask) that the drives to
1.2782 +be searched must match.
1.2783 +
1.2784 +*/
1.2785 + {
1.2786 +public:
1.2787 + IMPORT_C TFindFile(RFs& aFs);
1.2788 + IMPORT_C TInt FindByPath(const TDesC& aFileName,const TDesC* aPathList);
1.2789 + IMPORT_C TInt FindByDir(const TDesC& aFileName,const TDesC& aDirPath);
1.2790 + IMPORT_C TInt Find();
1.2791 + IMPORT_C TInt FindWildByPath(const TDesC& aFileName,const TDesC* aPathList,CDir*& aDirList);
1.2792 + IMPORT_C TInt FindWildByDir(const TDesC& aFileName,const TDesC& aDirPath,CDir*& aDir);
1.2793 + IMPORT_C TInt FindWild(CDir*& aDirList);
1.2794 + IMPORT_C TInt SetFindMask(TUint aMask);
1.2795 + inline const TDesC& File() const;
1.2796 +private:
1.2797 + TInt DoFind();
1.2798 + TInt DoFindByPath(const TDesC& aFileName,const TDesC* aPathList);
1.2799 + TInt DoFindByDir(const TDesC& aFileName,const TDesC& aDir);
1.2800 + TInt DoFindInDir();
1.2801 + TInt DoFindNextInPath();
1.2802 + TInt DoFindNextInDriveList();
1.2803 +private:
1.2804 + RFs* const iFs;
1.2805 + TParse iFile;
1.2806 + TInt iPathPos;
1.2807 + TInt iCurrentDrive;
1.2808 + TInt iMode;
1.2809 + const TDesC* iPath;
1.2810 + TDriveList iDrvList;
1.2811 + CDir** iDir;
1.2812 + TUint32 iMatchMask;
1.2813 + };
1.2814 +
1.2815 +
1.2816 +
1.2817 +
1.2818 +/**
1.2819 +@publishedAll
1.2820 +@released
1.2821 +
1.2822 +Contains a list of entries for the files which were opened in
1.2823 +a file server session.
1.2824 +
1.2825 +@see CDir
1.2826 +*/
1.2827 +typedef CDir CFileList;
1.2828 +
1.2829 +
1.2830 +
1.2831 +
1.2832 +class TOpenFileScan
1.2833 +/**
1.2834 +@publishedAll
1.2835 +@released
1.2836 +
1.2837 +Scans open files to get a list of the entries for all files which are currently
1.2838 +open in a particular file server session.
1.2839 +
1.2840 +NextL() creates a list of the files opened by the session.
1.2841 +The ID of the thread which opened the files listed may be obtained by calling ThreadId().
1.2842 +If multiple sessions are in use, repeatedly calling NextL() will return a list
1.2843 +of open files in each session.
1.2844 +*/
1.2845 + {
1.2846 +public:
1.2847 + IMPORT_C TOpenFileScan(RFs& aFs);
1.2848 + IMPORT_C void NextL(CFileList*& aFileList);
1.2849 + IMPORT_C TThreadId ThreadId() const;
1.2850 +private:
1.2851 + RFs* iFs;
1.2852 + TThreadId iThreadId;
1.2853 + TInt iScanPos;
1.2854 + TInt iEntryListPos;
1.2855 + };
1.2856 +
1.2857 +
1.2858 +
1.2859 +
1.2860 +class TFileText
1.2861 +/**
1.2862 +@publishedAll
1.2863 +@released
1.2864 +
1.2865 +Reads and writes single lines of text to or from a Unicode file.
1.2866 +*/
1.2867 + {
1.2868 +public:
1.2869 + /**
1.2870 + @internalComponent
1.2871 + */
1.2872 + enum TFileState
1.2873 + {
1.2874 + EStartOfFile,
1.2875 + ENormal,
1.2876 + EReverse
1.2877 + };
1.2878 +public:
1.2879 + IMPORT_C TFileText();
1.2880 + IMPORT_C void Set(RFile& aFile);
1.2881 + IMPORT_C TInt Read(TDes& aDes);
1.2882 + IMPORT_C TInt Write(const TDesC& aDes);
1.2883 + IMPORT_C TInt Seek(TSeek aMode);
1.2884 +private:
1.2885 + void NextRecord();
1.2886 + TInt CheckForTerminator(TBool& anAnswer);
1.2887 + TInt FillBuffer();
1.2888 +private:
1.2889 + const TText* iNext;
1.2890 + const TText* iEnd;
1.2891 + TFileState iState;
1.2892 + RFile iFile;
1.2893 + TBuf8<0x100> iReadBuf;
1.2894 + };
1.2895 +
1.2896 +
1.2897 +
1.2898 +
1.2899 +/**
1.2900 +@publishedAll
1.2901 +@released
1.2902 +*/
1.2903 +IMPORT_C TBool FileNamesIdentical(const TDesC& aFileName1,const TDesC& aFileName2);
1.2904 +
1.2905 +
1.2906 +
1.2907 +/**
1.2908 +Local drive mapping list - passed as argument to RFs::SetLocalDriveMapping().
1.2909 +
1.2910 +@publishedPartner
1.2911 +@released
1.2912 +*/
1.2913 +class TLocalDriveMappingInfo
1.2914 + {
1.2915 +public:
1.2916 + enum TDrvMapOperation {EWriteMappingsAndSet=0,EWriteMappingsNoSet=1,ESwapIntMappingAndSet=2};
1.2917 +public:
1.2918 + TInt iDriveMapping[KMaxLocalDrives];
1.2919 + TDrvMapOperation iOperation;
1.2920 + };
1.2921 +typedef TPckgBuf<TLocalDriveMappingInfo> TLocalDriveMappingInfoBuf;
1.2922 +
1.2923 +/**
1.2924 +Client side plugin API.
1.2925 +
1.2926 +@publishedPartner
1.2927 +@released
1.2928 +*/
1.2929 +class RPlugin : public RSubSessionBase
1.2930 + {
1.2931 +public:
1.2932 + IMPORT_C TInt Open(RFs& aFs, TInt aPos);
1.2933 + IMPORT_C void Close();
1.2934 +protected:
1.2935 + IMPORT_C void DoRequest(TInt aReqNo,TRequestStatus& aStatus) const;
1.2936 + IMPORT_C void DoRequest(TInt aReqNo,TRequestStatus& aStatus,TDes8& a1) const;
1.2937 + IMPORT_C void DoRequest(TInt aReqNo,TRequestStatus& aStatus,TDes8& a1,TDes8& a2) const;
1.2938 + IMPORT_C TInt DoControl(TInt aFunction) const;
1.2939 + IMPORT_C TInt DoControl(TInt aFunction,TDes8& a1) const;
1.2940 + IMPORT_C TInt DoControl(TInt aFunction,TDes8& a1,TDes8& a2) const;
1.2941 + IMPORT_C void DoCancel(TUint aReqMask) const;
1.2942 + };
1.2943 +
1.2944 +/**
1.2945 +@publishedPartner
1.2946 +@released
1.2947 +
1.2948 +Specifies that a plugin should determine for itself which drives it attaches to.
1.2949 +
1.2950 +@see RFs::MountPlugin
1.2951 +@see RFs::DismountPlugin
1.2952 +*/
1.2953 +const TInt KPluginAutoAttach = 0x19;
1.2954 +
1.2955 +/**
1.2956 +@publishedPartner
1.2957 +@released
1.2958 +
1.2959 +Specifies that a plugin should determine its own position in the plugin stack.
1.2960 +
1.2961 +@see RFs::MountPlugin
1.2962 +@see RFs::DismountPlugin
1.2963 +*/
1.2964 +const TInt KPluginAutoLocate = 0xC8;
1.2965 +
1.2966 +/**
1.2967 +@publishedAll
1.2968 +@released
1.2969 +
1.2970 +The UID of the File Server process
1.2971 +*/
1.2972 +const TInt KFileServerUidValue = 0x100039e3;
1.2973 +
1.2974 +enum TSessionFlags
1.2975 +/**
1.2976 +@internalTechnology
1.2977 +
1.2978 +A set of session specific configuration flags.
1.2979 +*/
1.2980 + {
1.2981 + /**
1.2982 + Notify the user or write failures
1.2983 + */
1.2984 + EFsSessionNotifyUser = KBit0,
1.2985 +
1.2986 + /**
1.2987 + Notify clients registered for change notification
1.2988 + */
1.2989 + EFsSessionNotifyChange = KBit1,
1.2990 +
1.2991 + /**
1.2992 + Enables all session flags
1.2993 + */
1.2994 + EFsSessionFlagsAll = KSet32,
1.2995 + };
1.2996 +
1.2997 +/**
1.2998 +@internalTechnology
1.2999 +*/
1.3000 +struct SBlockMapArgs
1.3001 + {
1.3002 + TInt64 iStartPos;
1.3003 + TInt64 iEndPos;
1.3004 + };
1.3005 +
1.3006 +
1.3007 +/**
1.3008 +@internalTechnology
1.3009 +
1.3010 +Validates the mask used to match drive attributes.
1.3011 +
1.3012 +@see RFs::DriveList
1.3013 +@see TFindFile::SetFindMask
1.3014 +*/
1.3015 +TInt ValidateMatchMask( TUint aMask);
1.3016 +
1.3017 +
1.3018 +
1.3019 +
1.3020 +#include "f32file.inl"
1.3021 +#endif