On Mon, Jan 13, 2014 at 12:54:36PM +0100, Pino Toscano wrote:
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?
Probably. This way was just easier for me to understand :-)
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine. Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/