usb: gadget: f_fs: Prevent panic due to failure of huge size buffer allocation
[platform/kernel/linux-rpi.git] / ipc / kdbus / reply.h
1 /*
2  * Copyright (C) 2013-2015 Kay Sievers
3  * Copyright (C) 2013-2015 Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4  * Copyright (C) 2013-2015 Daniel Mack <daniel@zonque.org>
5  * Copyright (C) 2013-2015 David Herrmann <dh.herrmann@gmail.com>
6  * Copyright (C) 2013-2015 Linux Foundation
7  * Copyright (C) 2014-2015 Djalal Harouni <tixxdz@opendz.org>
8  *
9  * kdbus is free software; you can redistribute it and/or modify it under
10  * the terms of the GNU Lesser General Public License as published by the
11  * Free Software Foundation; either version 2.1 of the License, or (at
12  * your option) any later version.
13  */
14
15 #ifndef __KDBUS_REPLY_H
16 #define __KDBUS_REPLY_H
17
18 /**
19  * struct kdbus_reply - an entry of kdbus_conn's list of replies
20  * @kref:               Ref-count of this object
21  * @entry:              The entry of the connection's reply_list
22  * @reply_src:          The connection the reply will be sent from
23  * @reply_dst:          The connection the reply will be sent to
24  * @queue_entry:        The queue entry item that is prepared by the replying
25  *                      connection
26  * @deadline_ns:        The deadline of the reply, in nanoseconds
27  * @cookie:             The cookie of the requesting message
28  * @name_id:            ID of the well-known name the original msg was sent to
29  * @sync:               The reply block is waiting for synchronous I/O
30  * @waiting:            The condition to synchronously wait for
31  * @interrupted:        The sync reply was left in an interrupted state
32  * @err:                The error code for the synchronous reply
33  */
34 struct kdbus_reply {
35         struct kref kref;
36         struct list_head entry;
37         struct kdbus_conn *reply_src;
38         struct kdbus_conn *reply_dst;
39         struct kdbus_queue_entry *queue_entry;
40         u64 deadline_ns;
41         u64 cookie;
42         u64 name_id;
43         bool sync:1;
44         bool waiting:1;
45         bool interrupted:1;
46         int err;
47 };
48
49 struct kdbus_reply *kdbus_reply_new(struct kdbus_conn *reply_src,
50                                     struct kdbus_conn *reply_dst,
51                                     const struct kdbus_msg *msg,
52                                     struct kdbus_name_entry *name_entry,
53                                     bool sync);
54
55 struct kdbus_reply *kdbus_reply_ref(struct kdbus_reply *r);
56 struct kdbus_reply *kdbus_reply_unref(struct kdbus_reply *r);
57
58 void kdbus_reply_link(struct kdbus_reply *r);
59 void kdbus_reply_unlink(struct kdbus_reply *r);
60
61 struct kdbus_reply *kdbus_reply_find(struct kdbus_conn *replying,
62                                      struct kdbus_conn *reply_dst,
63                                      u64 cookie);
64
65 void kdbus_sync_reply_wakeup(struct kdbus_reply *reply, int err);
66 void kdbus_reply_list_scan_work(struct work_struct *work);
67
68 #endif /* __KDBUS_REPLY_H */