kernel: don't use typedef for enums or non-opaque structs
This commit is contained in:
34
obj/object.c
34
obj/object.c
@@ -4,7 +4,7 @@
|
||||
|
||||
#define HAS_OP(obj, opname) ((obj)->ob_type->ob_ops.opname)
|
||||
|
||||
static queue_t object_types;
|
||||
static struct queue object_types;
|
||||
static spin_lock_t object_types_lock = SPIN_LOCK_INIT;
|
||||
|
||||
kern_status_t object_bootstrap(void)
|
||||
@@ -14,7 +14,7 @@ kern_status_t object_bootstrap(void)
|
||||
return KERN_OK;
|
||||
}
|
||||
|
||||
kern_status_t object_type_register(object_type_t *p)
|
||||
kern_status_t object_type_register(struct object_type *p)
|
||||
{
|
||||
unsigned long flags;
|
||||
spin_lock_irqsave(&object_types_lock, &flags);
|
||||
@@ -22,7 +22,7 @@ kern_status_t object_type_register(object_type_t *p)
|
||||
spin_unlock_irqrestore(&object_types_lock, flags);
|
||||
|
||||
p->ob_cache.c_name = p->ob_name;
|
||||
p->ob_cache.c_obj_size = sizeof(object_t) + p->ob_size;
|
||||
p->ob_cache.c_obj_size = sizeof(struct object) + p->ob_size;
|
||||
p->ob_cache.c_page_order = VM_PAGE_16K;
|
||||
|
||||
vm_cache_init(&p->ob_cache);
|
||||
@@ -31,7 +31,7 @@ kern_status_t object_type_register(object_type_t *p)
|
||||
return KERN_OK;
|
||||
}
|
||||
|
||||
kern_status_t object_type_unregister(object_type_t *p)
|
||||
kern_status_t object_type_unregister(struct object_type *p)
|
||||
{
|
||||
unsigned long flags;
|
||||
spin_lock_irqsave(&object_types_lock, &flags);
|
||||
@@ -41,14 +41,14 @@ kern_status_t object_type_unregister(object_type_t *p)
|
||||
return KERN_OK;
|
||||
}
|
||||
|
||||
object_t *object_create(object_type_t *type)
|
||||
struct object *object_create(struct object_type *type)
|
||||
{
|
||||
if (!(type->ob_flags & OBJTYPE_INIT)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
vm_cache_t *cache = &type->ob_cache;
|
||||
object_t *obj = vm_cache_alloc(cache, 0);
|
||||
struct vm_cache *cache = &type->ob_cache;
|
||||
struct object *obj = vm_cache_alloc(cache, 0);
|
||||
if (!obj) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -62,13 +62,13 @@ object_t *object_create(object_type_t *type)
|
||||
return obj;
|
||||
}
|
||||
|
||||
object_t *object_ref(object_t *obj)
|
||||
struct object *object_ref(struct object *obj)
|
||||
{
|
||||
obj->ob_refcount++;
|
||||
return obj;
|
||||
}
|
||||
|
||||
void object_deref(object_t *obj)
|
||||
void object_deref(struct object *obj)
|
||||
{
|
||||
unsigned long flags;
|
||||
spin_lock_irqsave(&obj->ob_lock, &flags);
|
||||
@@ -92,24 +92,24 @@ void object_deref(object_t *obj)
|
||||
vm_cache_free(&obj->ob_type->ob_cache, obj);
|
||||
}
|
||||
|
||||
void object_lock(object_t *obj, unsigned long *flags)
|
||||
void object_lock(struct object *obj, unsigned long *flags)
|
||||
{
|
||||
spin_lock_irqsave(&obj->ob_lock, flags);
|
||||
}
|
||||
|
||||
void object_unlock(object_t *obj, unsigned long flags)
|
||||
void object_unlock(struct object *obj, unsigned long flags)
|
||||
{
|
||||
spin_unlock_irqrestore(&obj->ob_lock, flags);
|
||||
}
|
||||
|
||||
void *object_data(object_t *obj)
|
||||
void *object_data(struct object *obj)
|
||||
{
|
||||
return (char *)obj + sizeof *obj;
|
||||
}
|
||||
|
||||
object_t *object_header(void *p)
|
||||
struct object *object_header(void *p)
|
||||
{
|
||||
object_t *obj = (object_t *)((char *)p - sizeof *obj);
|
||||
struct object *obj = (struct object *)((char *)p - sizeof *obj);
|
||||
if (obj->ob_magic != OBJECT_MAGIC) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -117,7 +117,7 @@ object_t *object_header(void *p)
|
||||
return obj;
|
||||
}
|
||||
|
||||
kern_status_t object_get_child_named(object_t *obj, const char *name, object_t **out)
|
||||
kern_status_t object_get_child_named(struct object *obj, const char *name, struct object **out)
|
||||
{
|
||||
kern_status_t status = KERN_UNSUPPORTED;
|
||||
|
||||
@@ -128,7 +128,7 @@ kern_status_t object_get_child_named(object_t *obj, const char *name, object_t *
|
||||
return status;
|
||||
}
|
||||
|
||||
kern_status_t object_get_child_at(object_t *obj, size_t at, object_t **out)
|
||||
kern_status_t object_get_child_at(struct object *obj, size_t at, struct object **out)
|
||||
{
|
||||
kern_status_t status = KERN_UNSUPPORTED;
|
||||
|
||||
@@ -139,7 +139,7 @@ kern_status_t object_get_child_at(object_t *obj, size_t at, object_t **out)
|
||||
return status;
|
||||
}
|
||||
|
||||
kern_status_t object_query_name(object_t *obj, char name[OBJECT_NAME_MAX])
|
||||
kern_status_t object_query_name(struct object *obj, char name[OBJECT_NAME_MAX])
|
||||
{
|
||||
if (HAS_OP(obj, query_name)) {
|
||||
return obj->ob_type->ob_ops.query_name(obj, name);
|
||||
|
||||
Reference in New Issue
Block a user