Sun Apr 24 16:20:22 2011 UTC ()
Pull up following revision(s) (requested by cegger in ticket #1599):
	sys/arch/xen/xenbus/xenbus_probe.c: revision 1.31
previous fix does not work if there is exactly only one entry where continue
exits the loop.
Apply fix from Konrad Wilke on port-xen@
That makes NetBSD DomU boot on Linux Dom0 with xl.


(riz)
diff -r1.26.2.2 -r1.26.2.3 src/sys/arch/xen/xenbus/xenbus_probe.c

cvs diff -r1.26.2.2 -r1.26.2.3 src/sys/arch/xen/xenbus/xenbus_probe.c (expand / switch to unified diff)

--- src/sys/arch/xen/xenbus/xenbus_probe.c 2011/04/24 16:16:51 1.26.2.2
+++ src/sys/arch/xen/xenbus/xenbus_probe.c 2011/04/24 16:20:22 1.26.2.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: xenbus_probe.c,v 1.26.2.2 2011/04/24 16:16:51 riz Exp $ */ 1/* $NetBSD: xenbus_probe.c,v 1.26.2.3 2011/04/24 16:20:22 riz Exp $ */
2/****************************************************************************** 2/******************************************************************************
3 * Talks to Xen Store to figure out what devices we have. 3 * Talks to Xen Store to figure out what devices we have.
4 * 4 *
5 * Copyright (C) 2005 Rusty Russell, IBM Corporation 5 * Copyright (C) 2005 Rusty Russell, IBM Corporation
6 * Copyright (C) 2005 Mike Wray, Hewlett-Packard 6 * Copyright (C) 2005 Mike Wray, Hewlett-Packard
7 * Copyright (C) 2005 XenSource Ltd 7 * Copyright (C) 2005 XenSource Ltd
8 *  8 *
9 * This file may be distributed separately from the Linux kernel, or 9 * This file may be distributed separately from the Linux kernel, or
10 * incorporated into other software packages, subject to the following license: 10 * incorporated into other software packages, subject to the following license:
11 *  11 *
12 * Permission is hereby granted, free of charge, to any person obtaining a copy 12 * Permission is hereby granted, free of charge, to any person obtaining a copy
13 * of this source file (the "Software"), to deal in the Software without 13 * of this source file (the "Software"), to deal in the Software without
14 * restriction, including without limitation the rights to use, copy, modify, 14 * restriction, including without limitation the rights to use, copy, modify,
@@ -19,27 +19,27 @@ @@ -19,27 +19,27 @@
19 * The above copyright notice and this permission notice shall be included in 19 * The above copyright notice and this permission notice shall be included in
20 * all copies or substantial portions of the Software. 20 * all copies or substantial portions of the Software.
21 *  21 *
22 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 27 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
28 * IN THE SOFTWARE. 28 * IN THE SOFTWARE.
29 */ 29 */
30 30
31#include <sys/cdefs.h> 31#include <sys/cdefs.h>
32__KERNEL_RCSID(0, "$NetBSD: xenbus_probe.c,v 1.26.2.2 2011/04/24 16:16:51 riz Exp $"); 32__KERNEL_RCSID(0, "$NetBSD: xenbus_probe.c,v 1.26.2.3 2011/04/24 16:20:22 riz Exp $");
33 33
34#if 0 34#if 0
35#define DPRINTK(fmt, args...) \ 35#define DPRINTK(fmt, args...) \
36 printf("xenbus_probe (%s:%d) " fmt ".\n", __func__, __LINE__, ##args) 36 printf("xenbus_probe (%s:%d) " fmt ".\n", __func__, __LINE__, ##args)
37#else 37#else
38#define DPRINTK(fmt, args...) ((void)0) 38#define DPRINTK(fmt, args...) ((void)0)
39#endif 39#endif
40 40
41#include <sys/types.h> 41#include <sys/types.h>
42#include <sys/null.h> 42#include <sys/null.h>
43#include <sys/errno.h> 43#include <sys/errno.h>
44#include <sys/malloc.h> 44#include <sys/malloc.h>
45#include <sys/systm.h> 45#include <sys/systm.h>
@@ -297,26 +297,27 @@ xenbus_probe_device_type(const char *pat @@ -297,26 +297,27 @@ xenbus_probe_device_type(const char *pat
297 snprintf(__UNCONST(xbusd->xbusd_path), 297 snprintf(__UNCONST(xbusd->xbusd_path),
298 msize - sizeof(*xbusd) + 1, "%s/%s", path, dir[i]); 298 msize - sizeof(*xbusd) + 1, "%s/%s", path, dir[i]);
299 if (xenbus_lookup_device_path(xbusd->xbusd_path) != NULL) { 299 if (xenbus_lookup_device_path(xbusd->xbusd_path) != NULL) {
300 /* device already registered */ 300 /* device already registered */
301 free(xbusd, M_DEVBUF); 301 free(xbusd, M_DEVBUF);
302 continue; 302 continue;
303 } 303 }
304 err = xenbus_read_ul(NULL, xbusd->xbusd_path, "state", 304 err = xenbus_read_ul(NULL, xbusd->xbusd_path, "state",
305 &state, 10); 305 &state, 10);
306 if (err) { 306 if (err) {
307 printf("xenbus: can't get state " 307 printf("xenbus: can't get state "
308 "for %s (%d)\n", xbusd->xbusd_path, err); 308 "for %s (%d)\n", xbusd->xbusd_path, err);
309 free(xbusd, M_DEVBUF); 309 free(xbusd, M_DEVBUF);
 310 err = 0;
310 continue; 311 continue;
311 } 312 }
312 if (state != XenbusStateInitialising) { 313 if (state != XenbusStateInitialising) {
313 /* device is not new */ 314 /* device is not new */
314 free(xbusd, M_DEVBUF); 315 free(xbusd, M_DEVBUF);
315 continue; 316 continue;
316 } 317 }
317 318
318 xbusd->xbusd_otherend_watch.xbw_dev = xbusd; 319 xbusd->xbusd_otherend_watch.xbw_dev = xbusd;
319 DPRINTK("xenbus_probe_device_type probe %s\n", 320 DPRINTK("xenbus_probe_device_type probe %s\n",
320 xbusd->xbusd_path); 321 xbusd->xbusd_path);
321 if (create != NULL) { 322 if (create != NULL) {
322 xbusd->xbusd_type = XENBUS_BACKEND_DEVICE; 323 xbusd->xbusd_type = XENBUS_BACKEND_DEVICE;