From: Kern Sibbald Date: Mon, 6 Oct 2008 07:35:32 +0000 (+0000) Subject: Update plugin API X-Git-Tag: Release-3.0.0~866 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a17e310e7698309fdb36ebed1dc1a3c850af0260;p=bacula%2Fdocs Update plugin API --- diff --git a/docs/manuals/en/concepts/concepts.kilepr b/docs/manuals/en/concepts/concepts.kilepr index a1fa5759..f0abd040 100644 --- a/docs/manuals/en/concepts/concepts.kilepr +++ b/docs/manuals/en/concepts/concepts.kilepr @@ -161,10 +161,10 @@ order=-1 [item:newfeatures.tex] archive=true -column=47 +column=49 encoding=UTF-8 highlight=LaTeX -line=259 +line=544 open=true order=0 diff --git a/docs/manuals/en/concepts/newfeatures.tex b/docs/manuals/en/concepts/newfeatures.tex index 4c8a1ad7..5a571dc9 100644 --- a/docs/manuals/en/concepts/newfeatures.tex +++ b/docs/manuals/en/concepts/newfeatures.tex @@ -542,7 +542,7 @@ catalog. \section{Miscellaneous} \index[general]{Misc New Features} -\subsection{Allow Mixed Priority = \lt{}yes|no\g{}} +\subsection{Allow Mixed Priority = \lt{}yes|no\gt{}} This directive is only implemented in version 2.5 and later. When set to {\bf yes} (default {\bf no}), this job may run even if lower priority jobs are already running. This means a high priority job @@ -1317,6 +1317,59 @@ struct restore_pkt { }; \end{verbatim} +Typical code to create a regular file would be the following: + +\begin{verbatim} + struct plugin_ctx *p_ctx = (struct plugin_ctx *)ctx->pContext; + time_t now = time(NULL); + sp->fname = p_ctx->fname; /* set the full path/filename I want to create */ + sp->type = FT_REG; + sp->statp.st_mode = 0700 | S_IFREG; + sp->statp.st_ctime = now; + sp->statp.st_mtime = now; + sp->statp.st_atime = now; + sp->statp.st_size = -1; + sp->statp.st_blksize = 4096; + sp->statp.st_blocks = 1; + return bRC_OK; +\end{verbatim} + +This will create a virtual file. If you are creating a file that actually +exists, you will most likely want to fill the statp packet using the +stat() system call. + +Creating a directory is similar, but requires a few extra steps: + +\begin{verbatim} + struct plugin_ctx *p_ctx = (struct plugin_ctx *)ctx->pContext; + time_t now = time(NULL); + sp->fname = p_ctx->fname; /* set the full path I want to create */ + sp->link = xxx; where xxx is p_ctx->fname with a trailing forward slash + sp->type = FT_DIREND + sp->statp.st_mode = 0700 | S_IFDIR; + sp->statp.st_ctime = now; + sp->statp.st_mtime = now; + sp->statp.st_atime = now; + sp->statp.st_size = -1; + sp->statp.st_blksize = 4096; + sp->statp.st_blocks = 1; + return bRC_OK; +\end{verbatim} + +The link field must be set with the full cononical path name, which always +ends with a forward slash. If you do not terminate it with a forward slash, +you will surely have problems later. + +As with the example that creates a file, if you are backing up a real +directory, you will want to do an stat() on the directory. + +Note, if you want the directory permissions and times to be correctly +restored, you must create the directory {\bf after} all the file directories +have been sent to Bacula. That allows the restore process to restore all the +files in a directory using default directory options, then at the end, restore +the directory permissions. If you do it the other way around, each time you +restore a file, the OS will modify the time values for the directory entry. + \subsection{setFileAttributes(bpContext *ctx, struct restore\_pkt *rp)} This is call not yet implemented. diff --git a/docs/manuals/en/install/dirdconf.tex b/docs/manuals/en/install/dirdconf.tex index 4c88d7a9..21741bea 100644 --- a/docs/manuals/en/install/dirdconf.tex +++ b/docs/manuals/en/install/dirdconf.tex @@ -1687,7 +1687,7 @@ priority ones. This insures that Bacula will examine the jobs in the correct order, and that your priority scheme will be respected. \label{AllowMixedPriority} -\item [Allow Mixed Priority = \lt{}yes|no\g{}] +\item [Allow Mixed Priority = \lt{}yes|no\gt{}] \index[dir]{Allow Mixed Priority} \index[dir]{Directive|Allow Mixed Priority}