summaryrefslogtreecommitdiff
path: root/vfs/UVFSCore.pas
diff options
context:
space:
mode:
Diffstat (limited to 'vfs/UVFSCore.pas')
-rw-r--r--vfs/UVFSCore.pas100
1 files changed, 51 insertions, 49 deletions
diff --git a/vfs/UVFSCore.pas b/vfs/UVFSCore.pas
index 88277ae..e3bdf4c 100644
--- a/vfs/UVFSCore.pas
+++ b/vfs/UVFSCore.pas
@@ -162,7 +162,7 @@ var PluginList: TList;
implementation
-uses SysUtils, ModuleLoader, UConfig, ULocale;
+uses SysUtils, UConfig, ULocale;
const ConstGlobalModulePath1 = '/usr/lib/tuxcmd';
@@ -188,47 +188,47 @@ begin
ModuleHandle := PluginHandle;
// Find the symbols
- @FVFSAllocNeeded := GetModuleSymbol(ModuleHandle, 'VFSAllocNeeded');
- @FVFSInit := GetModuleSymbol(ModuleHandle, 'VFSInit');
- @FVFSDestroy := GetModuleSymbol(ModuleHandle, 'VFSDestroy');
- @FVFSVersion := GetModuleSymbol(ModuleHandle, 'VFSVersion');
- @FVFSGetInfo := GetModuleSymbol(ModuleHandle, 'VFSGetInfo');
- @FVFSOpen := GetModuleSymbol(ModuleHandle, 'VFSOpen');
- @FVFSClose := GetModuleSymbol(ModuleHandle, 'VFSClose');
- @FVFSListFirst := GetModuleSymbol(ModuleHandle, 'VFSListFirst');
- @FVFSListNext := GetModuleSymbol(ModuleHandle, 'VFSListNext');
- @FVFSListClose := GetModuleSymbol(ModuleHandle, 'VFSListClose');
- @FVFSGetPath := GetModuleSymbol(ModuleHandle, 'VFSGetPath');
- @FVFSChangeDir := GetModuleSymbol(ModuleHandle, 'VFSChangeDir');
- @FVFSGetPrefix := GetModuleSymbol(ModuleHandle, 'VFSGetPrefix');
- @FVFSGetFileSystemSize := GetModuleSymbol(ModuleHandle, 'VFSGetFileSystemSize');
- @FVFSGetFileSystemFree := GetModuleSymbol(ModuleHandle, 'VFSGetFileSystemFree');
- @FVFSLogin := GetModuleSymbol(ModuleHandle, 'VFSLogin');
- @FVFSFileExists := GetModuleSymbol(ModuleHandle, 'VFSFileExists');
- @FVFSFileInfo := GetModuleSymbol(ModuleHandle, 'VFSFileInfo');
- @FVFSMkDir := GetModuleSymbol(ModuleHandle, 'VFSMkDir');
- @FVFSRemove := GetModuleSymbol(ModuleHandle, 'VFSRemove');
- @FVFSRename := GetModuleSymbol(ModuleHandle, 'VFSRename');
- @FVFSMakeSymLink := GetModuleSymbol(ModuleHandle, 'VFSMakeSymLink');
- @FVFSChmod := GetModuleSymbol(ModuleHandle, 'VFSChmod');
- @FVFSChown := GetModuleSymbol(ModuleHandle, 'VFSChown');
- @FVFSChangeTimes := GetModuleSymbol(ModuleHandle, 'VFSChangeTimes');
- @FVFSGetDirSize := GetModuleSymbol(ModuleHandle, 'VFSGetDirSize');
- @FVFSBreakGetDirSize := GetModuleSymbol(ModuleHandle, 'VFSBreakGetDirSize');
- @FVFSCopyOut := GetModuleSymbol(ModuleHandle, 'VFSCopyOut');
- @FVFSCopyIn := GetModuleSymbol(ModuleHandle, 'VFSCopyIn');
- @FVFSOpenFile := GetModuleSymbol(ModuleHandle, 'VFSOpenFile');
- @FVFSReadFile := GetModuleSymbol(ModuleHandle, 'VFSReadFile');
- @FVFSWriteFile := GetModuleSymbol(ModuleHandle, 'VFSWriteFile');
- @FVFSCloseFile := GetModuleSymbol(ModuleHandle, 'VFSCloseFile');
- @FVFSFileSeek := GetModuleSymbol(ModuleHandle, 'VFSFileSeek');
- @FVFSSetBlockSize := GetModuleSymbol(ModuleHandle, 'VFSSetBlockSize');
- @FVFSIsOnSameFS := GetModuleSymbol(ModuleHandle, 'VFSIsOnSameFS');
- @FVFSTwoSameFiles := GetModuleSymbol(ModuleHandle, 'VFSTwoSameFiles');
- @FVFSGetExts := GetModuleSymbol(ModuleHandle, 'VFSGetExts');
- @FVFSGetServices := GetModuleSymbol(ModuleHandle, 'VFSGetServices');
- @FVFSSetPassword := GetModuleSymbol(ModuleHandle, 'VFSSetPassword');
- @FVFSGetPasswordRequired := GetModuleSymbol(ModuleHandle, 'VFSGetPasswordRequired');
+ @FVFSAllocNeeded := dlsym(ModuleHandle, 'VFSAllocNeeded');
+ @FVFSInit := dlsym(ModuleHandle, 'VFSInit');
+ @FVFSDestroy := dlsym(ModuleHandle, 'VFSDestroy');
+ @FVFSVersion := dlsym(ModuleHandle, 'VFSVersion');
+ @FVFSGetInfo := dlsym(ModuleHandle, 'VFSGetInfo');
+ @FVFSOpen := dlsym(ModuleHandle, 'VFSOpen');
+ @FVFSClose := dlsym(ModuleHandle, 'VFSClose');
+ @FVFSListFirst := dlsym(ModuleHandle, 'VFSListFirst');
+ @FVFSListNext := dlsym(ModuleHandle, 'VFSListNext');
+ @FVFSListClose := dlsym(ModuleHandle, 'VFSListClose');
+ @FVFSGetPath := dlsym(ModuleHandle, 'VFSGetPath');
+ @FVFSChangeDir := dlsym(ModuleHandle, 'VFSChangeDir');
+ @FVFSGetPrefix := dlsym(ModuleHandle, 'VFSGetPrefix');
+ @FVFSGetFileSystemSize := dlsym(ModuleHandle, 'VFSGetFileSystemSize');
+ @FVFSGetFileSystemFree := dlsym(ModuleHandle, 'VFSGetFileSystemFree');
+ @FVFSLogin := dlsym(ModuleHandle, 'VFSLogin');
+ @FVFSFileExists := dlsym(ModuleHandle, 'VFSFileExists');
+ @FVFSFileInfo := dlsym(ModuleHandle, 'VFSFileInfo');
+ @FVFSMkDir := dlsym(ModuleHandle, 'VFSMkDir');
+ @FVFSRemove := dlsym(ModuleHandle, 'VFSRemove');
+ @FVFSRename := dlsym(ModuleHandle, 'VFSRename');
+ @FVFSMakeSymLink := dlsym(ModuleHandle, 'VFSMakeSymLink');
+ @FVFSChmod := dlsym(ModuleHandle, 'VFSChmod');
+ @FVFSChown := dlsym(ModuleHandle, 'VFSChown');
+ @FVFSChangeTimes := dlsym(ModuleHandle, 'VFSChangeTimes');
+ @FVFSGetDirSize := dlsym(ModuleHandle, 'VFSGetDirSize');
+ @FVFSBreakGetDirSize := dlsym(ModuleHandle, 'VFSBreakGetDirSize');
+ @FVFSCopyOut := dlsym(ModuleHandle, 'VFSCopyOut');
+ @FVFSCopyIn := dlsym(ModuleHandle, 'VFSCopyIn');
+ @FVFSOpenFile := dlsym(ModuleHandle, 'VFSOpenFile');
+ @FVFSReadFile := dlsym(ModuleHandle, 'VFSReadFile');
+ @FVFSWriteFile := dlsym(ModuleHandle, 'VFSWriteFile');
+ @FVFSCloseFile := dlsym(ModuleHandle, 'VFSCloseFile');
+ @FVFSFileSeek := dlsym(ModuleHandle, 'VFSFileSeek');
+ @FVFSSetBlockSize := dlsym(ModuleHandle, 'VFSSetBlockSize');
+ @FVFSIsOnSameFS := dlsym(ModuleHandle, 'VFSIsOnSameFS');
+ @FVFSTwoSameFiles := dlsym(ModuleHandle, 'VFSTwoSameFiles');
+ @FVFSGetExts := dlsym(ModuleHandle, 'VFSGetExts');
+ @FVFSGetServices := dlsym(ModuleHandle, 'VFSGetServices');
+ @FVFSSetPassword := dlsym(ModuleHandle, 'VFSSetPassword');
+ @FVFSGetPasswordRequired := dlsym(ModuleHandle, 'VFSGetPasswordRequired');
// Initialize the extensions list
SetLength(Extensions, 0);
SetLength(Services, 0);
@@ -238,7 +238,7 @@ end;
destructor TVFSPlugin.Destroy;
begin
- if ModuleHandle <> nil then UnloadModule(ModuleHandle);
+ if ModuleHandle <> nil then dlclose(ModuleHandle);
inherited Destroy;
end;
@@ -963,7 +963,7 @@ var Handle: PDirectoryStream;
DirEnt: PDirent64;
s: string;
PluginItem: TVFSPlugin;
- ModuleHandler: TModuleHandle;
+ ModuleHandler: Pointer;
VFSVersionFunc: TVFSVersion;
i: integer;
Buf: PChar;
@@ -1020,16 +1020,18 @@ begin
end;
ModuleHandler := nil;
- if b then DebugMsg(['Module ', s, ' is already loaded --> skipping...']) else
- if not LoadModule(ModuleHandler, IncludeTrailingPathDelimiter(s) + Buf) then DebugMsg([' XXX Error loading module: ', dlerror])
- else try
- @VFSVersionFunc := GetModuleSymbol(ModuleHandler, 'VFSVersion');
+ if b then DebugMsg(['Module ', s, ' is already loaded --> skipping...']) else begin
+ ModuleHandler := dlopen(PChar(IncludeTrailingPathDelimiter(s) + Buf), RTLD_LAZY);
+ if ModuleHandler = nil then DebugMsg([' XXX Error loading module: ', dlerror])
+ else try
+ @VFSVersionFunc := dlsym(ModuleHandler, 'VFSVersion');
if (@VFSVersionFunc <> nil) and (VFSVersionFunc >= ConstVFSVersionRequired) then begin
PluginItem := TVFSPlugin.Create(ModuleHandler);
PluginItem.FullPath := IncludeTrailingPathDelimiter(s) + Buf;
PluginList.Add(PluginItem);
end else DebugMsg([' $XXX: Error getting version info or version mismatch']);
except end;
+ end;
end;
end;
until DirEnt = nil;
@@ -1049,7 +1051,7 @@ begin
if Assigned(PluginList) and (PluginList.Count > 0) then
for i := PluginList.Count - 1 downto 0 do
try
- UnloadModule(TVFSPlugin(PluginList[i]).ModuleHandle);
+ dlclose(TVFSPlugin(PluginList[i]).ModuleHandle);
TVFSPlugin(PluginList[i]).Free;
PluginList.Delete(i);
except