]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/shmc/include/types.h
Update
[l4.git] / l4 / pkg / shmc / include / types.h
1 /*
2  * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>
3  *     economic rights: Technische Universität Dresden (Germany)
4  * This file is part of TUD:OS and distributed under the terms of the
5  * GNU Lesser General Public License 2.1.
6  * Please see the COPYING-LGPL-2.1 file for details.
7  */
8 /**
9  * \internal
10  * \file
11  */
12 #pragma once
13
14 #ifndef __INCLUDED_FROM_L4SHMC_H__
15 #error Do not include l4/shm/types.h directly, use l4/shm/shm.h!
16 #endif
17
18 #include <l4/re/c/dataspace.h>
19
20 enum {
21   L4SHMC_NAME_SIZE             = 15,
22   L4SHMC_NAME_STRINGLEN        = L4SHMC_NAME_SIZE + 1,
23   L4SHMC_CHUNK_NAME_SIZE       = 15,
24   L4SHMC_CHUNK_NAME_STRINGLEN  = L4SHMC_CHUNK_NAME_SIZE + 1,
25   L4SHMC_SIGNAL_NAME_SIZE      = 15,
26   L4SHMC_SIGNAL_NAME_STRINGLEN = L4SHMC_SIGNAL_NAME_SIZE + 1,
27
28   L4SHMC_CHUNK_READY = 2,
29   L4SHMC_CHUNK_BUSY  = 1,
30   L4SHMC_CHUNK_CLEAR = 0,
31
32   L4SHMC_CHUNK_MAGIC = 0xfedcba98,
33 };
34
35 /* l4shmc_chunk_desc_t is shared among address spaces */
36 /* private: This data structure is hidden for the clients */
37 typedef struct {
38   l4_umword_t _magic;        // magic
39   l4_addr_t _offset;         // offset of chunk in shm-area
40   l4_umword_t _capacity;     // capacity in bytes of chunk
41   l4_umword_t _size;         // size of current payload
42   l4_umword_t _status;       // status of chunk
43   char _name[L4SHMC_CHUNK_NAME_STRINGLEN]; // name of chunk
44   l4_addr_t _next;           // next chunk in shm-area, as absolute offset
45   char payload[];
46 } l4shmc_chunk_desc_t;
47
48 /* l4shmc_area_t is local to one address space */
49 /* private: This data structure is hidden for the clients */
50 typedef struct {
51   l4re_ds_t         _shm_ds;
52   void             *_local_addr;
53   char              _name[L4SHMC_NAME_STRINGLEN];
54   l4_umword_t       _size;
55 } l4shmc_area_t;
56
57 /* l4shmc_signal_t is local to one address space */
58 typedef struct {
59   l4_cap_idx_t        _sigcap;
60 } l4shmc_signal_t;
61
62 /* l4shmc_chunk_t is local to one address space */
63 typedef struct {
64   l4shmc_chunk_desc_t  *_chunk;
65   l4shmc_area_t        *_shm;
66   l4shmc_signal_t      *_sig;
67   l4_umword_t           _capacity;
68 } l4shmc_chunk_t;