Changeset 3f74275 in mainline for kernel/generic/include/cap/cap.h


Ignore:
Timestamp:
2017-08-20T16:45:01Z (8 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e68765e
Parents:
e7ac23d0
Message:

Fix terminology around capabilities, capability handles and kernel objects

File:
1 moved

Legend:

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

    re7ac23d0 r3f74275  
    3333 */
    3434
    35 #ifndef KERN_KOBJECT_H_
    36 #define KERN_KOBJECT_H_
     35#ifndef KERN_CAP_H_
     36#define KERN_CAP_H_
    3737
    3838#include <typedefs.h>
     
    4040#include <ddi/irq.h>
    4141
    42 #define MAX_KERNEL_OBJECTS  64
     42#define MAX_CAPS  64
    4343
    44 #define for_each_kobject(task, ko, type) \
    45         for (int i = 0, l = 1; i < MAX_KERNEL_OBJECTS && l; i++) \
    46                 for (kobject_t *(ko) = kobject_get((task), i, (type)); \
    47                     (ko) && !(l = 0); (ko) = NULL, l = 1)
     44#define for_each_cap(task, cap, type) \
     45        for (int i = 0, l = 1; i < MAX_CAPS && l; i++) \
     46                for (cap_t *(cap) = cap_get((task), i, (type)); \
     47                    (cap) && !(l = 0); (cap) = NULL, l = 1)
    4848
    49 #define for_each_kobject_current(ko, type) \
    50         for_each_kobject(TASK, (ko), (type))
     49#define for_each_cap_current(cap, type) \
     50        for_each_cap(TASK, (cap), (type))
    5151
    5252typedef enum {
    53         KOBJECT_TYPE_INVALID,
    54         KOBJECT_TYPE_ALLOCATED,
    55         KOBJECT_TYPE_PHONE,
    56         KOBJECT_TYPE_IRQ
    57 } kobject_type_t;
     53        CAP_TYPE_INVALID,
     54        CAP_TYPE_ALLOCATED,
     55        CAP_TYPE_PHONE,
     56        CAP_TYPE_IRQ
     57} cap_type_t;
    5858
    59 typedef struct kobject {
    60         kobject_type_t type;
    61         bool (* can_reclaim)(struct kobject *);
     59typedef struct cap {
     60        cap_type_t type;
     61        bool (* can_reclaim)(struct cap *);
    6262
     63        /* The underlying kernel object. */
    6364        union {
    6465                phone_t phone;
    6566                irq_t irq;
    6667        };
    67 } kobject_t;
     68} cap_t;
    6869
    6970struct task;
    7071
    71 void kobject_task_alloc(struct task *);
    72 void kobject_task_free(struct task *);
    73 void kobject_task_init(struct task *);
     72void caps_task_alloc(struct task *);
     73void caps_task_free(struct task *);
     74void caps_task_init(struct task *);
    7475
    75 extern void kobject_initialize(kobject_t *);
    76 extern kobject_t *kobject_get(struct task *, int, kobject_type_t);
    77 extern kobject_t *kobject_get_current(int, kobject_type_t);
    78 extern int kobject_alloc(struct task *);
    79 extern void kobject_free(struct task *, int);
     76extern void cap_initialize(cap_t *);
     77extern cap_t *cap_get(struct task *, int, cap_type_t);
     78extern cap_t *cap_get_current(int, cap_type_t);
     79extern int cap_alloc(struct task *);
     80extern void cap_free(struct task *, int);
    8081
    81 extern int kobject_to_cap(struct task *, kobject_t *);
     82extern int cap_get_handle(struct task *, cap_t *);
    8283
    8384#endif
Note: See TracChangeset for help on using the changeset viewer.