Sophie

Sophie

distrib > Fedora > 16 > i386 > by-pkgid > df754e4e6f7f5fc8ab9d6ed8559f3e3d > files > 73

bacula-docs-5.0.3-19.fc16.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<!--Converted with LaTeX2HTML 2008 (1.71)
original version by:  Nikos Drakos, CBLU, University of Leeds
* revised and updated by:  Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
  Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>Plugin Entry Points</TITLE>
<META NAME="description" CONTENT="Plugin Entry Points">
<META NAME="keywords" CONTENT="developers">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">

<META NAME="Generator" CONTENT="LaTeX2HTML v2008">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">

<LINK REL="STYLESHEET" HREF="developers.css">

<LINK REL="next" HREF="Bacula_Plugin_Entrypoints.html">
<LINK REL="previous" HREF="loadPlugin.html">
<LINK REL="up" HREF="Bacula_FD_Plugin_API.html">
<LINK REL="next" HREF="Bacula_Plugin_Entrypoints.html">
</HEAD>

<BODY >
<!--Navigation Panel-->
<A NAME="tex2html698"
  HREF="Bacula_Plugin_Entrypoints.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> 
<A NAME="tex2html692"
  HREF="Bacula_FD_Plugin_API.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> 
<A NAME="tex2html686"
  HREF="loadPlugin.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> 
<A NAME="tex2html694"
  HREF="Contents.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> 
<A NAME="tex2html696"
  HREF="GNU_Free_Documentation_Lice.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html699"
  HREF="Bacula_Plugin_Entrypoints.html">Bacula Plugin Entrypoints</A>
<B> Up:</B> <A NAME="tex2html693"
  HREF="Bacula_FD_Plugin_API.html">Bacula FD Plugin API</A>
<B> Previous:</B> <A NAME="tex2html687"
  HREF="loadPlugin.html">loadPlugin</A>
 &nbsp; <B>  <A NAME="tex2html695"
  HREF="Contents.html">Contents</A></B> 
 &nbsp; <B>  <A NAME="tex2html697"
  HREF="GNU_Free_Documentation_Lice.html">Index</A></B> 
<BR>
<BR>
<!--End of Navigation Panel-->
<!--Table of Child-Links-->
<A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></A>

<UL>
<LI><A NAME="tex2html700"
  HREF="Plugin_Entry_Points.html#SECTION00441000000000000000">newPlugin(bpContext *ctx)</A>
<LI><A NAME="tex2html701"
  HREF="Plugin_Entry_Points.html#SECTION00442000000000000000">freePlugin(bpContext *ctx)</A>
<LI><A NAME="tex2html702"
  HREF="Plugin_Entry_Points.html#SECTION00443000000000000000">getPluginValue(bpContext *ctx, pVariable var, void *value)</A>
<LI><A NAME="tex2html703"
  HREF="Plugin_Entry_Points.html#SECTION00444000000000000000">setPluginValue(bpContext *ctx, pVariable var, void *value)</A>
<LI><A NAME="tex2html704"
  HREF="Plugin_Entry_Points.html#SECTION00445000000000000000">handlePluginEvent(bpContext *ctx, bEvent *event, void *value)</A>
<LI><A NAME="tex2html705"
  HREF="Plugin_Entry_Points.html#SECTION00446000000000000000">startBackupFile(bpContext *ctx, struct save_pkt *sp)</A>
<LI><A NAME="tex2html706"
  HREF="Plugin_Entry_Points.html#SECTION00447000000000000000">endBackupFile(bpContext *ctx)</A>
<LI><A NAME="tex2html707"
  HREF="Plugin_Entry_Points.html#SECTION00448000000000000000">startRestoreFile(bpContext *ctx, const char *cmd)</A>
<LI><A NAME="tex2html708"
  HREF="Plugin_Entry_Points.html#SECTION00449000000000000000">createFile(bpContext *ctx, struct restore_pkt *rp)</A>
<LI><A NAME="tex2html709"
  HREF="Plugin_Entry_Points.html#SECTION004410000000000000000">setFileAttributes(bpContext *ctx, struct restore_pkt *rp)</A>
<LI><A NAME="tex2html710"
  HREF="Plugin_Entry_Points.html#SECTION004411000000000000000">endRestoreFile(bpContext *ctx)</A>
<LI><A NAME="tex2html711"
  HREF="Plugin_Entry_Points.html#SECTION004412000000000000000">pluginIO(bpContext *ctx, struct io_pkt *io)</A>
<LI><A NAME="tex2html712"
  HREF="Plugin_Entry_Points.html#SECTION004413000000000000000">bool checkFile(bpContext *ctx, char *fname)</A>
</UL>
<!--End of Table of Child-Links-->
<HR>

<H1><A NAME="SECTION00440000000000000000">
Plugin Entry Points</A>
</H1>
This section will describe each of the entry points (subroutines) within
the plugin that the plugin must provide for Bacula, when they are called
and their arguments. As noted above, pointers to these subroutines are
passed back to Bacula in the pFuncs structure when Bacula calls the 
loadPlugin() externally defined entry point.

<P>

<H2><A NAME="SECTION00441000000000000000">
newPlugin(bpContext *ctx)</A>
</H2>
  This is the entry point that Bacula will call
  when a new "instance" of the plugin is created. This typically
  happens at the beginning of a Job.  If 10 Jobs are running
  simultaneously, there will be at least 10 instances of the
  plugin.

<P>
The bpContext structure will be passed to the plugin, and
  during this call, if the plugin needs to have its private
  working storage that is associated with the particular
  instance of the plugin, it should create it from the heap
  (malloc the memory) and store a pointer to
  its private working storage in the <B>pContext</B> variable.
  Note: since Bacula is a multi-threaded program, you must not
  keep any variable data in your plugin unless it is truely meant
  to apply globally to the whole plugin.  In addition, you must
  be aware that except the first and last call to the plugin
  (loadPlugin and unloadPlugin) all the other calls will be 
  made by threads that correspond to a Bacula job.  The 
  bpContext that will be passed for each thread will remain the
  same throughout the Job thus you can keep your privat Job specific
  data in it (<B>bContext</B>).

<P>
<PRE>
typedef struct s_bpContext {
  void *pContext;   /* Plugin private context */
  void *bContext;   /* Bacula private context */
} bpContext;
</PRE>

<P>
This context pointer will be passed as the first argument to all
  the entry points that Bacula calls within the plugin.  Needless
  to say, the plugin should not change the bContext variable, which
  is Bacula's private context pointer for this instance (Job) of this
  plugin.

<P>

<H2><A NAME="SECTION00442000000000000000">
freePlugin(bpContext *ctx)</A>
</H2>
This entry point is called when the
this instance of the plugin is no longer needed (the Job is
ending), and the plugin should release all memory it may
have allocated for this particular instance (Job) i.e. the pContext.  
This is not the final termination
of the plugin signaled by a call to <B>unloadPlugin</B>. 
Any other instances (Job) will
continue to run, and the entry point <B>newPlugin</B> may be called
again if other jobs start.

<P>

<H2><A NAME="SECTION00443000000000000000">
getPluginValue(bpContext *ctx, pVariable var, void *value)</A>
</H2> 
Bacula will call this entry point to get
a value from the plugin.  This entry point is currently not called.

<P>

<H2><A NAME="SECTION00444000000000000000">
setPluginValue(bpContext *ctx, pVariable var, void *value)</A>
</H2>
Bacula will call this entry point to set
a value in the plugin.  This entry point is currently not called.

<P>

<H2><A NAME="SECTION00445000000000000000">
handlePluginEvent(bpContext *ctx, bEvent *event, void *value)</A>
</H2>
This entry point is called when Bacula
encounters certain events (discussed below). This is, in fact, the 
main way that most plugins get control when a Job runs and how
they know what is happening in the job. It can be likened to the
<B>RunScript</B> feature that calls external programs and scripts,
and is very similar to the Bacula Python interface.
When the plugin is called, Bacula passes it the pointer to an event
structure (bEvent), which currently has one item, the eventType:

<P>
<PRE>
typedef struct s_bEvent {
   uint32_t eventType;
} bEvent;
</PRE>

<P>
which defines what event has been triggered, and for each event,
  Bacula will pass a pointer to a value associated with that event.
  If no value is associated with a particular event, Bacula will 
  pass a NULL pointer, so the plugin must be careful to always check
  value pointer prior to dereferencing it.

<P>
The current list of events are:

<P>
<PRE>
typedef enum {
  bEventJobStart        = 1,
  bEventJobEnd          = 2,
  bEventStartBackupJob  = 3,
  bEventEndBackupJob    = 4,
  bEventStartRestoreJob = 5,
  bEventEndRestoreJob   = 6,
  bEventStartVerifyJob  = 7,
  bEventEndVerifyJob    = 8,
  bEventBackupCommand   = 9,
  bEventRestoreCommand  = 10,
  bEventLevel           = 11,
  bEventSince           = 12,
} bEventType;
</PRE>

<P>
Most of the above are self-explanatory.

<P>
<DL>
<DT><STRONG>bEventJobStart</STRONG></DT>
<DD>is called whenever a Job starts. The value
   passed is a pointer to a string that contains: "Jobid=nnn 
   Job=job-name". Where nnn will be replaced by the JobId and job-name
   will be replaced by the Job name. The variable is temporary so if you
   need the values, you must copy them.

<P>
</DD>
<DT><STRONG>bEventJobEnd</STRONG></DT>
<DD>is called whenever a Job ends. No value is passed.

<P>
</DD>
<DT><STRONG>bEventStartBackupJob</STRONG></DT>
<DD>is called when a Backup Job begins. No value
   is passed.

<P>
</DD>
<DT><STRONG>bEventEndBackupJob</STRONG></DT>
<DD>is called when a Backup Job ends. No value is 
   passed.

<P>
</DD>
<DT><STRONG>bEventStartRestoreJob</STRONG></DT>
<DD>is called when a Restore Job starts. No value
   is passed.

<P>
</DD>
<DT><STRONG>bEventEndRestoreJob</STRONG></DT>
<DD>is called when a Restore Job ends. No value is
   passed.

<P>
</DD>
<DT><STRONG>bEventStartVerifyJob</STRONG></DT>
<DD>is called when a Verify Job starts. No value
   is passed.

<P>
</DD>
<DT><STRONG>bEventEndVerifyJob</STRONG></DT>
<DD>is called when a Verify Job ends. No value
   is passed.

<P>
</DD>
<DT><STRONG>bEventBackupCommand</STRONG></DT>
<DD>is called prior to the bEventStartBackupJob and
   the plugin is passed the command string (everything after the equal sign
   in "Plugin =" as the value.

<P>
Note, if you intend to backup a file, this is an important first point to
   write code that copies the command string passed into your pContext area
   so that you will know that a backup is being performed and you will know
   the full contents of the "Plugin =" command (i.e. what to backup and
   what virtual filename the user wants to call it.

<P>
</DD>
<DT><STRONG>bEventRestoreCommand</STRONG></DT>
<DD>is called prior to the bEventStartRestoreJob and
   the plugin is passed the command string (everything after the equal sign
   in "Plugin =" as the value.

<P>
See the notes above concerning backup and the command string. This is the
   point at which Bacula passes you the original command string that was
   specified during the backup, so you will want to save it in your pContext
   area for later use when Bacula calls the plugin again.

<P>
</DD>
<DT><STRONG>bEventLevel</STRONG></DT>
<DD>is called when the level is set for a new Job. The value
   is a 32 bit integer stored in the void*, which represents the Job Level code.

<P>
</DD>
<DT><STRONG>bEventSince</STRONG></DT>
<DD>is called when the since time is set for a new Job. The 
   value is a time_t time at which the last job was run.
</DD>
</DL>

<P>
During each of the above calls, the plugin receives either no specific value or
only one value, which in some cases may not be sufficient.  However, knowing
the context of the event, the plugin can call back to the Bacula entry points
it was passed during the <B>loadPlugin</B> call and get to a number of Bacula
variables.  (at the current time few Bacula variables are implemented, but it
easily extended at a future time and as needs require).

<P>

<H2><A NAME="SECTION00446000000000000000">
startBackupFile(bpContext *ctx, struct save_pkt *sp)</A>
</H2>
This entry point is called only if your plugin is a command plugin, and 
it is called when Bacula encounters the "Plugin = " directive in
the Include section of the FileSet.
Called when beginning the backup of a file. Here Bacula provides you
with a pointer to the <B>save_pkt</B> structure and you must fill in 
this packet with the "attribute" data of the file.

<P>
<PRE>
struct save_pkt {
   int32_t pkt_size;                  /* size of this packet */
   char *fname;                       /* Full path and filename */
   char *link;                        /* Link name if any */
   struct stat statp;                 /* System stat() packet for file */
   int32_t type;                      /* FT_xx for this file */
   uint32_t flags;                    /* Bacula internal flags */
   bool portable;                     /* set if data format is portable */
   char *cmd;                         /* command */
   int32_t pkt_end;                   /* end packet sentinel */
};
</PRE>

<P>
The second argument is a pointer to the <B>save_pkt</B> structure for the file
to be backed up.  The plugin is responsible for filling in all the fields 
of the <B>save_pkt</B>. If you are backing up
a real file, then generally, the statp structure can be filled in by doing
a <B>stat</B> system call on the file.  

<P>
If you are backing up a database or
something that is more complex, you might want to create a virtual file.
That is a file that does not actually exist on the filesystem, but represents 
say an object that you are backing up.  In that case, you need to ensure
that the <B>fname</B> string that you pass back is unique so that it
does not conflict with a real file on the system, and you need to 
artifically create values in the statp packet.

<P>
Example programs such as <B>bpipe-fd.c</B> show how to set these fields.  You
must take care not to store pointers the stack in the pointer fields such as
fname and link, because when you return from your function, your stack entries
will be destroyed. The solution in that case is to malloc() and return the
pointer to it. In order to not have memory leaks, you should store a pointer to
all memory allocated in your pContext structure so that in subsequent calls or
at termination, you can release it back to the system.

<P>
Once the backup has begun, Bacula will call your plugin at the <B>pluginIO</B>
entry point to "read" the data to be backed up.  Please see the <B>bpipe-fd.c</B>
plugin for how to do I/O.

<P>
Example of filling in the save_pkt as used in bpipe-fd.c:

<P>
<PRE>
   struct plugin_ctx *p_ctx = (struct plugin_ctx *)ctx-&gt;pContext;
   time_t now = time(NULL);
   sp-&gt;fname = p_ctx-&gt;fname;
   sp-&gt;statp.st_mode = 0700 | S_IFREG;
   sp-&gt;statp.st_ctime = now;
   sp-&gt;statp.st_mtime = now;
   sp-&gt;statp.st_atime = now;
   sp-&gt;statp.st_size = -1;
   sp-&gt;statp.st_blksize = 4096;
   sp-&gt;statp.st_blocks = 1;
   p_ctx-&gt;backup = true;
   return bRC_OK;
</PRE>

<P>
Note: the filename to be created has already been created from the 
command string previously sent to the plugin and is in the plugin 
context (p_ctx-&gt;fname) and is a malloc()ed string.  This example
creates a regular file (S_IFREG), with various fields being created.

<P>
In general, the sequence of commands issued from Bacula to the plugin
to do a backup while processing the "Plugin = " directive are:

<P>

<OL>
<LI>generate a bEventBackupCommand event to the specified plugin
       and pass it the command string.
</LI>
<LI>make a startPluginBackup call to the plugin, which
       fills in the data needed in save_pkt to save as the file
       attributes and to put on the Volume and in the catalog.
</LI>
<LI>call Bacula's internal save_file() subroutine to save the specified
       file.  The plugin will then be called at pluginIO() to "open"
       the file, and then to read the file data.
       Note, if you are dealing with a virtual file, the "open" operation
       is something the plugin does internally and it doesn't necessarily
       mean opening a file on the filesystem.  For example in the case of
       the bpipe-fd.c program, it initiates a pipe to the requested program.
       Finally when the plugin signals to Bacula that all the data was read,
       Bacula will call the plugin with the "close" pluginIO() function.
</LI>
</OL>

<P>

<H2><A NAME="SECTION00447000000000000000">
endBackupFile(bpContext *ctx)</A>
</H2>
Called at the end of backing up a file for a command plugin.  If the plugin's
work is done, it should return bRC_OK.  If the plugin wishes to create another
file and back it up, then it must return bRC_More (not yet implemented).  This
is probably a good time to release any malloc()ed memory you used to pass back
filenames.

<P>

<H2><A NAME="SECTION00448000000000000000">
startRestoreFile(bpContext *ctx, const char *cmd)</A>
</H2>
Called when the first record is read from the Volume that was 
previously written by the command plugin.

<P>

<H2><A NAME="SECTION00449000000000000000">
createFile(bpContext *ctx, struct restore_pkt *rp)</A>
</H2>
Called for a command plugin to create a file during a Restore job before 
restoring the data. 
This entry point is called before any I/O is done on the file.  After
this call, Bacula will call pluginIO() to open the file for write.

<P>
The data in the 
restore_pkt is passed to the plugin and is based on the data that was
originally given by the plugin during the backup and the current user
restore settings (e.g. where, RegexWhere, replace).  This allows the
plugin to first create a file (if necessary) so that the data can
be transmitted to it.  The next call to the plugin will be a
pluginIO command with a request to open the file write-only.

<P>
This call must return one of the following values:

<P>
<PRE>
 enum {
   CF_SKIP = 1,       /* skip file (not newer or something) */
   CF_ERROR,          /* error creating file */
   CF_EXTRACT,        /* file created, data to extract */
   CF_CREATED         /* file created, no data to extract */
};
</PRE>

<P>
in the restore_pkt value <B>create_status</B>.  For a normal file,
unless there is an error, you must return <B>CF_EXTRACT</B>.

<P>
<PRE>
 
struct restore_pkt {
   int32_t pkt_size;                  /* size of this packet */
   int32_t stream;                    /* attribute stream id */
   int32_t data_stream;               /* id of data stream to follow */
   int32_t type;                      /* file type FT */
   int32_t file_index;                /* file index */
   int32_t LinkFI;                    /* file index to data if hard link */
   uid_t uid;                         /* userid */
   struct stat statp;                 /* decoded stat packet */
   const char *attrEx;                /* extended attributes if any */
   const char *ofname;                /* output filename */
   const char *olname;                /* output link name */
   const char *where;                 /* where */
   const char *RegexWhere;            /* regex where */
   int replace;                       /* replace flag */
   int create_status;                 /* status from createFile() */
   int32_t pkt_end;                   /* end packet sentinel */

};
</PRE>

<P>
Typical code to create a regular file would be the following:

<P>
<PRE>
   struct plugin_ctx *p_ctx = (struct plugin_ctx *)ctx-&gt;pContext;
   time_t now = time(NULL);
   sp-&gt;fname = p_ctx-&gt;fname;   /* set the full path/filename I want to create */
   sp-&gt;type = FT_REG;
   sp-&gt;statp.st_mode = 0700 | S_IFREG;
   sp-&gt;statp.st_ctime = now;
   sp-&gt;statp.st_mtime = now;
   sp-&gt;statp.st_atime = now;
   sp-&gt;statp.st_size = -1;
   sp-&gt;statp.st_blksize = 4096;
   sp-&gt;statp.st_blocks = 1;
   return bRC_OK;
</PRE>

<P>
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.

<P>
Creating a directory is similar, but requires a few extra steps:

<P>
<PRE>
   struct plugin_ctx *p_ctx = (struct plugin_ctx *)ctx-&gt;pContext;
   time_t now = time(NULL);
   sp-&gt;fname = p_ctx-&gt;fname;   /* set the full path I want to create */
   sp-&gt;link = xxx; where xxx is p_ctx-&gt;fname with a trailing forward slash
   sp-&gt;type = FT_DIREND
   sp-&gt;statp.st_mode = 0700 | S_IFDIR;
   sp-&gt;statp.st_ctime = now;
   sp-&gt;statp.st_mtime = now;
   sp-&gt;statp.st_atime = now;
   sp-&gt;statp.st_size = -1;
   sp-&gt;statp.st_blksize = 4096;
   sp-&gt;statp.st_blocks = 1;
   return bRC_OK;
</PRE>

<P>
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.

<P>
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.  

<P>
Note, if you want the directory permissions and times to be correctly
restored, you must create the directory <B>after</B> 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.

<P>

<H2><A NAME="SECTION004410000000000000000">
setFileAttributes(bpContext *ctx, struct restore_pkt *rp)</A>
</H2>
This is call not yet implemented.  Called for a command plugin.

<P>
See the definition of <B>restre_pkt</B> in the above section.

<P>

<H2><A NAME="SECTION004411000000000000000">
endRestoreFile(bpContext *ctx)</A>
</H2>
Called when a command plugin is done restoring a file.

<P>

<H2><A NAME="SECTION004412000000000000000">
pluginIO(bpContext *ctx, struct io_pkt *io)</A>
</H2>
Called to do the input (backup) or output (restore) of data from or to a file
for a command plugin. These routines simulate the Unix read(), write(), open(),
close(), and lseek() I/O calls, and the arguments are passed in the packet and
the return values are also placed in the packet.  In addition for Win32 systems
the plugin must return two additional values (described below).

<P>
<PRE>
 enum {
   IO_OPEN = 1,
   IO_READ = 2,
   IO_WRITE = 3,
   IO_CLOSE = 4,
   IO_SEEK = 5
};

struct io_pkt {
   int32_t pkt_size;                  /* Size of this packet */
   int32_t func;                      /* Function code */
   int32_t count;                     /* read/write count */
   mode_t mode;                       /* permissions for created files */
   int32_t flags;                     /* Open flags */
   char *buf;                         /* read/write buffer */
   const char *fname;                 /* open filename */
   int32_t status;                    /* return status */
   int32_t io_errno;                  /* errno code */
   int32_t lerror;                    /* Win32 error code */
   int32_t whence;                    /* lseek argument */
   boffset_t offset;                  /* lseek argument */
   bool win32;                        /* Win32 GetLastError returned */
   int32_t pkt_end;                   /* end packet sentinel */
};
</PRE>

<P>
The particular Unix function being simulated is indicated by the <B>func</B>,
which will have one of the IO_OPEN, IO_READ, ... codes listed above.  The
status code that would be returned from a Unix call is returned in <B>status</B>
for IO_OPEN, IO_CLOSE, IO_READ, and IO_WRITE. The return value for IO_SEEK
is returned in <B>offset</B> which in general is a 64 bit value.

<P>
When there is an error on Unix systems, you must always set io_error, and
on a Win32 system, you must always set win32, and the returned value from
the OS call GetLastError() in lerror.

<P>
For all except IO_SEEK, <B>status</B> is the return result.  In general it is
a positive integer unless there is an error in which case it is -1.

<P>
The following describes each call and what you get and what you
should return:

<P>
<DL>
<DT><STRONG>IO_OPEN</STRONG></DT>
<DD>You will be passed fname, mode, and flags.
   You must set on return: status, and if there is a Unix error
   io_errno must be set to the errno value, and if there is a 
   Win32 error win32 and lerror. 

<P>
</DD>
<DT><STRONG>IO_READ</STRONG></DT>
<DD>You will be passed: count, and buf (buffer of size count).
  You must set on return: status to the number of bytes 
  read into the buffer (buf) or -1 on an error, 
  and if there is a Unix error
  io_errno must be set to the errno value, and if there is a
  Win32 error, win32 and lerror must be set.

<P>
</DD>
<DT><STRONG>IO_WRITE</STRONG></DT>
<DD>You will be passed: count, and buf (buffer of size count).
  You must set on return: status to the number of bytes 
  written from the buffer (buf) or -1 on an error, 
  and if there is a Unix error
  io_errno must be set to the errno value, and if there is a
  Win32 error, win32 and lerror must be set.

<P>
</DD>
<DT><STRONG>IO_CLOSE</STRONG></DT>
<DD>Nothing will be passed to you.  On return you must set 
  status to 0 on success and -1 on failure.  If there is a Unix error
  io_errno must be set to the errno value, and if there is a
  Win32 error, win32 and lerror must be set.

<P>
</DD>
<DT><STRONG>IO_LSEEK</STRONG></DT>
<DD>You will be passed: offset, and whence. offset is a 64 bit value
  and is the position to seek to relative to whence.  whence is one
  of the following SEEK_SET, SEEK_CUR, or SEEK_END indicating to
  either to seek to an absolute possition, relative to the current 
  position or relative to the end of the file.
  You must pass back in offset the absolute location to which you 
  seeked. If there is an error, offset should be set to -1.
  If there is a Unix error
  io_errno must be set to the errno value, and if there is a
  Win32 error, win32 and lerror must be set.

<P>
Note: Bacula will call IO_SEEK only when writing a sparse file.

<P>
</DD>
</DL>

<P>

<H2><A NAME="SECTION004413000000000000000">
bool checkFile(bpContext *ctx, char *fname)</A>
</H2>
If this entry point is set, Bacula will call it after backing up all file
data during an Accurate backup.  It will be passed the full filename for
each file that Bacula is proposing to mark as deleted.  Only files
previously backed up but not backed up in the current session will be
marked to be deleted.  If you return <B>false</B>, the file will be be
marked deleted.  If you return <B>true</B> the file will not be marked
deleted.  This permits a plugin to ensure that previously saved virtual
files or files controlled by your plugin that have not change (not backed
up in the current job) are not marked to be deleted.  This entry point will
only be called during Accurate Incrmental and Differential backup jobs.

<P>
<HR>
<!--Navigation Panel-->
<A NAME="tex2html698"
  HREF="Bacula_Plugin_Entrypoints.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> 
<A NAME="tex2html692"
  HREF="Bacula_FD_Plugin_API.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> 
<A NAME="tex2html686"
  HREF="loadPlugin.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> 
<A NAME="tex2html694"
  HREF="Contents.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> 
<A NAME="tex2html696"
  HREF="GNU_Free_Documentation_Lice.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html699"
  HREF="Bacula_Plugin_Entrypoints.html">Bacula Plugin Entrypoints</A>
<B> Up:</B> <A NAME="tex2html693"
  HREF="Bacula_FD_Plugin_API.html">Bacula FD Plugin API</A>
<B> Previous:</B> <A NAME="tex2html687"
  HREF="loadPlugin.html">loadPlugin</A>
 &nbsp; <B>  <A NAME="tex2html695"
  HREF="Contents.html">Contents</A></B> 
 &nbsp; <B>  <A NAME="tex2html697"
  HREF="GNU_Free_Documentation_Lice.html">Index</A></B> 
<!--End of Navigation Panel-->
<ADDRESS>

2012-01-24
</ADDRESS>
</BODY>
</HTML>