ia64/xen-unstable

view linux-2.4-xen-sparse/mkbuildtree @ 7072:f9296342d9b2

Detangle the restart/reboot/halt/save/restore code. There is now one point
for management of shutdown state, XendDomainInfo.refreshShutdown, which is
able to cope whatever the current state of the domain. This fixes bug #124:
running reboot within a domU doesn't bring the domain back up after shutdown,
and bug #256: "xm reboot" could not make domU reboot.

Fix the refreshing inside XendDomain to ensure that the values returned by xm
list reflect reality correctly. We were removing XendDomainInfo instances,
but not creating them on start-up, so if xend were restarted, domain
information was being lost.

Merge XendDomain.dom0_unknown and initial_refresh into
XendDomainInfo.recreate.

Catch exceptions inside callInfo, and reraise them as XendErrors.

Remove unused XendDomain.close.

Further improvements are needed to XendDomainInfo to ensure that it avoids all
race conditions on shutdown, and can cope correctly with xend restarting
during a shutdown.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author emellor@ewan
date Tue Sep 27 13:53:06 2005 +0100 (2005-09-27)
parents 06d84bf87159
children
line source
1 #!/bin/bash
3 # mkbuildtree <build tree>
4 #
5 # Creates symbolic links in <build tree> for the sparse tree
6 # in the current directory.
8 # Script to determine the relative path between two directories.
9 # Copyright (c) D. J. Hawkey Jr. 2002
10 # Fixed for Xen project by K. Fraser in 2003.
11 abs_to_rel ()
12 {
13 local CWD SRCPATH
15 if [ "$1" != "/" -a "${1##*[^/]}" = "/" ]; then
16 SRCPATH=${1%?}
17 else
18 SRCPATH=$1
19 fi
20 if [ "$2" != "/" -a "${2##*[^/]}" = "/" ]; then
21 DESTPATH=${2%?}
22 else
23 DESTPATH=$2
24 fi
26 CWD=$PWD
27 [ "${1%%[^/]*}" != "/" ] && cd $1 && SRCPATH=$PWD
28 [ "${2%%[^/]*}" != "/" ] && cd $2 && DESTPATH=$PWD
29 [ "$CWD" != "$PWD" ] && cd $CWD
31 BASEPATH=$SRCPATH
33 [ "$SRCPATH" = "$DESTPATH" ] && DESTPATH="." && return
34 [ "$SRCPATH" = "/" ] && DESTPATH=${DESTPATH#?} && return
36 while [ "$BASEPATH/" != "${DESTPATH%${DESTPATH#$BASEPATH/}}" ]; do
37 BASEPATH=${BASEPATH%/*}
38 done
40 SRCPATH=${SRCPATH#$BASEPATH}
41 DESTPATH=${DESTPATH#$BASEPATH}
42 DESTPATH=${DESTPATH#?}
43 while [ -n "$SRCPATH" ]; do
44 SRCPATH=${SRCPATH%/*}
45 DESTPATH="../$DESTPATH"
46 done
48 [ -z "$BASEPATH" ] && BASEPATH="/"
49 [ "${DESTPATH##*[^/]}" = "/" ] && DESTPATH=${DESTPATH%?}
50 }
52 # relative_lndir <target_dir>
53 # Creates a tree of symlinks in the current working directory that mirror
54 # real files in <target_dir>. <target_dir> should be relative to the current
55 # working directory. Symlinks in <target_dir> are ignored. Source-control files
56 # are ignored.
57 relative_lndir ()
58 {
59 local SYMLINK_DIR REAL_DIR pref i j
60 SYMLINK_DIR=$PWD
61 REAL_DIR=$1
62 (
63 cd $REAL_DIR
64 for i in `find . -type d | grep -v SCCS`; do
65 [ -d $SYMLINK_DIR/$i ] || mkdir -p $SYMLINK_DIR/$i
66 (
67 cd $i
68 pref=`echo $i | sed -e 's#/[^/]*#../#g' -e 's#^\.##'`
69 for j in `find . -maxdepth 1 -type f -o -type l`; do
70 ln -sf ${pref}${REAL_DIR}/$i/$j ${SYMLINK_DIR}/$i/$j
71 done
72 )
73 done
74 )
75 }
77 [ "$1" == "" ] && { echo "Syntax: $0 <linux tree to xenify>"; exit 1; }
79 # Get absolute path to the destination directory
80 pushd . >/dev/null
81 cd ${1} || { echo "cannot cd to ${1}"; exit 1; }
82 AD=$PWD
83 popd >/dev/null
85 # Get absolute path to the source directory
86 AS=`pwd`
88 # Get path to source, relative to destination
89 abs_to_rel ${AD} ${AS}
90 RS=$DESTPATH
92 # Remove old copies of files and directories at the destination
93 for i in `find . -type f -o -type l` ; do rm -f ${AD}/${i#./} ; done
95 # We now work from the destination directory
96 cd ${AD} || { echo "cannot cd to ${AD}"; exit 1; }
98 # Remove old symlinks
99 for i in `find . -type l`; do rm -f $i; done
101 # Create symlinks of files and directories which exist in the sparse source
102 relative_lndir ${RS}
103 rm -f mkbuildtree
105 LINUX_26=${RS}/../linux-2.6-xen-sparse
106 [ -d $LINUX_26 ] || { echo "no Linux 2.6 sparse tree at ${RS}/../linux-2.6-xen-sparse"; exit 1; }
109 # Create links to the shared definitions of the Xen interfaces.
110 rm -rf ${AD}/include/asm-xen/xen-public
111 mkdir ${AD}/include/asm-xen/xen-public
112 cd ${AD}/include/asm-xen/xen-public
113 relative_lndir ../../../${RS}/../xen/include/public
115 # Create a link to the shared definitions for the control interface
116 cd ${AD}/include/asm-xen
118 ## Symlinks for files:
119 ## - which are identical in the i386 and xen-i386 architecture-dependent
120 ## subdirectories.
121 ## - which are identical in the Linux 2.6 and Linux 2.4 ports.
123 cd ${AD}/include/asm-xen
124 ln -sf ../asm-i386/a.out.h
125 ln -sf ../asm-i386/apicdef.h
126 ln -sf ../asm-i386/apic.h
127 ln -sf ../asm-i386/atomic.h
128 ln -sf ../asm-i386/bitops.h
129 ln -sf ../asm-i386/boot.h
130 ln -sf ../asm-i386/byteorder.h
131 ln -sf ../asm-i386/cache.h
132 ln -sf ../asm-i386/checksum.h
133 ln -sf ../asm-i386/cpufeature.h
134 ln -sf ../asm-i386/current.h
135 ln -sf ../asm-i386/debugreg.h
136 ln -sf ../asm-i386/delay.h
137 ln -sf ../asm-i386/div64.h
138 ln -sf ../asm-i386/dma.h
139 ln -sf ../asm-i386/elf.h
140 ln -sf ../asm-i386/errno.h
141 ln -sf ../asm-i386/fcntl.h
142 ln -sf ../asm-i386/floppy.h
143 ln -sf ../asm-i386/hardirq.h
144 ln -sf ../asm-i386/hdreg.h
145 ln -sf ../asm-i386/i387.h
146 ln -sf ../asm-i386/ide.h
147 ln -sf ../asm-i386/init.h
148 ln -sf ../asm-i386/io_apic.h
149 ln -sf ../asm-i386/ioctl.h
150 ln -sf ../asm-i386/ioctls.h
151 ln -sf ../asm-i386/ipcbuf.h
152 ln -sf ../asm-i386/ipc.h
153 ln -sf ../asm-i386/kmap_types.h
154 ln -sf ../asm-i386/ldt.h
155 ln -sf ../asm-i386/linux_logo.h
156 ln -sf ../asm-i386/locks.h
157 ln -sf ../asm-i386/math_emu.h
158 ln -sf ../asm-i386/mc146818rtc.h
159 ln -sf ../asm-i386/mca_dma.h
160 ln -sf ../asm-i386/mman.h
161 ln -sf ../asm-i386/mmu.h
162 ln -sf ../asm-i386/mmx.h
163 ln -sf ../asm-i386/mpspec.h
164 ln -sf ../asm-i386/msgbuf.h
165 ln -sf ../asm-i386/msr.h
166 ln -sf ../asm-i386/mtrr.h
167 ln -sf ../asm-i386/namei.h
168 ln -sf ../asm-i386/param.h
169 ln -sf ../asm-i386/parport.h
170 ln -sf ../asm-i386/pgtable-3level.h
171 ln -sf ../asm-i386/poll.h
172 ln -sf ../asm-i386/posix_types.h
173 ln -sf ../asm-i386/ptrace.h
174 ln -sf ../asm-i386/resource.h
175 ln -sf ../asm-i386/rwlock.h
176 ln -sf ../asm-i386/rwsem.h
177 ln -sf ../asm-i386/scatterlist.h
178 ln -sf ../asm-i386/semaphore.h
179 ln -sf ../asm-i386/sembuf.h
180 ln -sf ../asm-i386/serial.h
181 ln -sf ../asm-i386/setup.h
182 ln -sf ../asm-i386/shmbuf.h
183 ln -sf ../asm-i386/shmparam.h
184 ln -sf ../asm-i386/sigcontext.h
185 ln -sf ../asm-i386/siginfo.h
186 ln -sf ../asm-i386/signal.h
187 ln -sf ../asm-i386/smplock.h
188 ln -sf ../asm-i386/socket.h
189 ln -sf ../asm-i386/sockios.h
190 ln -sf ../asm-i386/softirq.h
191 ln -sf ../asm-i386/spinlock.h
192 ln -sf ../asm-i386/statfs.h
193 ln -sf ../asm-i386/stat.h
194 ln -sf ../asm-i386/string-486.h
195 ln -sf ../asm-i386/string.h
196 ln -sf ../asm-i386/termbits.h
197 ln -sf ../asm-i386/termios.h
198 ln -sf ../asm-i386/timex.h
199 ln -sf ../asm-i386/tlb.h
200 ln -sf ../asm-i386/types.h
201 ln -sf ../asm-i386/uaccess.h
202 ln -sf ../asm-i386/ucontext.h
203 ln -sf ../asm-i386/unaligned.h
204 ln -sf ../asm-i386/unistd.h
205 ln -sf ../asm-i386/user.h
206 ln -sf ../asm-i386/vm86.h
207 ln -sf ../../${LINUX_26}/include/asm-xen/balloon.h
208 ln -sf ../../${LINUX_26}/include/asm-xen/ctrl_if.h
209 ln -sf ../../${LINUX_26}/include/asm-xen/evtchn.h
210 ln -sf ../../${LINUX_26}/include/asm-xen/gnttab.h
211 ln -sf ../../${LINUX_26}/include/asm-xen/hypervisor.h
212 ln -sf ../../${LINUX_26}/include/asm-xen/xen_proc.h
213 ln -sf ../../${LINUX_26}/include/asm-xen/asm-i386/synch_bitops.h
214 ln -sf ../../${LINUX_26}/include/asm-xen/asm-i386/hypercall.h
216 mkdir -p linux-public && cd linux-public
217 ln -sf ../../../${LINUX_26}/include/asm-xen/linux-public/privcmd.h
218 ln -sf ../../../${LINUX_26}/include/asm-xen/linux-public/suspend.h
220 cd ${AD}/arch/xen/kernel
221 ln -sf ../../i386/kernel/i387.c
222 ln -sf ../../i386/kernel/init_task.c
223 ln -sf ../../i386/kernel/pci-i386.c
224 ln -sf ../../i386/kernel/pci-i386.h
225 ln -sf ../../i386/kernel/ptrace.c
226 ln -sf ../../i386/kernel/semaphore.c
227 ln -sf ../../i386/kernel/sys_i386.c
228 ln -sf ../../../${LINUX_26}/arch/xen/kernel/ctrl_if.c
229 ln -sf ../../../${LINUX_26}/arch/xen/kernel/evtchn.c
230 ln -sf ../../../${LINUX_26}/arch/xen/kernel/fixup.c
231 ln -sf ../../../${LINUX_26}/arch/xen/kernel/gnttab.c
232 ln -sf ../../../${LINUX_26}/arch/xen/kernel/reboot.c
233 ln -sf ../../../${LINUX_26}/arch/xen/kernel/skbuff.c
235 cd ${AD}/arch/xen/lib
236 ln -sf ../../i386/lib/checksum.S
237 ln -sf ../../i386/lib/dec_and_lock.c
238 ln -sf ../../i386/lib/getuser.S
239 ln -sf ../../i386/lib/iodebug.c
240 ln -sf ../../i386/lib/memcpy.c
241 ln -sf ../../i386/lib/mmx.c
242 ln -sf ../../i386/lib/old-checksum.c
243 ln -sf ../../i386/lib/strstr.c
244 ln -sf ../../i386/lib/usercopy.c
245 ln -sf ../../../${LINUX_26}/arch/xen/kernel/xen_proc.c
247 cd ${AD}/arch/xen/mm
248 ln -sf ../../i386/mm/extable.c
249 ln -sf ../../i386/mm/pageattr.c
250 ln -sf ../../../${LINUX_26}/arch/xen/i386/mm/hypervisor.c
252 cd ${AD}/arch/xen/drivers/balloon
253 ln -sf ../../../../${LINUX_26}/drivers/xen/balloon/balloon.c
255 cd ${AD}/arch/xen/drivers/console
256 ln -sf ../../../../${LINUX_26}/drivers/xen/console/console.c
258 cd ${AD}/arch/xen/drivers/dom0
259 ln -sf ../../../../${LINUX_26}/drivers/xen/privcmd/privcmd.c core.c
261 cd ${AD}/arch/xen/drivers/evtchn
262 ln -sf ../../../../${LINUX_26}/drivers/xen/evtchn/evtchn.c
264 cd ${AD}/arch/xen/drivers/netif/frontend
265 ln -sf ../../../../../${LINUX_26}/drivers/xen/netfront/netfront.c main.c
267 cd ${AD}/arch/xen/drivers/netif/backend
268 ln -sf ../../../../../${LINUX_26}/drivers/xen/netback/common.h
269 ln -sf ../../../../../${LINUX_26}/drivers/xen/netback/control.c
270 ln -sf ../../../../../${LINUX_26}/drivers/xen/netback/interface.c
271 ln -sf ../../../../../${LINUX_26}/drivers/xen/netback/netback.c main.c
273 cd ${AD}/arch/xen/drivers/blkif/backend
274 ln -sf ../../../../../${LINUX_26}/drivers/xen/blkback/common.h
275 ln -sf ../../../../../${LINUX_26}/drivers/xen/blkback/blkback.c main.c
276 ln -sf ../../../../../${LINUX_26}/drivers/xen/blkback/control.c
277 ln -sf ../../../../../${LINUX_26}/drivers/xen/blkback/interface.c
278 ln -sf ../../../../../${LINUX_26}/drivers/xen/blkback/vbd.c
280 cd ${AD}/arch/xen/drivers/blkif/frontend
281 ln -sf ../../../../../${LINUX_26}/drivers/xen/blkfront/blkfront.c
283 cd ${AD}/arch/xen/drivers/usbif/frontend
284 ln -sf ../../../../../${LINUX_26}/drivers/xen/usbfront/usbfront.c main.c
285 ln -sf ../../../../../${LINUX_26}/drivers/xen/usbfront/xhci.h
287 cd ${AD}/arch/xen/drivers/usbif/backend
288 ln -sf ../../../../../${LINUX_26}/drivers/xen/usbback/common.h
289 ln -sf ../../../../../${LINUX_26}/drivers/xen/usbback/control.c
290 ln -sf ../../../../../${LINUX_26}/drivers/xen/usbback/interface.c
291 ln -sf ../../../../../${LINUX_26}/drivers/xen/usbback/usbback.c main.c