Re: [Dar-libdar_api] specifying ea_mask
For full, incremental, compressed and encrypted backups or archives
Brought to you by:
edrusb
|
From: Denis C. <dar...@fr...> - 2006-07-22 21:27:45
|
Will Stephenson wrote:
> Hi list
Hello, (and sorry for the moderation overhead)
>
> I'm trying to update kdar(*) to work with libdar 4.0.0 and have run into a
> block
> in the plain libdar::archive ctor.
>
> I see that root_ea and user_ea args have been replaced by ea_mask, which must
> perform the same function, but I have no idea how to specify the
> equivalent "ignore user EA"/"ignore system EA" options using ea_mask.
well, that's not that complicated, but that's true there is a lack of
documentation on that point:
The ea_mask argument receives as argument a mask that defines which EA
(based on the "domain.name" expression) will be considered or not. This
is exactly as what can be found for file selection with file "subtree"
and "selection" arguments that correspond to the -P/-g/-[/-] options for
the first one and to the -X/-I options for the second one.
Thus, if you want to only consider user EA, you should give for example
a simple_mask("user.*") or a regular_mask("^user\..*") as ea_mask
argument to libdar.
if you want to ignore all EA, simply pass a bool_mask(false) as argument.
if you want to consider all EA, simply pass a bool_mask(true) as argument.
If you want to only consider system EA, the argument to pass can be for
example a simple_mask("system.*").
for the negation like "ignore user EA", you need to build a negation
this is done passing as argument the following object:
not_mask(simple_mask("user.*"))
> I've
> poked around in the command_line.* sources but it seems the string for the
> ignore/allow EAs comes from the command line, and I can't find an example or
> documentation for this,
EA have a structured name, where the first part is the domain ("system",
"user", "security", and so on), and the second part is the EA's name
in that domain. Theses two parts are separated by a dot. Full EA format
required by the system (and against which libdar makes comparisons) is
thus of the form:
user.my_own_EA
system.some_other_EA
security.yet_another_one
>the only masks I can find refer to extended file
> permissions, which as I understand it are a subset of EAs.
well I guess no. Masks make a generic class hierarchy that work on
strings. In one side a mask is build and pass to libdar. Libdar then, in
the other side, presents to this mask each string it has to take an
action on, the masks answer "true" or "false" for each presented string,
and libdar take subsequent action (exclude/include file, exclude/include
file or directory, exclude/include EA).
>
> Put simply:
>
> A What's the mask for "all user EA"?
simple_mask("user.*")
>
> B What's the mask for "all system EA"?
bool_mask(true)
>
> C What's A & B?
and_mask tmp;
tmp.add(A);
tmp.add(B);
>
> D What's !A & !B ?
and_mask tmp;
tmp.add(not_mask(A));
tmp.add(not_mask(B));
>
> Can anyone enlighten me?
please refer to the libdar/mask.hpp file for full available mask from
libdar. Note that you may also create your own mask by inheritance from
an already defined mask class.
>
> Thanks
>
> Will
>
> * Just a minimal update so it preserves the same behaviour with the new
> libdar, no new features.
Yes, I understand. I guess Johnathan will have some time soon or later
to update kdar more deeply with new features. ;-)
Kind Regards,
Denis.
|