Whole document tree
Implementing an access method in practiceImplementing a new access method is really not difficult at all. This section explains how this is done. Using shared librariesEvery module must be compiled as a shared library (i.e. a .so file). The current way for accessing the right module for the right method is very simple, and is based on file names. In practice, a module implementing access method named foo must be named libfoo.so. For example, the module implementing the ftp: access method is called libftp.so, the module implementing #gzip access is called libgzip.so and so on. This might change in the future. The initialization/shutdown functionsEvery shared library module must provide two functions:
These are the only functions that the VFS library will access directly. All the other symbols (i.e. functions and variables) in the module should be made static. vfs_module_init() is called as soon as the module is loaded in memory. It will have to return a pointer to a GnomeVFSMethod object that will contain the pointers to the method's implementation functions. We will describe this later. vfs_module_shutdown, instead, is called before the module is unloaded or the program that uses it dies. This functions should:
The GnomeVFSMethod objectThis object is contains pointers to the module implementation functions.
|