queue: remove dead memfds and fds variable

fds are installed now in kdbus_queue_entry_fds_install(), this is just
dead code.

Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
message: add a comment why we allow passing fds opened with O_PATH

Nothing special can be done with O_PATH fds, so allow them. This follows
the same logic used in unix socket domains.

Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
queue.c: comment cleanups, unnecessary assignment removed

Signed-off-by: Daniel Mack <daniel@zonque.org>
queue: convert kdbus_queue_entry_peek()

Make kdbus_queue_entry_peek() return the peeked entry directly.

Signed-off-by: Daniel Mack <daniel@zonque.org>
handle: clean up error unwind in kdbus_handle_open()

Signed-off-by: Daniel Mack <daniel@zonque.org>
metadata: let kdbus_meta_free() cope with PTR_ERR

In case of failures, a kmsg will have a reference to an error pointer.
Make kdbus_meta_free() bail out in such cases.

Signed-off-by: Daniel Mack <daniel@zonque.org>
doc: fix error descriptions of KDBUS_CMD_MSG_SEND ioctl

Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
connection: fix documentation of the reply_list field

connection->reply_list is the list of connections this connection should
reply to, not the list of connections that should reply to us, the remote
is the one who sent the message and is expecting a reply

Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
connection: check connection request count before looking up reply objects

Before taking connection locks and looking up reply objects, make sure
that the connection that is expecting a reply did really in the first place
issue a request and the request is still valid and was not canceled.

Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
connection: when looking up for a reply object return it as a result

When returning the reply object return it as a result instead of in
an argument pointer as suggested by Al Viro.

Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
endpoint: declared used objects in header

Make sure endpoint.h can be included by itself. Declare kdbus_kmsg inside
of it to avoid "undefined type" warnings.
connection: KDBUS_CMD_MSG_CANCEL cancel only sync replies

When doing KDBUS_CMD_MSG_CANCEL ioctl, make sure that we call
kdbus_conn_reply_sync() only on sync replies.

Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
node: add generic API nodes

The new kdbus_node object is supposed to replace all external API to
kdbus-core interaction. It is modeled similar to kernfs_node and provides
a node-interaction independent of the API locking.

Follow-up patches will introduce domain->node, bus->node and
endpoint->node and make handle.c use those to resolve API requests.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
bus: rename kdbus_bus_make_user() to kdbus_bus_new()

Signed-off-by: Daniel Mack <daniel@zonque.org>
bus: fix race condition on name collision

Hold domain->lock across the check whether a bus of a given name
already exists.

Signed-off-by: Daniel Mack <daniel@zonque.org>
node: remove pr_fmt()

Print is dead.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Empty lines for everyone!

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
domain: embed kdbus_node

Allocate a kdbus_node for each domain. Those nodes are still unused but
will later be used to replace kdbus_cdev lookups entirely.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
bus: drop unneeded extra ref

kdbus_bus_find() is now called under lock, no need to care for extra
refs.

Signed-off-by: Daniel Mack <daniel@zonque.org>
domain: kdbus_domain_user_ref() need to cope with ERR_PTRs

Signed-off-by: Daniel Mack <daniel@zonque.org>