On Mon, Nov 14, 2011 at 03:29:45PM +0800, Wanlong Gao wrote:
On 11/11/2011 08:58 PM, Richard W.M. Jones wrote:
From: "Richard W.M. Jones" <rjones@redhat.com>
Reviewed-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Thanks for looking at these patches. If you (or Fujitsu) have any other needs for libguestfs, I'd be more than happy to discuss them. [...]
+ if ((chunk & 1023) != 0) { + reply_with_error ("chunk size must be a multiple of 1024 bytes");
I'd like to make the 1024 to a macro, what do you thinks so?
I wasn't sure if you meant (a) remove the use of the constant here and replace it with a macro, or (b) allow users to specify other chunk sizes (eg. less than 1024 bytes, or not a multiple of 1024 bytes). As background: The reason we do this check is because the 'mdadm --chunk' option only allows the size to be specified in K. We like to use bytes in the libguestfs API [1]. We can only let users specify multiples of 1024 here. It may be in future that mdadm would allow chunk sizes which are not a multiple of 1024 bytes, but it doesn't right now. (a) is possible, but (b) is not possible right now. Rich. [1] That is, we like to use bytes in new APIs, but we weren't very consistent on this point in the early days. -- 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://et.redhat.com/~rjones/virt-df/