summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mack <zonque@gmail.com>2014-02-01 14:33:00 +0100
committerDaniel Mack <zonque@gmail.com>2014-02-01 14:35:07 +0100
commit9c02e69055861236b50210503b3d6e9fcfbe90b2 (patch)
treeb2e1c1e91c985842c6e00173dc161e92ed13a3ce
parent386394a4e1b1b3783367473d57c99619cbdb5a67 (diff)
downloadkdbus-bus-9c02e69055861236b50210503b3d6e9fcfbe90b2.tar.gz
kdbus-bus-9c02e69055861236b50210503b3d6e9fcfbe90b2.tar.bz2
kdbus-bus-9c02e69055861236b50210503b3d6e9fcfbe90b2.zip
rename namespace to domain
-rw-r--r--.gitignore2
-rw-r--r--Makefile2
-rw-r--r--TODO4
-rw-r--r--bus.c50
-rw-r--r--bus.h16
-rw-r--r--connection.c20
-rw-r--r--connection.h2
-rw-r--r--defaults.h6
-rw-r--r--domain.c (renamed from namespace.c)219
-rw-r--r--domain.h (renamed from namespace.h)58
-rw-r--r--endpoint.c23
-rw-r--r--endpoint.h6
-rw-r--r--handle.c52
-rw-r--r--kdbus.h14
-rw-r--r--main.c10
-rw-r--r--message.c2
-rw-r--r--metadata.c4
-rw-r--r--metadata.h4
-rw-r--r--test/test-kdbus.c10
-rw-r--r--util.c2
20 files changed, 254 insertions, 252 deletions
diff --git a/.gitignore b/.gitignore
index fc49417c013..f4416325c7c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -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
diff --git a/Makefile b/Makefile
index e1a655ea600..c593b517938 100644
--- a/Makefile
+++ b/Makefile
@@ -10,7 +10,7 @@ kdbus$(EXT)-y := \
metadata.o \
names.o \
notify.o \
- namespace.o \
+ domain.o \
policy.o \
pool.o \
util.o
diff --git a/TODO b/TODO
index d4f7a3768e6..7b9b714598a 100644
--- a/TODO
+++ b/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
diff --git a/bus.c b/bus.c
index 0d43c61e482..ba1566ce8d3 100644
--- a/bus.c
+++ b/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,13 +145,13 @@ 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;
@@ -159,13 +159,13 @@ static struct kdbus_bus *kdbus_bus_find(struct kdbus_ns *ns, const char *name)
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;
diff --git a/bus.h b/bus.h
index 57df2d9ed04..7b25cbc958f 100644
--- a/bus.h
+++ b/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,
diff --git a/connection.c b/connection.c
index 13d67cd137a..225c0417279 100644
--- a/connection.c
+++ b/connection.c
@@ -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:
diff --git a/connection.h b/connection.h
index 6435099495b..61e3b9a45fa 100644
--- a/connection.h
+++ b/connection.h
@@ -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;
diff --git a/defaults.h b/defaults.h
index 6e4459d67d7..511c6fa204b 100644
--- a/defaults.h
+++ b/defaults.h
@@ -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
diff --git a/namespace.c b/domain.c
index 8d17039bbc7..7c78ae0d587 100644
--- a/namespace.c
+++ b/domain.c
@@ -23,17 +23,17 @@
#include "bus.h"
#include "defaults.h"
#include "handle.h"
-#include "namespace.h"
+#include "domain.h"
#include "util.h"
/* map of majors to namespaces */
-static DEFINE_IDR(kdbus_ns_major_idr);
+static DEFINE_IDR(kdbus_domain_major_idr);
-/* next namespace id sequence number */
-static u64 kdbus_ns_seq_last;
+/* next domain id sequence number */
+static u64 kdbus_domain_seq_last;
-/* kdbus initial namespace */
-struct kdbus_ns *kdbus_ns_init;
+/* kdbus initial domain */
+struct kdbus_domain *kdbus_domain_init;
/* kdbus subsystem lock */
static DEFINE_MUTEX(kdbus_subsys_lock);
@@ -47,10 +47,10 @@ struct bus_type kdbus_subsys = {
static char *kdbus_devnode_control(struct device *dev, umode_t *mode,
kuid_t *uid, kgid_t *gid)
{
- struct kdbus_ns *ns = dev_get_drvdata(dev);
+ struct kdbus_domain *domain = dev_get_drvdata(dev);
if (mode)
- *mode = ns->mode;
+ *mode = domain->mode;
return NULL;
}
@@ -67,141 +67,142 @@ static struct device_type kdbus_devtype_control = {
};
/**
- * kdbus_ns_ref() - take a namespace reference
- * @ns : Namespace
+ * kdbus_domain_ref() - take a domain reference
+ * @domain: Namespace
*
- * Return: the namespace itself
+ * Return: the domain itself
*/
-struct kdbus_ns *kdbus_ns_ref(struct kdbus_ns *ns)
+struct kdbus_domain *kdbus_domain_ref(struct kdbus_domain *domain)
{
- kref_get(&ns->kref);
- return ns;
+ kref_get(&domain->kref);
+ return domain;
}
/**
- * kdbus_ns_disconnect() - invalidate a namespace
- * @ns : Namespace
+ * kdbus_domain_disconnect() - invalidate a domain
+ * @domain: Namespace
*/
-void kdbus_ns_disconnect(struct kdbus_ns *ns)
+void kdbus_domain_disconnect(struct kdbus_domain *domain)
{
struct kdbus_bus *bus, *tmp;
- mutex_lock(&ns->lock);
- if (ns->disconnected) {
- mutex_unlock(&ns->lock);
+ mutex_lock(&domain->lock);
+ if (domain->disconnected) {
+ mutex_unlock(&domain->lock);
return;
}
- ns->disconnected = true;
- mutex_unlock(&ns->lock);
+ domain->disconnected = true;
+ mutex_unlock(&domain->lock);
mutex_lock(&kdbus_subsys_lock);
- if (ns->parent)
- list_del(&ns->ns_entry);
+ if (domain->parent)
+ list_del(&domain->domain_entry);
mutex_unlock(&kdbus_subsys_lock);
/* remove any buses attached to this endpoint */
- list_for_each_entry_safe(bus, tmp, &ns->bus_list, ns_entry) {
+ list_for_each_entry_safe(bus, tmp, &domain->bus_list, domain_entry) {
kdbus_bus_disconnect(bus);
kdbus_bus_unref(bus);
}
- if (ns->dev) {
- device_unregister(ns->dev);
- ns->dev = NULL;
+ if (domain->dev) {
+ device_unregister(domain->dev);
+ domain->dev = NULL;
}
- if (ns->major > 0) {
- idr_remove(&kdbus_ns_major_idr, ns->major);
- unregister_chrdev(ns->major, KBUILD_MODNAME);
- ns->major = 0;
+ if (domain->major > 0) {
+ idr_remove(&kdbus_domain_major_idr, domain->major);
+ unregister_chrdev(domain->major, KBUILD_MODNAME);
+ domain->major = 0;
}
}
-static void __kdbus_ns_free(struct kref *kref)
+static void __kdbus_domain_free(struct kref *kref)
{
- struct kdbus_ns *ns = container_of(kref, struct kdbus_ns, kref);
-
- kdbus_ns_disconnect(ns);
- kdbus_ns_unref(ns->parent);
- kfree(ns->name);
- kfree(ns->devpath);
- kfree(ns);
+ struct kdbus_domain *domain =
+ container_of(kref, struct kdbus_domain, kref);
+
+ kdbus_domain_disconnect(domain);
+ kdbus_domain_unref(domain->parent);
+ kfree(domain->name);
+ kfree(domain->devpath);
+ kfree(domain);
}
/**
- * kdbus_ns_unref() - drop a namespace reference
- * @ns : Namespace
+ * kdbus_domain_unref() - drop a domain reference
+ * @domain: Namespace
*
- * When the last reference is dropped, the namespace internal structure
+ * When the last reference is dropped, the domain internal structure
* is freed.
*
* Return: NULL
*/
-struct kdbus_ns *kdbus_ns_unref(struct kdbus_ns *ns)
+struct kdbus_domain *kdbus_domain_unref(struct kdbus_domain *domain)
{
- if (!ns)
+ if (!domain)
return NULL;
- kref_put(&ns->kref, __kdbus_ns_free);
+ kref_put(&domain->kref, __kdbus_domain_free);
return NULL;
}
-static struct kdbus_ns *kdbus_ns_find(struct kdbus_ns const *parent,
+static struct kdbus_domain *kdbus_domain_find(struct kdbus_domain const *parent,
const char *name)
{
- struct kdbus_ns *ns = NULL;
- struct kdbus_ns *n;
+ struct kdbus_domain *domain = NULL;
+ struct kdbus_domain *n;
- list_for_each_entry(n, &parent->ns_list, ns_entry) {
+ list_for_each_entry(n, &parent->ns_list, domain_entry) {
if (strcmp(n->name, name))
continue;
- ns = kdbus_ns_ref(n);
+ domain = kdbus_domain_ref(n);
break;
}
- return ns;
+ return domain;
}
/**
- * kdbus_ns_find_by_major() - lookup a namespace by its major device number
+ * kdbus_domain_find_by_major() - lookup a domain by its major device number
* @major: Major number
*
- * Looks up a namespace by major number. The returned namspace
+ * Looks up a domain by major number. The returned namspace
* is ref'ed, and needs to be unref'ed by the user. Returns NULL if
* the namepace can't be found.
*
- * Return: the namespace, or NULL if not found
+ * Return: the domain, or NULL if not found
*/
-struct kdbus_ns *kdbus_ns_find_by_major(unsigned int major)
+struct kdbus_domain *kdbus_domain_find_by_major(unsigned int major)
{
- struct kdbus_ns *ns;
+ struct kdbus_domain *domain;
mutex_lock(&kdbus_subsys_lock);
- ns = idr_find(&kdbus_ns_major_idr, major);
- if (ns)
- kdbus_ns_ref(ns);
+ domain = idr_find(&kdbus_domain_major_idr, major);
+ if (domain)
+ kdbus_domain_ref(domain);
mutex_unlock(&kdbus_subsys_lock);
- return ns;
+ return domain;
}
/**
- * kdbus_ns_new() - create a new namespace
- * @parent: Parent namespace, NULL for initial one
- * @name: Name of the namespace, NULL for the initial one
+ * kdbus_domain_new() - create a new domain
+ * @parent: Parent domain, NULL for initial one
+ * @name: Name of the domain, NULL for the initial one
* @mode: The access mode for the "control" device node
- * @ns: The returned namespace
+ * @domain: The returned domain
*
* Return: 0 on success, negative errno on failure
*/
-int kdbus_ns_new(struct kdbus_ns *parent, const char *name, umode_t mode,
- struct kdbus_ns **ns)
+int kdbus_domain_new(struct kdbus_domain *parent, const char *name, umode_t mode,
+ struct kdbus_domain **domain)
{
- struct kdbus_ns *n;
+ struct kdbus_domain *n;
int ret;
- BUG_ON(*ns);
+ BUG_ON(*domain);
if ((parent && !name) || (!parent && name))
return -EINVAL;
@@ -222,23 +223,23 @@ int kdbus_ns_new(struct kdbus_ns *parent, const char *name, umode_t mode,
/* compose name and path of base directory in /dev */
if (!parent) {
- /* initial namespace */
+ /* initial domain */
n->devpath = kstrdup(KBUILD_MODNAME, GFP_KERNEL);
if (!n->devpath) {
ret = -ENOMEM;
goto exit_unlock;
}
} else {
- struct kdbus_ns *exists;
+ struct kdbus_domain *exists;
- exists = kdbus_ns_find(parent, name);
+ exists = kdbus_domain_find(parent, name);
if (exists) {
- kdbus_ns_unref(exists);
+ kdbus_domain_unref(exists);
ret = -EEXIST;
goto exit_unlock;
}
- n->devpath = kasprintf(GFP_KERNEL, "%s/ns/%s",
+ n->devpath = kasprintf(GFP_KERNEL, "%s/domain/%s",
parent->devpath, name);
if (!n->devpath) {
ret = -ENOMEM;
@@ -260,20 +261,20 @@ int kdbus_ns_new(struct kdbus_ns *parent, const char *name, umode_t mode,
n->major = ret;
/*
- * kdbus_device_ops' dev_t finds the namespace in the major map,
- * and the bus in the minor map of that namespace
+ * kdbus_device_ops' dev_t finds the domain in the major map,
+ * and the bus in the minor map of that domain
*/
- ret = idr_alloc(&kdbus_ns_major_idr, n, n->major, 0, GFP_KERNEL);
+ ret = idr_alloc(&kdbus_domain_major_idr, n, n->major, 0, GFP_KERNEL);
if (ret < 0) {
if (ret == -ENOSPC)
ret = -EEXIST;
goto exit_unlock;
}
- /* get id for this namespace */
- n->id = ++kdbus_ns_seq_last;
+ /* get id for this domain */
+ n->id = ++kdbus_domain_seq_last;
- /* register control device for this namespace */
+ /* register control device for this domain */
n->dev = kzalloc(sizeof(*n->dev), GFP_KERNEL);
if (!n->dev) {
ret = -ENOMEM;
@@ -292,30 +293,30 @@ int kdbus_ns_new(struct kdbus_ns *parent, const char *name, umode_t mode,
goto exit_unlock;
}
- /* link into parent namespace */
+ /* link into parent domain */
if (parent) {
- n->parent = kdbus_ns_ref(parent);
- list_add_tail(&n->ns_entry, &parent->ns_list);
+ n->parent = kdbus_domain_ref(parent);
+ list_add_tail(&n->domain_entry, &parent->ns_list);
}
mutex_unlock(&kdbus_subsys_lock);
- *ns = n;
+ *domain = n;
return 0;
exit_unlock:
mutex_unlock(&kdbus_subsys_lock);
- kdbus_ns_unref(n);
+ kdbus_domain_unref(n);
return ret;
}
/**
- * kdbus_ns_make_user() - create namespace data from user data
+ * kdbus_domain_make_user() - create domain data from user data
* @cmd: The command as passed in by the ioctl
- * @name: The name of the namespace to create
+ * @name: The name of the domain to create
*
* Return: 0 on success, negative errno on failure
*/
-int kdbus_ns_make_user(struct kdbus_cmd_make *cmd, char **name)
+int kdbus_domain_make_user(struct kdbus_cmd_make *cmd, char **name)
{
const struct kdbus_item *item;
const char *n = NULL;
@@ -363,28 +364,28 @@ int kdbus_ns_make_user(struct kdbus_cmd_make *cmd, char **name)
}
/**
- * kdbus_ns_user_ref() - get a kdbus_ns_user object in a namespace
- * @ns: The namespace
+ * kdbus_domain_user_ref() - get a kdbus_domain_user object in a domain
+ * @domain: The domain
* @uid: The uid of the user
*
- * Return: a kdbus_ns_user, either freshly allocated or with the reference
+ * 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_ns_user *kdbus_ns_user_ref(struct kdbus_ns *ns, kuid_t uid)
+struct kdbus_domain_user *kdbus_domain_user_ref(struct kdbus_domain *domain, kuid_t uid)
{
- struct kdbus_ns_user *u;
+ struct kdbus_domain_user *u;
/* find uid and reference it */
- mutex_lock(&ns->lock);
- hash_for_each_possible(ns->user_hash, u, hentry, __kuid_val(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(&ns->lock);
+ mutex_unlock(&domain->lock);
return u;
}
- mutex_unlock(&ns->lock);
+ mutex_unlock(&domain->lock);
/* allocate a new user */
u = kzalloc(sizeof(*u), GFP_KERNEL);
@@ -392,36 +393,36 @@ struct kdbus_ns_user *kdbus_ns_user_ref(struct kdbus_ns *ns, kuid_t uid)
return NULL;
kref_init(&u->kref);
- u->ns = kdbus_ns_ref(ns);
+ u->domain = kdbus_domain_ref(domain);
u->uid = uid;
atomic_set(&u->buses, 0);
atomic_set(&u->connections, 0);
- /* link into namespace */
- mutex_lock(&ns->lock);
- hash_add(ns->user_hash, &u->hentry, __kuid_val(u->uid));
- mutex_unlock(&ns->lock);
+ /* link into domain */
+ mutex_lock(&domain->lock);
+ hash_add(domain->user_hash, &u->hentry, __kuid_val(u->uid));
+ mutex_unlock(&domain->lock);
return u;
}
-static void __kdbus_ns_user_free(struct kref *kref)
+static void __kdbus_domain_user_free(struct kref *kref)
{
- struct kdbus_ns_user *user = container_of(kref, struct kdbus_ns_user,
+ struct kdbus_domain_user *user = container_of(kref, struct kdbus_domain_user,
kref);
BUG_ON(atomic_read(&user->buses) > 0);
BUG_ON(atomic_read(&user->connections) > 0);
- mutex_lock(&user->ns->lock);
+ mutex_lock(&user->domain->lock);
hash_del(&user->hentry);
- mutex_unlock(&user->ns->lock);
- kdbus_ns_unref(user->ns);
+ mutex_unlock(&user->domain->lock);
+ kdbus_domain_unref(user->domain);
kfree(user);
}
-struct kdbus_ns_user *kdbus_ns_user_unref(struct kdbus_ns_user *user)
+struct kdbus_domain_user *kdbus_domain_user_unref(struct kdbus_domain_user *user)
{
- kref_put(&user->kref, __kdbus_ns_user_free);
+ kref_put(&user->kref, __kdbus_domain_user_free);
return NULL;
}
diff --git a/namespace.h b/domain.h
index ad06bcb4f41..d71ad907bbf 100644
--- a/namespace.h
+++ b/domain.h
@@ -17,13 +17,13 @@
#include <linux/idr.h>
/**
- * struct kdbus_namespace - namespace for buses
+ * struct kdbus_namespace - domain for buses
* @kref: Reference counter
* @disconnected: Invalidated data
- * @name: Name of the namespace
- * @parent: Parent namespace
+ * @name: Name of the domain
+ * @parent: Parent domain
* @ns_list: List of child namespaces
- * @id: Global id of this namespace
+ * @id: Global id of this domain
* @devpath: /dev base directory path
* @major: Device major number for all nodes
* @mode: Device node access mode
@@ -32,25 +32,25 @@
* @lock: Namespace data lock
* @bus_seq_last: Last used bus id sequence number
* @msg_seq_last: Last used message id sequence number
- * @ns_entry: Entry in parent namespace
- * @bus_list: Buses in this namespace
+ * @domain_entry: Entry in parent domain
+ * @bus_list: Buses in this domain
* @user_hash: Accounting of user resources
*
- * A namespace provides a "control" device node. Every namespace has its
+ * A domain provides a "control" device node. Every domain has its
* own major number for its endpoint device nodes.
*
- * The initial namespace is created at initialization time, is unnamed and
+ * The initial domain is created at initialization time, is unnamed and
* stays around for forver.
*
- * A namespace is created by opening the "control" device node of the
- * parent namespace and issuing the KDBUS_CMD_NS_MAKE iotcl. Closing this
- * file immediately destroys the entire namespace.
+ * A domain is created by opening the "control" device node of the
+ * parent domain and issuing the KDBUS_CMD_NS_MAKE iotcl. Closing this
+ * file immediately destroys the entire domain.
*/
-struct kdbus_ns {
+struct kdbus_domain {
struct kref kref;
bool disconnected;
const char *name;
- struct kdbus_ns *parent;
+ struct kdbus_domain *parent;
struct list_head ns_list;
u64 id;
const char *devpath;
@@ -61,40 +61,40 @@ struct kdbus_ns {
struct mutex lock;
u64 bus_seq_last;
atomic64_t msg_seq_last;
- struct list_head ns_entry;
+ struct list_head domain_entry;
struct list_head bus_list;
DECLARE_HASHTABLE(user_hash, 6);
};
/**
- * struct kdbus_ns_user - resource accounting for users
+ * struct kdbus_domain_user - resource accounting for users
* @kref: Reference counter
- * @ns: Namespace of the user
- * @hentry: Entry in namespace user map
+ * @domain: Namespace of the user
+ * @hentry: Entry in domain user map
* @uid: UID of the user
* @buses: Number of buses the user has created
* @connections: Number of connections the user has created
*/
-struct kdbus_ns_user {
+struct kdbus_domain_user {
struct kref kref;
- struct kdbus_ns *ns;
+ struct kdbus_domain *domain;
struct hlist_node hentry;
kuid_t uid;
atomic_t buses;
atomic_t connections;
};
-extern struct kdbus_ns *kdbus_ns_init;
+extern struct kdbus_domain *kdbus_domain_init;
extern struct bus_type kdbus_subsys;
-struct kdbus_ns *kdbus_ns_ref(struct kdbus_ns *ns);
-struct kdbus_ns *kdbus_ns_unref(struct kdbus_ns *ns);
-void kdbus_ns_disconnect(struct kdbus_ns *ns);
-int kdbus_ns_new(struct kdbus_ns *parent, const char *name,
- umode_t mode, struct kdbus_ns **ns);
-int kdbus_ns_make_user(struct kdbus_cmd_make *cmd, char **name);
-struct kdbus_ns *kdbus_ns_find_by_major(unsigned int major);
+struct kdbus_domain *kdbus_domain_ref(struct kdbus_domain *domain);
+struct kdbus_domain *kdbus_domain_unref(struct kdbus_domain *domain);
+void kdbus_domain_disconnect(struct kdbus_domain *domain);
+int kdbus_domain_new(struct kdbus_domain *parent, const char *name,
+ umode_t mode, struct kdbus_domain **domain);
+int kdbus_domain_make_user(struct kdbus_cmd_make *cmd, char **name);
+struct kdbus_domain *kdbus_domain_find_by_major(unsigned int major);
-struct kdbus_ns_user *kdbus_ns_user_ref(struct kdbus_ns *ns, kuid_t uid);
-struct kdbus_ns_user *kdbus_ns_user_unref(struct kdbus_ns_user *user);
+struct kdbus_domain_user *kdbus_domain_user_ref(struct kdbus_domain *domain, kuid_t uid);
+struct kdbus_domain_user *kdbus_domain_user_unref(struct kdbus_domain_user *user);
#endif
diff --git a/endpoint.c b/endpoint.c
index af5bce90ac1..e2fb4f0c594 100644
--- a/endpoint.c
+++ b/endpoint.c
@@ -22,7 +22,7 @@
#include "bus.h"
#include "endpoint.h"
-#include "namespace.h"
+#include "domain.h"
#include "policy.h"
/* endpoints are by default owned by the bus owner */
@@ -84,7 +84,7 @@ void kdbus_ep_disconnect(struct kdbus_ep *ep)
ep->dev = NULL;
}
if (ep->minor > 0) {
- idr_remove(&ep->bus->ns->idr, ep->minor);
+ idr_remove(&ep->bus->domain->idr, ep->minor);
ep->minor = 0;
}
@@ -135,7 +135,7 @@ static struct kdbus_ep *kdbus_ep_find(struct kdbus_bus *bus, const char *name)
/**
* kdbus_ep_new() - create a new endpoint
* @bus: The bus this endpoint will be created for
- * @ns: The namespace of the bus; needed separately when
+ * @domain: The domain of the bus; needed separately when
* creating the default endpoint for a new bus
* @name: The name of the endpoint
* @mode: The access mode for the device node
@@ -148,8 +148,9 @@ static struct kdbus_ep *kdbus_ep_find(struct kdbus_bus *bus, const char *name)
*
* Return: 0 on success, negative errno on failure.
*/
-int kdbus_ep_new(struct kdbus_bus *bus, struct kdbus_ns *ns, const char *name,
- umode_t mode, kuid_t uid, kgid_t gid, bool policy_open)
+int kdbus_ep_new(struct kdbus_bus *bus, struct kdbus_domain *domain,
+ const char *name, umode_t mode, kuid_t uid, kgid_t gid,
+ bool policy_open)
{
struct kdbus_ep *e;
int ret;
@@ -177,17 +178,17 @@ int kdbus_ep_new(struct kdbus_bus *bus, struct kdbus_ns *ns, const char *name,
goto exit;
}
- mutex_lock(&ns->lock);
+ mutex_lock(&domain->lock);
/* register minor in our endpoint map */
- ret = idr_alloc(&ns->idr, e, 1, 0, GFP_KERNEL);
+ ret = idr_alloc(&domain->idr, e, 1, 0, GFP_KERNEL);
if (ret < 0) {
if (ret == -ENOSPC)
ret = -EEXIST;
- mutex_unlock(&ns->lock);
+ mutex_unlock(&domain->lock);
goto exit;
}
e->minor = ret;
- mutex_unlock(&ns->lock);
+ mutex_unlock(&domain->lock);
/* register bus endpoint device */
e->dev = kzalloc(sizeof(*e->dev), GFP_KERNEL);
@@ -196,10 +197,10 @@ int kdbus_ep_new(struct kdbus_bus *bus, struct kdbus_ns *ns, const char *name,
goto exit;
}
- dev_set_name(e->dev, "%s/%s/%s", ns->devpath, bus->name, name);
+ dev_set_name(e->dev, "%s/%s/%s", domain->devpath, bus->name, name);
e->dev->bus = &kdbus_subsys;
e->dev->type = &kdbus_devtype_ep;
- e->dev->devt = MKDEV(ns->major, e->minor);
+ e->dev->devt = MKDEV(domain->major, e->minor);
dev_set_drvdata(e->dev, e);
ret = device_register(e->dev);
if (ret < 0) {
diff --git a/endpoint.h b/endpoint.h
index 65e79982ca3..975dd738d18 100644
--- a/endpoint.h
+++ b/endpoint.h
@@ -23,7 +23,7 @@
* @bus bus behind this endpoint
* @name name of the endpoint
* @id id of this endpoint on the bus
- * @minor minor of this endpoint in the namespace major
+ * @minor minor of this endpoint in the domain major
* @dev device node of this endpoint
* @mode file mode of this endpoint device node
* @uid uid owning this endpoint
@@ -56,9 +56,9 @@ struct kdbus_ep {
bool policy_open:1;
};
-struct kdbus_ns;
+struct kdbus_domain;
-int kdbus_ep_new(struct kdbus_bus *bus, struct kdbus_ns *ns, const char *name,
+int kdbus_ep_new(struct kdbus_bus *bus, struct kdbus_domain *domain, const char *name,
umode_t mode, kuid_t uid, kgid_t gid, bool policy);
struct kdbus_ep *kdbus_ep_ref(struct kdbus_ep *ep);
struct kdbus_ep *kdbus_ep_unref(struct kdbus_ep *ep);
diff --git a/handle.c b/handle.c
index e747a7ec5ec..5bc4ebe926a 100644
--- a/handle.c
+++ b/handle.c
@@ -33,7 +33,7 @@
#include "message.h"
#include "metadata.h"
#include "names.h"
-#include "namespace.h"
+#include "domain.h"
#include "notify.h"
#include "policy.h"
@@ -41,7 +41,7 @@
* enum kdbus_handle_type - type a handle can be of
* @_KDBUS_HANDLE_NULL: Uninitialized/invalid
* @KDBUS_HANDLE_CONTROL: New file descriptor of a control node
- * @KDBUS_HANDLE_CONTROL_NS_OWNER: File descriptor to hold a namespace
+ * @KDBUS_HANDLE_CONTROL_NS_OWNER: File descriptor to hold a domain
* @KDBUS_HANDLE_CONTROL_BUS_OWNER: File descriptor to hold a bus
* @KDBUS_HANDLE_EP: New file descriptor of a bus node
* @KDBUS_HANDLE_EP_CONNECTED: A bus connection after HELLO
@@ -62,11 +62,11 @@ enum kdbus_handle_type {
/**
* struct kdbus_handle - a handle to the kdbus system
* @type: Type of this handle (KDBUS_HANDLE_*)
- * @ns: Namespace for this handle
+ * @domain: Namespace for this handle
* @meta: Cached connection creator's metadata/credentials
* @ep: The endpoint this handle owns, in case @type
* is KDBUS_HANDLE_EP
- * @ns_owner: The namespace this handle owns, in case @type
+ * @domain_owner: The domain this handle owns, in case @type
* is KDBUS_HANDLE_CONTROL_NS_OWNER
* @bus_owner: The bus this handle owns, in case @type
* is KDBUS_HANDLE_CONTROL_BUS_OWNER
@@ -78,11 +78,11 @@ enum kdbus_handle_type {
*/
struct kdbus_handle {
enum kdbus_handle_type type;
- struct kdbus_ns *ns;
+ struct kdbus_domain *domain;
struct kdbus_meta *meta;
struct kdbus_ep *ep;
union {
- struct kdbus_ns *ns_owner;
+ struct kdbus_domain *domain_owner;
struct kdbus_bus *bus_owner;
struct kdbus_ep *ep_owner;
struct kdbus_conn *conn;
@@ -92,7 +92,7 @@ struct kdbus_handle {
static int kdbus_handle_open(struct inode *inode, struct file *file)
{
struct kdbus_handle *handle;
- struct kdbus_ns *ns;
+ struct kdbus_domain *domain;
struct kdbus_ep *ep;
int ret;
@@ -100,13 +100,13 @@ static int kdbus_handle_open(struct inode *inode, struct file *file)
if (!handle)
return -ENOMEM;
- /* find and reference namespace */
- ns = kdbus_ns_find_by_major(MAJOR(inode->i_rdev));
- if (!ns || ns->disconnected) {
+ /* find and reference domain */
+ domain = kdbus_domain_find_by_major(MAJOR(inode->i_rdev));
+ if (!domain || domain->disconnected) {
kfree(handle);
return -ESHUTDOWN;
}
- handle->ns = ns;
+ handle->domain = domain;
file->private_data = handle;
/* control device node */
@@ -116,8 +116,8 @@ static int kdbus_handle_open(struct inode *inode, struct file *file)
}
/* find endpoint for device node */
- mutex_lock(&handle->ns->lock);
- ep = idr_find(&handle->ns->idr, MINOR(inode->i_rdev));
+ mutex_lock(&handle->domain->lock);
+ ep = idr_find(&handle->domain->idr, MINOR(inode->i_rdev));
if (!ep || ep->disconnected) {
ret = -ESHUTDOWN;
goto exit_unlock;
@@ -144,12 +144,12 @@ static int kdbus_handle_open(struct inode *inode, struct file *file)
if (ret < 0)
goto exit_unlock;
- mutex_unlock(&handle->ns->lock);
+ mutex_unlock(&handle->domain->lock);
return 0;
exit_unlock:
- mutex_unlock(&handle->ns->lock);
- kdbus_ns_unref(handle->ns);
+ mutex_unlock(&handle->domain->lock);
+ kdbus_domain_unref(handle->domain);
kfree(handle);
return ret;
}
@@ -160,8 +160,8 @@ static int kdbus_handle_release(struct inode *inode, struct file *file)
switch (handle->type) {
case KDBUS_HANDLE_CONTROL_NS_OWNER:
- kdbus_ns_disconnect(handle->ns_owner);
- kdbus_ns_unref(handle->ns_owner);
+ kdbus_domain_disconnect(handle->domain_owner);
+ kdbus_domain_unref(handle->domain_owner);
break;
case KDBUS_HANDLE_CONTROL_BUS_OWNER:
@@ -188,7 +188,7 @@ static int kdbus_handle_release(struct inode *inode, struct file *file)
}
kdbus_meta_free(handle->meta);
- kdbus_ns_unref(handle->ns);
+ kdbus_domain_unref(handle->domain);
kfree(handle);
return 0;
@@ -316,7 +316,7 @@ static long kdbus_handle_ioctl_control(struct file *file, unsigned int cmd,
struct kdbus_handle *handle = file->private_data;
struct kdbus_bus *bus = NULL;
struct kdbus_cmd_make *make;
- struct kdbus_ns *ns = NULL;
+ struct kdbus_domain *domain = NULL;
umode_t mode = 0600;
void *p = NULL;
int ret;
@@ -350,7 +350,7 @@ static long kdbus_handle_ioctl_control(struct file *file, unsigned int cmd,
gid = current_fsgid();
}
- ret = kdbus_bus_new(handle->ns, make, name, &bloom,
+ ret = kdbus_bus_new(handle->domain, make, name, &bloom,
mode, current_fsuid(), gid, &bus);
if (ret < 0)
break;
@@ -376,7 +376,7 @@ static long kdbus_handle_ioctl_control(struct file *file, unsigned int cmd,
break;
make = p;
- ret = kdbus_ns_make_user(make, &name);
+ ret = kdbus_domain_make_user(make, &name);
if (ret < 0)
break;
@@ -388,13 +388,13 @@ static long kdbus_handle_ioctl_control(struct file *file, unsigned int cmd,
if (make->flags & KDBUS_MAKE_ACCESS_WORLD)
mode = 0666;
- ret = kdbus_ns_new(kdbus_ns_init, name, mode, &ns);
+ ret = kdbus_domain_new(kdbus_domain_init, name, mode, &domain);
if (ret < 0)
break;
- /* turn the control fd into a new ns owner device */
+ /* turn the control fd into a new domain owner device */
handle->type = KDBUS_HANDLE_CONTROL_NS_OWNER;
- handle->ns_owner = ns;
+ handle->domain_owner = domain;
break;
}
@@ -456,7 +456,7 @@ static long kdbus_handle_ioctl_ep(struct file *file, unsigned int cmd,
gid = current_fsgid();
}
- ret = kdbus_ep_new(handle->ep->bus, handle->ep->bus->ns,
+ ret = kdbus_ep_new(handle->ep->bus, handle->ep->bus->domain,
name, mode, current_fsuid(), gid,
make->flags & KDBUS_MAKE_POLICY_OPEN);
diff --git a/kdbus.h b/kdbus.h
index f632dcf7f15..d2d73588d68 100644
--- a/kdbus.h
+++ b/kdbus.h
@@ -105,7 +105,7 @@ struct kdbus_audit {
/**
* struct kdbus_timestamp
- * @seqnum: Global per-namespace message sequence number
+ * @seqnum: Global per-domain message sequence number
* @monotonic_ns: Monotonic timestamp, in nanoseconds
* @realtime_ns: Realtime timestamp, in nanoseconds
*
@@ -233,7 +233,7 @@ struct kdbus_policy {
* @KDBUS_ITEM_BLOOM_MASK: Bloom mask used to match against a message's
* bloom filter
* @KDBUS_ITEM_DST_NAME: Destination's well-known name
- * @KDBUS_ITEM_MAKE_NAME: Name of namespace, bus, endpoint
+ * @KDBUS_ITEM_MAKE_NAME: Name of domain, bus, endpoint
* @KDBUS_ITEM_MEMFD_NAME: The human readable name of a memfd (debugging)
* @KDBUS_ITEM_ATTACH_FLAGS: Attach-flags, used for updating which metadata
* a connection subscribes to
@@ -592,9 +592,9 @@ enum kdbus_make_flags {
};
/**
- * struct kdbus_cmd_make - struct to make a bus, an endpoint or a namespace
+ * struct kdbus_cmd_make - struct to make a bus, an endpoint or a domain
* @size: The total size of the struct
- * @flags: Properties for the bus/ep/ns to create
+ * @flags: Properties for the bus/ep/domain to create
* @items: Items describing details
*
* This structure is used with the KDBUS_CMD_BUS_MAKE, KDBUS_CMD_EP_MAKE and
@@ -782,7 +782,7 @@ struct kdbus_cmd_memfd_make {
* cleaned up when the opened "control" device node
* is closed.
* @KDBUS_CMD_NS_MAKE: Similar to KDBUS_CMD_BUS_MAKE, but it creates a
- * new kdbus namespace.
+ * new kdbus domain.
* @KDBUS_CMD_EP_MAKE: Creates a new named special endpoint to talk to
* the bus. Such endpoints usually carry a more
* restrictive policy and grant restricted access
@@ -905,7 +905,7 @@ enum kdbus_ioctl_type {
* @EDESTADDRREQ: The well-known bus name is required but missing.
* @EDOM: The size of data does not match the expectations. Used
* for bloom bit field sizes.
- * @EEXIST: A requested namespace, bus or endpoint with the same
+ * @EEXIST: A requested domain, bus or endpoint with the same
* name already exists. A specific data type, which is
* only expected once, is provided multiple times.
* @EFAULT: The supplied memory could not be accessed, or the data
@@ -947,7 +947,7 @@ enum kdbus_ioctl_type {
* @EPIPE: When sending a message, a synchronous reply from the
* receiving connection was expected but the connection
* died before answering.
- * @ESHUTDOWN: A namespace or endpoint is currently shutting down;
+ * @ESHUTDOWN: A domain or endpoint is currently shutting down;
* no further operations will be possible.
* @ESRCH: A requested well-known bus name is not found.
* @ETIMEDOUT: A synchronous wait for a message reply did not arrive
diff --git a/main.c b/main.c
index b865d1593cb..a49169edc7c 100644
--- a/main.c
+++ b/main.c
@@ -20,7 +20,7 @@
#include "defaults.h"
#include "util.h"
-#include "namespace.h"
+#include "domain.h"
static int __init kdbus_init(void)
{
@@ -31,10 +31,10 @@ static int __init kdbus_init(void)
return ret;
/*
- * Create the initial namespace; it is world-accessible and
+ * Create the initial domain; it is world-accessible and
* provides the /dev/kdbus/control device node.
*/
- ret = kdbus_ns_new(NULL, NULL, 0666, &kdbus_ns_init);
+ ret = kdbus_domain_new(NULL, NULL, 0666, &kdbus_domain_init);
if (ret < 0) {
bus_unregister(&kdbus_subsys);
pr_err("failed to initialize, error=%i\n", ret);
@@ -47,8 +47,8 @@ static int __init kdbus_init(void)
static void __exit kdbus_exit(void)
{
- kdbus_ns_disconnect(kdbus_ns_init);
- kdbus_ns_unref(kdbus_ns_init);
+ kdbus_domain_disconnect(kdbus_domain_init);
+ kdbus_domain_unref(kdbus_domain_init);
bus_unregister(&kdbus_subsys);
}
diff --git a/message.c b/message.c
index b2dec05341f..bda93ec19ce 100644
--- a/message.c
+++ b/message.c
@@ -29,7 +29,7 @@
#include "match.h"
#include "message.h"
#include "names.h"
-#include "namespace.h"
+#include "domain.h"
#include "policy.h"
#define KDBUS_KMSG_HEADER_SIZE offsetof(struct kdbus_kmsg, msg)
diff --git a/metadata.c b/metadata.c
index a4889ccc845..51c99293f85 100644
--- a/metadata.c
+++ b/metadata.c
@@ -46,11 +46,11 @@ int kdbus_meta_new(struct kdbus_meta **meta)
return -ENOMEM;
/*
- * Remember the PID namespace our credentials belong to; we
+ * Remember the PID domain our credentials belong to; we
* need to prevent leaking authorization and security-relevant
* data across different namespaces.
*/
- m->ns = task_active_pid_ns(current);
+ m->domain = task_active_pid_ns(current);
*meta = m;
return 0;
diff --git a/metadata.h b/metadata.h
index d72b01f1084..ee3fd937fcc 100644
--- a/metadata.h
+++ b/metadata.h
@@ -16,7 +16,7 @@
/**
* struct kdbus_meta - metadata buffer
* @attached: Flags for already attached data
- * @ns: Namespace the metadata belongs to
+ * @domain: Namespace the metadata belongs to
* @data: Allocated buffer
* @size: Number of bytes used
* @allocated_size: Size of buffer
@@ -26,7 +26,7 @@
*/
struct kdbus_meta {
u64 attached;
- const struct pid_namespace *ns;
+ const struct pid_namespace *domain;
struct kdbus_item *data;
size_t size;
size_t allocated_size;
diff --git a/test/test-kdbus.c b/test/test-kdbus.c
index 7e5472c07ac..73816c9dcb9 100644
--- a/test/test-kdbus.c
+++ b/test/test-kdbus.c
@@ -279,7 +279,7 @@ static int check_nsmake(struct kdbus_check_env *env)
ns_make.n_type = KDBUS_ITEM_MAKE_NAME;
- /* create a new namespace */
+ /* create a new domain */
snprintf(ns_make.name, sizeof(ns_make.name), "blah");
ns_make.n_size = KDBUS_ITEM_HEADER_SIZE + strlen(ns_make.name) + 1;
ns_make.head.size = sizeof(struct kdbus_cmd_make) + ns_make.n_size;
@@ -288,9 +288,9 @@ static int check_nsmake(struct kdbus_check_env *env)
return CHECK_SKIP;
ASSERT_RETURN(ret == 0);
- ASSERT_RETURN(access("/dev/" KBUILD_MODNAME "/ns/blah/control", F_OK) == 0);
+ ASSERT_RETURN(access("/dev/" KBUILD_MODNAME "/domain/blah/control", F_OK) == 0);
- /* can't use the same fd for ns make twice */
+ /* can't use the same fd for domain make twice */
ret = ioctl(fd, KDBUS_CMD_NS_MAKE, &ns_make);
ASSERT_RETURN(ret == -1 && errno == EBADFD);
@@ -301,7 +301,7 @@ static int check_nsmake(struct kdbus_check_env *env)
close(fd2);
close(fd);
- ASSERT_RETURN(access("/dev/" KBUILD_MODNAME "/ns/blah/control", F_OK) < 0);
+ ASSERT_RETURN(access("/dev/" KBUILD_MODNAME "/domain/blah/control", F_OK) < 0);
return CHECK_OK;
}
@@ -1144,7 +1144,7 @@ static const struct kdbus_check checks[] = {
{ "match name add", check_match_name_add, CHECK_CREATE_BUS | CHECK_CREATE_CONN },
{ "match name remove", check_match_name_remove, CHECK_CREATE_BUS | CHECK_CREATE_CONN },
{ "match name change", check_match_name_change, CHECK_CREATE_BUS | CHECK_CREATE_CONN },
- { "ns make", check_nsmake, 0 },
+ { "domain make", check_nsmake, 0 },
{ NULL, NULL, 0 }
};
diff --git a/util.c b/util.c
index 4f767057733..03a1d151adc 100644
--- a/util.c
+++ b/util.c
@@ -19,7 +19,7 @@
/**
* kdbus_sysname_valid() - validate names showing up in /proc, /sys and /dev
- * @name: Name of namespace, bus, endpoint
+ * @name: Name of domain, bus, endpoint
*
* Return: 0 if the given name is valid, otherwise negative errno
*/