• Home
  • Raw
  • Download

Lines Matching refs:u

109 	} u;  member
123 struct xenbus_file_priv *u = filp->private_data; in xenbus_file_read() local
128 mutex_lock(&u->reply_mutex); in xenbus_file_read()
130 while (list_empty(&u->read_buffers)) { in xenbus_file_read()
131 mutex_unlock(&u->reply_mutex); in xenbus_file_read()
135 ret = wait_event_interruptible(u->read_waitq, in xenbus_file_read()
136 !list_empty(&u->read_buffers)); in xenbus_file_read()
139 mutex_lock(&u->reply_mutex); in xenbus_file_read()
142 rb = list_entry(u->read_buffers.next, struct read_buffer, list); in xenbus_file_read()
162 if (list_empty(&u->read_buffers)) in xenbus_file_read()
164 rb = list_entry(u->read_buffers.next, in xenbus_file_read()
172 mutex_unlock(&u->reply_mutex); in xenbus_file_read()
306 struct xenbus_file_priv *u) in xenbus_write_transaction() argument
319 } else if (u->u.msg.tx_id != 0) { in xenbus_write_transaction()
320 list_for_each_entry(trans, &u->transactions, list) in xenbus_write_transaction()
321 if (trans->handle.id == u->u.msg.tx_id) in xenbus_write_transaction()
323 if (&trans->list == &u->transactions) in xenbus_write_transaction()
327 reply = xenbus_dev_request_and_reply(&u->u.msg); in xenbus_write_transaction()
336 if (u->u.msg.type == XS_ERROR) in xenbus_write_transaction()
340 list_add(&trans->list, &u->transactions); in xenbus_write_transaction()
342 } else if (u->u.msg.type == XS_TRANSACTION_END) { in xenbus_write_transaction()
347 mutex_lock(&u->reply_mutex); in xenbus_write_transaction()
348 rc = queue_reply(&staging_q, &u->u.msg, sizeof(u->u.msg)); in xenbus_write_transaction()
350 rc = queue_reply(&staging_q, reply, u->u.msg.len); in xenbus_write_transaction()
352 list_splice_tail(&staging_q, &u->read_buffers); in xenbus_write_transaction()
353 wake_up(&u->read_waitq); in xenbus_write_transaction()
357 mutex_unlock(&u->reply_mutex); in xenbus_write_transaction()
365 static int xenbus_write_watch(unsigned msg_type, struct xenbus_file_priv *u) in xenbus_write_watch() argument
372 path = u->u.buffer + sizeof(u->u.msg); in xenbus_write_watch()
373 token = memchr(path, 0, u->u.msg.len); in xenbus_write_watch()
379 if (memchr(token, 0, u->u.msg.len - (token - path)) == NULL) { in xenbus_write_watch()
392 watch->dev_data = u; in xenbus_write_watch()
400 list_add(&watch->list, &u->watches); in xenbus_write_watch()
402 list_for_each_entry(watch, &u->watches, list) { in xenbus_write_watch()
426 mutex_lock(&u->reply_mutex); in xenbus_write_watch()
427 rc = queue_reply(&u->read_buffers, &reply, sizeof(reply)); in xenbus_write_watch()
428 wake_up(&u->read_waitq); in xenbus_write_watch()
429 mutex_unlock(&u->reply_mutex); in xenbus_write_watch()
440 struct xenbus_file_priv *u = filp->private_data; in xenbus_file_write() local
461 mutex_lock(&u->msgbuffer_mutex); in xenbus_file_write()
468 if (len > sizeof(u->u.buffer) - u->len) { in xenbus_file_write()
470 u->len = 0; in xenbus_file_write()
475 ret = copy_from_user(u->u.buffer + u->len, ubuf, len); in xenbus_file_write()
486 u->len += len; in xenbus_file_write()
489 if (u->len < sizeof(u->u.msg)) in xenbus_file_write()
494 if ((sizeof(u->u.msg) + u->u.msg.len) > sizeof(u->u.buffer)) { in xenbus_file_write()
496 u->len = 0; in xenbus_file_write()
500 if (u->len < (sizeof(u->u.msg) + u->u.msg.len)) in xenbus_file_write()
507 msg_type = u->u.msg.type; in xenbus_file_write()
513 ret = xenbus_write_watch(msg_type, u); in xenbus_file_write()
518 ret = xenbus_write_transaction(msg_type, u); in xenbus_file_write()
525 u->len = 0; in xenbus_file_write()
528 mutex_unlock(&u->msgbuffer_mutex); in xenbus_file_write()
534 struct xenbus_file_priv *u; in xenbus_file_open() local
541 u = kzalloc(sizeof(*u), GFP_KERNEL); in xenbus_file_open()
542 if (u == NULL) in xenbus_file_open()
545 INIT_LIST_HEAD(&u->transactions); in xenbus_file_open()
546 INIT_LIST_HEAD(&u->watches); in xenbus_file_open()
547 INIT_LIST_HEAD(&u->read_buffers); in xenbus_file_open()
548 init_waitqueue_head(&u->read_waitq); in xenbus_file_open()
550 mutex_init(&u->reply_mutex); in xenbus_file_open()
551 mutex_init(&u->msgbuffer_mutex); in xenbus_file_open()
553 filp->private_data = u; in xenbus_file_open()
560 struct xenbus_file_priv *u = filp->private_data; in xenbus_file_release() local
570 list_for_each_entry_safe(trans, tmp, &u->transactions, list) { in xenbus_file_release()
576 list_for_each_entry_safe(watch, tmp_watch, &u->watches, list) { in xenbus_file_release()
582 list_for_each_entry_safe(rb, tmp_rb, &u->read_buffers, list) { in xenbus_file_release()
586 kfree(u); in xenbus_file_release()
593 struct xenbus_file_priv *u = file->private_data; in xenbus_file_poll() local
595 poll_wait(file, &u->read_waitq, wait); in xenbus_file_poll()
596 if (!list_empty(&u->read_buffers)) in xenbus_file_poll()