Skip to contentSkip to conversation

ioemu: portability fixes for qemu-ifup

PATCH In review Christoph Egger 2 participants 3 messages Jul 2, 2009 – Jul 9, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ioemu: portability fixes for qemu-ifup

Hi!

Attached patch applies portability fixes to ioemu's qemu-ifup script:

- rename qemu-ifup to qemu-ifup-Linux
- add qemu-ifup-NetBSD for NetBSD
- add qemu-ifup which calls one of above.

Signature · 6 lines
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Karl-Hammerschmidt-Str. 34, 85609 Dornach b. Muenchen
Geschaeftsfuehrer: Thomas M. McCoy, Giuliano Meroni
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632
i386-dm/hookstarget.mak +2 -0
index cf4b39e..0aa6756 100644
@@ -3,3 +3,5 @@ install-hook:
 	$(INSTALL_DIR) "$(DESTDIR)/$(bindir)"
 	$(INSTALL_DIR) "$(DESTDIR)/$(configdir)"
 	$(INSTALL_PROG) qemu-ifup "$(DESTDIR)/$(configdir)/"
+	$(INSTALL_PROG) qemu-ifup-Linux "$(DESTDIR)/$(configdir)/"
+	$(INSTALL_PROG) qemu-ifup-NetBSD "$(DESTDIR)/$(configdir)/"
i386-dm/qemu-ifup +3 -35
index bcbee92..0cd2840 100644
@@ -1,37 +1,5 @@
 #!/bin/sh
 
-#. /etc/rc.d/init.d/functions
-#ulimit -c unlimited
-
-echo 'config qemu network with xen bridge for ' $*
-
-bridge=$2
-
-#
-# Old style bridge setup with netloop, used to have a bridge name
-# of xenbrX, enslaving pethX and vif0.X, and then configuring
-# eth0.
-#
-# New style bridge setup does not use netloop, so the bridge name
-# is ethX and the physical device is enslaved pethX
-#
-# So if...
-#
-#   - User asks for xenbrX
-#   - AND xenbrX doesn't exist
-#   - AND there is a ethX device which is a bridge
-#
-# ..then we translate xenbrX to ethX
-#
-# This lets old config files work without modification
-#
-if [ ! -e "/sys/class/net/$bridge" ] && [ -z "${bridge##xenbr*}" ]
-then
-   if [ -e "/sys/class/net/eth${bridge#xenbr}/bridge" ]
-   then
-      bridge="eth${bridge#xenbr}"
-   fi
-fi
-
-ifconfig $1 0.0.0.0 up
-brctl addif $bridge $1 || true
+PROG=$0
+OS=`uname -s`
+exec ${PROG}-${OS} $@
i386-dm/qemu-ifup-Linux new file +37 -0
new file mode 100644
index 0000000..bcbee92
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+#. /etc/rc.d/init.d/functions
+#ulimit -c unlimited
+
+echo 'config qemu network with xen bridge for ' $*
+
+bridge=$2
+
+#
+# Old style bridge setup with netloop, used to have a bridge name
+# of xenbrX, enslaving pethX and vif0.X, and then configuring
+# eth0.
+#
+# New style bridge setup does not use netloop, so the bridge name
+# is ethX and the physical device is enslaved pethX
+#
+# So if...
+#
+#   - User asks for xenbrX
+#   - AND xenbrX doesn't exist
+#   - AND there is a ethX device which is a bridge
+#
+# ..then we translate xenbrX to ethX
+#
+# This lets old config files work without modification
+#
+if [ ! -e "/sys/class/net/$bridge" ] && [ -z "${bridge##xenbr*}" ]
+then
+   if [ -e "/sys/class/net/eth${bridge#xenbr}/bridge" ]
+   then
+      bridge="eth${bridge#xenbr}"
+   fi
+fi
+
+ifconfig $1 0.0.0.0 up
+brctl addif $bridge $1 || true
i386-dm/qemu-ifup-NetBSD new file +3 -0
new file mode 100644
index 0000000..eee7876
@@ -0,0 +1,3 @@
+#!/bin/sh
+ifconfig $1 up
+exec /sbin/brconfig $2 add $1

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw

Christoph Egger writes ("[PATCH] ioemu: portability fixes for qemu-ifup"):

Quoted 4 lines

Attached patch applies portability fixes to ioemu's qemu-ifup script:
- rename qemu-ifup to qemu-ifup-Linux
- add qemu-ifup-NetBSD for NetBSD
- add qemu-ifup which calls one of above.

This is quite ugly. Why would we install both of them on the same computer and then switch at runtime ? Surely the build system should pick the right one and install just that under the conventional name ?

Ian.

#2 lore raw
Quoted 9 lines · On Wednesday 08 July 2009 15:36:43 Ian Jackson wrote:

Christoph Egger writes ("[PATCH] ioemu: portability fixes for qemu-ifup"):

Quoted 4 lines

Attached patch applies portability fixes to ioemu's qemu-ifup script:
- rename qemu-ifup to qemu-ifup-Linux
- add qemu-ifup-NetBSD for NetBSD
- add qemu-ifup which calls one of above.

This is quite ugly. Why would we install both of them on the same computer and then switch at runtime ? Surely the build system should pick the right one and install just that under the conventional name ?

Good idea. Attached patch does this.

Signature · 6 lines
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Karl-Hammerschmidt-Str. 34, 85609 Dornach b. Muenchen
Geschaeftsfuehrer: Thomas M. McCoy, Giuliano Meroni
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632
i386-dm/hookstarget.mak +2 -1
index cf4b39e..de2a670 100644
@@ -1,5 +1,6 @@
+IOEMU_OS=$(shell uname -s)
 
 install-hook:
 	$(INSTALL_DIR) "$(DESTDIR)/$(bindir)"
 	$(INSTALL_DIR) "$(DESTDIR)/$(configdir)"
-	$(INSTALL_PROG) qemu-ifup "$(DESTDIR)/$(configdir)/"
+	$(INSTALL_PROG) qemu-ifup-$(IOEMU_OS) "$(DESTDIR)/$(configdir)/qemu-ifup"
i386-dm/qemu-ifup deleted +0 -37
deleted file mode 100644
index bcbee92..0000000
@@ -1,37 +0,0 @@
-#!/bin/sh
-
-#. /etc/rc.d/init.d/functions
-#ulimit -c unlimited
-
-echo 'config qemu network with xen bridge for ' $*
-
-bridge=$2
-
-#
-# Old style bridge setup with netloop, used to have a bridge name
-# of xenbrX, enslaving pethX and vif0.X, and then configuring
-# eth0.
-#
-# New style bridge setup does not use netloop, so the bridge name
-# is ethX and the physical device is enslaved pethX
-#
-# So if...
-#
-#   - User asks for xenbrX
-#   - AND xenbrX doesn't exist
-#   - AND there is a ethX device which is a bridge
-#
-# ..then we translate xenbrX to ethX
-#
-# This lets old config files work without modification
-#
-if [ ! -e "/sys/class/net/$bridge" ] && [ -z "${bridge##xenbr*}" ]
-then
-   if [ -e "/sys/class/net/eth${bridge#xenbr}/bridge" ]
-   then
-      bridge="eth${bridge#xenbr}"
-   fi
-fi
-
-ifconfig $1 0.0.0.0 up
-brctl addif $bridge $1 || true
i386-dm/qemu-ifup-Linux new file +37 -0
new file mode 100644
index 0000000..bcbee92
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+#. /etc/rc.d/init.d/functions
+#ulimit -c unlimited
+
+echo 'config qemu network with xen bridge for ' $*
+
+bridge=$2
+
+#
+# Old style bridge setup with netloop, used to have a bridge name
+# of xenbrX, enslaving pethX and vif0.X, and then configuring
+# eth0.
+#
+# New style bridge setup does not use netloop, so the bridge name
+# is ethX and the physical device is enslaved pethX
+#
+# So if...
+#
+#   - User asks for xenbrX
+#   - AND xenbrX doesn't exist
+#   - AND there is a ethX device which is a bridge
+#
+# ..then we translate xenbrX to ethX
+#
+# This lets old config files work without modification
+#
+if [ ! -e "/sys/class/net/$bridge" ] && [ -z "${bridge##xenbr*}" ]
+then
+   if [ -e "/sys/class/net/eth${bridge#xenbr}/bridge" ]
+   then
+      bridge="eth${bridge#xenbr}"
+   fi
+fi
+
+ifconfig $1 0.0.0.0 up
+brctl addif $bridge $1 || true
i386-dm/qemu-ifup-NetBSD new file +3 -0
new file mode 100644
index 0000000..eee7876
@@ -0,0 +1,3 @@
+#!/bin/sh
+ifconfig $1 up
+exec /sbin/brconfig $2 add $1

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel