[Libguestfs] RFC: copy-attributes command

Pino Toscano ptoscano at redhat.com
Mon Jan 13 11:54:36 UTC 2014


On Friday 10 January 2014 16:53:32 Richard W.M. Jones wrote:
> On Fri, Jan 10, 2014 at 05:36:39PM +0100, Pino Toscano wrote:
> [..]
> 
> This still isn't quite what I meant.  My meaning was that mode
> would be disabled by default (unless all:true).

OK.

> How about:
> 
> int copy_mode, copy_xattributes, copy_ownership;
> 
> /* Set defaults. */
> if (all)
>   copy_mode = copy_xattributes = copy_ownership = 1;
> else
>   copy_mode = copy_xattributes = copy_ownership = 0;
> 
> /* If set in the original struct, copy those settings overriding
>  * the defaults.
>  */
> if ((optargs_bitmask & GUESTFS_COPY_ATTRIBUTES_MODE_BITMASK))
>   copy_mode = mode;
> if ((optargs_bitmask & GUESTFS_COPY_ATTRIBUTES_XATTRIBUTES_BITMASK))
>   copy_xattributes = xattributes;
> if ((optargs_bitmask & GUESTFS_COPY_ATTRIBUTES_OWNERSHIP_BITMASK))
>   copy_ownership = ownership;

Isn't this doing basically the same of the snippet I used (the «if (all) 
{ ... }» one), short of the part that enables mode if neither all nor 
mode were specified?

-- 
Pino Toscano




More information about the Libguestfs mailing list