connection: kdbus_conn_kmsg_send() -> kdbus_cmd_msg_send()
authorDavid Herrmann <dh.herrmann@gmail.com>
Fri, 19 Dec 2014 11:14:03 +0000 (12:14 +0100)
committerDavid Herrmann <dh.herrmann@gmail.com>
Fri, 19 Dec 2014 11:14:03 +0000 (12:14 +0100)
The _kmsg_send() function is no longer used for non-ioctl messages, so we
can mark it as command dispatcher now, like all the other kdbus_cmd_msg_*
helpers we already have.

This also allows us to drop the "ep" argument, as we can safely use
conn_src->ep now.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
connection.c
connection.h
handle.c

index 7c5575f625dfa8f57148f585ae2a5ac6b95e0b3d..29cafd3f428c284dcafc6cf501c922732748e614 100644 (file)
@@ -705,18 +705,16 @@ static int kdbus_conn_wait_reply(struct kdbus_conn *conn_src,
 }
 
 /**
- * kdbus_conn_kmsg_send() - send a message
- * @ep:                        Endpoint to send from
- * @conn_src:          Connection, kernel-generated messages do not have one
+ * kdbus_cmd_msg_send() - send a message
+ * @conn_src:          Connection
  * @cmd:               Payload of SEND command
  * @kmsg:              Message to send
  *
  * Return: 0 on success, negative errno on failure
  */
-int kdbus_conn_kmsg_send(struct kdbus_ep *ep,
-                        struct kdbus_conn *conn_src,
-                        struct kdbus_cmd_send *cmd,
-                        struct kdbus_kmsg *kmsg)
+int kdbus_cmd_msg_send(struct kdbus_conn *conn_src,
+                      struct kdbus_cmd_send *cmd,
+                      struct kdbus_kmsg *kmsg)
 {
        bool sync = cmd->flags & KDBUS_SEND_SYNC_REPLY;
        struct kdbus_conn_reply *reply_wait = NULL;
@@ -724,7 +722,7 @@ int kdbus_conn_kmsg_send(struct kdbus_ep *ep,
        struct kdbus_name_entry *name_entry = NULL;
        struct kdbus_msg *msg = &kmsg->msg;
        struct kdbus_conn *conn_dst = NULL;
-       struct kdbus_bus *bus = ep->bus;
+       struct kdbus_bus *bus = conn_src->ep->bus;
        struct kdbus_item *item;
        int ret = 0;
 
@@ -870,8 +868,8 @@ int kdbus_conn_kmsg_send(struct kdbus_ep *ep,
                        goto exit_unref;
 
                if (msg->flags & KDBUS_MSG_EXPECT_REPLY) {
-                       ret = kdbus_conn_check_access(ep, msg, conn_src,
-                                                     conn_dst, NULL);
+                       ret = kdbus_conn_check_access(conn_src->ep, msg,
+                                                     conn_src, conn_dst, NULL);
                        if (ret < 0)
                                goto exit_unref;
 
@@ -882,8 +880,9 @@ int kdbus_conn_kmsg_send(struct kdbus_ep *ep,
                                goto exit_unref;
                        }
                } else {
-                       ret = kdbus_conn_check_access(ep, msg, conn_src,
-                                                     conn_dst, &reply_wake);
+                       ret = kdbus_conn_check_access(conn_src->ep, msg,
+                                                     conn_src, conn_dst,
+                                                     &reply_wake);
                        if (ret < 0)
                                goto exit_unref;
                }
index 43b19c6ed5e5fb05b3f0d65e531e51dc2e1958b6..c7e7a4e2178f48deba1940b5e6b9cfa546dab586 100644 (file)
@@ -139,16 +139,15 @@ bool kdbus_conn_has_name(struct kdbus_conn *conn, const char *name);
 int kdbus_conn_policy_own_name(struct kdbus_conn *conn, const char *name);
 
 /* command dispatcher */
+int kdbus_cmd_msg_send(struct kdbus_conn *conn_src,
+                      struct kdbus_cmd_send *cmd_send,
+                      struct kdbus_kmsg *kmsg);
 int kdbus_cmd_msg_recv(struct kdbus_conn *conn,
                       struct kdbus_cmd_recv *recv);
 int kdbus_cmd_conn_info(struct kdbus_conn *conn,
                        struct kdbus_cmd_info *cmd_info);
 int kdbus_cmd_conn_update(struct kdbus_conn *conn,
                          const struct kdbus_cmd_update *cmd_update);
-int kdbus_conn_kmsg_send(struct kdbus_ep *ep,
-                        struct kdbus_conn *conn_src,
-                        struct kdbus_cmd_send *cmd_send,
-                        struct kdbus_kmsg *kmsg);
 
 /**
  * kdbus_conn_is_ordinary() - Check if connection is ordinary
index 4581d3cc9601b2b6b0d766c4e9d6d1999c4195e9..c0de97aca13dc719347e9175a6e90198162eeb6c 100644 (file)
--- a/handle.c
+++ b/handle.c
@@ -699,7 +699,7 @@ static long handle_ep_ioctl_connected(struct file *file, unsigned int cmd,
                        break;
                }
 
-               ret = kdbus_conn_kmsg_send(conn->ep, conn, cmd_send, kmsg);
+               ret = kdbus_cmd_msg_send(conn, cmd_send, kmsg);
                if (ret < 0) {
                        kdbus_kmsg_free(kmsg);
                        break;