commit 910b019f9371ceaab504f4e3d7f7a125eba75535
Author: Daniel P. Berrange <berrange@redhat.com>
Date:   Tue Feb 9 13:06:56 2010 +0000

    Convert qemu command line flags to 64-bit int
    
    The QEMU flags are commonly stored as a signed or unsigned int,
    allowing only 31 flags. This limit is rather close, so to aid
    future patches, change it to a 64-bit int
    
    * src/qemu/qemu_conf.c, src/qemu/qemu_conf.h, src/qemu/qemu_driver.c,
      tests/qemuargv2xmltest.c, tests/qemuhelptest.c, tests/qemuxml2argvtest.c:
      Use 'unsigned long long' for QEMU flags

Index: libvirt-0.7.6/src/qemu/qemu_conf.c
===================================================================
--- libvirt-0.7.6.orig/src/qemu/qemu_conf.c
+++ libvirt-0.7.6/src/qemu/qemu_conf.c
@@ -1112,12 +1112,12 @@ virCapsPtr qemudCapsInit(virCapsPtr old_
     return NULL;
 }
 
-static unsigned int qemudComputeCmdFlags(const char *help,
-                                         unsigned int version,
-                                         unsigned int is_kvm,
-                                         unsigned int kvm_version)
+static unsigned long long qemudComputeCmdFlags(const char *help,
+                                               unsigned int version,
+                                               unsigned int is_kvm,
+                                               unsigned int kvm_version)
 {
-    unsigned int flags = 0;
+    unsigned long long flags = 0;
 
     if (strstr(help, "-no-kqemu"))
         flags |= QEMUD_CMD_FLAG_KQEMU;
@@ -1244,7 +1244,7 @@ static unsigned int qemudComputeCmdFlags
 #define SKIP_BLANKS(p) do { while ((*(p) == ' ') || (*(p) == '\t')) (p)++; } while (0)
 
 int qemudParseHelpStr(const char *help,
-                      unsigned int *flags,
+                      unsigned long long *flags,
                       unsigned int *version,
                       unsigned int *is_kvm,
                       unsigned int *kvm_version)
@@ -1324,14 +1324,14 @@ fail:
 
 int qemudExtractVersionInfo(const char *qemu,
                             unsigned int *retversion,
-                            unsigned int *retflags) {
+                            unsigned long long *retflags) {
     const char *const qemuarg[] = { qemu, "-help", NULL };
     const char *const qemuenv[] = { "LC_ALL=C", NULL };
     pid_t child;
     int newstdout = -1;
     int ret = -1, status;
     unsigned int version, is_kvm, kvm_version;
-    unsigned int flags = 0;
+    unsigned long long flags = 0;
 
     if (retflags)
         *retflags = 0;
@@ -1434,7 +1434,7 @@ int
 qemudNetworkIfaceConnect(virConnectPtr conn,
                          struct qemud_driver *driver,
                          virDomainNetDefPtr net,
-                         int qemuCmdFlags)
+                         unsigned long long qemuCmdFlags)
 {
     char *brname = NULL;
     int err;
@@ -1666,7 +1666,7 @@ no_memory:
 
 
 int
-qemuAssignDeviceDiskAlias(virDomainDiskDefPtr def, int qemuCmdFlags)
+qemuAssignDeviceDiskAlias(virDomainDiskDefPtr def, unsigned long long qemuCmdFlags)
 {
     if (qemuCmdFlags & QEMUD_CMD_FLAG_DRIVE) {
         if (qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE)
@@ -1749,7 +1749,7 @@ qemuAssignDeviceControllerAlias(virDomai
 
 
 static int
-qemuAssignDeviceAliases(virDomainDefPtr def, int qemuCmdFlags)
+qemuAssignDeviceAliases(virDomainDefPtr def, unsigned long long qemuCmdFlags)
 {
     int i;
 
@@ -2218,7 +2218,7 @@ qemuSafeSerialParamValue(virConnectPtr c
 char *
 qemuBuildDriveStr(virDomainDiskDefPtr disk,
                   int bootable,
-                  int qemuCmdFlags)
+                  unsigned long long qemuCmdFlags)
 {
     virBuffer opt = VIR_BUFFER_INITIALIZER;
     const char *bus = virDomainDiskQEMUBusTypeToString(disk->bus);
@@ -2497,7 +2497,7 @@ qemuBuildNicStr(virConnectPtr conn,
 
 
 char *
-qemuBuildNicDevStr(virDomainNetDefPtr net, int vlan)
+qemuBuildNicDevStr(virDomainNetDefPtr net, unsigned long long vlan)
 {
     virBuffer buf = VIR_BUFFER_INITIALIZER;
     const char *nic;
@@ -3098,7 +3098,7 @@ no_memory:
 static char *
 qemuBuildSmpArgStr(virConnectPtr conn,
                    const virDomainDefPtr def,
-                   int qemuCmdFlags)
+                   unsigned long long qemuCmdFlags)
 {
     virBuffer buf = VIR_BUFFER_INITIALIZER;
 
@@ -3138,7 +3138,7 @@ int qemudBuildCommandLine(virConnectPtr
                           virDomainDefPtr def,
                           virDomainChrDefPtr monitor_chr,
                           int monitor_json,
-                          unsigned int qemuCmdFlags,
+                          unsigned long long qemuCmdFlags,
                           const char ***retargv,
                           const char ***retenv,
                           int **tapfds,
Index: libvirt-0.7.6/src/qemu/qemu_conf.h
===================================================================
--- libvirt-0.7.6.orig/src/qemu/qemu_conf.h
+++ libvirt-0.7.6/src/qemu/qemu_conf.h
@@ -178,10 +178,10 @@ int         qemudExtractVersion
                                          struct qemud_driver *driver);
 int         qemudExtractVersionInfo     (const char *qemu,
                                          unsigned int *version,
-                                         unsigned int *flags);
+                                         unsigned long long *qemuCmdFlags);
 
 int         qemudParseHelpStr           (const char *str,
-                                         unsigned int *flags,
+                                         unsigned long long *qemuCmdFlags,
                                          unsigned int *version,
                                          unsigned int *is_kvm,
                                          unsigned int *kvm_version);
@@ -191,7 +191,7 @@ int         qemudBuildCommandLine
                                          virDomainDefPtr def,
                                          virDomainChrDefPtr monitor_chr,
                                          int monitor_json,
-                                         unsigned int qemuCmdFlags,
+                                         unsigned long long qemuCmdFlags,
                                          const char ***retargv,
                                          const char ***retenv,
                                          int **tapfds,
@@ -213,7 +213,7 @@ char * qemuBuildNicStr(virConnectPtr con
 
 /* Current, best practice */
 char * qemuBuildNicDevStr(virDomainNetDefPtr net,
-                          int qemuCmdFlags);
+                          unsigned long long qemuCmdFlags);
 
 char *qemuDeviceDriveHostAlias(virDomainDiskDefPtr disk,
                                unsigned long long qemudCmdFlags);
@@ -221,7 +221,7 @@ char *qemuDeviceDriveHostAlias(virDomain
 /* Both legacy & current support */
 char *qemuBuildDriveStr(virDomainDiskDefPtr disk,
                         int bootable,
-                        int qemuCmdFlags);
+                        unsigned long long qemuCmdFlags);
 
 /* Current, best practice */
 char * qemuBuildDriveDevStr(virConnectPtr conn,
@@ -255,7 +255,7 @@ char * qemuBuildUSBHostdevDevStr(virDoma
 int         qemudNetworkIfaceConnect    (virConnectPtr conn,
                                          struct qemud_driver *driver,
                                          virDomainNetDefPtr net,
-                                         int qemuCmdFlags);
+                                         unsigned long long qemuCmdFlags);
 
 int         qemudProbeMachineTypes      (const char *binary,
                                          virCapsGuestMachinePtr **machines,
@@ -294,7 +294,7 @@ int  qemuAssignDevicePCISlots(virDomainD
 
 int qemuDomainNetVLAN(virDomainNetDefPtr def);
 int qemuAssignDeviceNetAlias(virDomainDefPtr def, virDomainNetDefPtr net, int idx);
-int qemuAssignDeviceDiskAlias(virDomainDiskDefPtr def, int qemuCmdFlags);
+int qemuAssignDeviceDiskAlias(virDomainDiskDefPtr def, unsigned long long qemuCmdFlags);
 int qemuAssignDeviceHostdevAlias(virDomainDefPtr def, virDomainHostdevDefPtr net, int idx);
 int qemuAssignDeviceControllerAlias(virDomainControllerDefPtr controller);
 
Index: libvirt-0.7.6/src/qemu/qemu_driver.c
===================================================================
--- libvirt-0.7.6.orig/src/qemu/qemu_driver.c
+++ libvirt-0.7.6/src/qemu/qemu_driver.c
@@ -2566,7 +2566,7 @@ static int qemudStartVMDaemon(virConnect
     struct stat sb;
     int *tapfds = NULL;
     int ntapfds = 0;
-    unsigned int qemuCmdFlags;
+    unsigned long long qemuCmdFlags;
     fd_set keepfd;
     const char *emulator;
     pid_t child;
@@ -4835,7 +4835,7 @@ static char *qemuDomainXMLToNative(virCo
     virDomainDefPtr def = NULL;
     virDomainChrDef monConfig;
     const char *emulator;
-    unsigned int qemuCmdFlags;
+    unsigned long long qemuCmdFlags;
     struct stat sb;
     const char **retargv = NULL;
     const char **retenv = NULL;
@@ -5748,7 +5748,7 @@ static int qemudDomainAttachNetDevice(vi
                                       struct qemud_driver *driver,
                                       virDomainObjPtr vm,
                                       virDomainNetDefPtr net,
-                                      unsigned int qemuCmdFlags)
+                                      unsigned long long qemuCmdFlags)
 {
     qemuDomainObjPrivatePtr priv = vm->privateData;
     char *tapfd_name = NULL;
@@ -6077,7 +6077,7 @@ static int qemudDomainAttachDevice(virDo
     struct qemud_driver *driver = dom->conn->privateData;
     virDomainObjPtr vm;
     virDomainDeviceDefPtr dev = NULL;
-    unsigned int qemuCmdFlags;
+    unsigned long long qemuCmdFlags;
     virCgroupPtr cgroup = NULL;
     int ret = -1;
 
@@ -7636,7 +7636,7 @@ qemudDomainMigratePrepareTunnel(virConne
     int ret = -1;
     int internalret;
     char *unixfile = NULL;
-    unsigned int qemuCmdFlags;
+    unsigned long long qemuCmdFlags;
     struct qemuStreamMigFile *qemust = NULL;
 
     qemuDriverLock(driver);
@@ -8083,7 +8083,7 @@ static int doTunnelMigrate(virDomainPtr
     virStreamPtr st = NULL;
     char *unixfile = NULL;
     int internalret;
-    unsigned int qemuCmdFlags;
+    unsigned long long qemuCmdFlags;
     int status;
     unsigned long long transferred, remaining, total;
 
Index: libvirt-0.7.6/tests/qemuargv2xmltest.c
===================================================================
--- libvirt-0.7.6.orig/tests/qemuargv2xmltest.c
+++ libvirt-0.7.6/tests/qemuargv2xmltest.c
@@ -75,7 +75,7 @@ static int testCompareXMLToArgvFiles(con
 
 struct testInfo {
     const char *name;
-    int extraFlags;
+    unsigned long long extraFlags;
     const char *migrateFrom;
 };
 
Index: libvirt-0.7.6/tests/qemuhelptest.c
===================================================================
--- libvirt-0.7.6.orig/tests/qemuhelptest.c
+++ libvirt-0.7.6/tests/qemuhelptest.c
@@ -12,10 +12,10 @@
 
 struct testInfo {
     const char *name;
-    unsigned flags;
-    unsigned version;
-    unsigned is_kvm;
-    unsigned kvm_version;
+    unsigned long long flags;
+    unsigned int version;
+    unsigned int is_kvm;
+    unsigned int kvm_version;
 };
 
 static char *progname;
@@ -41,7 +41,8 @@ static int testHelpStrParsing(const void
     char path[PATH_MAX];
     char helpStr[MAX_HELP_OUTPUT_SIZE];
     char *help = &(helpStr[0]);
-    unsigned flags, version, is_kvm, kvm_version;
+    unsigned int version, is_kvm, kvm_version;
+    unsigned long long flags;
 
     snprintf(path, PATH_MAX, "%s/qemuhelpdata/%s", abs_srcdir, info->name);
 
@@ -52,7 +53,7 @@ static int testHelpStrParsing(const void
         return -1;
 
     if (flags != info->flags) {
-        fprintf(stderr, "Computed flags do not match: got 0x%x, expected 0x%x\n",
+        fprintf(stderr, "Computed flags do not match: got 0x%llx, expected 0x%llx\n",
                 flags, info->flags);
 
         if (getenv("VIR_TEST_DEBUG"))
Index: libvirt-0.7.6/tests/qemuxml2argvtest.c
===================================================================
--- libvirt-0.7.6.orig/tests/qemuxml2argvtest.c
+++ libvirt-0.7.6/tests/qemuxml2argvtest.c
@@ -24,7 +24,7 @@ static struct qemud_driver driver;
 
 static int testCompareXMLToArgvFiles(const char *xml,
                                      const char *cmd,
-                                     int extraFlags,
+                                     unsigned long long extraFlags,
                                      const char *migrateFrom) {
     char argvData[MAX_FILE];
     char *expectargv = &(argvData[0]);
@@ -32,7 +32,8 @@ static int testCompareXMLToArgvFiles(con
     const char **argv = NULL;
     const char **qenv = NULL;
     const char **tmp = NULL;
-    int ret = -1, len, flags;
+    int ret = -1, len;
+    unsigned long long flags;
     virDomainDefPtr vmdef = NULL;
     virDomainChrDef monitor_chr;
 
@@ -142,7 +143,7 @@ static int testCompareXMLToArgvFiles(con
 
 struct testInfo {
     const char *name;
-    int extraFlags;
+    unsigned long long extraFlags;
     const char *migrateFrom;
 };
 
