[BACK]Return to xenbus_xs.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / arch / xen / xenbus

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/sys/arch/xen/xenbus/xenbus_xs.c between version 1.9 and 1.9.2.1

version 1.9, 2007/10/17 19:58:34 version 1.9.2.1, 2007/12/08 18:18:31
Line 46  __KERNEL_RCSID(0, "$NetBSD$");
Line 46  __KERNEL_RCSID(0, "$NetBSD$");
 #include <sys/systm.h>  #include <sys/systm.h>
 #include <sys/param.h>  #include <sys/param.h>
 #include <sys/proc.h>  #include <sys/proc.h>
   #include <sys/mutex.h>
 #include <sys/kthread.h>  #include <sys/kthread.h>
   
 #include <machine/stdarg.h>  #include <machine/stdarg.h>
   
 #include <machine/xenbus.h>  #include <xen/xenbus.h>
 #include "xenbus_comms.h"  #include "xenbus_comms.h"
   
 #define streq(a, b) (strcmp((a), (b)) == 0)  #define streq(a, b) (strcmp((a), (b)) == 0)
Line 79  struct xs_handle {
Line 80  struct xs_handle {
         /* A list of replies. Currently only one will ever be outstanding. */          /* A list of replies. Currently only one will ever be outstanding. */
         SIMPLEQ_HEAD(, xs_stored_msg) reply_list;          SIMPLEQ_HEAD(, xs_stored_msg) reply_list;
         struct simplelock reply_lock;          struct simplelock reply_lock;
         struct lock xs_lock; /* serialize access to xenstore */          kmutex_t xs_lock; /* serialize access to xenstore */
         int suspend_spl;          int suspend_spl;
   
 };  };
Line 168  xenbus_dev_request_and_reply(struct xsd_
Line 169  xenbus_dev_request_and_reply(struct xsd_
         int err = 0, s;          int err = 0, s;
   
         s = spltty();          s = spltty();
         err = lockmgr(&xs_state.xs_lock, LK_EXCLUSIVE, NULL);          mutex_enter(&xs_state.xs_lock);
         if (err)  
                 panic("can't get xs_state.xs_lock: %d", err);  
   
         err = xb_write(msg, sizeof(*msg) + msg->len);          err = xb_write(msg, sizeof(*msg) + msg->len);
         if (err) {          if (err) {
                 msg->type = XS_ERROR;                  msg->type = XS_ERROR;
Line 179  xenbus_dev_request_and_reply(struct xsd_
Line 177  xenbus_dev_request_and_reply(struct xsd_
         } else {          } else {
                 *reply = read_reply(&msg->type, &msg->len);                  *reply = read_reply(&msg->type, &msg->len);
         }          }
           mutex_exit(&xs_state.xs_lock);
         lockmgr(&xs_state.xs_lock, LK_RELEASE, NULL);  
         splx(s);          splx(s);
   
         return err;          return err;
Line 208  xs_talkv(struct xenbus_transaction *t,
Line 205  xs_talkv(struct xenbus_transaction *t,
                 msg.len += iovec[i].iov_len;                  msg.len += iovec[i].iov_len;
   
         s = spltty();          s = spltty();
         err = lockmgr(&xs_state.xs_lock, LK_EXCLUSIVE, NULL);          mutex_enter(&xs_state.xs_lock);
         if (err)  
                 panic("can't get xs_state.xs_lock: %d", err);  
   
         DPRINTK("write msg");          DPRINTK("write msg");
         err = xb_write(&msg, sizeof(msg));          err = xb_write(&msg, sizeof(msg));
         DPRINTK("write msg err %d", err);          DPRINTK("write msg err %d", err);
         if (err) {          if (err) {
                 lockmgr(&xs_state.xs_lock, LK_RELEASE, NULL);                  mutex_exit(&xs_state.xs_lock);
                 splx(s);                  splx(s);
                 return (err);                  return (err);
         }          }
Line 226  xs_talkv(struct xenbus_transaction *t,
Line 221  xs_talkv(struct xenbus_transaction *t,
                 err = xb_write(iovec[i].iov_base, iovec[i].iov_len);;                  err = xb_write(iovec[i].iov_base, iovec[i].iov_len);;
                 DPRINTK("write iovect err %d", err);                  DPRINTK("write iovect err %d", err);
                 if (err) {                  if (err) {
                         lockmgr(&xs_state.xs_lock, LK_RELEASE, NULL);                          mutex_exit(&xs_state.xs_lock);
                         splx(s);                          splx(s);
                         return (err);                          return (err);
                 }                  }
Line 236  xs_talkv(struct xenbus_transaction *t,
Line 231  xs_talkv(struct xenbus_transaction *t,
         ret = read_reply(&msg.type, len);          ret = read_reply(&msg.type, len);
         DPRINTK("read done");          DPRINTK("read done");
   
         lockmgr(&xs_state.xs_lock, LK_RELEASE, NULL);          mutex_exit(&xs_state.xs_lock);
         splx(s);          splx(s);
   
         if (msg.type == XS_ERROR) {          if (msg.type == XS_ERROR) {
Line 834  xs_init(void)
Line 829  xs_init(void)
   
         SIMPLEQ_INIT(&xs_state.reply_list);          SIMPLEQ_INIT(&xs_state.reply_list);
         simple_lock_init(&xs_state.reply_lock);          simple_lock_init(&xs_state.reply_lock);
         lockinit(&xs_state.xs_lock, IPL_TTY, "xenst", 0, 0);          mutex_init(&xs_state.xs_lock, MUTEX_DEFAULT, IPL_NONE);
   
         err = kthread_create(PRI_NONE, 0, NULL, xenwatch_thread,          err = kthread_create(PRI_NONE, 0, NULL, xenwatch_thread,
             NULL, NULL, "xenwatch");              NULL, NULL, "xenwatch");

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.9.2.1

CVSweb <webmaster@jp.NetBSD.org>