qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 4/5] implement -no-user-config command-line opti


From: Anthony Liguori
Subject: Re: [Qemu-devel] [PATCH 4/5] implement -no-user-config command-line option
Date: Tue, 24 Apr 2012 09:34:41 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120329 Thunderbird/11.0.1

On 04/18/2012 03:02 PM, Eduardo Habkost wrote:
Signed-off-by: Eduardo Habkost<address@hidden>
---
  arch_init.c     |   10 +++++++---
  arch_init.h     |    2 +-
  qemu-options.hx |   16 +++++++++++++---
  vl.c            |    6 +++++-
  4 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/arch_init.c b/arch_init.c
index 62332e9..c5fc00f 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -114,19 +114,23 @@ const uint32_t arch_type = QEMU_ARCH;

  static struct defconfig_file {
      const char *filename;
+    /* If non-zero, this is a user config file (disabled by -no-user-config) */
+    int userconfig;
  } default_config_files[] = {
-    { CONFIG_QEMU_CONFDIR "/qemu.conf" },
-    { CONFIG_QEMU_CONFDIR "/target-" TARGET_ARCH ".conf" },
+    { CONFIG_QEMU_CONFDIR "/qemu.conf",                   1 },
+    { CONFIG_QEMU_CONFDIR "/target-" TARGET_ARCH ".conf", 1 },
      { NULL }, /* end of list */
  };


-int qemu_read_default_config_files(void)
+int qemu_read_default_config_files(int userconfig)
  {
      int ret;
      struct defconfig_file *f;

      for (f = default_config_files; f->filename; f++) {
+        if (!userconfig&&  f->userconfig)
+            continue;

Coding style is off here.  While you're at it, you should make userconfig a 
bool.


          ret = qemu_read_config_file(f->filename);
          if (ret<  0&&  ret != -ENOENT) {
              return ret;
diff --git a/arch_init.h b/arch_init.h
index 495871b..07510cf 100644
--- a/arch_init.h
+++ b/arch_init.h
@@ -32,6 +32,6 @@ int xen_available(void);

  /* Read default Qemu config files
   */
-int qemu_read_default_config_files(void);
+int qemu_read_default_config_files(int userconfig);

Let's use a bool here and move this to qemu-config.h. The declaration can live there even if the definition is in arch_init.c

Regards,

Anthony Liguori



reply via email to

[Prev in Thread] Current Thread [Next in Thread]