do not use __ prefix for ordinary functions
authorKay Sievers <kay@vrfy.org>
Thu, 31 Jul 2014 15:15:13 +0000 (17:15 +0200)
committerKay Sievers <kay@vrfy.org>
Thu, 31 Jul 2014 15:15:13 +0000 (17:15 +0200)
bus.c
connection.c
domain.c
domain.h
handle.c
policy.c
test/kdbus-util.c

diff --git a/bus.c b/bus.c
index 9e2f41ba5f0bf5c777073665de6b3ec930ba956f..77175451d0780202d67e21dced36db51329775b2 100644 (file)
--- a/bus.c
+++ b/bus.c
@@ -277,7 +277,7 @@ int kdbus_bus_new(struct kdbus_domain *domain,
        }
 
        /* account the bus against the user */
-       ret = __kdbus_domain_user_account(domain, uid, &b->user);
+       ret = kdbus_domain_get_user_unlocked(domain, uid, &b->user);
        if (ret < 0)
                goto exit_unref_user_unlock;
 
index b42606c30659617f4106d8c451a2554993c7bbab..d8c3bc087bda2fa02476ed9f62842a49a44cfd72 100644 (file)
@@ -2089,9 +2089,9 @@ int kdbus_conn_new(struct kdbus_ep *ep,
        if (ep->user)
                conn->user = kdbus_domain_user_ref(ep->user);
        else {
-               ret = kdbus_domain_user_account(ep->bus->domain,
-                                               current_fsuid(),
-                                               &conn->user);
+               ret = kdbus_domain_get_user(ep->bus->domain,
+                                           current_fsuid(),
+                                           &conn->user);
                if (ret < 0)
                        goto exit_free_meta;
        }
index 6f6df158699551d247cb1b818b36c0d0e36e3207..946a616310b0d4bfb66f6ad296bbd33bbaf454a7 100644 (file)
--- a/domain.c
+++ b/domain.c
@@ -452,8 +452,7 @@ static int kdbus_domain_user_assign_id(struct kdbus_domain *domain,
 }
 
 /**
- * __kdbus_domain_user_account() - account a kdbus_domain_user object
- *                                into the specified domain
+ * kdbus_domain_get_user_unlocked() - get a kdbus_domain_user object
  * @domain:            The domain of the user
  * @uid:               The uid of the user; INVALID_UID for an
  *                     anonymous user like a custom endpoint
@@ -467,9 +466,9 @@ static int kdbus_domain_user_assign_id(struct kdbus_domain *domain,
  * return it in the @user argument. Otherwise allocate a new one,
  * link it into the domain and return it.
  */
-int __kdbus_domain_user_account(struct kdbus_domain *domain,
-                               kuid_t uid,
-                               struct kdbus_domain_user **user)
+int kdbus_domain_get_user_unlocked(struct kdbus_domain *domain,
+                                  kuid_t uid,
+                                  struct kdbus_domain_user **user)
 {
        int ret;
        struct kdbus_domain_user *tmp_user;
@@ -519,8 +518,7 @@ exit_free:
 }
 
 /**
- * kdbus_domain_user_account() - account a kdbus_domain_user object
- *                              into the specified domain
+ * kdbus_domain_get_user() - get a kdbus_domain_user object
  * @domain:            The domain of the user
  * @uid:               The uid of the user; INVALID_UID for an
  *                     anonymous user like a custom endpoint
@@ -528,27 +526,16 @@ exit_free:
  *                     domain user will be stored.
  *
  * Return: 0 on success, negative errno on failure.
- *
- * On success: if there is a uid matching, then use the already
- * accounted kdbus_domain_user, increment its reference counter and
- * return it in the 'user' argument. Otherwise, allocate a new one,
- * link it into the domain, then return it.
- *
- * On failure: the 'user' argument is not updated.
- *
- * This function will first check if the domain was not disconnected.
  */
-int kdbus_domain_user_account(struct kdbus_domain *domain,
-                             kuid_t uid,
-                             struct kdbus_domain_user **user)
+int kdbus_domain_get_user(struct kdbus_domain *domain,
+                         kuid_t uid,
+                         struct kdbus_domain_user **user)
 {
        int ret = -ESHUTDOWN;
 
        mutex_lock(&domain->lock);
-
        if (!domain->disconnected)
-               ret = __kdbus_domain_user_account(domain, uid, user);
-
+               ret = kdbus_domain_get_user_unlocked(domain, uid, user);
        mutex_unlock(&domain->lock);
 
        return ret;
index 0577e5d535684e1a9cafeff585e808139686b3ef..92d57526410e6c43c21a219d82de93ef7606f08f 100644 (file)
--- a/domain.h
+++ b/domain.h
@@ -99,13 +99,13 @@ int kdbus_domain_new(struct kdbus_domain *parent, const char *name,
 int kdbus_domain_make_user(struct kdbus_cmd_make *cmd, char **name);
 struct kdbus_domain *kdbus_domain_find_by_major(unsigned int major);
 
-int __kdbus_domain_user_account(struct kdbus_domain *domain,
-                               kuid_t uid,
-                               struct kdbus_domain_user **user);
+int kdbus_domain_get_user_unlocked(struct kdbus_domain *domain,
+                                  kuid_t uid,
+                                  struct kdbus_domain_user **user);
 
-int kdbus_domain_user_account(struct kdbus_domain *domain,
-                             kuid_t uid,
-                             struct kdbus_domain_user **user);
+int kdbus_domain_get_user(struct kdbus_domain *domain,
+                         kuid_t uid,
+                         struct kdbus_domain_user **user);
 
 struct kdbus_domain_user *kdbus_domain_user_ref(struct kdbus_domain_user *u);
 struct kdbus_domain_user *kdbus_domain_user_unref(struct kdbus_domain_user *u);
index 59842c15c0daaeee156cc74e2964f76a69755c77..8d821d4f21997fa7b46d9ec4c42721448635ed42 100644 (file)
--- a/handle.c
+++ b/handle.c
@@ -464,8 +464,8 @@ static long kdbus_handle_ioctl_ep(struct file *file, unsigned int cmd,
                 * endpoint users do not share the budget with the ordinary
                 * users created for a UID.
                 */
-               ret = kdbus_domain_user_account(handle->ep->bus->domain,
-                                               INVALID_UID, &ep->user);
+               ret = kdbus_domain_get_user(handle->ep->bus->domain,
+                                           INVALID_UID, &ep->user);
                if (ret < 0) {
                        kdbus_ep_unref(ep);
                        break;
index 58ab6a5e295eecb72b2589130f6e8c6f710feb6e..a946a6cebbf8977e1b2e20a9b1707e0d5e8e2b83 100644 (file)
--- a/policy.c
+++ b/policy.c
@@ -87,7 +87,7 @@ static void kdbus_policy_entry_free(struct kdbus_policy_db_entry *e)
 }
 
 static const struct kdbus_policy_db_entry *
-__kdbus_policy_lookup(struct kdbus_policy_db *db,
+kdbus_policy_lookup(struct kdbus_policy_db *db,
                      const char *name, u32 hash,
                      bool wildcard)
 {
@@ -244,7 +244,7 @@ int kdbus_policy_check_own_access(struct kdbus_policy_db *db,
                return 0;
 
        mutex_lock(&db->entries_lock);
-       e = __kdbus_policy_lookup(db, name, kdbus_str_hash(name), true);
+       e = kdbus_policy_lookup(db, name, kdbus_str_hash(name), true);
        ret = kdbus_policy_check_access(e, conn->cred, KDBUS_POLICY_OWN);
        mutex_unlock(&db->entries_lock);
 
@@ -261,7 +261,7 @@ static int __kdbus_policy_check_talk_access(struct kdbus_policy_db *db,
        mutex_lock(&conn_dst->lock);
        list_for_each_entry(name_entry, &conn_dst->names_list, conn_entry) {
                u32 hash = kdbus_str_hash(name_entry->name);
-               e = __kdbus_policy_lookup(db, name_entry->name, hash, true);
+               e = kdbus_policy_lookup(db, name_entry->name, hash, true);
                if (kdbus_policy_check_access(e, current_cred(),
                                              KDBUS_POLICY_TALK) == 0) {
                        ret = 0;
@@ -371,7 +371,7 @@ int kdbus_policy_check_see_access_unlocked(struct kdbus_policy_db *db,
 {
        const struct kdbus_policy_db_entry *e;
 
-       e = __kdbus_policy_lookup(db, name, kdbus_str_hash(name), true);
+       e = kdbus_policy_lookup(db, name, kdbus_str_hash(name), true);
        return kdbus_policy_check_access(e, current_cred(), KDBUS_POLICY_SEE);
 }
 
@@ -431,7 +431,7 @@ kdbus_policy_add_one(struct kdbus_policy_db *db,
        int ret = 0;
        u32 hash = kdbus_str_hash(e->name);
 
-       if (__kdbus_policy_lookup(db, e->name, hash, false))
+       if (kdbus_policy_lookup(db, e->name, hash, false))
                ret = -EEXIST;
        else
                hash_add(db->entries_hash, &e->hentry, hash);
index 298d1ec3731b1f4911f1e2d5fc7f0ffee4703970..e04aab102060844232e99cb162161a922df19a24 100644 (file)
@@ -630,7 +630,7 @@ int conn_update(struct conn *conn, const char *name,
 
        /*
         * normally having flags == 0 is valid, but just keep
-        * HELLO flags of __kdbus_hello(), don't check them.
+        * HELLO flags of kdbus_hello(), don't check them.
         */
        item->type = KDBUS_ITEM_ATTACH_FLAGS;
        item->size = KDBUS_ITEM_HEADER_SIZE + sizeof(uint64_t);