Lines Matching refs:u

111 	} u;  member
125 struct xenbus_file_priv *u = filp->private_data; in xenbus_file_read() local
130 mutex_lock(&u->reply_mutex); in xenbus_file_read()
132 while (list_empty(&u->read_buffers)) { in xenbus_file_read()
133 mutex_unlock(&u->reply_mutex); in xenbus_file_read()
137 ret = wait_event_interruptible(u->read_waitq, in xenbus_file_read()
138 !list_empty(&u->read_buffers)); in xenbus_file_read()
141 mutex_lock(&u->reply_mutex); in xenbus_file_read()
144 rb = list_entry(u->read_buffers.next, struct read_buffer, list); in xenbus_file_read()
164 if (list_empty(&u->read_buffers)) in xenbus_file_read()
166 rb = list_entry(u->read_buffers.next, in xenbus_file_read()
174 mutex_unlock(&u->reply_mutex); in xenbus_file_read()
306 struct xenbus_file_priv *u) in xenbus_write_transaction() argument
321 reply = xenbus_dev_request_and_reply(&u->u.msg); in xenbus_write_transaction()
329 if (u->u.msg.type == XS_ERROR) in xenbus_write_transaction()
333 list_add(&trans->list, &u->transactions); in xenbus_write_transaction()
335 } else if (u->u.msg.type == XS_TRANSACTION_END) { in xenbus_write_transaction()
336 list_for_each_entry(trans, &u->transactions, list) in xenbus_write_transaction()
337 if (trans->handle.id == u->u.msg.tx_id) in xenbus_write_transaction()
339 BUG_ON(&trans->list == &u->transactions); in xenbus_write_transaction()
345 mutex_lock(&u->reply_mutex); in xenbus_write_transaction()
346 rc = queue_reply(&staging_q, &u->u.msg, sizeof(u->u.msg)); in xenbus_write_transaction()
348 rc = queue_reply(&staging_q, reply, u->u.msg.len); in xenbus_write_transaction()
350 list_splice_tail(&staging_q, &u->read_buffers); in xenbus_write_transaction()
351 wake_up(&u->read_waitq); in xenbus_write_transaction()
355 mutex_unlock(&u->reply_mutex); in xenbus_write_transaction()
363 static int xenbus_write_watch(unsigned msg_type, struct xenbus_file_priv *u) in xenbus_write_watch() argument
370 path = u->u.buffer + sizeof(u->u.msg); in xenbus_write_watch()
371 token = memchr(path, 0, u->u.msg.len); in xenbus_write_watch()
377 if (memchr(token, 0, u->u.msg.len - (token - path)) == NULL) { in xenbus_write_watch()
390 watch->dev_data = u; in xenbus_write_watch()
398 list_add(&watch->list, &u->watches); in xenbus_write_watch()
400 list_for_each_entry_safe(watch, tmp_watch, &u->watches, list) { in xenbus_write_watch()
424 mutex_lock(&u->reply_mutex); in xenbus_write_watch()
425 rc = queue_reply(&u->read_buffers, &reply, sizeof(reply)); in xenbus_write_watch()
426 wake_up(&u->read_waitq); in xenbus_write_watch()
427 mutex_unlock(&u->reply_mutex); in xenbus_write_watch()
438 struct xenbus_file_priv *u = filp->private_data; in xenbus_file_write() local
459 mutex_lock(&u->msgbuffer_mutex); in xenbus_file_write()
466 if (len > sizeof(u->u.buffer) - u->len) { in xenbus_file_write()
468 u->len = 0; in xenbus_file_write()
473 ret = copy_from_user(u->u.buffer + u->len, ubuf, len); in xenbus_file_write()
484 u->len += len; in xenbus_file_write()
487 if (u->len < sizeof(u->u.msg)) in xenbus_file_write()
492 if ((sizeof(u->u.msg) + u->u.msg.len) > sizeof(u->u.buffer)) { in xenbus_file_write()
494 u->len = 0; in xenbus_file_write()
498 if (u->len < (sizeof(u->u.msg) + u->u.msg.len)) in xenbus_file_write()
505 msg_type = u->u.msg.type; in xenbus_file_write()
511 ret = xenbus_write_watch(msg_type, u); in xenbus_file_write()
516 ret = xenbus_write_transaction(msg_type, u); in xenbus_file_write()
523 u->len = 0; in xenbus_file_write()
526 mutex_unlock(&u->msgbuffer_mutex); in xenbus_file_write()
532 struct xenbus_file_priv *u; in xenbus_file_open() local
539 u = kzalloc(sizeof(*u), GFP_KERNEL); in xenbus_file_open()
540 if (u == NULL) in xenbus_file_open()
543 INIT_LIST_HEAD(&u->transactions); in xenbus_file_open()
544 INIT_LIST_HEAD(&u->watches); in xenbus_file_open()
545 INIT_LIST_HEAD(&u->read_buffers); in xenbus_file_open()
546 init_waitqueue_head(&u->read_waitq); in xenbus_file_open()
548 mutex_init(&u->reply_mutex); in xenbus_file_open()
549 mutex_init(&u->msgbuffer_mutex); in xenbus_file_open()
551 filp->private_data = u; in xenbus_file_open()
558 struct xenbus_file_priv *u = filp->private_data; in xenbus_file_release() local
568 list_for_each_entry_safe(trans, tmp, &u->transactions, list) { in xenbus_file_release()
574 list_for_each_entry_safe(watch, tmp_watch, &u->watches, list) { in xenbus_file_release()
580 list_for_each_entry_safe(rb, tmp_rb, &u->read_buffers, list) { in xenbus_file_release()
584 kfree(u); in xenbus_file_release()
591 struct xenbus_file_priv *u = file->private_data; in xenbus_file_poll() local
593 poll_wait(file, &u->read_waitq, wait); in xenbus_file_poll()
594 if (!list_empty(&u->read_buffers)) in xenbus_file_poll()