| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: xenbus_xs.c,v 1.21 2011/07/17 20:54:49 joerg Exp $ */ | | 1 | /* $NetBSD: xenbus_xs.c,v 1.22 2011/07/27 23:11:23 matt Exp $ */ |
2 | /****************************************************************************** | | 2 | /****************************************************************************** |
3 | * xenbus_xs.c | | 3 | * xenbus_xs.c |
4 | * | | 4 | * |
5 | * This is the kernel equivalent of the "xs" library. We don't need everything | | 5 | * This is the kernel equivalent of the "xs" library. We don't need everything |
6 | * and we use xenbus_comms for communication. | | 6 | * and we use xenbus_comms for communication. |
7 | * | | 7 | * |
8 | * Copyright (C) 2005 Rusty Russell, IBM Corporation | | 8 | * Copyright (C) 2005 Rusty Russell, IBM Corporation |
9 | * | | 9 | * |
10 | * This file may be distributed separately from the Linux kernel, or | | 10 | * This file may be distributed separately from the Linux kernel, or |
11 | * incorporated into other software packages, subject to the following license: | | 11 | * incorporated into other software packages, subject to the following license: |
12 | * | | 12 | * |
13 | * Permission is hereby granted, free of charge, to any person obtaining a copy | | 13 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
14 | * of this source file (the "Software"), to deal in the Software without | | 14 | * of this source file (the "Software"), to deal in the Software without |
| @@ -20,27 +20,27 @@ | | | @@ -20,27 +20,27 @@ |
20 | * The above copyright notice and this permission notice shall be included in | | 20 | * The above copyright notice and this permission notice shall be included in |
21 | * all copies or substantial portions of the Software. | | 21 | * all copies or substantial portions of the Software. |
22 | * | | 22 | * |
23 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | | 23 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
24 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | | 24 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
25 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | | 25 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
26 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | | 26 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
27 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | | 27 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
28 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | | 28 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS |
29 | * IN THE SOFTWARE. | | 29 | * IN THE SOFTWARE. |
30 | */ | | 30 | */ |
31 | | | 31 | |
32 | #include <sys/cdefs.h> | | 32 | #include <sys/cdefs.h> |
33 | __KERNEL_RCSID(0, "$NetBSD: xenbus_xs.c,v 1.21 2011/07/17 20:54:49 joerg Exp $"); | | 33 | __KERNEL_RCSID(0, "$NetBSD: xenbus_xs.c,v 1.22 2011/07/27 23:11:23 matt Exp $"); |
34 | | | 34 | |
35 | #if 0 | | 35 | #if 0 |
36 | #define DPRINTK(fmt, args...) \ | | 36 | #define DPRINTK(fmt, args...) \ |
37 | printf("xenbus_xs (%s:%d) " fmt ".\n", __func__, __LINE__, ##args) | | 37 | printf("xenbus_xs (%s:%d) " fmt ".\n", __func__, __LINE__, ##args) |
38 | #else | | 38 | #else |
39 | #define DPRINTK(fmt, args...) ((void)0) | | 39 | #define DPRINTK(fmt, args...) ((void)0) |
40 | #endif | | 40 | #endif |
41 | | | 41 | |
42 | #include <sys/types.h> | | 42 | #include <sys/types.h> |
43 | #include <sys/null.h> | | 43 | #include <sys/null.h> |
44 | #include <sys/errno.h> | | 44 | #include <sys/errno.h> |
45 | #include <sys/malloc.h> | | 45 | #include <sys/malloc.h> |
46 | #include <sys/systm.h> | | 46 | #include <sys/systm.h> |
| @@ -730,27 +730,27 @@ xenwatch_thread(void *unused) | | | @@ -730,27 +730,27 @@ xenwatch_thread(void *unused) |
730 | mutex_enter(&watch_events_lock); | | 730 | mutex_enter(&watch_events_lock); |
731 | while (SIMPLEQ_EMPTY(&watch_events)) | | 731 | while (SIMPLEQ_EMPTY(&watch_events)) |
732 | cv_wait(&watch_cv, &watch_events_lock); | | 732 | cv_wait(&watch_cv, &watch_events_lock); |
733 | SIMPLEQ_CONCAT(&events_to_proces, &watch_events); | | 733 | SIMPLEQ_CONCAT(&events_to_proces, &watch_events); |
734 | mutex_exit(&watch_events_lock); | | 734 | mutex_exit(&watch_events_lock); |
735 | | | 735 | |
736 | DPRINTK("xenwatch_thread: processing events"); | | 736 | DPRINTK("xenwatch_thread: processing events"); |
737 | | | 737 | |
738 | while ((msg = SIMPLEQ_FIRST(&events_to_proces)) != NULL) { | | 738 | while ((msg = SIMPLEQ_FIRST(&events_to_proces)) != NULL) { |
739 | DPRINTK("xenwatch_thread: got event"); | | 739 | DPRINTK("xenwatch_thread: got event"); |
740 | SIMPLEQ_REMOVE_HEAD(&events_to_proces, msg_next); | | 740 | SIMPLEQ_REMOVE_HEAD(&events_to_proces, msg_next); |
741 | msg->u.watch.handle->xbw_callback( | | 741 | msg->u.watch.handle->xbw_callback( |
742 | msg->u.watch.handle, | | 742 | msg->u.watch.handle, |
743 | (const char **)msg->u.watch.vec, | | 743 | (void *)msg->u.watch.vec, |
744 | msg->u.watch.vec_size); | | 744 | msg->u.watch.vec_size); |
745 | free(msg->u.watch.vec, M_DEVBUF); | | 745 | free(msg->u.watch.vec, M_DEVBUF); |
746 | free(msg, M_DEVBUF); | | 746 | free(msg, M_DEVBUF); |
747 | } | | 747 | } |
748 | } | | 748 | } |
749 | } | | 749 | } |
750 | | | 750 | |
751 | static int | | 751 | static int |
752 | process_msg(void) | | 752 | process_msg(void) |
753 | { | | 753 | { |
754 | struct xs_stored_msg *msg; | | 754 | struct xs_stored_msg *msg; |
755 | char *body; | | 755 | char *body; |
756 | int err; | | 756 | int err; |