Re: updating kdar to work with libdar 4 (dar 2.3.1)

Denis Corbin <[email protected]> Wed, 21 Feb 2007 22:41:32 +0100
Newsgroups gmane.comp.sysutils.backup.dar.libdar
Message-ID <[email protected]>
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--===============0033177751==
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature";
	boundary="------------enig9C8ABFD823B19F8B42F1D927"

This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enig9C8ABFD823B19F8B42F1D927
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit



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.

--------------enig9C8ABFD823B19F8B42F1D927
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF3LyUpC5CI8gYGlIRAmlhAJ98oxeeiYcBEgJfCJNpqZMn9UP44ACgj3CD
UNOZqTaGPgNCeYouqgSp29k=
=ta18
-----END PGP SIGNATURE-----

--------------enig9C8ABFD823B19F8B42F1D927--


--===============0033177751==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
--===============0033177751==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Dar-libdar_api mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dar-libdar_api

--===============0033177751==--