Next: Protected methods
Up: PKGFS
Previous: PKGFS
Indice
Since we need C++ to communicate with C programming language (the
lufsd language), we had to add the typical ``
''
compatility layer. This layer affects PKGFS functions in several ways:
first, as a convention to rename the functions, we replaced the ``pkgfs''
string in lufsd symbols, with the ``do''. The only exception are
and
that become
respectively the class constructor and the destructor. Secondly, in
C notation each function (except init()) gets a pointer to the structure
allocated by init() in its first parameter. This structure acts as
a local context and in the newer programming paradigm
it is replaced by the object itself. A function that appearsin the interface as
,
becomes
.
Most file system operations return 0 on success and -1 on failure,
unlike the
one that will return 1 on success
and 0 upon failure.
Description of interesting publicly available methods follows (we
are using
namespace):
-
.
If lufsd starts with PackageFS support, it invokes this method at
initialization time. It provides a list of configuration options in
the first parameter, and pointers to owning cache and credentials.
At the very beginning these values are stored in private variables.
In addition, the baselevel is set. The baselevel, represents
the subdirectory level that holds packages entries at level-one.
We will say more about this near the end of this section. Subsequently
the function retrieves the distribution information and instantiates
two objects: the first one is specific for iteration of the corresponding
package manager cache. The second instance implements real low-level
package manager interaction. In the end it assigns them both to the
virtual objects providing class abstraction (virtual interface for
package iterator is simply
);
~
destroys its private objects;
-
. The job of this function consists in
building the virtual tree. It creates an instance of the Vtree object
and then tries to fetch data from the PackageFS disk cache. If this
operation does not succeed, it builds the whole tree from scratch:
at first it asks the PkgManager object to retrieve the cache of the
low-level package manager and to put information in a buffer. Then
it creates the base directories according to the given configuration
(by section, priority, both or none), and at last inserts all packages
entries in the tree. While creating an
subdirectory
the
fakefile is placed. If a package is in the installed
status, PKGFS must also ask PkgManager for owned files, dependencies
and reverse dependencies, and then it has to build their entries too;
-
writes the virtual tree cache on disk;
-
. This is the method that permits
to install a package on the system. Directories can be created only
inside the
subtree: if a level-one entry is made,
the PkgManager object is invoked for installation of the package named
as the entry itself. If the installation succeeds, the package subtree
is built in the same way the program did at mount time;
-
is the opposite of
;
-
. The current implementation
provides this method only for creation of the
fakefiles
in the
subtree. This possibility is needed when
a user wants to install a package copying an
entry. In future versions the creation of the
fakefiles
will be not publicly available anymore, since it is only a PackageFS
internal duty. Thus this method will be empty;
-
:
it is
tuned to read only the
fakefiles. When reading
such a file, PkgManager is invoked to put packages metadata in a buffer.
Then the function behaves like standard read;
-
is interesting because it always succeeds. It simply simulates successful
writing, since we never write any data, but merely empty fakefiles.
However these latter have a fixed size which is needed to temporarily
hold metadata. Unfortunately it is not possible to create zero-sized
fakefiles like in procfs, because of LUFS kernel module implementation;
-
. The interesting
feature provided by this function consists in upgrading packages and
updating their database as the user respectively updates the modification
time of
or
directories.
Next: Protected methods
Up: PKGFS
Previous: PKGFS
Indice
2004-11-19