Permalink
Browse files

rename namespace to domain

  • Loading branch information...
1 parent 386394a commit 9c02e69055861236b50210503b3d6e9fcfbe90b2 @zonque zonque committed Feb 1, 2014
Showing with 254 additions and 252 deletions.
  1. +1 −1 .gitignore
  2. +1 −1 Makefile
  3. +2 −2 TODO
  4. +25 −25 bus.c
  5. +8 −8 bus.h
  6. +10 −10 connection.c
  7. +1 −1 connection.h
  8. +3 −3 defaults.h
  9. +110 −109 namespace.c → domain.c
  10. +29 −29 namespace.h → domain.h
  11. +12 −11 endpoint.c
  12. +3 −3 endpoint.h
  13. +26 −26 handle.c
  14. +7 −7 kdbus.h
  15. +5 −5 main.c
  16. +1 −1 message.c
  17. +2 −2 metadata.c
  18. +2 −2 metadata.h
  19. +5 −5 test/test-kdbus.c
  20. +1 −1 util.c
View
@@ -9,7 +9,7 @@ Module.symvers
tags
test/test-kdbus
test/test-kdbus-daemon
-test/test-kdbus-namespace
+test/test-kdbus-domain
test/test-kdbus-fuzz
test/test-kdbus-benchmark
test/test-kdbus-monitor
View
@@ -10,7 +10,7 @@ kdbus$(EXT)-y := \
metadata.o \
names.o \
notify.o \
- namespace.o \
+ domain.o \
policy.o \
pool.o \
util.o
View
4 TODO
@@ -4,7 +4,7 @@ Features:
- test kdbus_match_bloom() multi-generation bloom masks, we need to
be sure it works with old kernels when we update userspace tools
- - make sure that our namespace/kuid/pidns creds passing/deny logic
+ - make sure that our domain/kuid/pidns creds passing/deny logic
is what we want in the long run, interaction with userns?
- use/prepare for something like this to manage the pool backing shmemfd:
@@ -18,7 +18,7 @@ Features:
- impersonation
- name register
- $UID prefix
- - ns creation
+ - domain creation
- ep prefixing
- policy, policy for custom endpoints
View
50 bus.c
@@ -26,7 +26,7 @@
#include "connection.h"
#include "endpoint.h"
#include "names.h"
-#include "namespace.h"
+#include "domain.h"
bool kdbus_bus_uid_is_privileged(const struct kdbus_bus *bus)
{
@@ -61,11 +61,11 @@ static void __kdbus_bus_free(struct kref *kref)
kdbus_bus_disconnect(bus);
atomic_dec(&bus->user->buses);
- kdbus_ns_user_unref(bus->user);
+ kdbus_domain_user_unref(bus->user);
if (bus->name_registry)
kdbus_name_registry_free(bus->name_registry);
- kdbus_ns_unref(bus->ns);
+ kdbus_domain_unref(bus->domain);
kfree(bus->name);
kfree(bus);
}
@@ -132,11 +132,11 @@ void kdbus_bus_disconnect(struct kdbus_bus *bus)
bus->disconnected = true;
mutex_unlock(&bus->lock);
- /* disconnect from namespace */
- mutex_lock(&bus->ns->lock);
- if (bus->ns)
- list_del(&bus->ns_entry);
- mutex_unlock(&bus->ns->lock);
+ /* disconnect from domain */
+ mutex_lock(&bus->domain->lock);
+ if (bus->domain)
+ list_del(&bus->domain_entry);
+ mutex_unlock(&bus->domain->lock);
/* remove all endpoints attached to this bus */
list_for_each_entry_safe(ep, tmp, &bus->ep_list, bus_entry) {
@@ -145,27 +145,27 @@ void kdbus_bus_disconnect(struct kdbus_bus *bus)
}
}
-static struct kdbus_bus *kdbus_bus_find(struct kdbus_ns *ns, const char *name)
+static struct kdbus_bus *kdbus_bus_find(struct kdbus_domain *domain, const char *name)
{
struct kdbus_bus *bus = NULL;
struct kdbus_bus *b;
- mutex_lock(&ns->lock);
- list_for_each_entry(b, &ns->bus_list, ns_entry) {
+ mutex_lock(&domain->lock);
+ list_for_each_entry(b, &domain->bus_list, domain_entry) {
if (strcmp(b->name, name))
continue;
bus = kdbus_bus_ref(b);
break;
}
- mutex_unlock(&ns->lock);
+ mutex_unlock(&domain->lock);
return bus;
}
/**
* kdbus_bus_new() - create a new bus
- * @ns: The namespace to work on
+ * @domain: The domain to work on
* @make: Pointer to a struct kdbus_cmd_make containing the
* details for the bus creation
* @name: Name of the bus
@@ -176,11 +176,11 @@ static struct kdbus_bus *kdbus_bus_find(struct kdbus_ns *ns, const char *name)
* @bus: Pointer to a reference where the new bus is stored
*
* This function will allocate a new kdbus_bus and link it to the given
- * namespace.
+ * domain.
*
* Return: 0 on success, negative errno on failure.
*/
-int kdbus_bus_new(struct kdbus_ns *ns,
+int kdbus_bus_new(struct kdbus_domain *domain,
struct kdbus_cmd_make *make, const char *name,
const struct kdbus_bloom_parameter *bloom,
umode_t mode, kuid_t uid, kgid_t gid,
@@ -198,7 +198,7 @@ int kdbus_bus_new(struct kdbus_ns *ns,
if (strncmp(name, prefix, strlen(prefix) != 0))
return -EINVAL;
- b = kdbus_bus_find(ns, name);
+ b = kdbus_bus_find(domain, name);
if (b) {
kdbus_bus_unref(b);
return -EEXIST;
@@ -231,13 +231,13 @@ int kdbus_bus_new(struct kdbus_ns *ns,
if (ret < 0)
goto exit;
- ret = kdbus_ep_new(b, ns, "bus", mode, uid, gid,
+ ret = kdbus_ep_new(b, domain, "bus", mode, uid, gid,
b->bus_flags & KDBUS_MAKE_POLICY_OPEN);
if (ret < 0)
goto exit;
/* account the bus against the user */
- b->user = kdbus_ns_user_ref(ns, uid);
+ b->user = kdbus_domain_user_ref(domain, uid);
if (!b->user) {
ret = -ENOMEM;
goto exit;
@@ -246,17 +246,17 @@ int kdbus_bus_new(struct kdbus_ns *ns,
if (!capable(CAP_IPC_OWNER) &&
atomic_inc_return(&b->user->buses) > KDBUS_USER_MAX_BUSES) {
atomic_dec(&b->user->buses);
- b->user = kdbus_ns_user_unref(b->user);
+ b->user = kdbus_domain_user_unref(b->user);
ret = -EMFILE;
goto exit;
}
- /* link into namespace */
- mutex_lock(&ns->lock);
- b->id = ++ns->bus_seq_last;
- list_add_tail(&b->ns_entry, &ns->bus_list);
- b->ns = kdbus_ns_ref(ns);
- mutex_unlock(&ns->lock);
+ /* link into domain */
+ mutex_lock(&domain->lock);
+ b->id = ++domain->bus_seq_last;
+ list_add_tail(&b->domain_entry, &domain->bus_list);
+ b->domain = kdbus_domain_ref(domain);
+ mutex_unlock(&domain->lock);
*bus = b;
return 0;
View
16 bus.h
@@ -19,13 +19,13 @@
#include "util.h"
/**
- * struct kdbus_bus - bus in a namespace
+ * struct kdbus_bus - bus in a domain
* @kref: Reference count
* @disconnected: Invalidated data
* @uid_owner: The uid of the owner of the bus
- * @ns: Namespace of this bus
+ * @domain: Namespace of this bus
* @name: The bus name
- * @id: ID of this bus in the namespace
+ * @id: ID of this bus in the domain
* @lock: Bus data lock
* @ep_seq_last: Last used endpoint id sequence number
* @conn_seq_last: Last used connection id sequence number
@@ -34,7 +34,7 @@
* @ep_list: Endpoints on this bus
* @bus_flags: Simple pass-through flags from userspace to userspace
* @name_registry: Namespace's list of buses
- * @ns_entry: Namespace's list of buses
+ * @domain_entry: Namespace's list of buses
* @monitors_list: Connections that monitor this bus
* @bloom: Bloom parameters
* @id128: Unique random 128 bit ID of this bus
@@ -50,7 +50,7 @@ struct kdbus_bus {
struct kref kref;
bool disconnected;
kuid_t uid_owner;
- struct kdbus_ns *ns;
+ struct kdbus_domain *domain;
const char *name;
u64 id;
struct mutex lock;
@@ -61,16 +61,16 @@ struct kdbus_bus {
struct list_head ep_list;
u64 bus_flags;
struct kdbus_name_registry *name_registry;
- struct list_head ns_entry;
+ struct list_head domain_entry;
struct list_head monitors_list;
struct kdbus_bloom_parameter bloom;
u8 id128[16];
- struct kdbus_ns_user *user;
+ struct kdbus_domain_user *user;
};
int kdbus_bus_make_user(struct kdbus_cmd_make *make,
char **name, struct kdbus_bloom_parameter *bloom);
-int kdbus_bus_new(struct kdbus_ns *ns,
+int kdbus_bus_new(struct kdbus_domain *domain,
struct kdbus_cmd_make *make, const char *name,
const struct kdbus_bloom_parameter *bloom,
umode_t mode, kuid_t uid, kgid_t gid,
View
@@ -34,7 +34,7 @@
#include "message.h"
#include "metadata.h"
#include "names.h"
-#include "namespace.h"
+#include "domain.h"
#include "notify.h"
#include "policy.h"
#include "util.h"
@@ -500,7 +500,7 @@ static int kdbus_conn_queue_alloc(struct kdbus_conn *conn,
/* space for metadata/credential items */
if (kmsg->meta && kmsg->meta->size > 0 &&
- kmsg->meta->ns == conn->meta->ns) {
+ kmsg->meta->domain == conn->meta->domain) {
meta = msg_size;
msg_size += kmsg->meta->size;
}
@@ -1092,9 +1092,9 @@ int kdbus_conn_kmsg_send(struct kdbus_ep *ep,
sync = msg->flags & KDBUS_MSG_FLAGS_SYNC_REPLY;
- /* assign namespace-global message sequence number */
+ /* assign domain-global message sequence number */
BUG_ON(kmsg->seq > 0);
- kmsg->seq = atomic64_inc_return(&ep->bus->ns->msg_seq_last);
+ kmsg->seq = atomic64_inc_return(&ep->bus->domain->msg_seq_last);
/* non-kernel senders append credentials/metadata */
if (conn_src) {
@@ -1498,7 +1498,7 @@ static void __kdbus_conn_free(struct kref *kref)
kdbus_conn_disconnect(conn, false);
atomic_dec(&conn->user->connections);
- kdbus_ns_user_unref(conn->user);
+ kdbus_domain_user_unref(conn->user);
if (conn->ep->policy_db)
kdbus_policy_db_remove_conn(conn->ep->policy_db, conn);
@@ -1705,8 +1705,8 @@ int kdbus_cmd_conn_info(struct kdbus_conn *conn,
info.id = owner_conn->id;
info.flags = owner_conn->flags;
- /* do not leak namespace-specific credentials */
- if (conn->meta->ns == owner_conn->meta->ns)
+ /* do not leak domain-specific credentials */
+ if (conn->meta->domain == owner_conn->meta->domain)
info.size += owner_conn->meta->size;
/*
@@ -1738,7 +1738,7 @@ int kdbus_cmd_conn_info(struct kdbus_conn *conn,
goto exit_free;
pos = off + sizeof(struct kdbus_conn_info);
- if (conn->meta->ns == owner_conn->meta->ns) {
+ if (conn->meta->domain == owner_conn->meta->domain) {
ret = kdbus_pool_write(conn->pool, pos, owner_conn->meta->data,
owner_conn->meta->size);
if (ret < 0)
@@ -2001,7 +2001,7 @@ int kdbus_conn_new(struct kdbus_ep *ep,
}
/* account the connection against the user */
- conn->user = kdbus_ns_user_ref(ep->bus->ns, ep->bus->uid_owner);
+ conn->user = kdbus_domain_user_ref(ep->bus->domain, ep->bus->uid_owner);
if (!conn->user) {
ret = -ENOMEM;
goto exit_free_meta;
@@ -2023,7 +2023,7 @@ int kdbus_conn_new(struct kdbus_ep *ep,
return 0;
exit_unref_user:
- kdbus_ns_user_unref(conn->user);
+ kdbus_domain_user_unref(conn->user);
exit_free_meta:
kdbus_meta_free(conn->owner_meta);
exit_release_names:
View
@@ -77,7 +77,7 @@ struct kdbus_conn {
struct kdbus_meta *owner_meta;
unsigned int msg_count;
struct kdbus_pool *pool;
- struct kdbus_ns_user *user;
+ struct kdbus_domain_user *user;
};
struct kdbus_kmsg;
View
@@ -31,7 +31,7 @@
/* maximum length of well-known bus name */
#define KDBUS_NAME_MAX_LEN 255
-/* maximum length of bus, ns, ep name */
+/* maximum length of bus, domain, ep name */
#define KDBUS_SYSNAME_MAX_LEN 63
/* maximum size of make data */
@@ -58,10 +58,10 @@
/* maximum number of queud requests waiting for a reply */
#define KDBUS_CONN_MAX_REQUESTS_PENDING 64
-/* maximum number of connections per user in one namespace */
+/* maximum number of connections per user in one domain */
#define KDBUS_USER_MAX_CONN 256
-/* maximum number of buses per user in one namespace */
+/* maximum number of buses per user in one domain */
#define KDBUS_USER_MAX_BUSES 16
#endif
Oops, something went wrong.

0 comments on commit 9c02e69

Please sign in to comment.