Changeset 96368f56 in mainline
- Timestamp:
- 2025-01-16T13:33:58Z (32 hours ago)
- Children:
- fa3ed5b
- Parents:
- e0e2264
- Location:
- kernel/generic
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/cap/cap.h
re0e2264 r96368f56 37 37 38 38 #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> 39 46 #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>46 47 47 48 typedef enum { … … 80 81 typedef struct kobject { 81 82 kobject_type_t type; 82 atomic_ size_t refcnt;83 atomic_refcount_t refcnt; 83 84 84 85 /** Mutex protecting caps_list */ -
kernel/generic/src/cap/cap.c
re0e2264 r96368f56 426 426 void kobject_initialize(kobject_t *kobj, kobject_type_t type, void *raw) 427 427 { 428 atomic_store(&kobj->refcnt, 1);428 refcount_init(&kobj->refcnt); 429 429 430 430 mutex_initialize(&kobj->caps_list_lock, MUTEX_PASSIVE); … … 455 455 if (cap->kobject->type == type) { 456 456 kobj = cap->kobject; 457 atomic_inc(&kobj->refcnt);457 refcount_up(&kobj->refcnt); 458 458 } 459 459 } … … 469 469 void kobject_add_ref(kobject_t *kobj) 470 470 { 471 atomic_inc(&kobj->refcnt);471 refcount_up(&kobj->refcnt); 472 472 } 473 473 … … 481 481 void kobject_put(kobject_t *kobj) 482 482 { 483 if ( atomic_postdec(&kobj->refcnt) == 1) {483 if (refcount_down(&kobj->refcnt)) { 484 484 KOBJECT_OP(kobj)->destroy(kobj->raw); 485 485 kobject_free(kobj);
Note:
See TracChangeset
for help on using the changeset viewer.