use conn->type instead of conn->flags where possible
authorKay Sievers <kay@vrfy.org>
Mon, 4 Aug 2014 14:18:08 +0000 (16:18 +0200)
committerKay Sievers <kay@vrfy.org>
Mon, 4 Aug 2014 14:18:08 +0000 (16:18 +0200)
connection.c
names.c

index 71bb66af5339421b14d74fb017b42af0f5463e32..c2d71a80464711b1d23de2a34cfda5b4bde80993 100644 (file)
@@ -1248,7 +1248,8 @@ int kdbus_conn_kmsg_send(struct kdbus_ep *ep,
                         * Activator connections will not receive any
                         * broadcast messages.
                         */
-                       if (conn_dst->flags & KDBUS_HELLO_ACTIVATOR)
+                       if (conn_dst->type != KDBUS_CONN_CONNECTED &&
+                           conn_dst->type != KDBUS_CONN_MONITOR)
                                continue;
 
                        if (!kdbus_match_db_match_kmsg(conn_dst->match_db,
@@ -1287,7 +1288,7 @@ int kdbus_conn_kmsg_send(struct kdbus_ep *ep,
                        conn_dst = kdbus_conn_ref(entry->conn);
 
                if ((msg->flags & KDBUS_MSG_FLAGS_NO_AUTO_START) &&
-                   (conn_dst->flags & KDBUS_HELLO_ACTIVATOR)) {
+                   (conn_dst->type == KDBUS_CONN_ACTIVATOR)) {
                        ret = -EADDRNOTAVAIL;
                        goto exit_unref;
                }
diff --git a/names.c b/names.c
index aeedd6f79638c105fcfabf92f43e1db45ee602fb..78c5455942b239ad4c2c48411e3137c158fd59b1 100644 (file)
--- a/names.c
+++ b/names.c
@@ -314,7 +314,7 @@ void kdbus_name_remove_by_conn(struct kdbus_name_registry *reg,
        list_splice_init(&conn->names_queue_list, &names_queue_list);
        mutex_unlock(&conn->lock);
 
-       if (conn->flags & KDBUS_HELLO_ACTIVATOR) {
+       if (conn->type == KDBUS_CONN_ACTIVATOR) {
                activator = conn->activator_of->activator;
                conn->activator_of->activator = NULL;
        }
@@ -494,7 +494,7 @@ int kdbus_name_acquire(struct kdbus_name_registry *reg,
                        goto exit_unlock;
                }
 
-               if (conn->flags & KDBUS_HELLO_ACTIVATOR) {
+               if (conn->type == KDBUS_CONN_ACTIVATOR) {
                        /* An activator can only own a single name */
                        if (conn->activator_of) {
                                if (conn->activator_of == e)
@@ -560,7 +560,7 @@ int kdbus_name_acquire(struct kdbus_name_registry *reg,
                goto exit_unlock;
        } else {
                /* An activator can only own a single name */
-               if ((conn->flags & KDBUS_HELLO_ACTIVATOR) &&
+               if ((conn->type == KDBUS_CONN_ACTIVATOR) &&
                    conn->activator_of) {
                        ret = -EINVAL;
                        goto exit_unlock;
@@ -581,7 +581,7 @@ int kdbus_name_acquire(struct kdbus_name_registry *reg,
                goto exit_unlock;
        }
 
-       if (conn->flags & KDBUS_HELLO_ACTIVATOR) {
+       if (conn->type & KDBUS_CONN_ACTIVATOR) {
                e->activator = kdbus_conn_ref(conn);
                conn->activator_of = e;
        }
@@ -764,7 +764,7 @@ static int kdbus_name_list_all(struct kdbus_conn *conn, u64 flags,
 
                /* skip activators */
                if (!(flags & KDBUS_NAME_LIST_ACTIVATORS) &&
-                   c->flags & KDBUS_HELLO_ACTIVATOR)
+                   c->type == KDBUS_CONN_ACTIVATOR)
                        continue;
 
                /* all names the connection owns */
@@ -786,7 +786,7 @@ static int kdbus_name_list_all(struct kdbus_conn *conn, u64 flags,
                                }
 
                                if (flags & KDBUS_NAME_LIST_NAMES ||
-                                   c->flags & KDBUS_HELLO_ACTIVATOR) {
+                                   c->type == KDBUS_CONN_ACTIVATOR) {
                                        ret = kdbus_name_list_write(conn, c,
                                                        slice, &p, e, write);
                                        if (ret < 0)