diff options
| author | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2009-12-13 14:32:58 +0100 |
|---|---|---|
| committer | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2009-12-13 14:32:58 +0100 |
| commit | 0f7616a007edaa1d19c4672a4fd390c072b1eba6 (patch) | |
| tree | a1524927d8986bb54345c47ded84bb3c2a9559c2 /vfs/uVFSprototypes.pas | |
| parent | ae0047b8a5fa76ea76c66d8c5c580eba39178755 (diff) | |
| download | tuxcmd-0f7616a007edaa1d19c4672a4fd390c072b1eba6.tar.xz | |
Error system transformation to GErrorv0.6.74
Note that most coreworkers are broken at the moment.
Diffstat (limited to 'vfs/uVFSprototypes.pas')
| -rw-r--r-- | vfs/uVFSprototypes.pas | 86 |
1 files changed, 35 insertions, 51 deletions
diff --git a/vfs/uVFSprototypes.pas b/vfs/uVFSprototypes.pas index 8beacdd..9ed0844 100644 --- a/vfs/uVFSprototypes.pas +++ b/vfs/uVFSprototypes.pas @@ -36,24 +36,7 @@ uses glib2; const cVFSVersion = 5; // current version of the VFS API - // Error codes (TVFSResult) - cVFS_OK = 0; - cVFS_Failed = 1; // also No such file - cVFS_Cancelled = 2; - cVFS_Not_Supported = 3; - cVFS_Not_More_Files = 4; // returned while directory listing - cVFS_ReadErr = 5; - cVFS_WriteErr = 6; // also ReadOnlyFileSystem - cVFS_LoginFailed = 7; - cVFS_PermissionDenied = 8; - cVFS_NoSpaceLeft = 9; - cVFS_mallocFailed = 10; - cVFS_BadPassword = 11; - cVFS_MissingVolume = 12; - cVFS_CorruptedArchive = 13; - - - // Open modes (for VFSOpenFile function) + // Open modes (for VFSOpenFile function) cVFS_OpenRead = 0; cVFS_OpenWrite = 1; cVFS_OpenAppend = 2; @@ -76,8 +59,6 @@ const type - TVFSResult = longint; - // Plugin private data for each connection/instance TVFSGlobs = Pointer; @@ -94,7 +75,6 @@ type TVFSItemType = (vRegular=0, vChardev=1, vBlockdev=2, vDirectory=3, vFifo=4, vSock=5, vOther=6); - PVFSItem = ^TVFSItem; TVFSItem = record FName: PChar; @@ -149,10 +129,14 @@ type password_save: PVFSPasswordSave; user_data: Pointer): gboolean; cdecl; - // Return False to break the operation + // Progress callback, return False to break the copy process + // If an Error is set, returning True means to ignore error (don't delete broken file if possible) + // If an Error is set, Position may contain random value + // Do not free Error, it belongs to the copy operation PVFSProgressCallback = ^TVFSProgressCallback; + // Keep in sync with UCoreWorkers.pas/vfs_progress_callback TVFSProgressCallback = function (position: guint64; - max: guint64; + error: PGError; user_data: Pointer): gboolean; cdecl; type @@ -192,33 +176,33 @@ type // Opens specified archive. This will also switch engine into an archiving mode - TVFSOpenArchive = function (g:TVFSGlobs; const sName: PChar): TVFSResult; cdecl; + TVFSOpenArchive = function (g:TVFSGlobs; const sName: PChar; Error: PPGError): gboolean; cdecl; // Opens specified network location. This will also switch engine into a networking mode // In case of URI, do not supply password encoded in the string; plugin will automatically spawn the TVFSAskPasswordCallback callback when needed - TVFSOpenURI = function (g:TVFSGlobs; const sURI: PChar): TVFSResult; cdecl; + TVFSOpenURI = function (g:TVFSGlobs; const sURI: PChar; Error: PPGError): gboolean; cdecl; // Closes the file or connection to the server - TVFSClose = function (g:TVFSGlobs): TVFSResult; cdecl; + TVFSClose = function (g:TVFSGlobs; Error: PPGError): gboolean; cdecl; // These functions serves for listing contents of a directory // Before calling VFSListFirst, it is recommended to change target directory (VFSChangeDir) to check it really exists // First call the VFSListFirst function and then repeat call of VFSListNext until it returns NULL. // Then call VFSListClose to make cleanup - TVFSListFirst = function (g:TVFSGlobs; const sDir: PChar; VFSItem: PVFSItem; FollowSymlinks, AddFullPath: gboolean): TVFSResult; cdecl; - TVFSListNext = function (g:TVFSGlobs; VFSItem: PVFSItem): TVFSResult; cdecl; - TVFSListClose = function (g:TVFSGlobs): TVFSResult; cdecl; + TVFSListFirst = function (g:TVFSGlobs; const sDir: PChar; FollowSymlinks, AddFullPath: gboolean; Error: PPGError): PVFSItem; cdecl; + TVFSListNext = function (g:TVFSGlobs; Error: PPGError): PVFSItem; cdecl; + TVFSListClose = function (g:TVFSGlobs; Error: PPGError): gboolean; cdecl; // Gets a single info item without need to list a whole directory - TVFSFileInfo = function (g:TVFSGlobs; const AFileName: PChar; VFSItem: PVFSItem; FollowSymlinks, AddFullPath: gboolean): TVFSResult; cdecl; + TVFSFileInfo = function (g:TVFSGlobs; const AFileName: PChar; FollowSymlinks, AddFullPath: gboolean; Error: PPGError): PVFSItem; cdecl; // Try to change directory, checks real access - TVFSChangeDir = function (g:TVFSGlobs; const NewPath: PChar): TVFSResult; cdecl; + TVFSChangeDir = function (g:TVFSGlobs; const NewPath: PChar; Error: PPGError): gboolean; cdecl; // Returns current working path, tuxcmd will take care of memory deallocation TVFSGetPath = function (g:TVFSGlobs): PChar; cdecl; // Returns the current working path in the URI form, tuxcmd will take care of memory deallocation TVFSGetPathURI = function (g:TVFSGlobs): PChar; cdecl; // Gets filesystem info; tuxcmd will take care of memory deallocation - TVFSGetFileSystemInfo = function (g:TVFSGlobs; const APath: PChar; FSSize, FSFree: PInt64; FSLabel: PPChar): TVFSResult; cdecl; + TVFSGetFileSystemInfo = procedure (g:TVFSGlobs; const APath: PChar; FSSize, FSFree: PInt64; FSLabel: PPChar); cdecl; TVFSIsOnSameFS = function (g:TVFSGlobs; const Path1, Path2: PChar; FollowSymlinks: gboolean): gboolean; cdecl; // Checks if the two files are simmilar (used to test the case-insensitive filesystem - or hardlinks) TVFSTwoSameFiles = function (g:TVFSGlobs; const Path1, Path2: PChar; FollowSymlinks: gboolean): gboolean; cdecl; @@ -228,34 +212,34 @@ type TVFSBreakGetDirSize = procedure (g:TVFSGlobs); cdecl; // Operations - TVFSMkDir = function (g:TVFSGlobs; const sDirName: PChar): TVFSResult; cdecl; + TVFSMkDir = function (g:TVFSGlobs; const sDirName: PChar; Error: PPGError): gboolean; cdecl; // Rename/Move, the two files/directories have to be on the same filesystem (do manual copy and delete otherway) - TVFSRename = function (g:TVFSGlobs; const sSrcName, sDstName: PChar): TVFSResult; cdecl; + TVFSRename = function (g:TVFSGlobs; const sSrcName, sDstName: PChar; Error: PPGError): gboolean; cdecl; // Removes file/directory (empty only!) - TVFSRemove = function (g:TVFSGlobs; const APath: PChar): TVFSResult; cdecl; - TVFSMakeSymLink = function (g:TVFSGlobs; const NewFileName, PointTo: PChar): TVFSResult; cdecl; + TVFSRemove = function (g:TVFSGlobs; const APath: PChar; Error: PPGError): gboolean; cdecl; + TVFSMakeSymLink = function (g:TVFSGlobs; const NewFileName, PointTo: PChar; Error: PPGError): gboolean; cdecl; // Mode is classic unix format (glibc) - a bit mask - TVFSChmod = function (g:TVFSGlobs; const FileName: PChar; Mode: guint32): TVFSResult; cdecl; - TVFSChown = function (g:TVFSGlobs; const FileName: PChar; UID, GID: guint32): TVFSResult; cdecl; + TVFSChmod = function (g:TVFSGlobs; const FileName: PChar; Mode: guint32; Error: PPGError): gboolean; cdecl; + TVFSChown = function (g:TVFSGlobs; const FileName: PChar; UID, GID: guint32; Error: PPGError): gboolean; cdecl; // Changes times for the file/directory - mtime and atime are __time_t parameters (glibc) - TVFSChangeTimes = function (g:TVFSGlobs; const APath: PChar; mtime, atime: guint32): TVFSResult; cdecl; + TVFSChangeTimes = function (g:TVFSGlobs; const APath: PChar; mtime, atime: guint32; Error: PPGError): gboolean; cdecl; // Performs the copy process from inside of module to local filesystem // (thus sSrcName is a path from inside of module and sDstName is path in the local filesystem where the file should be copied) // Note: if you need to transfer a file between two VFS modules, you need to do it manually - // - either first copy to local FS or use the Open, Read, Write functions of the module (NOTE: both VFS modules have to support these functions) - TVFSCopyToLocal = function (g:TVFSGlobs; const sSrcName, sDstName: PChar; Append: gboolean): TVFSResult; cdecl; + TVFSCopyToLocal = function (g:TVFSGlobs; const sSrcName, sDstName: PChar; Append: gboolean; Error: PPGError): gboolean; cdecl; // Performs the copy process from local filesystem into the module - TVFSCopyFromLocal = function (g:TVFSGlobs; const sSrcName, sDstName: PChar; Append: gboolean): TVFSResult; cdecl; - // Start the copy operation - open the archive and prepare internal structures - TVFSStartCopyOperation = function (g:TVFSGlobs): TVFSResult; cdecl; - // Stop the copy operation - close the archive and free memory - TVFSStopCopyOperation = function (g:TVFSGlobs): TVFSResult; cdecl; + TVFSCopyFromLocal = function (g:TVFSGlobs; const sSrcName, sDstName: PChar; Append: gboolean; Error: PPGError): gboolean; cdecl; + // Start the copy operation - open the archive and prepare internal structures (called only in archive mode) + TVFSStartCopyOperation = function (g:TVFSGlobs; Error: PPGError): gboolean; cdecl; + // Stop the copy operation - close the archive and free memory (called only in archive mode) + TVFSStopCopyOperation = function (g:TVFSGlobs; Error: PPGError): gboolean; cdecl; // TODO: Prototype function for packing new files into archive - TVFSPack = function (g:TVFSGlobs; const sSrcName, sDstName: PChar; CompressionLevel: integer; const Password: PChar): TVFSResult; cdecl; + TVFSPack = function (g:TVFSGlobs; const sSrcName, sDstName: PChar; CompressionLevel: integer; const Password: PChar; Error: PPGError): gboolean; cdecl; // TODO: not implemented at all @@ -263,14 +247,14 @@ type // There is a TVFSFileDes object which identifies the processed file (filedescriptor) // All these functions needs a pointer to an int variable to store the error code // NOTE: not all modules could support this set of functions due to its design (unable to set a solid block size) - TVFSOpenFile = function (g:TVFSGlobs; const APath: PChar; Mode: integer; Error: Pinteger): TVFSFileDes; cdecl; + TVFSOpenFile = function (g:TVFSGlobs; const APath: PChar; Mode: integer; Error: PPGError): TVFSFileDes; cdecl; // Opens a file or creates new (the values for the Mode parameter are described above) and returns the assigned filedescriptor - TVFSReadFile = function (g:TVFSGlobs; const FileDescriptor: TVFSFileDes; Buffer: Pointer; ABlockSize: integer; Error: Pinteger): integer; cdecl; + TVFSReadFile = function (g:TVFSGlobs; const FileDescriptor: TVFSFileDes; Buffer: Pointer; ABlockSize: integer; Error: PPGError): integer; cdecl; // Returns number of bytes read; the buffer needs to be allocated by a blocksize (set it by VFSSetBlockSize function) - TVFSWriteFile = function (g:TVFSGlobs; const FileDescriptor: TVFSFileDes; Buffer: Pointer; BytesCount: integer; Error: Pinteger): integer; cdecl; + TVFSWriteFile = function (g:TVFSGlobs; const FileDescriptor: TVFSFileDes; Buffer: Pointer; BytesCount: integer; Error: PPGError): integer; cdecl; // Returns number of bytes written - TVFSCloseFile = function (g:TVFSGlobs; const FileDescriptor: TVFSFileDes): TVFSResult; cdecl; - TVFSFileSeek = function (g:TVFSGlobs; const FileDescriptor: TVFSFileDes; const AbsoluteOffset: Int64; Error: Pinteger): Int64; cdecl; + TVFSCloseFile = function (g:TVFSGlobs; const FileDescriptor: TVFSFileDes; Error: PPGError): gboolean; cdecl; + TVFSFileSeek = function (g:TVFSGlobs; const FileDescriptor: TVFSFileDes; const AbsoluteOffset: Int64; Error: PPGError): Int64; cdecl; // Sets the position in the file from the start and returns real current position |
