All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori@us.ibm.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] Allow default network type to be determined from an environmental variable
Date: Sun, 13 Jan 2008 15:20:56 -0600	[thread overview]
Message-ID: <478A80B8.7070708@us.ibm.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 725 bytes --]

One typically wants to use the same networking type on a given system.  
For instance, if you have a bridge set up for taps, you'll generally 
pass -net tap to the guest.  If you're an unprivileged user, you'll 
typically use -net user.

In the absence of a global configuration file, a reasonably sane way to 
support this configuration system wide is to use an environmental 
variable.  QEMU already uses a number of global variables for 
configuring audio options.

This patch introduces a global variable (QEMU_NET_DEFAULT) which allows 
a user to set a system-wide default networking type.  This saves a lot 
of typing for me as I no longer have to specify -net tap every time I 
launch QEMU.

Regards,

Anthony Liguori

[-- Attachment #2: configurable_default_nic.diff --]
[-- Type: text/x-patch, Size: 671 bytes --]

Index: qemu/vl.c
===================================================================
--- qemu.orig/vl.c	2008-01-13 15:12:55.000000000 -0600
+++ qemu/vl.c	2008-01-13 15:15:02.000000000 -0600
@@ -8754,11 +8754,16 @@
 
     /* init network clients */
     if (nb_net_clients == 0) {
+	const char *net_type = getenv("QEMU_NET_DEFAULT");
+
+	if (net_type == NULL)
+	    net_type = "user";
+
         /* if no clients, we use a default config */
         pstrcpy(net_clients[0], sizeof(net_clients[0]),
                 "nic");
         pstrcpy(net_clients[1], sizeof(net_clients[0]),
-                "user");
+                net_type);
         nb_net_clients = 2;
     }
 

             reply	other threads:[~2008-01-13 21:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-13 21:20 Anthony Liguori [this message]
2008-01-19 21:10 ` [Qemu-devel] [PATCH] Allow default network type to be determined from an environmental variable Paul Brook
2008-01-19 22:40   ` Anthony Liguori
2008-01-19 22:47   ` M. Warner Losh
2008-02-12  0:17   ` Rob Landley
2008-02-12  1:42     ` Paul Brook
2008-02-12  2:19     ` andrzej zaborowski
2008-02-12  2:46       ` Paul Brook
2008-02-12  3:47         ` Anthony Liguori
2008-02-12 12:27           ` Paul Brook

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=478A80B8.7070708@us.ibm.com \
    --to=aliguori@us.ibm.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.