Lines Matching refs:data
26 struct pipe_data_t data; member
38 spin_lock(&pipe_ptr->data.lock); in pipe_read()
39 while (pipe_ptr->data.valid_cnt == 0) in pipe_read()
43 wait_queue_wakeup(&pipe_ptr->data.write_wait_queue, PROC_UNINTERRUPTIBLE); in pipe_read()
44 wait_queue_sleep_on_unlock(&pipe_ptr->data.read_wait_queue, (void *)&pipe_ptr->data.lock); in pipe_read()
45 spin_lock(&pipe_ptr->data.lock); in pipe_read()
47 for (i = 0; i < pipe_ptr->data.valid_cnt; i++) in pipe_read()
53 copy_to_user(buf + i, &pipe_ptr->buf[pipe_ptr->data.read_pos], sizeof(char)); in pipe_read()
54 pipe_ptr->data.read_pos = (pipe_ptr->data.read_pos + 1) % PIPE_BUFF_SIZE; in pipe_read()
56 pipe_ptr->data.valid_cnt = pipe_ptr->data.valid_cnt - i; in pipe_read()
57 spin_unlock(&pipe_ptr->data.lock); in pipe_read()
58 wait_queue_wakeup(&pipe_ptr->data.write_wait_queue, PROC_UNINTERRUPTIBLE); in pipe_read()
71 spin_lock(&pipe_ptr->data.lock); in pipe_write()
72 while (pipe_ptr->data.valid_cnt + count >= PIPE_BUFF_SIZE) in pipe_write()
76 wait_queue_wakeup(&pipe_ptr->data.read_wait_queue, PROC_UNINTERRUPTIBLE); in pipe_write()
77 wait_queue_sleep_on_unlock(&pipe_ptr->data.write_wait_queue, (void *)&pipe_ptr->data.lock); in pipe_write()
78 spin_lock(&pipe_ptr->data.lock); in pipe_write()
80 for (i = pipe_ptr->data.valid_cnt; i < PIPE_BUFF_SIZE; i++) in pipe_write()
82 if (i - pipe_ptr->data.valid_cnt == count) in pipe_write()
86 copy_from_user(&pipe_ptr->buf[pipe_ptr->data.write_pos], buf + i, sizeof(char)); in pipe_write()
87 pipe_ptr->data.write_pos = (pipe_ptr->data.write_pos + 1) % PIPE_BUFF_SIZE; in pipe_write()
89 pipe_ptr->data.valid_cnt += count; in pipe_write()
90 spin_unlock(&pipe_ptr->data.lock); in pipe_write()
91 wait_queue_wakeup(&pipe_ptr->data.read_wait_queue, PROC_UNINTERRUPTIBLE); in pipe_write()
117 spin_init(&pipe_ptr->data.lock); in pipe_alloc()
118 pipe_ptr->data.read_pos = 0; in pipe_alloc()
119 pipe_ptr->data.write_pos = 0; in pipe_alloc()
120 pipe_ptr->data.valid_cnt = 0; in pipe_alloc()
122 wait_queue_init(&pipe_ptr->data.read_wait_queue, NULL); in pipe_alloc()
123 wait_queue_init(&pipe_ptr->data.write_wait_queue, NULL); in pipe_alloc()