Changeset 162ad53 in mainline for kernel/generic/include


Ignore:
Timestamp:
2025-06-27T16:18:16Z (4 weeks ago)
Author:
GitHub <noreply@…>
Parents:
5caad1d (diff), 455241b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2025-06-27 16:18:16)
git-committer:
GitHub <noreply@…> (2025-06-27 16:18:16)
Message:

Merge 455241b37bedd3719ed3b5b025fdf26f44fd565b into 5caad1d4a9774280b120ed9f9da51f4bb6f1f4bf

Location:
kernel/generic/include
Files:
5 edited

Legend:

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

    r5caad1d r162ad53  
    3737
    3838#include <abi/cap.h>
     39#include <adt/hash_table.h>
     40#include <adt/hash.h>
     41#include <adt/list.h>
     42#include <atomic.h>
     43#include <lib/ra.h>
     44#include <lib/refcount.h>
     45#include <synch/mutex.h>
    3946#include <typedefs.h>
    40 #include <adt/list.h>
    41 #include <adt/hash.h>
    42 #include <adt/hash_table.h>
    43 #include <lib/ra.h>
    44 #include <synch/mutex.h>
    45 #include <atomic.h>
    4647
    4748typedef enum {
     
    5960} kobject_type_t;
    6061
    61 struct task;
    62 
    63 struct call;
    64 struct irq;
    65 struct phone;
    66 struct waitq;
     62struct kobject;
    6763
    6864typedef struct kobject_ops {
    69         void (*destroy)(void *);
     65        void (*destroy)(struct kobject *);
    7066} kobject_ops_t;
    7167
     
    7672/*
    7773 * Everything in kobject_t except for the atomic reference count, the capability
    78  * list and its lock is imutable.
     74 * list and its lock is immutable.
    7975 */
    8076typedef struct kobject {
    8177        kobject_type_t type;
    82         atomic_size_t refcnt;
     78        atomic_refcount_t refcnt;
    8379
    8480        /** Mutex protecting caps_list */
     
    8682        /** List of published capabilities associated with the kobject */
    8783        list_t caps_list;
    88 
    89         union {
    90                 void *raw;
    91                 struct call *call;
    92                 struct irq *irq;
    93                 struct phone *phone;
    94                 struct waitq *waitq;
    95         };
    9684} kobject_t;
    9785
     
    129117extern errno_t caps_task_alloc(struct task *);
    130118extern void caps_task_free(struct task *);
    131 extern void caps_task_init(struct task *);
     119extern void caps_task_clear(struct task *task);
     120extern errno_t caps_task_init(struct task *);
    132121extern bool caps_apply_to_kobject_type(struct task *, kobject_type_t,
    133122    bool (*)(cap_t *, void *), void *);
     
    139128extern void cap_free(struct task *, cap_handle_t);
    140129
    141 extern kobject_t *kobject_alloc(unsigned int);
    142 extern void kobject_free(kobject_t *);
    143 extern void kobject_initialize(kobject_t *, kobject_type_t, void *);
     130extern void kobject_initialize(kobject_t *, kobject_type_t);
    144131extern kobject_t *kobject_get(struct task *, cap_handle_t, kobject_type_t);
    145132extern void kobject_add_ref(kobject_t *);
  • kernel/generic/include/ddi/irq.h

    r5caad1d r162ad53  
    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

    r5caad1d r162ad53  
    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

    r5caad1d r162ad53  
    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 *);
  • kernel/generic/include/synch/syswaitq.h

    r5caad1d r162ad53  
    4444extern void sys_waitq_init(void);
    4545
    46 extern void sys_waitq_task_cleanup(void);
    47 
    4846extern sys_errno_t sys_waitq_create(uspace_ptr_cap_waitq_handle_t);
    4947extern sys_errno_t sys_waitq_sleep(cap_waitq_handle_t, uint32_t, unsigned int);
Note: See TracChangeset for help on using the changeset viewer.