[libvirt] [PATCHv2 01/15] docs: use correct terminology for 1024 bytes

Eric Blake eblake at redhat.com
Tue Mar 6 00:34:16 UTC 2012


Yes, I like kilobytes better than kibibytes (when I say kilobytes,
I generally mean 1024).  But since the term is ambiguous, it can't
hurt to say what we mean, by using both the correct name and
calling out the numeric equivalent.

* src/libvirt.c (virDomainGetMaxMemory, virDomainSetMaxMemory)
(virDomainSetMemory, virDomainSetMemoryFlags)
(virNodeGetFreeMemory): Tweak wording.
* docs/formatdomain.html.in: Likewise.
* docs/formatstorage.html.in: Likewise.
---

v2: separate doc changes out early

 docs/formatdomain.html.in  |   15 ++++++++-------
 docs/formatstorage.html.in |    8 ++++++--
 src/libvirt.c              |   10 +++++-----
 3 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index a61895f..0855c7f 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -424,7 +424,7 @@
     <dl>
       <dt><code>memory</code></dt>
       <dd>The maximum allocation of memory for the guest at boot time.
-        The units for this value are kilobytes (i.e. blocks of 1024 bytes)</dd>
+        The units for this value are kibibytes (i.e. blocks of 1024 bytes)</dd>
       <dt><code>currentMemory</code></dt>
       <dd>The actual allocation of memory for the guest. This value can
         be less than the maximum allocation, to allow for ballooning
@@ -480,21 +480,21 @@
         determine so one needs guess and try.</dd>
       <dt><code>hard_limit</code></dt>
       <dd> The optional <code>hard_limit</code> element is the maximum memory
-        the guest can use. The units for this value are kilobytes (i.e. blocks
+        the guest can use. The units for this value are kibibytes (i.e. blocks
         of 1024 bytes)</dd>
       <dt><code>soft_limit</code></dt>
       <dd> The optional <code>soft_limit</code> element is the memory limit to
         enforce during memory contention. The units for this value are
-        kilobytes (i.e. blocks of 1024 bytes)</dd>
+        kibibytes (i.e. blocks of 1024 bytes)</dd>
       <dt><code>swap_hard_limit</code></dt>
       <dd> The optional <code>swap_hard_limit</code> element is the maximum
         memory plus swap the guest can use. The units for this value are
-        kilobytes (i.e. blocks of 1024 bytes). This has to be more than
+        kibibytes (i.e. blocks of 1024 bytes). This has to be more than
         hard_limit value provided</dd>
       <dt><code>min_guarantee</code></dt>
       <dd> The optional <code>min_guarantee</code> element is the guaranteed
         minimum memory allocation for the guest. The units for this value are
-        kilobytes (i.e. blocks of 1024 bytes)</dd>
+        kibibytes (i.e. blocks of 1024 bytes)</dd>
     </dl>


@@ -774,7 +774,7 @@
     <p>
       Each <code>cell</code> element specifies a NUMA cell or a NUMA node.
       <code>cpus</code> specifies the CPU or range of CPUs that are part of
-      the node. <code>memory</code> specifies the node memory in kilobytes
+      the node. <code>memory</code> specifies the node memory in kibibytes
       (i.e. blocks of 1024 bytes). Each cell or node is assigned cellid
       or nodeid in the increasing order starting from 0.
     </p>
@@ -2920,7 +2920,8 @@ qemu-kvm -net nic,model=? /dev/null
         attribute which takes the value "vga", "cirrus", "vmvga", "xen",
         "vbox", or "qxl" (<span class="since">since 0.8.6</span>)
         depending on the hypervisor features available.
-        You can also provide the amount of video memory in kilobytes using
+        You can also provide the amount of video memory in kibibytes
+        (blocks of 1024 bytes) using
         <code>vram</code> and the number of screen with <code>heads</code>.
       </dd>

diff --git a/docs/formatstorage.html.in b/docs/formatstorage.html.in
index 0dcf6df..93d8ab2 100644
--- a/docs/formatstorage.html.in
+++ b/docs/formatstorage.html.in
@@ -236,8 +236,12 @@
         <br/>
         By default this is specified in bytes, but an optional
         <code>unit</code> can be specified to adjust the passed value.
-        Values can be: 'K' (kilobytes), 'M' (megabytes), 'G' (gigabytes),
-        'T' (terabytes), 'P' (petabytes), or 'E' (exabytes).
+        Values can be: 'K' (kibibytes, 2<sup>10</sup> or 1024), 'M'
+        (mebibytes, 2<sup>20</sup> or 1,048,576), 'G' (gibibytes,
+        2<sup>30</sup> or 1,073,741,824), 'T' (tebibytes,
+        2<sup>40</sup> or 1,099,511,627,776), 'P' (pebibytes,
+        2<sup>50</sup> or 1,125,899,906,842,624), or 'E' (exbibytes,
+        2<sup>60</sup> or 1,152,921,504,606,846,976).
         <span class="since">Since 0.4.1</span></dd>
       <dt><code>capacity</code></dt>
       <dd>Providing the logical capacity for the volume. This value is
diff --git a/src/libvirt.c b/src/libvirt.c
index d98741b..650252e 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -3582,7 +3582,7 @@ error:
  * domain. If domain is NULL, then this get the amount of memory reserved
  * to Domain0 i.e. the domain where the application runs.
  *
- * Returns the memory size in kilobytes or 0 in case of error.
+ * Returns the memory size in kibibytes (blocks of 1024), or 0 in case of error.
  */
 unsigned long
 virDomainGetMaxMemory(virDomainPtr domain)
@@ -3619,7 +3619,7 @@ error:
 /**
  * virDomainSetMaxMemory:
  * @domain: a domain object or NULL
- * @memory: the memory size in kilobytes
+ * @memory: the memory size in kibibytes (blocks of 1024)
  *
  * Dynamically change the maximum amount of physical memory allocated to a
  * domain. If domain is NULL, then this change the amount of memory reserved
@@ -3674,7 +3674,7 @@ error:
 /**
  * virDomainSetMemory:
  * @domain: a domain object or NULL
- * @memory: the memory size in kilobytes
+ * @memory: the memory size in kibibytes (blocks of 1024)
  *
  * Dynamically change the target amount of physical memory allocated to a
  * domain. If domain is NULL, then this change the amount of memory reserved
@@ -3729,7 +3729,7 @@ error:
 /**
  * virDomainSetMemoryFlags:
  * @domain: a domain object or NULL
- * @memory: the memory size in kilobytes
+ * @memory: the memory size in kibibytes (blocks of 1024)
  * @flags: bitwise-OR of virDomainMemoryModFlags
  *
  * Dynamically change the target amount of physical memory allocated to a
@@ -6684,7 +6684,7 @@ error:
  * @conn: pointer to the hypervisor connection
  *
  * provides the free memory available on the Node
- * Note: most libvirt APIs provide memory sizes in kilobytes, but in this
+ * Note: most libvirt APIs provide memory sizes in kibibytes, but in this
  * function the returned value is in bytes. Divide by 1024 as necessary.
  *
  * Returns the available free memory in bytes or 0 in case of error
-- 
1.7.7.6




More information about the libvir-list mailing list