xenstore.c (216448) | xenstore.c (225704) |
---|---|
1/****************************************************************************** 2 * xenstore.c 3 * 4 * Low-level kernel interface to the XenStore. 5 * 6 * Copyright (C) 2005 Rusty Russell, IBM Corporation 7 * Copyright (C) 2009,2010 Spectra Logic Corporation 8 * --- 16 unchanged lines hidden (view full) --- 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 27 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 28 * IN THE SOFTWARE. 29 */ 30 31 32#include <sys/cdefs.h> | 1/****************************************************************************** 2 * xenstore.c 3 * 4 * Low-level kernel interface to the XenStore. 5 * 6 * Copyright (C) 2005 Rusty Russell, IBM Corporation 7 * Copyright (C) 2009,2010 Spectra Logic Corporation 8 * --- 16 unchanged lines hidden (view full) --- 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 27 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 28 * IN THE SOFTWARE. 29 */ 30 31 32#include <sys/cdefs.h> |
33__FBSDID("$FreeBSD: head/sys/xen/xenstore/xenstore.c 216448 2010-12-14 20:57:40Z gibbs $"); | 33__FBSDID("$FreeBSD: head/sys/xen/xenstore/xenstore.c 225704 2011-09-20 23:44:34Z gibbs $"); |
34 35#include <sys/param.h> 36#include <sys/bus.h> 37#include <sys/kernel.h> 38#include <sys/lock.h> 39#include <sys/module.h> 40#include <sys/mutex.h> 41#include <sys/sx.h> --- 674 unchanged lines hidden (view full) --- 716 */ 717static inline void 718xs_reply_filter(uint32_t request_msg_type, 719 uint32_t reply_msg_type, int request_reply_error) 720{ 721 /* 722 * The count of transactions drops if we attempted 723 * to end a transaction (even if that attempt fails | 34 35#include <sys/param.h> 36#include <sys/bus.h> 37#include <sys/kernel.h> 38#include <sys/lock.h> 39#include <sys/module.h> 40#include <sys/mutex.h> 41#include <sys/sx.h> --- 674 unchanged lines hidden (view full) --- 716 */ 717static inline void 718xs_reply_filter(uint32_t request_msg_type, 719 uint32_t reply_msg_type, int request_reply_error) 720{ 721 /* 722 * The count of transactions drops if we attempted 723 * to end a transaction (even if that attempt fails |
724 * in error), we receive a transaction end acknowledgement 725 * or if our attempt to begin a transactionfails. | 724 * in error), we receive a transaction end acknowledgement, 725 * or if our attempt to begin a transaction fails. |
726 */ 727 if (request_msg_type == XS_TRANSACTION_END 728 || (request_reply_error == 0 && reply_msg_type == XS_TRANSACTION_END) 729 || (request_msg_type == XS_TRANSACTION_START 730 && (request_reply_error != 0 || reply_msg_type == XS_ERROR))) 731 sx_sunlock(&xs.suspend_mutex); 732 733} --- 455 unchanged lines hidden (view full) --- 1189 return (error); 1190} 1191 1192/** 1193 * Prepare for suspension of this VM by halting XenStore access after 1194 * all transactions and individual requests have completed. 1195 */ 1196static int | 726 */ 727 if (request_msg_type == XS_TRANSACTION_END 728 || (request_reply_error == 0 && reply_msg_type == XS_TRANSACTION_END) 729 || (request_msg_type == XS_TRANSACTION_START 730 && (request_reply_error != 0 || reply_msg_type == XS_ERROR))) 731 sx_sunlock(&xs.suspend_mutex); 732 733} --- 455 unchanged lines hidden (view full) --- 1189 return (error); 1190} 1191 1192/** 1193 * Prepare for suspension of this VM by halting XenStore access after 1194 * all transactions and individual requests have completed. 1195 */ 1196static int |
1197xs_suspend(device_t dev __unused) | 1197xs_suspend(device_t dev) |
1198{ | 1198{ |
1199 int error; |
|
1199 | 1200 |
1201 /* Suspend child Xen devices. */ 1202 error = bus_generic_suspend(dev); 1203 if (error != 0) 1204 return (error); 1205 |
|
1200 sx_xlock(&xs.suspend_mutex); 1201 sx_xlock(&xs.request_mutex); 1202 1203 return (0); 1204} 1205 1206/** 1207 * Resume XenStore operations after this VM is resumed. --- 14 unchanged lines hidden (view full) --- 1222 */ 1223 LIST_FOREACH(watch, &xs.registered_watches, list) { 1224 sprintf(token, "%lX", (long)watch); 1225 xs_watch(watch->node, token); 1226 } 1227 1228 sx_xunlock(&xs.suspend_mutex); 1229 | 1206 sx_xlock(&xs.suspend_mutex); 1207 sx_xlock(&xs.request_mutex); 1208 1209 return (0); 1210} 1211 1212/** 1213 * Resume XenStore operations after this VM is resumed. --- 14 unchanged lines hidden (view full) --- 1228 */ 1229 LIST_FOREACH(watch, &xs.registered_watches, list) { 1230 sprintf(token, "%lX", (long)watch); 1231 xs_watch(watch->node, token); 1232 } 1233 1234 sx_xunlock(&xs.suspend_mutex); 1235 |
1236 /* Resume child Xen devices. */ 1237 bus_generic_resume(dev); 1238 |
|
1230 return (0); 1231} 1232 1233/*-------------------- Private Device Attachment Data -----------------------*/ 1234static device_method_t xenstore_methods[] = { 1235 /* Device interface */ 1236 DEVMETHOD(device_identify, xs_identify), 1237 DEVMETHOD(device_probe, xs_probe), --- 416 unchanged lines hidden --- | 1239 return (0); 1240} 1241 1242/*-------------------- Private Device Attachment Data -----------------------*/ 1243static device_method_t xenstore_methods[] = { 1244 /* Device interface */ 1245 DEVMETHOD(device_identify, xs_identify), 1246 DEVMETHOD(device_probe, xs_probe), --- 416 unchanged lines hidden --- |