Lines Matching refs:pipe

86 	struct rpc_pipe *pipe =
91 spin_lock(&pipe->lock);
92 destroy_msg = pipe->ops->destroy_msg;
93 if (pipe->nreaders == 0) {
94 list_splice_init(&pipe->pipe, &free_list);
95 pipe->pipelen = 0;
97 dentry = dget(pipe->dentry);
98 spin_unlock(&pipe->lock);
126 * @pipe: upcall pipe on which to queue given message
135 rpc_queue_upcall(struct rpc_pipe *pipe, struct rpc_pipe_msg *msg)
140 spin_lock(&pipe->lock);
141 if (pipe->nreaders) {
142 list_add_tail(&msg->list, &pipe->pipe);
143 pipe->pipelen += msg->len;
145 } else if (pipe->flags & RPC_PIPE_WAIT_FOR_OPEN) {
146 if (list_empty(&pipe->pipe))
148 &pipe->queue_timeout,
150 list_add_tail(&msg->list, &pipe->pipe);
151 pipe->pipelen += msg->len;
154 dentry = dget(pipe->dentry);
155 spin_unlock(&pipe->lock);
173 struct rpc_pipe *pipe = RPC_I(inode)->pipe;
178 spin_lock(&pipe->lock);
179 need_release = pipe->nreaders != 0 || pipe->nwriters != 0;
180 pipe->nreaders = 0;
181 list_splice_init(&pipe->in_upcall, &free_list);
182 list_splice_init(&pipe->pipe, &free_list);
183 pipe->pipelen = 0;
184 pipe->dentry = NULL;
185 spin_unlock(&pipe->lock);
186 rpc_purge_list(&RPC_I(inode)->waitq, &free_list, pipe->ops->destroy_msg, -EPIPE);
187 pipe->nwriters = 0;
188 if (need_release && pipe->ops->release_pipe)
189 pipe->ops->release_pipe(inode);
190 cancel_delayed_work_sync(&pipe->queue_timeout);
192 RPC_I(inode)->pipe = NULL;
215 struct rpc_pipe *pipe;
220 pipe = RPC_I(inode)->pipe;
221 if (pipe == NULL)
223 first_open = pipe->nreaders == 0 && pipe->nwriters == 0;
224 if (first_open && pipe->ops->open_pipe) {
225 res = pipe->ops->open_pipe(inode);
230 pipe->nreaders++;
232 pipe->nwriters++;
242 struct rpc_pipe *pipe;
247 pipe = RPC_I(inode)->pipe;
248 if (pipe == NULL)
252 spin_lock(&pipe->lock);
255 spin_unlock(&pipe->lock);
256 pipe->ops->destroy_msg(msg);
259 pipe->nwriters --;
261 pipe->nreaders --;
262 if (pipe->nreaders == 0) {
264 spin_lock(&pipe->lock);
265 list_splice_init(&pipe->pipe, &free_list);
266 pipe->pipelen = 0;
267 spin_unlock(&pipe->lock);
269 pipe->ops->destroy_msg, -EAGAIN);
272 last_close = pipe->nwriters == 0 && pipe->nreaders == 0;
273 if (last_close && pipe->ops->release_pipe)
274 pipe->ops->release_pipe(inode);
284 struct rpc_pipe *pipe;
289 pipe = RPC_I(inode)->pipe;
290 if (pipe == NULL) {
296 spin_lock(&pipe->lock);
297 if (!list_empty(&pipe->pipe)) {
298 msg = list_entry(pipe->pipe.next,
301 list_move(&msg->list, &pipe->in_upcall);
302 pipe->pipelen -= msg->len;
306 spin_unlock(&pipe->lock);
311 res = pipe->ops->upcall(filp, msg, buf, len);
314 spin_lock(&pipe->lock);
316 spin_unlock(&pipe->lock);
317 pipe->ops->destroy_msg(msg);
332 if (RPC_I(inode)->pipe != NULL)
333 res = RPC_I(inode)->pipe->ops->downcall(filp, buf, len);
348 if (rpci->pipe == NULL)
350 else if (filp->private_data || !list_empty(&rpci->pipe->pipe))
360 struct rpc_pipe *pipe;
366 pipe = RPC_I(inode)->pipe;
367 if (pipe == NULL) {
371 spin_lock(&pipe->lock);
372 len = pipe->pipelen;
378 spin_unlock(&pipe->lock);
543 init_pipe(struct rpc_pipe *pipe)
545 pipe->nreaders = 0;
546 pipe->nwriters = 0;
547 INIT_LIST_HEAD(&pipe->in_upcall);
548 INIT_LIST_HEAD(&pipe->in_downcall);
549 INIT_LIST_HEAD(&pipe->pipe);
550 pipe->pipelen = 0;
551 INIT_DELAYED_WORK(&pipe->queue_timeout,
553 pipe->ops = NULL;
554 spin_lock_init(&pipe->lock);
555 pipe->dentry = NULL;
558 void rpc_destroy_pipe_data(struct rpc_pipe *pipe)
560 kfree(pipe);
566 struct rpc_pipe *pipe;
568 pipe = kzalloc(sizeof(struct rpc_pipe), GFP_KERNEL);
569 if (!pipe)
571 init_pipe(pipe);
572 pipe->ops = ops;
573 pipe->flags = flags;
574 return pipe;
582 struct rpc_pipe *pipe)
592 rpci->pipe = pipe;
787 * @parent: dentry of directory to create new "pipe" in
788 * @name: name of pipe
789 * @private: private data to associate with the pipe, for the caller's use
790 * @pipe: &rpc_pipe containing input parameters
804 void *private, struct rpc_pipe *pipe)
811 if (pipe->ops->upcall == NULL)
813 if (pipe->ops->downcall == NULL)
821 private, pipe);
829 printk(KERN_WARNING "%s: %s() failed to create pipe %pd/%s (errno = %d)\n",
837 * rpc_unlink - remove a pipe
838 * @dentry: dentry for the pipe, as returned from rpc_mkpipe
840 * After this call, lookups will no longer find the pipe, and any
841 * attempts to read or write using preexisting opens of the pipe will
1067 * @rpc_client: rpc_client for the pipe
1290 * rpc_gssd_dummy_populate - create a dummy gssd pipe
1292 * @pipe_data: pipe data created when netns is initialized
1294 * Create a dummy set of directories and a pipe that gssd can hold open to
1414 struct rpc_pipe *pipe = sn->gssd_dummy;
1416 return pipe->nreaders || pipe->nwriters;
1482 rpci->pipe = NULL;