Changeset 455241b in mainline for kernel/generic/include


Ignore:
Timestamp:
2025-01-16T19:29:20Z (6 months ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Children:
162ad53
Parents:
df721df
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2025-01-16 19:23:14)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2025-01-16 19:29:20)
Message:

Integrate kobject_t into target structures

This just means fewer allocations and indirections.

Location:
kernel/generic/include
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/cap/cap.h

    rdf721df r455241b  
    6060} kobject_type_t;
    6161
    62 struct task;
    63 
    64 struct call;
    65 struct irq;
    66 struct phone;
    67 struct waitq;
     62struct kobject;
    6863
    6964typedef struct kobject_ops {
    70         void (*destroy)(void *);
     65        void (*destroy)(struct kobject *);
    7166} kobject_ops_t;
    7267
     
    7772/*
    7873 * Everything in kobject_t except for the atomic reference count, the capability
    79  * list and its lock is imutable.
     74 * list and its lock is immutable.
    8075 */
    8176typedef struct kobject {
     
    8782        /** List of published capabilities associated with the kobject */
    8883        list_t caps_list;
    89 
    90         union {
    91                 void *raw;
    92                 struct call *call;
    93                 struct irq *irq;
    94                 struct phone *phone;
    95                 struct waitq *waitq;
    96         };
    9784} kobject_t;
    9885
     
    141128extern void cap_free(struct task *, cap_handle_t);
    142129
    143 extern kobject_t *kobject_alloc(unsigned int);
    144 extern void kobject_free(kobject_t *);
    145 extern void kobject_initialize(kobject_t *, kobject_type_t, void *);
     130extern void kobject_initialize(kobject_t *, kobject_type_t);
    146131extern kobject_t *kobject_get(struct task *, cap_handle_t, kobject_type_t);
    147132extern void kobject_add_ref(kobject_t *);
  • kernel/generic/include/ddi/irq.h

    rdf721df r455241b  
    132132extern hash_table_t irq_uspace_hash_table;
    133133
    134 extern slab_cache_t *irq_cache;
    135 
    136134extern inr_t last_inr;
    137135
  • kernel/generic/include/ipc/ipc.h

    rdf721df r455241b  
    7474        /** User-defined label */
    7575        sysarg_t label;
    76         kobject_t *kobject;
     76        kobject_t kobject;
    7777} phone_t;
    7878
     
    108108
    109109typedef struct call {
    110         kobject_t *kobject;
     110        kobject_t kobject;
    111111
    112112        /**
     
    169169
    170170extern slab_cache_t *phone_cache;
     171extern slab_cache_t *irq_cache;
    171172
    172173extern answerbox_t *ipc_box_0;
    173174
    174175extern kobject_ops_t call_kobject_ops;
     176
     177static inline phone_t *phone_from_kobject(kobject_t *kobject)
     178{
     179        if (kobject)
     180                return ((void *) kobject) - offsetof(phone_t, kobject);
     181        else
     182                return NULL;
     183}
     184
     185static inline call_t *call_from_kobject(kobject_t *kobject)
     186{
     187        if (kobject)
     188                return ((void *) kobject) - offsetof(call_t, kobject);
     189        else
     190                return NULL;
     191}
    175192
    176193extern void ipc_init(void);
  • kernel/generic/include/ipc/irq.h

    rdf721df r455241b  
    5050extern kobject_ops_t irq_kobject_ops;
    5151
     52typedef struct {
     53        kobject_t kobject;
     54        irq_t irq;
     55} irq_kobject_t;
     56
     57static inline irq_t *irq_from_kobject(kobject_t *kobject)
     58{
     59        if (kobject) {
     60                return &((irq_kobject_t *) kobject)->irq;
     61        } else {
     62                return NULL;
     63        }
     64}
     65
    5266extern irq_ownership_t ipc_irq_top_half_claim(irq_t *);
    5367extern void ipc_irq_top_half_handler(irq_t *);
Note: See TracChangeset for help on using the changeset viewer.