Re: [Tuxcmd-dev-vfs] Koncepce VFS - cast 2. round II.
Status: Beta
Brought to you by:
tbzatek
From: Radek C. <rad...@ce...> - 2004-03-16 08:10:37
|
mi se to libi az na : > capVFS_Multiple=32; //support multiple files co to je? jak plugin oznaci ze neumi pohybovani ve streamu? Vsude chybi volaci konvence cdecl; a jeste aby vsechny funkce zacinaly VFS takze > function FileExists(g:TVFSGlobs; const FileName: PChar; const Use_lstat: LongBool = False): LongBool;> function VFSFileExists(g:TVFSGlobs; const FileName: PChar; const Use_lstat: LongBool = False): LongBool; > function ChangeTimes(g:TVFSGlobs; APath: PChar; mtime, atime: Longint):TVFSResult; > // zmeni casy u souboru (ctime se vetsinou nepouziva) ale neznamena ze tam v rozhrani nebude > function GetFSID(g:TVFSGlobs; const APath: PChar): Int64; > // vrati nejake unikatni cislo FS, ktere identifikuje, ze soubor se nachazi na urcitem FS no nevim > function GetFSLabel(g:TVFSGlobs; const APath: PChar): PChar; > // zase plati stejna poznamka jako u GetFileSystemSize taky nevim > function VFSRun(g:TVFSGlobs; const sName:String):TVFSResult; > // nainstaluje(prip. provede jinou akci) balicek rpm ci deb dekuji > > Blokove operace: > > > > !!! Sporne funkce - kopirovani: > TCallBackFunc = Function (iPos:Int64; iMax:Int64):Boolean; > > function VFSCopyOut(g:TVFSGlobs; const sSrcName, sDstName:String; pCallBackProgress: TCallBackFunc):TVFSResult; > function VFSCopyIn(g:TVFSGlobs; const sSrcName, sDstName:String; pCallBackProgress: TCallBackFunc):TVFSResult; > // Kopirovani souboru - zevnitr ven a zvenku dovnitr > // - tady jsme ale porad nedoresili co delat v pripade kopirovani mezi dvema VFS (z archivu na SMB disk, ze SMB na FTP...) - aby se nepouzival zadny temp soubor to by se delalo asi pres blokove operace nebo pres mmap (coz by bylo lepsi). Jeden plugin by to namapoval do pameti a druhemu by se predal pointer na pamet a delka > ale tohle bych precejenom implementoval: > (ikdyz zpocatku to nebude nutne, rad bych to ale chtel mit v programu > kvuli random pristupu k obsahu souboru treba na SMB disku (prohlizec) - > je jasne ze v nekterych pluginech to nepujde implementovat - v takovem > pripade bych to vracel ve funkci VFSCaps) popremislej o tom mmap > > function OpenFile(g:TVFSGlobs; const APath: PChar; const Flags, Mode: integer; var Error: integer): integer; > // vrati filedescriptor > function ReadFile(g:TVFSGlobs; const FileDescriptor: integer; Buffer: Pointer; ABlockSize: integer; var Error: integer): integer; > // Returns number of bytes read > function WriteFile(g:TVFSGlobs; const FileDescriptor: integer; Buffer: Pointer; BytesCount: integer; var Error: integer): integer; > // Returns number of bytes written > function CloseFile(g:TVFSGlobs; const FileDescriptor: integer): TVFSResult; > function FileSeek(g:TVFSGlobs; const FileDescriptor: integer; const AbsoluteOffset: Int64; var Error: integer): Int64; > // vrati nastavenou pozici nebo -1 pri chybe > // DirRec.DateTime := EncodeDate (1970, 1, 1) + (ExtractNumber (@Header.MTime, 12) / 86400.0); jo to ExtractNumber je tam navic (to byla takova suport rutina): EncodeDate (1970, 1, 1) + MTime / 86400.0); > end; > > function VFSList(g:TVFSGlobs; const sDir:String; iItemID:Integer; var VFSItem:TVFSItem):TVFSResult; > // vylistuje seznam souboru v urcite ceste ja si tady tim nejsem moc jist (a to jsem to vymyslel) Lepsi byl asi sekvencni pristup jako FindFirst, FindNext, FindClose > function VFSFileInfo(g:TVFSGlobs; AFileName: PChar; var VFSItem:PVFSItem):TVFSResult; > // vrati strukturu s informacema jenom o tom jednom souboru to bych sem nedaval zbytecne to bude kompikovat plugin Radek Cervinka |