kernel: don't use typedef for enums or non-opaque structs
This commit is contained in:
@@ -1,34 +1,34 @@
|
||||
#include <socks/object.h>
|
||||
|
||||
static object_namespace_t *global_ns;
|
||||
static struct object_namespace *global_ns;
|
||||
|
||||
struct object_namespace {
|
||||
/* root directory set object */
|
||||
object_t *ns_root;
|
||||
struct object *ns_root;
|
||||
};
|
||||
|
||||
static kern_status_t ns_query_name(object_t *obj, char out[OBJECT_NAME_MAX])
|
||||
static kern_status_t ns_query_name(struct object *obj, char out[OBJECT_NAME_MAX])
|
||||
{
|
||||
out[0] = '/';
|
||||
out[1] = 0;
|
||||
return KERN_OK;
|
||||
}
|
||||
|
||||
static kern_status_t ns_get_child_at(object_t *obj, size_t at, object_t **out)
|
||||
static kern_status_t ns_get_child_at(struct object *obj, size_t at, struct object **out)
|
||||
{
|
||||
object_namespace_t *ns = object_data(obj);
|
||||
struct object_namespace *ns = object_data(obj);
|
||||
return object_get_child_at(ns->ns_root, at, out);
|
||||
}
|
||||
|
||||
static kern_status_t ns_get_child_named(object_t *obj, const char *name, object_t **out)
|
||||
static kern_status_t ns_get_child_named(struct object *obj, const char *name, struct object **out)
|
||||
{
|
||||
object_namespace_t *ns = object_data(obj);
|
||||
struct object_namespace *ns = object_data(obj);
|
||||
return object_get_child_named(ns->ns_root, name, out);
|
||||
}
|
||||
|
||||
static object_type_t ns_type = {
|
||||
static struct object_type ns_type = {
|
||||
.ob_name = "namespace",
|
||||
.ob_size = sizeof(object_namespace_t),
|
||||
.ob_size = sizeof(struct object_namespace),
|
||||
.ob_ops = {
|
||||
.query_name = ns_query_name,
|
||||
.get_named = ns_get_child_named,
|
||||
@@ -43,20 +43,20 @@ void init_global_namespace(void)
|
||||
global_ns = object_namespace_create();
|
||||
}
|
||||
|
||||
object_namespace_t *global_namespace(void)
|
||||
struct object_namespace *global_namespace(void)
|
||||
{
|
||||
return global_ns;
|
||||
}
|
||||
|
||||
object_namespace_t *object_namespace_create(void)
|
||||
struct object_namespace *object_namespace_create(void)
|
||||
{
|
||||
object_t *ns_object = object_create(&ns_type);
|
||||
object_namespace_t *ns = object_data(ns_object);
|
||||
struct object *ns_object = object_create(&ns_type);
|
||||
struct object_namespace *ns = object_data(ns_object);
|
||||
ns->ns_root = set_create("/");
|
||||
return ns;
|
||||
}
|
||||
|
||||
kern_status_t object_namespace_get_object(object_namespace_t *ns, const char *path, object_t **out)
|
||||
kern_status_t object_namespace_get_object(struct object_namespace *ns, const char *path, struct object **out)
|
||||
{
|
||||
return KERN_OK;
|
||||
}
|
||||
@@ -93,7 +93,7 @@ static void cleanup_object_path(char *path, size_t len, size_t *parts)
|
||||
path[final_len] = 0;
|
||||
}
|
||||
|
||||
kern_status_t object_publish(object_namespace_t *ns, const char *path, object_t *obj)
|
||||
kern_status_t object_publish(struct object_namespace *ns, const char *path, struct object *obj)
|
||||
{
|
||||
if (*path != '/') {
|
||||
return KERN_INVALID_ARGUMENT;
|
||||
@@ -119,13 +119,13 @@ kern_status_t object_publish(object_namespace_t *ns, const char *path, object_t
|
||||
|
||||
char *sp;
|
||||
char *tok = strtok_r(rpath, "/", &sp);
|
||||
object_t *cur = ns->ns_root;
|
||||
struct object *cur = ns->ns_root;
|
||||
|
||||
unsigned long flags;
|
||||
while (tok) {
|
||||
object_lock(cur, &flags);
|
||||
|
||||
object_t *next;
|
||||
struct object *next;
|
||||
kern_status_t status = object_get_child_named(cur, tok, &next);
|
||||
if (status == KERN_NO_ENTRY) {
|
||||
next = set_create(tok);
|
||||
@@ -154,7 +154,7 @@ kern_status_t object_publish(object_namespace_t *ns, const char *path, object_t
|
||||
return set_add_object(cur, obj);
|
||||
}
|
||||
|
||||
kern_status_t object_unpublish(object_namespace_t *ns, object_t *obj)
|
||||
kern_status_t object_unpublish(struct object_namespace *ns, struct object *obj)
|
||||
{
|
||||
return KERN_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user