Moved capability struct to api/capability.h for userspace coherence

Userspace often breaks as we change the capability structure. Now
structure is under api/ so userspace can also update with changes.
This commit is contained in:
Bahadir Balban
2009-11-22 15:08:29 +02:00
parent f3f581f2e7
commit 19b4c6c4c1
5 changed files with 778 additions and 81 deletions

View File

@@ -6,6 +6,10 @@
#ifndef __API_CAPABILITY_H__
#define __API_CAPABILITY_H__
#if defined(__KERNEL__)
#include <l4/lib/list.h>
#endif
/* Capability syscall request types */
#define CAP_CONTROL_NCAPS 0x00000000
#define CAP_CONTROL_READ 0x00000001
@@ -30,4 +34,63 @@
#define CAP_SPLIT_ACCESS 0x00000002
#define CAP_SPLIT_RANGE 0x00000003 /* Returns -EPERM */
/*
* A capability is a unique representation of security
* qualifiers on a particular resource.
*
* In this structure:
*
* The capid denotes the unique capability ID.
* The resid denotes the unique ID of targeted resource.
* The owner denotes the unique ID of the one and only capability owner. This is
* almost always a thread ID.
*
* The type field contains two types:
* - The capability type,
* - The targeted resource type.
*
* The targeted resouce type denotes what type of resource the capability is
* allowed to operate on. For example a thread, a thread group, an address space
* or a memory can be of this type.
*
* The capability type defines the general set of operations allowed on a
* particular resource. For example a capability type may be thread_control,
* exchange_registers, ipc, or map operations. A resource type may be such as a
* thread, a thread group, a virtual or physical memory region.
*
* There are also quantitative capability types. While their names denote
* quantitative objects such as memory, threads, and address spaces, these
* types actually define the quantitative operations available on those
* resources such as creation and deletion of a thread, allocation and
* deallocation of a memory region etc.
*
* The access field denotes the fine-grain operations available on a particular
* resource. The meaning of each bitfield differs according to the type of the
* capability. For example, for a capability type thread_control, the bitfields
* may mean suspend, resume, create, delete etc.
*/
struct capability {
struct link list;
/* Capability identifiers */
l4id_t capid; /* Unique capability ID */
l4id_t owner; /* Capability owner ID */
l4id_t resid; /* Targeted resource ID */
unsigned int type; /* Capability and target resource type */
/* Capability limits/permissions */
u32 access; /* Permitted operations */
/* Limits on the resource (NOTE: must never have signed type) */
unsigned long start; /* Resource start value */
unsigned long end; /* Resource end value */
unsigned long size; /* Resource size */
/* Use count of resource */
unsigned long used;
/* User-defined attributes on capability (like devtypes) */
unsigned int uattr;
};
#endif /* __API_CAPABILITY_H__ */

View File

@@ -6,8 +6,8 @@
#ifndef __GENERIC_CAPABILITY_H__
#define __GENERIC_CAPABILITY_H__
#include <l4/lib/list.h>
#include <l4/api/exregs.h>
#include <l4/api/capability.h>
/*
* Some resources that capabilities possess don't
@@ -19,64 +19,6 @@
*/
#define CAP_RESID_NONE -1
/*
* A capability is a unique representation of security
* qualifiers on a particular resource.
*
* In this structure:
*
* The capid denotes the unique capability ID.
* The resid denotes the unique ID of targeted resource.
* The owner denotes the unique ID of the one and only capability owner. This is
* almost always a thread ID.
*
* The type field contains two types:
* - The capability type,
* - The targeted resource type.
*
* The targeted resouce type denotes what type of resource the capability is
* allowed to operate on. For example a thread, a thread group, an address space
* or a memory can be of this type.
*
* The capability type defines the general set of operations allowed on a
* particular resource. For example a capability type may be thread_control,
* exchange_registers, ipc, or map operations. A resource type may be such as a
* thread, a thread group, a virtual or physical memory region.
*
* There are also quantitative capability types. While their names denote
* quantitative objects such as memory, threads, and address spaces, these
* types actually define the quantitative operations available on those
* resources such as creation and deletion of a thread, allocation and
* deallocation of a memory region etc.
*
* The access field denotes the fine-grain operations available on a particular
* resource. The meaning of each bitfield differs according to the type of the
* capability. For example, for a capability type thread_control, the bitfields
* may mean suspend, resume, create, delete etc.
*/
struct capability {
struct link list;
/* Capability identifiers */
l4id_t capid; /* Unique capability ID */
l4id_t owner; /* Capability owner ID */
l4id_t resid; /* Targeted resource ID */
unsigned int type; /* Capability and target resource type */
/* Capability limits/permissions */
u32 access; /* Permitted operations */
/* Limits on the resource (NOTE: must never have signed type) */
unsigned long start; /* Resource start value */
unsigned long end; /* Resource end value */
unsigned long size; /* Resource size */
/* Use count of resource */
unsigned long used;
/* User-defined attributes on capability (like devtypes) */
unsigned int uattr;
};
struct cap_list {
int ktcb_refs;