[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] libvirt-domain.h: Fix enum description placement



There are only two acceptable places for describing enum values.
It's either:

    typedef enum {
        /* Some long description. Therefore it's placed before
         * the value. */
        VIR_ENUM_A_VAL = 1,
    } virEnumA;

or:

    typedef enum {
        VIR_ENUM_B_VAL = 1, /* Some short description */
    } virEnumB;

However, during review of a patch sent upstream I realized that
is not always the case. I went through all the public header
files and identified all the offenders. Luckily there were just
two of them.

Yes, this makes our HTML generated documentation broken, but
that's bug of the generator. Our header files shouldn't be forced
to use something we don't want to.

Signed-off-by: Michal Privoznik <mprivozn redhat com>
---
 include/libvirt/libvirt-domain.h | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index 45f939a8c..a3bb9cbe9 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -2309,21 +2309,21 @@ int virDomainSetPerfEvents(virDomainPtr dom,
 typedef enum {
     VIR_DOMAIN_BLOCK_JOB_TYPE_UNKNOWN = 0, /* Placeholder */
 
-    VIR_DOMAIN_BLOCK_JOB_TYPE_PULL = 1,
     /* Block Pull (virDomainBlockPull, or virDomainBlockRebase without
      * flags), job ends on completion */
+    VIR_DOMAIN_BLOCK_JOB_TYPE_PULL = 1,
 
-    VIR_DOMAIN_BLOCK_JOB_TYPE_COPY = 2,
     /* Block Copy (virDomainBlockCopy, or virDomainBlockRebase with
      * flags), job exists as long as mirroring is active */
+    VIR_DOMAIN_BLOCK_JOB_TYPE_COPY = 2,
 
-    VIR_DOMAIN_BLOCK_JOB_TYPE_COMMIT = 3,
     /* Block Commit (virDomainBlockCommit without flags), job ends on
      * completion */
+    VIR_DOMAIN_BLOCK_JOB_TYPE_COMMIT = 3,
 
-    VIR_DOMAIN_BLOCK_JOB_TYPE_ACTIVE_COMMIT = 4,
     /* Active Block Commit (virDomainBlockCommit with flags), job
      * exists as long as sync is active */
+    VIR_DOMAIN_BLOCK_JOB_TYPE_ACTIVE_COMMIT = 4,
 
 # ifdef VIR_ENUM_SENTINELS
     VIR_DOMAIN_BLOCK_JOB_TYPE_LAST
@@ -3712,12 +3712,13 @@ typedef void (*virConnectDomainEventBlockJobCallback)(virConnectPtr conn,
  * The reason describing why this callback is called
  */
 typedef enum {
-    VIR_DOMAIN_EVENT_DISK_CHANGE_MISSING_ON_START = 0,
-    /* removable media changed to empty according to startup policy as source
+    /* Removable media changed to empty according to startup policy as source
      * was missing. oldSrcPath is set, newSrcPath is NULL */
-    VIR_DOMAIN_EVENT_DISK_DROP_MISSING_ON_START = 1,
-    /* disk was dropped from domain as source file was missing.
+    VIR_DOMAIN_EVENT_DISK_CHANGE_MISSING_ON_START = 0,
+
+    /* Disk was dropped from domain as source file was missing.
      * oldSrcPath is set, newSrcPath is NULL */
+    VIR_DOMAIN_EVENT_DISK_DROP_MISSING_ON_START = 1,
 
 # ifdef VIR_ENUM_SENTINELS
     VIR_DOMAIN_EVENT_DISK_CHANGE_LAST
-- 
2.13.0


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]