Signed-off-by: Djalal Harouni <tix...@opendz.org>
---
 domain.c | 67 ----------------------------------------------------------------
 domain.h |  2 --
 2 files changed, 69 deletions(-)

diff --git a/domain.c b/domain.c
index 1e2c3c9..eeb73ca 100644
--- a/domain.c
+++ b/domain.c
@@ -557,73 +557,6 @@ int kdbus_domain_user_account(struct kdbus_domain *domain,
        return ret;
 }
 
-/**
- * kdbus_domain_user_find_or_new() - get a kdbus_domain_user object in a domain
- * @domain:            The domain
- * @uid:               The uid of the user; INVALID_UID for an anonymous
- *                     user like a custom endpoint
- *
- * Return: a kdbus_domain_user, either freshly allocated or with the reference
- * counter increased. In case of memory allocation failure, NULL is returned.
- */
-struct kdbus_domain_user
-*kdbus_domain_user_find_or_new(struct kdbus_domain *domain, kuid_t uid)
-{
-       struct kdbus_domain_user *u;
-       int ret;
-
-       /* find uid and reference it */
-       if (uid_valid(uid)) {
-               mutex_lock(&domain->lock);
-               hash_for_each_possible(domain->user_hash, u,
-                                      hentry, __kuid_val(uid)) {
-                       if (!uid_eq(u->uid, uid))
-                               continue;
-
-                       kref_get(&u->kref);
-                       mutex_unlock(&domain->lock);
-                       return u;
-               }
-               mutex_unlock(&domain->lock);
-       }
-
-       /* allocate a new user */
-       u = kzalloc(sizeof(*u), GFP_KERNEL);
-       if (!u)
-               return NULL;
-
-       kref_init(&u->kref);
-       u->domain = kdbus_domain_ref(domain);
-       u->uid = uid;
-       atomic_set(&u->buses, 0);
-       atomic_set(&u->connections, 0);
-
-       /* link into domain */
-       mutex_lock(&domain->lock);
-       if (domain->disconnected) {
-               mutex_unlock(&domain->lock);
-               kfree(u);
-               return NULL;
-       }
-
-       /*
-        * Allocate the smallest possible index for this user; used
-        * in arrays for accounting user quota in receiver queues.
-        */
-       ret = idr_alloc(&domain->user_idr, u, 0, 0, GFP_KERNEL);
-       if (ret < 0) {
-               mutex_unlock(&domain->lock);
-               return NULL;
-       }
-       u->idr = ret;
-
-       /* UID hash map */
-       hash_add(domain->user_hash, &u->hentry, __kuid_val(u->uid));
-       mutex_unlock(&domain->lock);
-
-       return u;
-}
-
 static void __kdbus_domain_user_free(struct kref *kref)
 {
        struct kdbus_domain_user *user =
diff --git a/domain.h b/domain.h
index c81589e..0577e5d 100644
--- a/domain.h
+++ b/domain.h
@@ -107,8 +107,6 @@ int kdbus_domain_user_account(struct kdbus_domain *domain,
                              kuid_t uid,
                              struct kdbus_domain_user **user);
 
-struct kdbus_domain_user
-*kdbus_domain_user_find_or_new(struct kdbus_domain *domain, kuid_t uid);
 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);
 #endif
-- 
1.9.3

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to