.TH "mount.c" 3elektra "Sat Oct 8 2022" "Version 0.9.11" "Elektra" \" -*- nroff -*-
.ad l
.nh
.SH NAME
mount.c \- Internals of mount functionality\&.  

.SH SYNOPSIS
.br
.PP
\fC#include <stdio\&.h>\fP
.br
\fC#include <kdbassert\&.h>\fP
.br
\fC#include 'kdbinternal\&.h'\fP
.br

.SS "Functions"

.in +1c
.ti -1c
.RI "int \fBmountOpen\fP (KDB *kdb, KeySet *config, KeySet *modules, Key *errorKey)"
.br
.RI "Creates a trie from a given configuration\&. "
.ti -1c
.RI "int \fBmountDefault\fP (KDB *kdb, KeySet *modules, int inFallback, Key *errorKey)"
.br
.RI "Reopens the default backend and mounts the default backend if needed\&. "
.ti -1c
.RI "int \fBelektraMountGlobalsLoadPlugin\fP (Plugin **plugin, KeySet *referencePlugins, Key *cur, KeySet *global, KeySet *system, KeySet *modules, Key *errorKey)"
.br
.RI "Loads global plugin\&. "
.ti -1c
.RI "int \fBmountModules\fP (KDB *kdb, KeySet *modules, Key *errorKey)"
.br
.RI "Mount all module configurations\&. "
.ti -1c
.RI "int \fBmountVersion\fP (KDB *kdb, Key *errorKey)"
.br
.RI "Mount the version backend\&. "
.ti -1c
.RI "int \fBmountBackend\fP (KDB *kdb, Backend *backend, Key *errorKey)"
.br
.RI "Mounts a backend into the trie\&. "
.ti -1c
.RI "Key * \fBmountGetMountpoint\fP (KDB *handle, const char *where)"
.br
.RI "Lookup a mountpoint in a handle for a specific key\&. "
.ti -1c
.RI "Backend * \fBmountGetBackend\fP (KDB *handle, const char *where)"
.br
.RI "Lookup a backend handle for a specific key\&. "
.in -1c
.SH "Detailed Description"
.PP 
Internals of mount functionality\&. 


.PP
\fBCopyright\fP
.RS 4
BSD License (see LICENSE\&.md or https://www.libelektra.org) 
.RE
.PP

.SH "Function Documentation"
.PP 
.SS "int elektraMountGlobalsLoadPlugin (Plugin ** plugin, KeySet * referencePlugins, Key * cur, KeySet * global, KeySet * system, KeySet * modules, Key * errorKey)"

.PP
Loads global plugin\&. 
.PP
\fBReturn values\fP
.RS 4
\fI-1\fP on failure 
.br
\fI0\fP on empty plugin name (nothing configured at given position) 
.br
\fI1\fP on success 
.RE
.PP

.SS "int mountBackend (KDB * kdb, Backend * backend, Key * errorKey)"

.PP
Mounts a backend into the trie\&. 
.PP
\fBPrecondition\fP
.RS 4
user must pass correctly allocated backend 
.RE
.PP
\fBPostcondition\fP
.RS 4
sets reference counter of backend
.RE
.PP
\fBWarning\fP
.RS 4
in case of init and default backends, the reference counter needs to be modified \fIafter\fP calling mountBackend\&.
.RE
.PP
\fBParameters\fP
.RS 4
\fIkdb\fP the handle to work with 
.br
\fIbackend\fP the backend to mount 
.br
\fIerrorKey\fP the key used to report warnings 
.RE
.PP
\fBReturn values\fP
.RS 4
\fI-1\fP on failure 
.br
\fI1\fP on success 
.RE
.PP

.SS "int mountDefault (KDB * kdb, KeySet * modules, int inFallback, Key * errorKey)"

.PP
Reopens the default backend and mounts the default backend if needed\&. 
.PP
\fBPrecondition\fP
.RS 4
Default Backend is closed\&. mountOpen was executed before\&.
.RE
.PP
\fBParameters\fP
.RS 4
\fIkdb\fP the handle to work with 
.br
\fImodules\fP the current list of loaded modules 
.br
\fIerrorKey\fP the key used to report warnings 
.RE
.PP
\fBReturn values\fP
.RS 4
\fI-1\fP on error 
.br
\fI0\fP on success 
.RE
.PP

.SS "Backend* mountGetBackend (KDB * handle, const char * where)"

.PP
Lookup a backend handle for a specific key\&. The required canonical name is ensured by using a key as parameter, which will transform the key to canonical representation\&.
.PP
Will return handle when no more specific KDB could be found\&.
.PP
If key is 0 or invalid the default backend will be returned\&.
.PP
\fBParameters\fP
.RS 4
\fIhandle\fP is the data structure, where the mounted directories are saved\&. 
.br
\fIwhere\fP the key name, that should be looked up\&. 
.RE
.PP
\fBReturns\fP
.RS 4
the backend handle associated with the key 
.RE
.PP

.SS "Key* mountGetMountpoint (KDB * handle, const char * where)"

.PP
Lookup a mountpoint in a handle for a specific key\&. Will return a key representing the mountpoint or null if there is no appropriate mountpoint e\&.g\&. its the root mountpoint\&.
.PP
\fBExample:\fP
.RS 4

.PP
.nf
KDB * handle = kdbOpen();
Key *mountpoint=0;
mountpoint=kdbGetMountpoint(handle, "system:/template");

printf("The backend I am using is %s mounted in %s\n",
        keyValue(mountpoint),
        keyName(mountpoint));
kdbClose (handle);

.fi
.PP
.RE
.PP
\fBParameters\fP
.RS 4
\fIhandle\fP is the data structure, where the mounted directories are saved\&. 
.br
\fIwhere\fP the key name, that should be looked up\&. 
.RE
.PP
\fBReturns\fP
.RS 4
the mountpoint associated with the key 
.RE
.PP

.SS "int mountModules (KDB * kdb, KeySet * modules, Key * errorKey)"

.PP
Mount all module configurations\&. 
.PP
\fBParameters\fP
.RS 4
\fIkdb\fP the handle to work with 
.br
\fImodules\fP the current list of loaded modules 
.br
\fIerrorKey\fP the key used to report warnings
.RE
.PP
\fBReturn values\fP
.RS 4
\fI-1\fP if not rootkey was found 
.br
\fI0\fP otherwise 
.RE
.PP

.SS "int mountOpen (KDB * kdb, KeySet * config, KeySet * modules, Key * errorKey)"

.PP
Creates a trie from a given configuration\&. The config will be deleted within this function\&.
.PP
\fBNote\fP
.RS 4
mountDefault is not allowed to be executed before
.RE
.PP
\fBParameters\fP
.RS 4
\fIkdb\fP the handle to work with 
.br
\fImodules\fP the current list of loaded modules 
.br
\fIconfig\fP the configuration which should be used to build up the trie\&. 
.br
\fIerrorKey\fP the key used to report warnings 
.RE
.PP
\fBReturn values\fP
.RS 4
\fI-1\fP on failure 
.br
\fI0\fP on success 
.RE
.PP

.SS "int mountVersion (KDB * kdb, Key * errorKey)"

.PP
Mount the version backend\&. 
.PP
\fBParameters\fP
.RS 4
\fIkdb\fP the handle to work with 
.br
\fIerrorKey\fP the key used to report warnings
.RE
.PP
\fBReturn values\fP
.RS 4
\fI0\fP on success 
.RE
.PP

.SH "Author"
.PP 
Generated automatically by Doxygen for Elektra from the source code\&.
