\hypertarget{mount_8c}{\section{mount.\+c File Reference}
\label{mount_8c}\index{mount.\+c@{mount.\+c}}
}


Interna of mount functionality.  


{\ttfamily \#include \char`\"{}kdbinternal.\+h\char`\"{}}\\*
Include dependency graph for mount.\+c\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{mount_8c__incl}
\end{center}
\end{figure}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
int \hyperlink{mount_8c_a1ff489dcf9cab7c95f88bb5a89242d9d}{mount\+Open} (K\+D\+B $\ast$kdb, Key\+Set $\ast$config, Key\+Set $\ast$modules, Key $\ast$error\+Key)
\begin{DoxyCompactList}\small\item\em Creates a trie from a given configuration. \end{DoxyCompactList}\item 
int \hyperlink{mount_8c_a30835e0251609a411eea1d629f5f1729}{mount\+Default} (K\+D\+B $\ast$kdb, Key\+Set $\ast$modules, int in\+Fallback, Key $\ast$error\+Key)
\begin{DoxyCompactList}\small\item\em Reopens the default backend and mounts the default backend if needed. \end{DoxyCompactList}\item 
int \hyperlink{mount_8c_aef6fc92aedac3c04188c89e8a54f3c5f}{mount\+Modules} (K\+D\+B $\ast$kdb, Key\+Set $\ast$modules, Key $\ast$error\+Key)
\begin{DoxyCompactList}\small\item\em Mount all module configurations. \end{DoxyCompactList}\item 
int \hyperlink{mount_8c_a23024da76a37a7d29b95d052ba17644e}{mount\+Version} (K\+D\+B $\ast$kdb, Key $\ast$error\+Key)
\begin{DoxyCompactList}\small\item\em Mount the version backend. \end{DoxyCompactList}\item 
int \hyperlink{mount_8c_aae740f9dc4ff807f236a78a443c66524}{mount\+Backend} (K\+D\+B $\ast$kdb, Backend $\ast$backend, Key $\ast$error\+Key)
\begin{DoxyCompactList}\small\item\em Mounts a backend into the trie. \end{DoxyCompactList}\item 
Key $\ast$ \hyperlink{mount_8c_a06bb59784fce5582ee1363fdb6a59215}{mount\+Get\+Mountpoint} (K\+D\+B $\ast$handle, const Key $\ast$where)
\begin{DoxyCompactList}\small\item\em Lookup a mountpoint in a handle for a specific key. \end{DoxyCompactList}\item 
Backend $\ast$ \hyperlink{mount_8c_a1db75a434f913420942d6896123c5a66}{mount\+Get\+Backend} (K\+D\+B $\ast$handle, const Key $\ast$key)
\begin{DoxyCompactList}\small\item\em Lookup a backend handle for a specific key. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Interna of mount functionality. 

\begin{DoxyCopyright}{Copyright}
B\+S\+D License (see doc/\+L\+I\+C\+E\+N\+S\+E.\+md or \href{http://www.libelektra.org}{\tt http\+://www.\+libelektra.\+org}) 
\end{DoxyCopyright}


\subsection{Function Documentation}
\hypertarget{mount_8c_aae740f9dc4ff807f236a78a443c66524}{\index{mount.\+c@{mount.\+c}!mount\+Backend@{mount\+Backend}}
\index{mount\+Backend@{mount\+Backend}!mount.\+c@{mount.\+c}}
\subsubsection[{mount\+Backend}]{\setlength{\rightskip}{0pt plus 5cm}int mount\+Backend (
\begin{DoxyParamCaption}
\item[{K\+D\+B $\ast$}]{kdb, }
\item[{Backend $\ast$}]{backend, }
\item[{Key $\ast$}]{error\+Key}
\end{DoxyParamCaption}
)}}\label{mount_8c_aae740f9dc4ff807f236a78a443c66524}


Mounts a backend into the trie. 

\begin{DoxyPrecond}{Precondition}
user must pass correctly allocated backend 
\end{DoxyPrecond}
\begin{DoxyPostcond}{Postcondition}
sets reference counter of backend
\end{DoxyPostcond}
\begin{DoxyWarning}{Warning}
in case of init and default backends, the reference counter needs to be modified {\itshape after} calling mount\+Backend.
\end{DoxyWarning}

\begin{DoxyParams}{Parameters}
{\em kdb} & the handle to work with \\
\hline
{\em backend} & the backend to mount \\
\hline
{\em error\+Key} & the key used to report warnings \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em -\/1} & on failure \\
\hline
{\em 1} & on success \\
\hline
\end{DoxyRetVals}
\hypertarget{mount_8c_a30835e0251609a411eea1d629f5f1729}{\index{mount.\+c@{mount.\+c}!mount\+Default@{mount\+Default}}
\index{mount\+Default@{mount\+Default}!mount.\+c@{mount.\+c}}
\subsubsection[{mount\+Default}]{\setlength{\rightskip}{0pt plus 5cm}int mount\+Default (
\begin{DoxyParamCaption}
\item[{K\+D\+B $\ast$}]{kdb, }
\item[{Key\+Set $\ast$}]{modules, }
\item[{int}]{in\+Fallback, }
\item[{Key $\ast$}]{error\+Key}
\end{DoxyParamCaption}
)}}\label{mount_8c_a30835e0251609a411eea1d629f5f1729}


Reopens the default backend and mounts the default backend if needed. 

\begin{DoxyPrecond}{Precondition}
Default Backend is closed. mount\+Open was executed before.
\end{DoxyPrecond}

\begin{DoxyParams}{Parameters}
{\em kdb} & the handle to work with \\
\hline
{\em modules} & the current list of loaded modules \\
\hline
{\em error\+Key} & the key used to report warnings \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em -\/1} & on error \\
\hline
{\em 0} & on success \\
\hline
\end{DoxyRetVals}
\hypertarget{mount_8c_a1db75a434f913420942d6896123c5a66}{\index{mount.\+c@{mount.\+c}!mount\+Get\+Backend@{mount\+Get\+Backend}}
\index{mount\+Get\+Backend@{mount\+Get\+Backend}!mount.\+c@{mount.\+c}}
\subsubsection[{mount\+Get\+Backend}]{\setlength{\rightskip}{0pt plus 5cm}Backend$\ast$ mount\+Get\+Backend (
\begin{DoxyParamCaption}
\item[{K\+D\+B $\ast$}]{handle, }
\item[{const Key $\ast$}]{key}
\end{DoxyParamCaption}
)}}\label{mount_8c_a1db75a434f913420942d6896123c5a66}


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.

Will return handle when no more specific K\+D\+B could be found.

If key is 0 or invalid the default backend will be returned.


\begin{DoxyParams}{Parameters}
{\em handle} & is the data structure, where the mounted directories are saved. \\
\hline
{\em key} & the key, that should be looked up. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the backend handle associated with the key 
\end{DoxyReturn}
\hypertarget{mount_8c_a06bb59784fce5582ee1363fdb6a59215}{\index{mount.\+c@{mount.\+c}!mount\+Get\+Mountpoint@{mount\+Get\+Mountpoint}}
\index{mount\+Get\+Mountpoint@{mount\+Get\+Mountpoint}!mount.\+c@{mount.\+c}}
\subsubsection[{mount\+Get\+Mountpoint}]{\setlength{\rightskip}{0pt plus 5cm}Key$\ast$ mount\+Get\+Mountpoint (
\begin{DoxyParamCaption}
\item[{K\+D\+B $\ast$}]{handle, }
\item[{const Key $\ast$}]{where}
\end{DoxyParamCaption}
)}}\label{mount_8c_a06bb59784fce5582ee1363fdb6a59215}


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.

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}
1 Key * key = keyNew ("system/template");
2 KDB * handle = kdbOpen();
3 Key *mountpoint=0;
4 mountpoint=kdbGetMountpoint(handle, key);
5 
6 printf("The backend I am using is %s mounted in %s\(\backslash\)n",
7         keyValue(mountpoint),
8         keyName(mountpoint));
9 kdbClose (handle);
10 keyDel (key);
\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em handle} & is the data structure, where the mounted directories are saved. \\
\hline
{\em where} & the key, that should be looked up. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the mountpoint associated with the key 
\end{DoxyReturn}
\hypertarget{mount_8c_aef6fc92aedac3c04188c89e8a54f3c5f}{\index{mount.\+c@{mount.\+c}!mount\+Modules@{mount\+Modules}}
\index{mount\+Modules@{mount\+Modules}!mount.\+c@{mount.\+c}}
\subsubsection[{mount\+Modules}]{\setlength{\rightskip}{0pt plus 5cm}int mount\+Modules (
\begin{DoxyParamCaption}
\item[{K\+D\+B $\ast$}]{kdb, }
\item[{Key\+Set $\ast$}]{modules, }
\item[{Key $\ast$}]{error\+Key}
\end{DoxyParamCaption}
)}}\label{mount_8c_aef6fc92aedac3c04188c89e8a54f3c5f}


Mount all module configurations. 


\begin{DoxyParams}{Parameters}
{\em kdb} & the handle to work with \\
\hline
{\em modules} & the current list of loaded modules \\
\hline
{\em error\+Key} & the key used to report warnings\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em -\/1} & if not rootkey was found \\
\hline
{\em 0} & otherwise \\
\hline
\end{DoxyRetVals}
\hypertarget{mount_8c_a1ff489dcf9cab7c95f88bb5a89242d9d}{\index{mount.\+c@{mount.\+c}!mount\+Open@{mount\+Open}}
\index{mount\+Open@{mount\+Open}!mount.\+c@{mount.\+c}}
\subsubsection[{mount\+Open}]{\setlength{\rightskip}{0pt plus 5cm}int mount\+Open (
\begin{DoxyParamCaption}
\item[{K\+D\+B $\ast$}]{kdb, }
\item[{Key\+Set $\ast$}]{config, }
\item[{Key\+Set $\ast$}]{modules, }
\item[{Key $\ast$}]{error\+Key}
\end{DoxyParamCaption}
)}}\label{mount_8c_a1ff489dcf9cab7c95f88bb5a89242d9d}


Creates a trie from a given configuration. 

The config will be deleted within this function.

is not allowed to be executed before


\begin{DoxyParams}{Parameters}
{\em kdb} & the handle to work with \\
\hline
{\em modules} & the current list of loaded modules \\
\hline
{\em config} & the configuration which should be used to build up the trie. \\
\hline
{\em error\+Key} & the key used to report warnings \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em -\/1} & on failure \\
\hline
{\em 0} & on success \\
\hline
\end{DoxyRetVals}
\hypertarget{mount_8c_a23024da76a37a7d29b95d052ba17644e}{\index{mount.\+c@{mount.\+c}!mount\+Version@{mount\+Version}}
\index{mount\+Version@{mount\+Version}!mount.\+c@{mount.\+c}}
\subsubsection[{mount\+Version}]{\setlength{\rightskip}{0pt plus 5cm}int mount\+Version (
\begin{DoxyParamCaption}
\item[{K\+D\+B $\ast$}]{kdb, }
\item[{Key $\ast$}]{error\+Key}
\end{DoxyParamCaption}
)}}\label{mount_8c_a23024da76a37a7d29b95d052ba17644e}


Mount the version backend. 


\begin{DoxyParams}{Parameters}
{\em kdb} & the handle to work with \\
\hline
{\em error\+Key} & the key used to report warnings\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em 0} & on success \\
\hline
\end{DoxyRetVals}
