Changeset 455241b in mainline for kernel/generic/src/cap/cap.c


Ignore:
Timestamp:
2025-01-16T19:29:20Z (27 hours ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Children:
6caf5fb
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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/cap/cap.c

    rdf721df r455241b  
    9797
    9898static slab_cache_t *cap_cache;
    99 static slab_cache_t *kobject_cache;
    10099
    101100kobject_ops_t *kobject_ops[KOBJECT_TYPE_MAX] = {
     
    156155        cap_cache = slab_cache_create("cap_t", sizeof(cap_t), 0, NULL,
    157156            NULL, 0);
    158         kobject_cache = slab_cache_create("kobject_t", sizeof(kobject_t), 0,
    159             NULL, NULL, 0);
    160157}
    161158
     
    463460}
    464461
    465 kobject_t *kobject_alloc(unsigned int flags)
    466 {
    467         return slab_alloc(kobject_cache, flags);
    468 }
    469 
    470 void kobject_free(kobject_t *kobj)
    471 {
    472         slab_free(kobject_cache, kobj);
    473 }
    474 
    475462/** Initialize kernel object
    476463 *
    477464 * @param kobj  Kernel object to initialize.
    478465 * @param type  Type of the kernel object.
    479  * @param raw   Raw pointer to the encapsulated object.
    480  */
    481 void kobject_initialize(kobject_t *kobj, kobject_type_t type, void *raw)
     466 */
     467void kobject_initialize(kobject_t *kobj, kobject_type_t type)
    482468{
    483469        refcount_init(&kobj->refcnt);
     
    487473
    488474        kobj->type = type;
    489         kobj->raw = raw;
    490475}
    491476
     
    537522{
    538523        if (refcount_down(&kobj->refcnt)) {
    539                 KOBJECT_OP(kobj)->destroy(kobj->raw);
    540                 kobject_free(kobj);
     524                KOBJECT_OP(kobj)->destroy(kobj);
    541525        }
    542526}
Note: See TracChangeset for help on using the changeset viewer.