ia64/xen-unstable
changeset 3560:de9af8f0cdf1
bitkeeper revision 1.1159.231.7 (41f913d39TdyKRddqjGU3m60tTUoUQ)
Remove excessive debug messages from xend/xcs interface code.
Remove excessive debug messages from xend/xcs interface code.
author | akw27@labyrinth.cl.cam.ac.uk |
---|---|
date | Thu Jan 27 16:16:19 2005 +0000 (2005-01-27) |
parents | ca35c856c1eb |
children | 25f3f22927e9 2e60786262c4 |
files | tools/python/xen/lowlevel/xu/xu.c |
line diff
1.1 --- a/tools/python/xen/lowlevel/xu/xu.c Thu Jan 27 13:52:54 2005 +0000 1.2 +++ b/tools/python/xen/lowlevel/xu/xu.c Thu Jan 27 16:16:19 2005 +0000 1.3 @@ -82,12 +82,12 @@ static int xcs_ctrl_fd = -1; /* control 1.4 static int xcs_data_fd = -1; /* data connection to the xcs server. */ 1.5 static u32 xcs_session_id = 0; 1.6 1.7 -int xcs_ctrl_send(xcs_msg_t *msg); 1.8 -int xcs_ctrl_read(xcs_msg_t *msg); 1.9 -int xcs_data_send(xcs_msg_t *msg); 1.10 -int xcs_data_read(xcs_msg_t *msg); 1.11 +static int xcs_ctrl_send(xcs_msg_t *msg); 1.12 +static int xcs_ctrl_read(xcs_msg_t *msg); 1.13 +static int xcs_data_send(xcs_msg_t *msg); 1.14 +static int xcs_data_read(xcs_msg_t *msg); 1.15 1.16 -int xcs_connect(char *ip, short port) 1.17 +static int xcs_connect(char *ip, short port) 1.18 { 1.19 struct sockaddr_in addr; 1.20 int ret, flags; 1.21 @@ -170,22 +170,6 @@ int xcs_connect(char *ip, short port) 1.22 goto data_fd_fail; 1.23 } 1.24 1.25 - /* Haven't put type binding hooks into Xend yet. */ 1.26 - /* for now, register for everything: */ 1.27 - /* 1.28 - msg.type = XCS_MSG_BIND; 1.29 - msg.u.bind.port = PORT_WILDCARD; 1.30 - msg.u.bind.type = TYPE_WILDCARD; 1.31 - xcs_ctrl_send(&msg); 1.32 - xcs_ctrl_read(&msg); 1.33 - 1.34 - if (msg.result != XCS_RSLT_OK) 1.35 - { 1.36 - printf("error binding!\n"); 1.37 - goto data_fd_fail; 1.38 - } 1.39 - printf("successfully connected to xcs.\n"); 1.40 - */ 1.41 return 0; 1.42 1.43 data_fd_fail: 1.44 @@ -201,66 +185,43 @@ fail: 1.45 1.46 } 1.47 1.48 -void xcs_disconnect(void) 1.49 +static void xcs_disconnect(void) 1.50 { 1.51 - printf("xcs_disconnect called!\n"); 1.52 close(xcs_data_fd); 1.53 xcs_data_fd = -1; 1.54 close(xcs_ctrl_fd); 1.55 xcs_ctrl_fd = -1; 1.56 } 1.57 1.58 -int xcs_ctrl_read(xcs_msg_t *msg) 1.59 +static int xcs_ctrl_read(xcs_msg_t *msg) 1.60 { 1.61 int ret; 1.62 1.63 ret = read(xcs_ctrl_fd, msg, sizeof(xcs_msg_t)); 1.64 - if (ret != sizeof(xcs_msg_t)) { 1.65 - printf("xu-xcs: ctrl read error (%d)\n", errno); 1.66 - /* TODO: set xcs_fd to -1 if the connection has been dropped. */ 1.67 - } else { 1.68 - printf("xu-xcs: read! fd: %d, type: %u\n", xcs_ctrl_fd, msg->type); 1.69 - } 1.70 return ret; 1.71 } 1.72 1.73 -int xcs_ctrl_send(xcs_msg_t *msg) 1.74 +static int xcs_ctrl_send(xcs_msg_t *msg) 1.75 { 1.76 int ret; 1.77 1.78 ret = send(xcs_ctrl_fd, msg, sizeof(xcs_msg_t), 0); 1.79 - if (ret != sizeof(xcs_msg_t) ) 1.80 - { 1.81 - printf("xu-xcs: ctrl send error(%d)\n", errno); 1.82 - /* TODO: set xcs_fd to -1 if the connection has been dropped. */ 1.83 - } else { 1.84 - printf("xu-xcs: sent! fd: %d, type: %u\n", xcs_ctrl_fd, msg->type); 1.85 - } 1.86 return ret; 1.87 } 1.88 1.89 -int xcs_data_read(xcs_msg_t *msg) 1.90 +static int xcs_data_read(xcs_msg_t *msg) 1.91 { 1.92 int ret; 1.93 1.94 ret = read(xcs_data_fd, msg, sizeof(xcs_msg_t)); 1.95 - if (ret != sizeof(xcs_msg_t)) { 1.96 - printf("xu-xcs: ctrl read error (%d)\n", errno); 1.97 - /* TODO: set xcs_fd to -1 if the connection has been dropped. */ 1.98 - } 1.99 return ret; 1.100 } 1.101 1.102 -int xcs_data_send(xcs_msg_t *msg) 1.103 +static int xcs_data_send(xcs_msg_t *msg) 1.104 { 1.105 int ret; 1.106 1.107 ret = send(xcs_data_fd, msg, sizeof(xcs_msg_t), 0); 1.108 - if (ret != sizeof(xcs_msg_t) ) 1.109 - { 1.110 - printf("xu-xcs: ctrl send error(%d)\n", errno); 1.111 - /* TODO: set xcs_fd to -1 if the connection has been dropped. */ 1.112 - } 1.113 return ret; 1.114 } 1.115 1.116 @@ -302,7 +263,6 @@ static PyObject *xu_notifier_read(PyObje 1.117 1.118 if ( !PyArg_ParseTuple(args, "") ) 1.119 return NULL; 1.120 - printf("xu_notifier_read()\n"); 1.121 1.122 while ((!REQ_RING_FULL) && (!RSP_RING_FULL)) 1.123 { 1.124 @@ -318,7 +278,7 @@ static PyObject *xu_notifier_read(PyObje 1.125 break; 1.126 return PyErr_SetFromErrno(PyExc_IOError); 1.127 } 1.128 - printf("notifier got msg type %u\n", ent->msg.type); 1.129 + 1.130 switch (ent->msg.type) 1.131 { 1.132 case XCS_REQUEST: 1.133 @@ -337,26 +297,21 @@ static PyObject *xu_notifier_read(PyObje 1.134 return PyInt_FromLong(ret); 1.135 1.136 default: 1.137 - printf("Throwing away xcs msg type: %u\n", ent->msg.type); 1.138 + /*printf("Throwing away xcs msg type: %u\n", ent->msg.type);*/ 1.139 free(ent); 1.140 } 1.141 } 1.142 1.143 if (!REQ_RING_EMPTY) 1.144 { 1.145 - printf("nfy: req: %d\n", 1.146 - REQ_RING_ENT(req_cons)->msg.u.control.local_port); 1.147 return PyInt_FromLong(REQ_RING_ENT(req_cons)->msg.u.control.local_port); 1.148 } 1.149 1.150 if (!RSP_RING_EMPTY) 1.151 { 1.152 - printf("nfy: rsp: %d\n", 1.153 - RSP_RING_ENT(rsp_cons)->msg.u.control.local_port); 1.154 return PyInt_FromLong(RSP_RING_ENT(rsp_cons)->msg.u.control.local_port); 1.155 } 1.156 1.157 - printf("nfy: returning None\n"); 1.158 Py_INCREF(Py_None); 1.159 return Py_None; 1.160 } 1.161 @@ -484,7 +439,6 @@ static PyObject *xu_notifier_new(PyObjec 1.162 xu_notifier_object *xun; 1.163 int i; 1.164 1.165 -printf("xu_notifier_new()\n"); 1.166 if ( !PyArg_ParseTuple(args, "") ) 1.167 return NULL; 1.168 1.169 @@ -506,6 +460,7 @@ static PyObject *xu_notifier_getattr(PyO 1.170 1.171 static void xu_notifier_dealloc(PyObject *self) 1.172 { 1.173 + xcs_disconnect(); 1.174 PyObject_Del(self); 1.175 } 1.176 1.177 @@ -1119,9 +1074,6 @@ static PyObject *xu_port_read_request(Py 1.178 if ((ent == NULL) || 1.179 (ent->msg.u.control.remote_dom != xup->remote_dom)) 1.180 goto none; 1.181 - 1.182 -printf("read request (%d:%d)\n", ent->msg.u.control.msg.type, 1.183 - ent->msg.u.control.msg.subtype); 1.184 1.185 cmsg = &ent->msg.u.control.msg; 1.186 xum = PyObject_New(xu_message_object, &xu_message_type); 1.187 @@ -1138,7 +1090,6 @@ printf("read request (%d:%d)\n", ent->ms 1.188 return (PyObject *)xum; 1.189 1.190 none: 1.191 -printf("read request - NO REQUEST!\n"); 1.192 Py_INCREF(Py_None); 1.193 return Py_None; 1.194 1.195 @@ -1187,9 +1138,6 @@ static PyObject *xu_port_read_response(P 1.196 if ((ent == NULL) || 1.197 (ent->msg.u.control.remote_dom != xup->remote_dom)) 1.198 goto none; 1.199 - 1.200 -printf("read response (%d:%d)\n", ent->msg.u.control.msg.type, 1.201 - ent->msg.u.control.msg.subtype); 1.202 1.203 cmsg = &ent->msg.u.control.msg; 1.204 xum = PyObject_New(xu_message_object, &xu_message_type); 1.205 @@ -1206,7 +1154,6 @@ printf("read response (%d:%d)\n", ent->m 1.206 return (PyObject *)xum; 1.207 1.208 none: 1.209 -printf("read response - NO RESPONSE!\n"); 1.210 Py_INCREF(Py_None); 1.211 return Py_None; 1.212 1.213 @@ -1242,8 +1189,7 @@ static PyObject *xu_port_request_to_read 1.214 xcs_msg_ent_t *ent; 1.215 int found = 0; 1.216 unsigned i; 1.217 - 1.218 -printf("xu_port_request_to_read()\n"); 1.219 + 1.220 if ( !PyArg_ParseTuple(args, "") ) 1.221 return NULL; 1.222 1.223 @@ -1274,8 +1220,7 @@ static PyObject *xu_port_response_to_rea 1.224 xcs_msg_ent_t *ent; 1.225 int found = 0; 1.226 unsigned i; 1.227 - 1.228 -printf("xu_port_response_to_read()\n"); 1.229 + 1.230 if ( !PyArg_ParseTuple(args, "") ) 1.231 return NULL; 1.232 1.233 @@ -1327,9 +1272,6 @@ static PyObject *xu_port_register(PyObje 1.234 &type) ) 1.235 return NULL; 1.236 1.237 - printf("REGISTER : Dom: %3d Port: %3d Type:%3d\n", 1.238 - xup->remote_dom, xup->local_port, type); 1.239 - 1.240 msg.type = XCS_MSG_BIND; 1.241 msg.u.bind.port = xup->local_port; 1.242 msg.u.bind.type = type; 1.243 @@ -1338,7 +1280,6 @@ static PyObject *xu_port_register(PyObje 1.244 1.245 if (msg.result != XCS_RSLT_OK) 1.246 { 1.247 - printf(" : REGISTRATION FAILED! (%d)\n", msg.result); 1.248 return PyInt_FromLong(0); 1.249 } 1.250 1.251 @@ -1357,9 +1298,6 @@ static PyObject *xu_port_deregister(PyOb 1.252 &type) ) 1.253 return NULL; 1.254 1.255 - printf("DEREGISTER: Dom: %3d Port: %3d Type:%3d\n", 1.256 - xup->remote_dom, xup->local_port, type); 1.257 - 1.258 msg.type = XCS_MSG_UNBIND; 1.259 msg.u.bind.port = xup->local_port; 1.260 msg.u.bind.type = type; 1.261 @@ -1368,7 +1306,6 @@ static PyObject *xu_port_deregister(PyOb 1.262 1.263 if (msg.result != XCS_RSLT_OK) 1.264 { 1.265 - printf(" : DEREGISTRATION FAILED! (%d)\n", msg.result); 1.266 return PyInt_FromLong(0); 1.267 } 1.268