kernel: don't use typedef for enums or non-opaque structs
This commit is contained in:
@@ -16,11 +16,11 @@ extern "C" {
|
||||
struct object;
|
||||
struct object_attrib;
|
||||
|
||||
typedef enum object_type_flags {
|
||||
enum object_type_flags {
|
||||
OBJTYPE_INIT = 0x01u,
|
||||
} object_type_flags_t;
|
||||
};
|
||||
|
||||
typedef struct object_ops {
|
||||
struct object_ops {
|
||||
kern_status_t(*open)(struct object *obj);
|
||||
kern_status_t(*close)(struct object *obj);
|
||||
kern_status_t(*destroy)(struct object *obj);
|
||||
@@ -30,64 +30,62 @@ typedef struct object_ops {
|
||||
kern_status_t(*get_at)(struct object *obj, size_t at, struct object **out);
|
||||
kern_status_t(*read_attrib)(struct object *obj, struct object_attrib *attrib, char *out, size_t max, size_t *r);
|
||||
kern_status_t(*write_attrib)(struct object *obj, struct object_attrib *attrib, const char *s, size_t len, size_t *r);
|
||||
} object_ops_t;
|
||||
};
|
||||
|
||||
typedef struct object_attrib {
|
||||
struct object_attrib {
|
||||
char *a_name;
|
||||
queue_entry_t a_list;
|
||||
} object_attrib_t;
|
||||
struct queue_entry a_list;
|
||||
};
|
||||
|
||||
typedef struct object_type {
|
||||
object_type_flags_t ob_flags;
|
||||
struct object_type {
|
||||
enum object_type_flags ob_flags;
|
||||
char ob_name[32];
|
||||
unsigned int ob_size;
|
||||
vm_cache_t ob_cache;
|
||||
queue_entry_t ob_list;
|
||||
queue_t ob_attrib;
|
||||
object_ops_t ob_ops;
|
||||
} object_type_t;
|
||||
struct vm_cache ob_cache;
|
||||
struct queue_entry ob_list;
|
||||
struct queue ob_attrib;
|
||||
struct object_ops ob_ops;
|
||||
};
|
||||
|
||||
typedef struct object {
|
||||
struct object {
|
||||
uint32_t ob_magic;
|
||||
object_type_t *ob_type;
|
||||
struct object_type *ob_type;
|
||||
spin_lock_t ob_lock;
|
||||
unsigned int ob_refcount;
|
||||
unsigned int ob_handles;
|
||||
queue_t ob_attrib;
|
||||
queue_entry_t ob_list;
|
||||
} __aligned(sizeof(long)) object_t;
|
||||
|
||||
typedef struct object_namespace object_namespace_t;
|
||||
struct queue ob_attrib;
|
||||
struct queue_entry ob_list;
|
||||
} __aligned(sizeof(long));
|
||||
|
||||
extern kern_status_t object_bootstrap(void);
|
||||
extern kern_status_t object_type_register(object_type_t *p);
|
||||
extern kern_status_t object_type_unregister(object_type_t *p);
|
||||
extern kern_status_t object_type_register(struct object_type *p);
|
||||
extern kern_status_t object_type_unregister(struct object_type *p);
|
||||
|
||||
extern object_namespace_t *global_namespace(void);
|
||||
extern object_namespace_t *object_namespace_create(void);
|
||||
extern kern_status_t object_namespace_get_object(object_namespace_t *ns, const char *path, object_t **out);
|
||||
extern kern_status_t object_publish(object_namespace_t *ns, const char *path, object_t *obj);
|
||||
extern kern_status_t object_unpublish(object_namespace_t *ns, object_t *obj);
|
||||
extern struct object_namespace *global_namespace(void);
|
||||
extern struct object_namespace *object_namespace_create(void);
|
||||
extern kern_status_t object_namespace_get_object(struct object_namespace *ns, const char *path, struct object **out);
|
||||
extern kern_status_t object_publish(struct object_namespace *ns, const char *path, struct object *obj);
|
||||
extern kern_status_t object_unpublish(struct object_namespace *ns, struct object *obj);
|
||||
|
||||
extern object_t *object_create(object_type_t *type);
|
||||
extern object_t *object_ref(object_t *obj);
|
||||
extern void object_deref(object_t *obj);
|
||||
extern void object_lock(object_t *obj, unsigned long *flags);
|
||||
extern void object_unlock(object_t *obj, unsigned long flags);
|
||||
extern void *object_data(object_t *obj);
|
||||
extern object_t *object_header(void *p);
|
||||
static inline kern_status_t object_get(const char *path, object_t **out)
|
||||
extern struct object *object_create(struct object_type *type);
|
||||
extern struct object *object_ref(struct object *obj);
|
||||
extern void object_deref(struct object *obj);
|
||||
extern void object_lock(struct object *obj, unsigned long *flags);
|
||||
extern void object_unlock(struct object *obj, unsigned long flags);
|
||||
extern void *object_data(struct object *obj);
|
||||
extern struct object *object_header(void *p);
|
||||
static inline kern_status_t object_get(const char *path, struct object **out)
|
||||
{
|
||||
return object_namespace_get_object(global_namespace(), path, out);
|
||||
}
|
||||
extern kern_status_t object_get_child_named(object_t *obj, const char *name, object_t **out);
|
||||
extern kern_status_t object_get_child_at(object_t *obj, size_t at, object_t **out);
|
||||
extern kern_status_t object_query_name(object_t *obj, char name[OBJECT_NAME_MAX]);
|
||||
extern kern_status_t object_get_child_named(struct object *obj, const char *name, struct object **out);
|
||||
extern kern_status_t object_get_child_at(struct object *obj, size_t at, struct object **out);
|
||||
extern kern_status_t object_query_name(struct object *obj, char name[OBJECT_NAME_MAX]);
|
||||
|
||||
extern object_t *set_create(const char *name);
|
||||
extern kern_status_t set_add_object(object_t *set, object_t *obj);
|
||||
extern kern_status_t set_remove_object(object_t *set, object_t *obj);
|
||||
extern bool object_is_set(object_t *obj);
|
||||
extern struct object *set_create(const char *name);
|
||||
extern kern_status_t set_add_object(struct object *set, struct object *obj);
|
||||
extern kern_status_t set_remove_object(struct object *set, struct object *obj);
|
||||
extern bool object_is_set(struct object *obj);
|
||||
|
||||
extern void init_set_objects(void);
|
||||
extern void init_global_namespace(void);
|
||||
|
||||
Reference in New Issue
Block a user