Re: [Dar-libdar_api] updating kdar to work with libdar 4 (dar 2.3.1)
For full, incremental, compressed and encrypted backups or archives
Brought to you by:
edrusb
|
From: Denis C. <dar...@fr...> - 2007-02-21 21:41:47
|
Glen Ogilvie wrote:
>
> Dennis, have you managed to put togeather a summary of the API
> changes? It would help in updating kdar to use them.
>
Point 1: [taken from the ChangeLog and diff] :
added -[ and -] options (file selection from file listing)
Important consequence for libdar user programs:
the fs_root argument is now expanded to full absolute path inside
libdar, thus the mask you will give for path inclusion/exclusion
(the "subtree" argument) will be used against full absolute path
of files under consideration for the operation. Assuming you have
fs_root=tmp/A and the current directory is /var/tmp, your mask will
be used against strings like /var/tmp/A/some/file. (instead of
tmp/A/some/file as in the previous API version). Things are equal
if the fs_root is given an absolute path.
In other word, the fs_root argument (in all public archive's methods
that use it) has to use become an absolute path, when user provides a
relative path.
fs_root is an object of class path, the is_relative() method can let you
know whether a path is relative or not. If it is relative, find the
current working directory (getcwd() system call for example) build a
temporary path object (let's call it cwd_path) with the getcwd() string
(constructor works with std::string that can be also built from char *)
and before passing fs_root, set it to absolute with the path::operator+
fs_root = cwd_path + fs_root;
This has to be done for any 'fs_root' argument in the archive methods.
Point 2: the 'pause' argument moved from boolean to infinint.
replacing the boolean argument by the following expression will keep
the same feature:
original_provided_boolean_argument ? 1 : 0
(if true -> pause every 1 slice else do not pause at all)
Point 3: root_EA and user_EA has been replaced by a mask 'ea_mask'.
to keep the same behavior you have to build a mask as follows and use it
in place of root_EA and user_EA:
ou_mask ea_mask; // build an empty mask that does the *or* operation
if(root_EA)
ea_mask.add(simple_mask("system.*"));
if(user_EA)
ea_mask.add(simple_mask("user.*"));
if(!root_EA && !user_EA) // if ea_mask is still empty
ea_mask.add(bool_mask(false));
// note that if ea_mask is empty (both root_EA and user_EA
// are false) you can avoid using an ou_mask object by directly
// using a bool_mask(false) object as argument (this does the same
// but will save some CPU cycles.
Point 3: ignore_owner (boolean) has been replaced by 'what_to_check'
of type inode::comparison_fields, which is declared in catalogue.hpp.
here the equivalent behavior is realized by the following expression:
what_to_check = ignore_owner ? cf_ignore_owner : cf_all
Point 4 : as opposed to point 1 to 3 that are general to the different
public archive's class methods, this point does only apply to the
'create' constructor of archive class:
between the 'same_fs' and the 'ret' argument (which is the last of this
method), took place 4 new arguments corresponding to four new features:
for backward compatibilty:
- snapshot (boolean), has to set to false
- cache_directory_tagging (boolean) has to be set to false also
- display_skipped (boolean) has to be set to false also
- fixed_date (infinit) has to be set to zero
Point 5 : still in the same 'create' constructor, the last argument
'ret' has been changed of name ('progressive_report') and type (pointer).
here, providing the address of the original argument (thanks to the &
operator) will do the trick.
Point 6 : archive::op_extract received a new argument 'ea_erase'.
For backward compatibility set it to false. (Point 1 to 3 also apply to
this method as well as point 5).
Point 7 : archive::op_listing has seen the tar_format boolean argument
been replaced by list_mode of type listformat.
listformat = tar_format ? normal : tree
(I guess op_listing is not used in kdar, but...)
Point 8 : archive::op_diff has point 1 to 3 and point 5 that do apply.
Point 9 : archive::op_test has point 1, 3 and 5 that apply.
Point 10 : the statistic type has been changed from struct to class
the different field that were accessible directly before has to be
read throw the get_*() methods. For example:
statistics_obj.treated
has to be replaced by
statistics_obj.get_treated()
That's all the changes I could found that are officially part of the
API, I know however that Johnathan has used some useful tools from the
tools.hpp/cpp module. No much change there, but rather several new
functions have been added, but in case of problem here don't hesitate to
ask me.
I wish you success!
Kind Regards,
Denis.
|