Lines Matching defs:pipe

84 	struct rpc_pipe *pipe =
89 spin_lock(&pipe->lock);
90 destroy_msg = pipe->ops->destroy_msg;
91 if (pipe->nreaders == 0) {
92 list_splice_init(&pipe->pipe, &free_list);
93 pipe->pipelen = 0;
95 dentry = dget(pipe->dentry);
96 spin_unlock(&pipe->lock);
124 * @pipe: upcall pipe on which to queue given message
133 rpc_queue_upcall(struct rpc_pipe *pipe, struct rpc_pipe_msg *msg)
138 spin_lock(&pipe->lock);
139 if (pipe->nreaders) {
140 list_add_tail(&msg->list, &pipe->pipe);
141 pipe->pipelen += msg->len;
143 } else if (pipe->flags & RPC_PIPE_WAIT_FOR_OPEN) {
144 if (list_empty(&pipe->pipe))
146 &pipe->queue_timeout,
148 list_add_tail(&msg->list, &pipe->pipe);
149 pipe->pipelen += msg->len;
152 dentry = dget(pipe->dentry);
153 spin_unlock(&pipe->lock);
171 struct rpc_pipe *pipe = RPC_I(inode)->pipe;
176 spin_lock(&pipe->lock);
177 need_release = pipe->nreaders != 0 || pipe->nwriters != 0;
178 pipe->nreaders = 0;
179 list_splice_init(&pipe->in_upcall, &free_list);
180 list_splice_init(&pipe->pipe, &free_list);
181 pipe->pipelen = 0;
182 pipe->dentry = NULL;
183 spin_unlock(&pipe->lock);
184 rpc_purge_list(&RPC_I(inode)->waitq, &free_list, pipe->ops->destroy_msg, -EPIPE);
185 pipe->nwriters = 0;
186 if (need_release && pipe->ops->release_pipe)
187 pipe->ops->release_pipe(inode);
188 cancel_delayed_work_sync(&pipe->queue_timeout);
190 RPC_I(inode)->pipe = NULL;
220 struct rpc_pipe *pipe;
225 pipe = RPC_I(inode)->pipe;
226 if (pipe == NULL)
228 first_open = pipe->nreaders == 0 && pipe->nwriters == 0;
229 if (first_open && pipe->ops->open_pipe) {
230 res = pipe->ops->open_pipe(inode);
235 pipe->nreaders++;
237 pipe->nwriters++;
247 struct rpc_pipe *pipe;
252 pipe = RPC_I(inode)->pipe;
253 if (pipe == NULL)
257 spin_lock(&pipe->lock);
260 spin_unlock(&pipe->lock);
261 pipe->ops->destroy_msg(msg);
264 pipe->nwriters --;
266 pipe->nreaders --;
267 if (pipe->nreaders == 0) {
269 spin_lock(&pipe->lock);
270 list_splice_init(&pipe->pipe, &free_list);
271 pipe->pipelen = 0;
272 spin_unlock(&pipe->lock);
274 pipe->ops->destroy_msg, -EAGAIN);
277 last_close = pipe->nwriters == 0 && pipe->nreaders == 0;
278 if (last_close && pipe->ops->release_pipe)
279 pipe->ops->release_pipe(inode);
289 struct rpc_pipe *pipe;
294 pipe = RPC_I(inode)->pipe;
295 if (pipe == NULL) {
301 spin_lock(&pipe->lock);
302 if (!list_empty(&pipe->pipe)) {
303 msg = list_entry(pipe->pipe.next,
306 list_move(&msg->list, &pipe->in_upcall);
307 pipe->pipelen -= msg->len;
311 spin_unlock(&pipe->lock);
316 res = pipe->ops->upcall(filp, msg, buf, len);
319 spin_lock(&pipe->lock);
321 spin_unlock(&pipe->lock);
322 pipe->ops->destroy_msg(msg);
337 if (RPC_I(inode)->pipe != NULL)
338 res = RPC_I(inode)->pipe->ops->downcall(filp, buf, len);
353 if (rpci->pipe == NULL)
355 else if (filp->private_data || !list_empty(&rpci->pipe->pipe))
365 struct rpc_pipe *pipe;
371 pipe = RPC_I(inode)->pipe;
372 if (pipe == NULL) {
376 spin_lock(&pipe->lock);
377 len = pipe->pipelen;
383 spin_unlock(&pipe->lock);
547 init_pipe(struct rpc_pipe *pipe)
549 pipe->nreaders = 0;
550 pipe->nwriters = 0;
551 INIT_LIST_HEAD(&pipe->in_upcall);
552 INIT_LIST_HEAD(&pipe->in_downcall);
553 INIT_LIST_HEAD(&pipe->pipe);
554 pipe->pipelen = 0;
555 INIT_DELAYED_WORK(&pipe->queue_timeout,
557 pipe->ops = NULL;
558 spin_lock_init(&pipe->lock);
559 pipe->dentry = NULL;
562 void rpc_destroy_pipe_data(struct rpc_pipe *pipe)
564 kfree(pipe);
570 struct rpc_pipe *pipe;
572 pipe = kzalloc(sizeof(struct rpc_pipe), GFP_KERNEL);
573 if (!pipe)
575 init_pipe(pipe);
576 pipe->ops = ops;
577 pipe->flags = flags;
578 return pipe;
586 struct rpc_pipe *pipe)
596 rpci->pipe = pipe;
802 * @parent: dentry of directory to create new "pipe" in
803 * @name: name of pipe
804 * @private: private data to associate with the pipe, for the caller's use
805 * @pipe: &rpc_pipe containing input parameters
819 void *private, struct rpc_pipe *pipe)
826 if (pipe->ops->upcall == NULL)
828 if (pipe->ops->downcall == NULL)
836 private, pipe);
844 printk(KERN_WARNING "%s: %s() failed to create pipe %pd/%s (errno = %d)\n",
852 * rpc_unlink - remove a pipe
853 * @dentry: dentry for the pipe, as returned from rpc_mkpipe
855 * After this call, lookups will no longer find the pipe, and any
856 * attempts to read or write using preexisting opens of the pipe will
1082 * @rpc_client: rpc_client for the pipe
1318 * rpc_gssd_dummy_populate - create a dummy gssd pipe
1320 * @pipe_data: pipe data created when netns is initialized
1322 * Create a dummy set of directories and a pipe that gssd can hold open to
1441 struct rpc_pipe *pipe = sn->gssd_dummy;
1443 return pipe->nreaders || pipe->nwriters;
1492 rpci->pipe = NULL;