Changeset a33f0a6 in mainline for uspace/lib/c/include


Ignore:
Timestamp:
2011-08-03T17:34:57Z (14 years ago)
Author:
Oleg Romanenko <romanenko.oleg@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1940326
Parents:
52a79081 (diff), 3fab770 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge from mainline

Location:
uspace/lib/c/include
Files:
20 added
41 edited
3 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/adt/fifo.h

    r52a79081 ra33f0a6  
    5151typedef unsigned long fifo_index_t;
    5252
    53 #define FIFO_CREATE_STATIC(name, t, itms)               \
    54         struct {                                        \
    55                 t fifo[(itms)];                         \
    56                 fifo_count_t items;                     \
    57                 fifo_index_t head;                      \
    58                 fifo_index_t tail;                      \
     53#define FIFO_CREATE_STATIC(name, t, itms) \
     54        struct { \
     55                t fifo[(itms)]; \
     56                fifo_count_t items; \
     57                fifo_index_t head; \
     58                fifo_index_t tail; \
    5959        } name
    6060
  • uspace/lib/c/include/adt/hash_table.h

    r52a79081 ra33f0a6  
    3838#include <adt/list.h>
    3939#include <unistd.h>
     40#include <bool.h>
    4041
    4142typedef unsigned long hash_count_t;
     
    7475/** Hash table structure. */
    7576typedef struct {
    76         link_t *entry;
     77        list_t *entry;
    7778        hash_count_t entries;
    7879        hash_count_t max_keys;
     
    8384    list_get_instance((item), type, member)
    8485
    85 extern int hash_table_create(hash_table_t *, hash_count_t, hash_count_t,
     86extern bool hash_table_create(hash_table_t *, hash_count_t, hash_count_t,
    8687    hash_table_operations_t *);
    8788extern void hash_table_insert(hash_table_t *, unsigned long [], link_t *);
  • uspace/lib/c/include/adt/list.h

    r52a79081 ra33f0a6  
    11/*
    22 * Copyright (c) 2001-2004 Jakub Jermar
     3 * Copyright (c) 2011 Jiri Svoboda
    34 * All rights reserved.
    45 *
     
    3637#define LIBC_LIST_H_
    3738
     39#include <assert.h>
    3840#include <unistd.h>
    3941
    40 /** Doubly linked list head and link type. */
     42/** Doubly linked list link. */
    4143typedef struct link {
    4244        struct link *prev;  /**< Pointer to the previous item in the list. */
     
    4446} link_t;
    4547
     48/** Doubly linked list. */
     49typedef struct list {
     50        link_t head;  /**< List head. Does not have any data. */
     51} list_t;
     52
    4653/** Declare and initialize statically allocated list.
    4754 *
    4855 * @param name Name of the new statically allocated list.
    49  */
    50 #define LIST_INITIALIZE(name)  link_t name = { \
    51         .prev = &name, \
    52         .next = &name \
    53 }
     56 *
     57 */
     58#define LIST_INITIALIZE(name) \
     59        list_t name = { \
     60                .head = { \
     61                        .prev = &(name).head, \
     62                        .next = &(name).head \
     63                } \
     64        }
     65
     66#define list_get_instance(link, type, member) \
     67        ((type *) (((void *)(link)) - ((void *) &(((type *) NULL)->member))))
     68
     69#define list_foreach(list, iterator) \
     70        for (link_t *iterator = (list).head.next; \
     71            iterator != &(list).head; iterator = iterator->next)
     72
     73#define assert_link_not_used(link) \
     74        assert((link)->prev == NULL && (link)->next == NULL)
    5475
    5576/** Initialize doubly-linked circular list link
     
    5879 *
    5980 * @param link Pointer to link_t structure to be initialized.
     81 *
    6082 */
    6183static inline void link_initialize(link_t *link)
     
    6991 * Initialize doubly-linked circular list.
    7092 *
    71  * @param head Pointer to link_t structure representing head of the list.
    72  */
    73 static inline void list_initialize(link_t *head)
    74 {
    75         head->prev = head;
    76         head->next = head;
     93 * @param list Pointer to list_t structure.
     94 *
     95 */
     96static inline void list_initialize(list_t *list)
     97{
     98        list->head.prev = &list->head;
     99        list->head.next = &list->head;
     100}
     101
     102/** Insert item before another item in doubly-linked circular list.
     103 *
     104 */
     105static inline void list_insert_before(link_t *lnew, link_t *lold)
     106{
     107        lnew->next = lold;
     108        lnew->prev = lold->prev;
     109        lold->prev->next = lnew;
     110        lold->prev = lnew;
     111}
     112
     113/** Insert item after another item in doubly-linked circular list.
     114 *
     115 */
     116static inline void list_insert_after(link_t *lnew, link_t *lold)
     117{
     118        lnew->prev = lold;
     119        lnew->next = lold->next;
     120        lold->next->prev = lnew;
     121        lold->next = lnew;
    77122}
    78123
     
    82127 *
    83128 * @param link Pointer to link_t structure to be added.
    84  * @param head Pointer to link_t structure representing head of the list.
    85  */
    86 static inline void list_prepend(link_t *link, link_t *head)
    87 {
    88         link->next = head->next;
    89         link->prev = head;
    90         head->next->prev = link;
    91         head->next = link;
     129 * @param list Pointer to list_t structure.
     130 *
     131 */
     132static inline void list_prepend(link_t *link, list_t *list)
     133{
     134        list_insert_after(link, &list->head);
    92135}
    93136
     
    97140 *
    98141 * @param link Pointer to link_t structure to be added.
    99  * @param head Pointer to link_t structure representing head of the list.
    100  */
    101 static inline void list_append(link_t *link, link_t *head)
    102 {
    103         link->prev = head->prev;
    104         link->next = head;
    105         head->prev->next = link;
    106         head->prev = link;
    107 }
    108 
    109 /** Insert item before another item in doubly-linked circular list. */
    110 static inline void list_insert_before(link_t *l, link_t *r)
    111 {
    112         list_append(l, r);
    113 }
    114 
    115 /** Insert item after another item in doubly-linked circular list. */
    116 static inline void list_insert_after(link_t *r, link_t *l)
    117 {
    118         list_prepend(l, r);
     142 * @param list Pointer to list_t structure.
     143 *
     144 */
     145static inline void list_append(link_t *link, list_t *list)
     146{
     147        list_insert_before(link, &list->head);
    119148}
    120149
     
    123152 * Remove item from doubly-linked circular list.
    124153 *
    125  * @param link Pointer to link_t structure to be removed from the list it is contained in.
     154 * @param link Pointer to link_t structure to be removed from the list
     155 *             it is contained in.
     156 *
    126157 */
    127158static inline void list_remove(link_t *link)
     
    136167 * Query emptiness of doubly-linked circular list.
    137168 *
    138  * @param head Pointer to link_t structure representing head of the list.
    139  */
    140 static inline int list_empty(link_t *head)
    141 {
    142         return ((head->next == head) ? 1 : 0);
    143 }
    144 
     169 * @param list Pointer to lins_t structure.
     170 *
     171 */
     172static inline int list_empty(list_t *list)
     173{
     174        return (list->head.next == &list->head);
     175}
     176
     177/** Get first item in list.
     178 *
     179 * @param list Pointer to list_t structure.
     180 *
     181 * @return Head item of the list.
     182 * @return NULL if the list is empty.
     183 *
     184 */
     185static inline link_t *list_first(list_t *list)
     186{
     187        return ((list->head.next == &list->head) ? NULL : list->head.next);
     188}
     189
     190/** Get last item in list.
     191 *
     192 * @param list Pointer to list_t structure.
     193 *
     194 * @return Head item of the list.
     195 * @return NULL if the list is empty.
     196 *
     197 */
     198static inline link_t *list_last(list_t *list)
     199{
     200        return ((list->head.prev == &list->head) ? NULL : list->head.prev);
     201}
    145202
    146203/** Split or concatenate headless doubly-linked circular list
     
    151208 * concatenates splitted lists and splits concatenated lists.
    152209 *
    153  * @param part1 Pointer to link_t structure leading the first (half of the headless) list.
    154  * @param part2 Pointer to link_t structure leading the second (half of the headless) list.
     210 * @param part1 Pointer to link_t structure leading the first
     211 *              (half of the headless) list.
     212 * @param part2 Pointer to link_t structure leading the second
     213 *              (half of the headless) list.
     214 *
    155215 */
    156216static inline void headless_list_split_or_concat(link_t *part1, link_t *part2)
     
    165225}
    166226
    167 
    168227/** Split headless doubly-linked circular list
    169228 *
    170229 * Split headless doubly-linked circular list.
    171230 *
    172  * @param part1 Pointer to link_t structure leading the first half of the headless list.
    173  * @param part2 Pointer to link_t structure leading the second half of the headless list.
     231 * @param part1 Pointer to link_t structure leading
     232 *              the first half of the headless list.
     233 * @param part2 Pointer to link_t structure leading
     234 *              the second half of the headless list.
     235 *
    174236 */
    175237static inline void headless_list_split(link_t *part1, link_t *part2)
     
    182244 * Concatenate two headless doubly-linked circular lists.
    183245 *
    184  * @param part1 Pointer to link_t structure leading the first headless list.
    185  * @param part2 Pointer to link_t structure leading the second headless list.
     246 * @param part1 Pointer to link_t structure leading
     247 *              the first headless list.
     248 * @param part2 Pointer to link_t structure leading
     249 *              the second headless list.
     250 *
    186251 */
    187252static inline void headless_list_concat(link_t *part1, link_t *part2)
     
    190255}
    191256
    192 #define list_get_instance(link, type, member)  ((type *) (((void *)(link)) - ((void *) &(((type *) NULL)->member))))
    193 
    194 extern int list_member(const link_t *link, const link_t *head);
    195 extern void list_concat(link_t *head1, link_t *head2);
    196 extern unsigned int list_count(const link_t *link);
     257/** Get n-th item in a list.
     258 *
     259 * @param list Pointer to link_t structure representing the list.
     260 * @param n    Item number (indexed from zero).
     261 *
     262 * @return n-th item of the list.
     263 * @return NULL if no n-th item found.
     264 *
     265 */
     266static inline link_t *list_nth(list_t *list, unsigned int n)
     267{
     268        unsigned int cnt = 0;
     269       
     270        list_foreach(*list, link) {
     271                if (cnt == n)
     272                        return link;
     273               
     274                cnt++;
     275        }
     276       
     277        return NULL;
     278}
     279
     280extern int list_member(const link_t *, const list_t *);
     281extern void list_concat(list_t *, list_t *);
     282extern unsigned int list_count(const list_t *);
    197283
    198284#endif
  • uspace/lib/c/include/adt/measured_strings.h

    r52a79081 ra33f0a6  
    4141
    4242#include <sys/types.h>
     43#include <async.h>
    4344
    4445/** Type definition of the character string with measured length.
     
    6162extern measured_string_t *measured_string_create_bulk(const uint8_t *, size_t);
    6263extern measured_string_t *measured_string_copy(measured_string_t *);
     64
    6365extern int measured_strings_receive(measured_string_t **, uint8_t **, size_t);
    6466extern int measured_strings_reply(const measured_string_t *, size_t);
    65 extern int measured_strings_return(int, measured_string_t **, uint8_t **, size_t);
    66 extern int measured_strings_send(int, const measured_string_t *, size_t);
     67
     68extern int measured_strings_return(async_exch_t *, measured_string_t **,
     69    uint8_t **, size_t);
     70extern int measured_strings_send(async_exch_t *, const measured_string_t *,
     71    size_t);
    6772
    6873#endif
  • uspace/lib/c/include/as.h

    r52a79081 ra33f0a6  
    5454}
    5555
    56 extern void *as_area_create(void *address, size_t size, int flags);
    57 extern int as_area_resize(void *address, size_t size, int flags);
    58 extern int as_area_change_flags(void *address, int flags);
    59 extern int as_area_destroy(void *address);
    60 extern void *set_maxheapsize(size_t mhs);
    61 extern void * as_get_mappable_page(size_t sz);
     56extern void *as_area_create(void *, size_t, unsigned int);
     57extern int as_area_resize(void *, size_t, unsigned int);
     58extern int as_area_change_flags(void *, unsigned int);
     59extern int as_area_destroy(void *);
     60extern void *set_maxheapsize(size_t);
     61extern void *as_get_mappable_page(size_t);
     62extern int as_get_physical_mapping(void *, uintptr_t *);
    6263
    6364#endif
  • uspace/lib/c/include/async.h

    r52a79081 ra33f0a6  
    4141
    4242#include <ipc/common.h>
    43 #include <async_sess.h>
    4443#include <fibril.h>
     44#include <fibril_synch.h>
    4545#include <sys/time.h>
    4646#include <atomic.h>
     
    5353typedef void (*async_client_data_dtor_t)(void *);
    5454
    55 typedef void (*async_client_conn_t)(ipc_callid_t, ipc_call_t *);
     55/** Client connection handler
     56 *
     57 * @param callid ID of incoming call or 0 if connection initiated from
     58 *               inside using async_connect_to_me()
     59 * @param call   Incoming call or 0 if connection initiated from inside
     60 * @param arg    Local argument passed from async_new_connection() or
     61 *               async_connect_to_me()
     62 */
     63typedef void (*async_client_conn_t)(ipc_callid_t, ipc_call_t *, void *);
     64
     65/** Interrupt handler */
     66typedef void (*async_interrupt_handler_t)(ipc_callid_t, ipc_call_t *);
     67
     68/** Exchange management style
     69 *
     70 */
     71typedef enum {
     72        /** No explicit exchange management
     73         *
     74         * Suitable for protocols which use a single
     75         * IPC message per exchange only.
     76         *
     77         */
     78        EXCHANGE_ATOMIC = 0,
     79       
     80        /** Exchange management via phone cloning
     81         *
     82         * Suitable for servers which support client
     83         * data tracking by task hashes and do not
     84         * mind cloned phones.
     85         *
     86         */
     87        EXCHANGE_PARALLEL,
     88       
     89        /** Exchange management via mutual exclusion
     90         *
     91         * Suitable for any kind of client/server communication,
     92         * but can limit parallelism.
     93         *
     94         */
     95        EXCHANGE_SERIALIZE
     96} exch_mgmt_t;
     97
     98/** Session data */
     99typedef struct {
     100        /** List of inactive exchanges */
     101        list_t exch_list;
     102       
     103        /** Exchange management style */
     104        exch_mgmt_t mgmt;
     105       
     106        /** Session identification */
     107        int phone;
     108       
     109        /** First clone connection argument */
     110        sysarg_t arg1;
     111       
     112        /** Second clone connection argument */
     113        sysarg_t arg2;
     114       
     115        /** Third clone connection argument */
     116        sysarg_t arg3;
     117       
     118        /** Exchange mutex */
     119        fibril_mutex_t mutex;
     120       
     121        /** Number of opened exchanges */
     122        atomic_t refcnt;
     123} async_sess_t;
     124
     125/** Exchange data */
     126typedef struct {
     127        /** Link into list of inactive exchanges */
     128        link_t sess_link;
     129       
     130        /** Link into global list of inactive exchanges */
     131        link_t global_link;
     132       
     133        /** Session pointer */
     134        async_sess_t *sess;
     135       
     136        /** Exchange identification */
     137        int phone;
     138} async_exch_t;
    56139
    57140extern atomic_t threads_in_ipc_wait;
     
    68151 * User-friendly wrappers for async_send_fast() and async_send_slow(). The
    69152 * macros are in the form async_send_m(), where m denotes the number of payload
    70  * arguments.  Each macros chooses between the fast and the slow version based
     153 * arguments. Each macros chooses between the fast and the slow version based
    71154 * on m.
    72155 */
    73156
    74 #define async_send_0(phoneid, method, dataptr) \
    75         async_send_fast((phoneid), (method), 0, 0, 0, 0, (dataptr))
    76 #define async_send_1(phoneid, method, arg1, dataptr) \
    77         async_send_fast((phoneid), (method), (arg1), 0, 0, 0, (dataptr))
    78 #define async_send_2(phoneid, method, arg1, arg2, dataptr) \
    79         async_send_fast((phoneid), (method), (arg1), (arg2), 0, 0, (dataptr))
    80 #define async_send_3(phoneid, method, arg1, arg2, arg3, dataptr) \
    81         async_send_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, (dataptr))
    82 #define async_send_4(phoneid, method, arg1, arg2, arg3, arg4, dataptr) \
    83         async_send_fast((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
    84             (dataptr))
    85 #define async_send_5(phoneid, method, arg1, arg2, arg3, arg4, arg5, dataptr) \
    86         async_send_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
    87             (arg5), (dataptr))
    88 
    89 extern aid_t async_send_fast(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
    90     sysarg_t, ipc_call_t *);
    91 extern aid_t async_send_slow(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
     157#define async_send_0(exch, method, dataptr) \
     158        async_send_fast(exch, method, 0, 0, 0, 0, dataptr)
     159#define async_send_1(exch, method, arg1, dataptr) \
     160        async_send_fast(exch, method, arg1, 0, 0, 0, dataptr)
     161#define async_send_2(exch, method, arg1, arg2, dataptr) \
     162        async_send_fast(exch, method, arg1, arg2, 0, 0, dataptr)
     163#define async_send_3(exch, method, arg1, arg2, arg3, dataptr) \
     164        async_send_fast(exch, method, arg1, arg2, arg3, 0, dataptr)
     165#define async_send_4(exch, method, arg1, arg2, arg3, arg4, dataptr) \
     166        async_send_fast(exch, method, arg1, arg2, arg3, arg4, dataptr)
     167#define async_send_5(exch, method, arg1, arg2, arg3, arg4, arg5, dataptr) \
     168        async_send_slow(exch, method, arg1, arg2, arg3, arg4, arg5, dataptr)
     169
     170extern aid_t async_send_fast(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
    92171    sysarg_t, sysarg_t, ipc_call_t *);
     172extern aid_t async_send_slow(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
     173    sysarg_t, sysarg_t, sysarg_t, ipc_call_t *);
     174
    93175extern void async_wait_for(aid_t, sysarg_t *);
    94176extern int async_wait_timeout(aid_t, sysarg_t *, suseconds_t);
    95177
    96178extern fid_t async_new_connection(sysarg_t, sysarg_t, ipc_callid_t,
    97     ipc_call_t *, void (*)(ipc_callid_t, ipc_call_t *));
     179    ipc_call_t *, async_client_conn_t, void *);
     180
    98181extern void async_usleep(suseconds_t);
    99182extern void async_create_manager(void);
     
    102185extern void async_set_client_data_constructor(async_client_data_ctor_t);
    103186extern void async_set_client_data_destructor(async_client_data_dtor_t);
    104 
    105 extern void *async_client_data_get(void);
     187extern void *async_get_client_data(void);
    106188
    107189extern void async_set_client_connection(async_client_conn_t);
    108 extern void async_set_interrupt_received(async_client_conn_t);
     190extern void async_set_interrupt_received(async_interrupt_handler_t);
    109191
    110192/*
     
    112194 */
    113195
    114 extern void async_msg_0(int, sysarg_t);
    115 extern void async_msg_1(int, sysarg_t, sysarg_t);
    116 extern void async_msg_2(int, sysarg_t, sysarg_t, sysarg_t);
    117 extern void async_msg_3(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t);
    118 extern void async_msg_4(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t, sysarg_t);
    119 extern void async_msg_5(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
     196extern void async_msg_0(async_exch_t *, sysarg_t);
     197extern void async_msg_1(async_exch_t *, sysarg_t, sysarg_t);
     198extern void async_msg_2(async_exch_t *, sysarg_t, sysarg_t, sysarg_t);
     199extern void async_msg_3(async_exch_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t);
     200extern void async_msg_4(async_exch_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
    120201    sysarg_t);
     202extern void async_msg_5(async_exch_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
     203    sysarg_t, sysarg_t);
    121204
    122205/*
     
    138221 */
    139222
    140 extern int async_forward_fast(ipc_callid_t, int, sysarg_t, sysarg_t, sysarg_t,
    141     unsigned int);
    142 extern int async_forward_slow(ipc_callid_t, int, sysarg_t, sysarg_t, sysarg_t,
    143     sysarg_t, sysarg_t, sysarg_t, unsigned int);
     223extern int async_forward_fast(ipc_callid_t, async_exch_t *, sysarg_t, sysarg_t,
     224    sysarg_t, unsigned int);
     225extern int async_forward_slow(ipc_callid_t, async_exch_t *, sysarg_t, sysarg_t,
     226    sysarg_t, sysarg_t, sysarg_t, sysarg_t, unsigned int);
    144227
    145228/*
     
    150233 */
    151234
    152 #define async_req_0_0(phoneid, method) \
    153         async_req_fast((phoneid), (method), 0, 0, 0, 0, NULL, NULL, NULL, NULL, \
    154             NULL)
    155 #define async_req_0_1(phoneid, method, r1) \
    156         async_req_fast((phoneid), (method), 0, 0, 0, 0, (r1), NULL, NULL, NULL, \
    157             NULL)
    158 #define async_req_0_2(phoneid, method, r1, r2) \
    159         async_req_fast((phoneid), (method), 0, 0, 0, 0, (r1), (r2), NULL, NULL, \
    160             NULL)
    161 #define async_req_0_3(phoneid, method, r1, r2, r3) \
    162         async_req_fast((phoneid), (method), 0, 0, 0, 0, (r1), (r2), (r3), NULL, \
    163             NULL)
    164 #define async_req_0_4(phoneid, method, r1, r2, r3, r4) \
    165         async_req_fast((phoneid), (method), 0, 0, 0, 0, (r1), (r2), (r3), (r4), \
    166             NULL)
    167 #define async_req_0_5(phoneid, method, r1, r2, r3, r4, r5) \
    168         async_req_fast((phoneid), (method), 0, 0, 0, 0, (r1), (r2), (r3), (r4), \
    169             (r5))
    170 #define async_req_1_0(phoneid, method, arg1) \
    171         async_req_fast((phoneid), (method), (arg1), 0, 0, 0, NULL, NULL, NULL, \
    172             NULL, NULL)
    173 #define async_req_1_1(phoneid, method, arg1, rc1) \
    174         async_req_fast((phoneid), (method), (arg1), 0, 0, 0, (rc1), NULL, NULL, \
    175             NULL, NULL)
    176 #define async_req_1_2(phoneid, method, arg1, rc1, rc2) \
    177         async_req_fast((phoneid), (method), (arg1), 0, 0, 0, (rc1), (rc2), NULL, \
    178             NULL, NULL)
    179 #define async_req_1_3(phoneid, method, arg1, rc1, rc2, rc3) \
    180         async_req_fast((phoneid), (method), (arg1), 0, 0, 0, (rc1), (rc2), (rc3), \
    181             NULL, NULL)
    182 #define async_req_1_4(phoneid, method, arg1, rc1, rc2, rc3, rc4) \
    183         async_req_fast((phoneid), (method), (arg1), 0, 0, 0, (rc1), (rc2), (rc3), \
    184             (rc4), NULL)
    185 #define async_req_1_5(phoneid, method, arg1, rc1, rc2, rc3, rc4, rc5) \
    186         async_req_fast((phoneid), (method), (arg1), 0, 0, 0, (rc1), (rc2), (rc3), \
    187             (rc4), (rc5))
    188 #define async_req_2_0(phoneid, method, arg1, arg2) \
    189         async_req_fast((phoneid), (method), (arg1), (arg2), 0, 0, NULL, NULL, \
     235#define async_req_0_0(exch, method) \
     236        async_req_fast(exch, method, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL)
     237#define async_req_0_1(exch, method, r1) \
     238        async_req_fast(exch, method, 0, 0, 0, 0, r1, NULL, NULL, NULL, NULL)
     239#define async_req_0_2(exch, method, r1, r2) \
     240        async_req_fast(exch, method, 0, 0, 0, 0, r1, r2, NULL, NULL, NULL)
     241#define async_req_0_3(exch, method, r1, r2, r3) \
     242        async_req_fast(exch, method, 0, 0, 0, 0, r1, r2, r3, NULL, NULL)
     243#define async_req_0_4(exch, method, r1, r2, r3, r4) \
     244        async_req_fast(exch, method, 0, 0, 0, 0, r1, r2, r3, r4, NULL)
     245#define async_req_0_5(exch, method, r1, r2, r3, r4, r5) \
     246        async_req_fast(exch, method, 0, 0, 0, 0, r1, r2, r3, r4, r5)
     247
     248#define async_req_1_0(exch, method, arg1) \
     249        async_req_fast(exch, method, arg1, 0, 0, 0, NULL, NULL, NULL, NULL, \
     250            NULL)
     251#define async_req_1_1(exch, method, arg1, rc1) \
     252        async_req_fast(exch, method, arg1, 0, 0, 0, rc1, NULL, NULL, NULL, \
     253            NULL)
     254#define async_req_1_2(exch, method, arg1, rc1, rc2) \
     255        async_req_fast(exch, method, arg1, 0, 0, 0, rc1, rc2, NULL, NULL, \
     256            NULL)
     257#define async_req_1_3(exch, method, arg1, rc1, rc2, rc3) \
     258        async_req_fast(exch, method, arg1, 0, 0, 0, rc1, rc2, rc3, NULL, \
     259            NULL)
     260#define async_req_1_4(exch, method, arg1, rc1, rc2, rc3, rc4) \
     261        async_req_fast(exch, method, arg1, 0, 0, 0, rc1, rc2, rc3, rc4, \
     262            NULL)
     263#define async_req_1_5(exch, method, arg1, rc1, rc2, rc3, rc4, rc5) \
     264        async_req_fast(exch, method, arg1, 0, 0, 0, rc1, rc2, rc3, rc4, \
     265            rc5)
     266
     267#define async_req_2_0(exch, method, arg1, arg2) \
     268        async_req_fast(exch, method, arg1, arg2, 0, 0, NULL, NULL, NULL, \
     269            NULL, NULL)
     270#define async_req_2_1(exch, method, arg1, arg2, rc1) \
     271        async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, NULL, NULL, \
     272            NULL, NULL)
     273#define async_req_2_2(exch, method, arg1, arg2, rc1, rc2) \
     274        async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, rc2, NULL, NULL, \
     275            NULL)
     276#define async_req_2_3(exch, method, arg1, arg2, rc1, rc2, rc3) \
     277        async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, rc2, rc3, NULL, \
     278            NULL)
     279#define async_req_2_4(exch, method, arg1, arg2, rc1, rc2, rc3, rc4) \
     280        async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, rc2, rc3, rc4, \
     281            NULL)
     282#define async_req_2_5(exch, method, arg1, arg2, rc1, rc2, rc3, rc4, rc5) \
     283        async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, rc2, rc3, rc4, \
     284            rc5)
     285
     286#define async_req_3_0(exch, method, arg1, arg2, arg3) \
     287        async_req_fast(exch, method, arg1, arg2, arg3, 0, NULL, NULL, NULL, \
     288            NULL, NULL)
     289#define async_req_3_1(exch, method, arg1, arg2, arg3, rc1) \
     290        async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, NULL, NULL, \
     291            NULL, NULL)
     292#define async_req_3_2(exch, method, arg1, arg2, arg3, rc1, rc2) \
     293        async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, rc2, NULL, \
     294            NULL, NULL)
     295#define async_req_3_3(exch, method, arg1, arg2, arg3, rc1, rc2, rc3) \
     296        async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, rc2, rc3, \
     297            NULL, NULL)
     298#define async_req_3_4(exch, method, arg1, arg2, arg3, rc1, rc2, rc3, rc4) \
     299        async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, rc2, rc3, \
     300            rc4, NULL)
     301#define async_req_3_5(exch, method, arg1, arg2, arg3, rc1, rc2, rc3, rc4, \
     302    rc5) \
     303        async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, rc2, rc3, \
     304            rc4, rc5)
     305
     306#define async_req_4_0(exch, method, arg1, arg2, arg3, arg4) \
     307        async_req_fast(exch, method, arg1, arg2, arg3, arg4, NULL, NULL, \
    190308            NULL, NULL, NULL)
    191 #define async_req_2_1(phoneid, method, arg1, arg2, rc1) \
    192         async_req_fast((phoneid), (method), (arg1), (arg2), 0, 0, (rc1), NULL, \
     309#define async_req_4_1(exch, method, arg1, arg2, arg3, arg4, rc1) \
     310        async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, NULL, \
    193311            NULL, NULL, NULL)
    194 #define async_req_2_2(phoneid, method, arg1, arg2, rc1, rc2) \
    195         async_req_fast((phoneid), (method), (arg1), (arg2), 0, 0, (rc1), (rc2), \
     312#define async_req_4_2(exch, method, arg1, arg2, arg3, arg4, rc1, rc2) \
     313        async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, NULL, \
     314            NULL, NULL)
     315#define async_req_4_3(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3) \
     316        async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
     317            NULL, NULL)
     318#define async_req_4_4(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
     319    rc4) \
     320        async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
     321            rc4, NULL)
     322#define async_req_4_5(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
     323    rc4, rc5) \
     324        async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
     325            rc4, rc5)
     326
     327#define async_req_5_0(exch, method, arg1, arg2, arg3, arg4, arg5) \
     328        async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, NULL, \
     329            NULL, NULL, NULL, NULL)
     330#define async_req_5_1(exch, method, arg1, arg2, arg3, arg4, arg5, rc1) \
     331        async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, \
     332            NULL, NULL, NULL, NULL)
     333#define async_req_5_2(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2) \
     334        async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
    196335            NULL, NULL, NULL)
    197 #define async_req_2_3(phoneid, method, arg1, arg2, rc1, rc2, rc3) \
    198         async_req_fast((phoneid), (method), (arg1), (arg2), 0, 0, (rc1), (rc2), \
    199             (rc3), NULL, NULL)
    200 #define async_req_2_4(phoneid, method, arg1, arg2, rc1, rc2, rc3, rc4) \
    201         async_req_fast((phoneid), (method), (arg1), (arg2), 0, 0, (rc1), (rc2), \
    202             (rc3), (rc4), NULL)
    203 #define async_req_2_5(phoneid, method, arg1, arg2, rc1, rc2, rc3, rc4, rc5) \
    204         async_req_fast((phoneid), (method), (arg1), (arg2), 0, 0, (rc1), (rc2), \
    205             (rc3), (rc4), (rc5))
    206 #define async_req_3_0(phoneid, method, arg1, arg2, arg3) \
    207         async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, NULL, NULL, \
    208             NULL, NULL, NULL)
    209 #define async_req_3_1(phoneid, method, arg1, arg2, arg3, rc1) \
    210         async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, (rc1), \
    211             NULL, NULL, NULL, NULL)
    212 #define async_req_3_2(phoneid, method, arg1, arg2, arg3, rc1, rc2) \
    213         async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, (rc1), \
    214             (rc2), NULL, NULL, NULL)
    215 #define async_req_3_3(phoneid, method, arg1, arg2, arg3, rc1, rc2, rc3) \
    216         async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, (rc1), \
    217             (rc2), (rc3), NULL, NULL)
    218 #define async_req_3_4(phoneid, method, arg1, arg2, arg3, rc1, rc2, rc3, rc4) \
    219         async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, (rc1), \
    220             (rc2), (rc3), (rc4), NULL)
    221 #define async_req_3_5(phoneid, method, arg1, arg2, arg3, rc1, rc2, rc3, rc4, \
    222     rc5) \
    223         async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, (rc1), \
    224             (rc2), (rc3), (rc4), (rc5))
    225 #define async_req_4_0(phoneid, method, arg1, arg2, arg3, arg4) \
    226         async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), (arg4), NULL, \
    227             NULL, NULL, NULL, NULL)
    228 #define async_req_4_1(phoneid, method, arg1, arg2, arg3, arg4, rc1) \
    229         async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), (arg4), (rc1), \
    230             NULL, NULL, NULL, NULL)
    231 #define async_req_4_2(phoneid, method, arg1, arg2, arg3, arg4, rc1, rc2) \
    232         async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), (arg4), (rc1), \
    233             (rc2), NULL, NULL, NULL)
    234 #define async_req_4_3(phoneid, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3) \
    235         async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), (arg4), (rc1), \
    236             (rc2), (rc3), NULL, NULL)
    237 #define async_req_4_4(phoneid, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
    238     rc4) \
    239         async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
    240             (rc1), (rc2), (rc3), (rc4), NULL)
    241 #define async_req_4_5(phoneid, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
    242     rc4, rc5) \
    243         async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
    244             (rc1), (rc2), (rc3), (rc4), (rc5))
    245 #define async_req_5_0(phoneid, method, arg1, arg2, arg3, arg4, arg5) \
    246         async_req_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
    247             (arg5), NULL, NULL, NULL, NULL, NULL)
    248 #define async_req_5_1(phoneid, method, arg1, arg2, arg3, arg4, arg5, rc1) \
    249         async_req_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
    250             (arg5), (rc1), NULL, NULL, NULL, NULL)
    251 #define async_req_5_2(phoneid, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2) \
    252         async_req_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
    253             (arg5), (rc1), (rc2), NULL, NULL, NULL)
    254 #define async_req_5_3(phoneid, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
     336#define async_req_5_3(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
    255337    rc3) \
    256         async_req_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
    257             (arg5), (rc1), (rc2), (rc3), NULL, NULL)
    258 #define async_req_5_4(phoneid, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
     338        async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
     339            rc3, NULL, NULL)
     340#define async_req_5_4(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
    259341    rc3, rc4) \
    260         async_req_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
    261             (arg5), (rc1), (rc2), (rc3), (rc4), NULL)
    262 #define async_req_5_5(phoneid, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
     342        async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
     343            rc3, rc4, NULL)
     344#define async_req_5_5(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
    263345    rc3, rc4, rc5) \
    264         async_req_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
    265             (arg5), (rc1), (rc2), (rc3), (rc4), (rc5))
    266 
    267 extern sysarg_t async_req_fast(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
    268     sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *);
    269 extern sysarg_t async_req_slow(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
     346        async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
     347            rc3, rc4, rc5)
     348
     349extern sysarg_t async_req_fast(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
    270350    sysarg_t, sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *,
    271351    sysarg_t *);
    272 
    273 static inline void async_serialize_start(void)
    274 {
    275         fibril_inc_sercount();
    276 }
    277 
    278 static inline void async_serialize_end(void)
    279 {
    280         fibril_dec_sercount();
    281 }
    282 
    283 extern int async_connect_to_me(int, sysarg_t, sysarg_t, sysarg_t,
    284     async_client_conn_t);
    285 extern int async_connect_me_to(int, sysarg_t, sysarg_t, sysarg_t);
    286 extern int async_connect_me_to_blocking(int, sysarg_t, sysarg_t, sysarg_t);
    287 extern int async_connect_kbox(task_id_t);
    288 extern int async_hangup(int);
     352extern sysarg_t async_req_slow(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
     353    sysarg_t, sysarg_t, sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *,
     354    sysarg_t *, sysarg_t *);
     355
     356extern async_sess_t *async_connect_me(exch_mgmt_t, async_exch_t *);
     357extern async_sess_t *async_connect_me_to(exch_mgmt_t, async_exch_t *, sysarg_t,
     358    sysarg_t, sysarg_t);
     359extern async_sess_t *async_connect_me_to_blocking(exch_mgmt_t, async_exch_t *,
     360    sysarg_t, sysarg_t, sysarg_t);
     361extern async_sess_t *async_connect_kbox(task_id_t);
     362
     363extern int async_connect_to_me(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
     364    async_client_conn_t, void *);
     365
     366extern int async_hangup(async_sess_t *);
    289367extern void async_poke(void);
    290368
     369extern async_exch_t *async_exchange_begin(async_sess_t *);
     370extern void async_exchange_end(async_exch_t *);
     371
    291372/*
    292373 * User-friendly wrappers for async_share_in_start().
    293374 */
    294375
    295 #define async_share_in_start_0_0(phoneid, dst, size) \
    296         async_share_in_start((phoneid), (dst), (size), 0, NULL)
    297 #define async_share_in_start_0_1(phoneid, dst, size, flags) \
    298         async_share_in_start((phoneid), (dst), (size), 0, (flags))
    299 #define async_share_in_start_1_0(phoneid, dst, size, arg) \
    300         async_share_in_start((phoneid), (dst), (size), (arg), NULL)
    301 #define async_share_in_start_1_1(phoneid, dst, size, arg, flags) \
    302         async_share_in_start((phoneid), (dst), (size), (arg), (flags))
    303 
    304 extern int async_share_in_start(int, void *, size_t, sysarg_t, unsigned int *);
     376#define async_share_in_start_0_0(exch, dst, size) \
     377        async_share_in_start(exch, dst, size, 0, NULL)
     378#define async_share_in_start_0_1(exch, dst, size, flags) \
     379        async_share_in_start(exch, dst, size, 0, flags)
     380#define async_share_in_start_1_0(exch, dst, size, arg) \
     381        async_share_in_start(exch, dst, size, arg, NULL)
     382#define async_share_in_start_1_1(exch, dst, size, arg, flags) \
     383        async_share_in_start(exch, dst, size, arg, flags)
     384
     385extern int async_share_in_start(async_exch_t *, void *, size_t, sysarg_t,
     386    unsigned int *);
    305387extern bool async_share_in_receive(ipc_callid_t *, size_t *);
    306388extern int async_share_in_finalize(ipc_callid_t, void *, unsigned int);
    307389
    308 extern int async_share_out_start(int, void *, unsigned int);
     390extern int async_share_out_start(async_exch_t *, void *, unsigned int);
    309391extern bool async_share_out_receive(ipc_callid_t *, size_t *, unsigned int *);
    310392extern int async_share_out_finalize(ipc_callid_t, void *);
     
    314396 */
    315397
    316 #define async_data_read_forward_0_0(phoneid, method, answer) \
    317         async_data_read_forward_fast((phoneid), (method), 0, 0, 0, 0, NULL)
    318 #define async_data_read_forward_0_1(phoneid, method, answer) \
    319         async_data_read_forward_fast((phoneid), (method), 0, 0, 0, 0, (answer))
    320 #define async_data_read_forward_1_0(phoneid, method, arg1, answer) \
    321         async_data_read_forward_fast((phoneid), (method), (arg1), 0, 0, 0, NULL)
    322 #define async_data_read_forward_1_1(phoneid, method, arg1, answer) \
    323         async_data_read_forward_fast((phoneid), (method), (arg1), 0, 0, 0, (answer))
    324 #define async_data_read_forward_2_0(phoneid, method, arg1, arg2, answer) \
    325         async_data_read_forward_fast((phoneid), (method), (arg1), (arg2), 0, 0, NULL)
    326 #define async_data_read_forward_2_1(phoneid, method, arg1, arg2, answer) \
    327         async_data_read_forward_fast((phoneid), (method), (arg1), (arg2), 0, 0, \
    328             (answer))
    329 #define async_data_read_forward_3_0(phoneid, method, arg1, arg2, arg3, answer) \
    330         async_data_read_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, \
    331             NULL)
    332 #define async_data_read_forward_3_1(phoneid, method, arg1, arg2, arg3, answer) \
    333         async_data_read_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, \
    334             (answer))
    335 #define async_data_read_forward_4_0(phoneid, method, arg1, arg2, arg3, arg4, answer) \
    336         async_data_read_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), \
    337             (arg4), NULL)
    338 #define async_data_read_forward_4_1(phoneid, method, arg1, arg2, arg3, arg4, answer) \
    339         async_data_read_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), \
    340             (arg4), (answer))
    341 
    342 #define async_data_read_start(p, buf, len) \
    343         async_data_read_start_generic((p), (buf), (len), IPC_XF_NONE)
    344 
    345 extern int async_data_read_start_generic(int, void *, size_t, int);
     398#define async_data_read_forward_0_0(exch, method, answer) \
     399        async_data_read_forward_fast(exch, method, 0, 0, 0, 0, NULL)
     400#define async_data_read_forward_0_1(exch, method, answer) \
     401        async_data_read_forward_fast(exch, method, 0, 0, 0, 0, answer)
     402#define async_data_read_forward_1_0(exch, method, arg1, answer) \
     403        async_data_read_forward_fast(exch, method, arg1, 0, 0, 0, NULL)
     404#define async_data_read_forward_1_1(exch, method, arg1, answer) \
     405        async_data_read_forward_fast(exch, method, arg1, 0, 0, 0, answer)
     406#define async_data_read_forward_2_0(exch, method, arg1, arg2, answer) \
     407        async_data_read_forward_fast(exch, method, arg1, arg2, 0, 0, NULL)
     408#define async_data_read_forward_2_1(exch, method, arg1, arg2, answer) \
     409        async_data_read_forward_fast(exch, method, arg1, arg2, 0, 0, answer)
     410#define async_data_read_forward_3_0(exch, method, arg1, arg2, arg3, answer) \
     411        async_data_read_forward_fast(exch, method, arg1, arg2, arg3, 0, NULL)
     412#define async_data_read_forward_3_1(exch, method, arg1, arg2, arg3, answer) \
     413        async_data_read_forward_fast(exch, method, arg1, arg2, arg3, 0, \
     414            answer)
     415#define async_data_read_forward_4_0(exch, method, arg1, arg2, arg3, arg4, \
     416    answer) \
     417        async_data_read_forward_fast(exch, method, arg1, arg2, arg3, arg4, \
     418            NULL)
     419#define async_data_read_forward_4_1(exch, method, arg1, arg2, arg3, arg4, \
     420    answer) \
     421        async_data_read_forward_fast(exch, method, arg1, arg2, arg3, arg4, \
     422            answer)
     423
     424extern aid_t async_data_read(async_exch_t *, void *, size_t, ipc_call_t *);
     425extern int async_data_read_start(async_exch_t *, void *, size_t);
    346426extern bool async_data_read_receive(ipc_callid_t *, size_t *);
    347427extern int async_data_read_finalize(ipc_callid_t, const void *, size_t);
    348428
    349 extern int async_data_read_forward_fast(int, sysarg_t, sysarg_t, sysarg_t,
    350     sysarg_t, sysarg_t, ipc_call_t *);
     429extern int async_data_read_forward_fast(async_exch_t *, sysarg_t, sysarg_t,
     430    sysarg_t, sysarg_t, sysarg_t, ipc_call_t *);
    351431
    352432/*
     
    354434 */
    355435
    356 #define async_data_write_forward_0_0(phoneid, method, answer) \
    357         async_data_write_forward_fast((phoneid), (method), 0, 0, 0, 0, NULL)
    358 #define async_data_write_forward_0_1(phoneid, method, answer) \
    359         async_data_write_forward_fast((phoneid), (method), 0, 0, 0, 0, (answer))
    360 #define async_data_write_forward_1_0(phoneid, method, arg1, answer) \
    361         async_data_write_forward_fast((phoneid), (method), (arg1), 0, 0, 0, NULL)
    362 #define async_data_write_forward_1_1(phoneid, method, arg1, answer) \
    363         async_data_write_forward_fast((phoneid), (method), (arg1), 0, 0, 0, \
    364             (answer))
    365 #define async_data_write_forward_2_0(phoneid, method, arg1, arg2, answer) \
    366         async_data_write_forward_fast((phoneid), (method), (arg1), (arg2), 0, 0, \
    367             NULL)
    368 #define async_data_write_forward_2_1(phoneid, method, arg1, arg2, answer) \
    369         async_data_write_forward_fast((phoneid), (method), (arg1), (arg2), 0, 0, \
    370             (answer))
    371 #define async_data_write_forward_3_0(phoneid, method, arg1, arg2, arg3, answer) \
    372         async_data_write_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), \
    373             0, NULL)
    374 #define async_data_write_forward_3_1(phoneid, method, arg1, arg2, arg3, answer) \
    375         async_data_write_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), \
    376             0, (answer))
    377 #define async_data_write_forward_4_0(phoneid, method, arg1, arg2, arg3, arg4, answer) \
    378         async_data_write_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), \
    379             (arg4), NULL)
    380 #define async_data_write_forward_4_1(phoneid, method, arg1, arg2, arg3, arg4, answer) \
    381         async_data_write_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), \
    382             (arg4), (answer))
    383 
    384 #define async_data_write_start(p, buf, len) \
    385         async_data_write_start_generic((p), (buf), (len), IPC_XF_NONE)
    386 
    387 extern int async_data_write_start_generic(int, const void *, size_t, int);
     436#define async_data_write_forward_0_0(exch, method, answer) \
     437        async_data_write_forward_fast(exch, method, 0, 0, 0, 0, NULL)
     438#define async_data_write_forward_0_1(exch, method, answer) \
     439        async_data_write_forward_fast(exch, method, 0, 0, 0, 0, answer)
     440#define async_data_write_forward_1_0(exch, method, arg1, answer) \
     441        async_data_write_forward_fast(exch, method, arg1, 0, 0, 0, NULL)
     442#define async_data_write_forward_1_1(exch, method, arg1, answer) \
     443        async_data_write_forward_fast(exch, method, arg1, 0, 0, 0, answer)
     444#define async_data_write_forward_2_0(exch, method, arg1, arg2, answer) \
     445        async_data_write_forward_fast(exch, method, arg1, arg2, 0, 0, NULL)
     446#define async_data_write_forward_2_1(exch, method, arg1, arg2, answer) \
     447        async_data_write_forward_fast(exch, method, arg1, arg2, 0, 0, answer)
     448#define async_data_write_forward_3_0(exch, method, arg1, arg2, arg3, answer) \
     449        async_data_write_forward_fast(exch, method, arg1, arg2, arg3, 0, \
     450            NULL)
     451#define async_data_write_forward_3_1(exch, method, arg1, arg2, arg3, answer) \
     452        async_data_write_forward_fast(exch, method, arg1, arg2, arg3, 0, \
     453            answer)
     454#define async_data_write_forward_4_0(exch, method, arg1, arg2, arg3, arg4, \
     455    answer) \
     456        async_data_write_forward_fast(exch, method, arg1, arg2, arg3, arg4, \
     457            NULL)
     458#define async_data_write_forward_4_1(exch, method, arg1, arg2, arg3, arg4, \
     459    answer) \
     460        async_data_write_forward_fast(exch, method, arg1, arg2, arg3, arg4, \
     461            answer)
     462
     463extern int async_data_write_start(async_exch_t *, const void *, size_t);
    388464extern bool async_data_write_receive(ipc_callid_t *, size_t *);
    389465extern int async_data_write_finalize(ipc_callid_t, void *, size_t);
     
    393469extern void async_data_write_void(sysarg_t);
    394470
    395 extern int async_data_write_forward_fast(int, sysarg_t, sysarg_t, sysarg_t,
    396     sysarg_t, sysarg_t, ipc_call_t *);
     471extern int async_data_write_forward_fast(async_exch_t *, sysarg_t, sysarg_t,
     472    sysarg_t, sysarg_t, sysarg_t, ipc_call_t *);
     473
     474extern int async_exchange_clone(async_exch_t *, async_exch_t *);
     475extern async_sess_t *async_clone_receive(exch_mgmt_t);
     476extern async_sess_t *async_callback_receive(exch_mgmt_t);
     477extern async_sess_t *async_callback_receive_start(exch_mgmt_t, ipc_call_t *);
    397478
    398479#endif
  • uspace/lib/c/include/bitops.h

    r52a79081 ra33f0a6  
    3838#include <sys/types.h>
    3939
     40/** Mask with bit @a n set. */
     41#define BIT_V(type, n) \
     42    ((type)1 << ((n) - 1))
     43
     44/** Mask with rightmost @a n bits set. */
     45#define BIT_RRANGE(type, n) \
     46    (BIT_V(type, (n) + 1) - 1)
     47
     48/** Mask with bits @a hi .. @a lo set. @a hi >= @a lo. */
     49#define BIT_RANGE(type, hi, lo) \
     50    (BIT_RRANGE(type, (hi) - (lo) + 1) << (lo))
     51
     52/** Extract range of bits @a hi .. @a lo from @a value. */
     53#define BIT_RANGE_EXTRACT(type, hi, lo, value) \
     54    (((value) >> (lo)) & BIT_RRANGE(type, (hi) - (lo) + 1))
    4055
    4156/** Return position of first non-zero bit from left (i.e. [log_2(arg)]).
  • uspace/lib/c/include/device/char_dev.h

    r52a79081 ra33f0a6  
    3636#define LIBC_DEVICE_CHAR_DEV_H_
    3737
     38#include <async.h>
     39
    3840typedef enum {
    3941        CHAR_DEV_READ = 0,
     
    4143} char_dev_method_t;
    4244
    43 ssize_t char_dev_read(int dev_phone, void *buf, size_t len);
    44 ssize_t char_dev_write(int dev_phone, void *buf, size_t len);
     45extern ssize_t char_dev_read(async_sess_t *, void *, size_t);
     46extern ssize_t char_dev_write(async_sess_t *, void *, size_t);
    4547
    4648#endif
  • uspace/lib/c/include/device/hw_res.h

    r52a79081 ra33f0a6  
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
    28  
     28
    2929/** @addtogroup libc
    3030 * @{
     
    3232/** @file
    3333 */
    34  
     34
    3535#ifndef LIBC_DEVICE_HW_RES_H_
    3636#define LIBC_DEVICE_HW_RES_H_
    3737
    3838#include <ipc/dev_iface.h>
     39#include <async.h>
    3940#include <bool.h>
    4041
     
    4849typedef enum {
    4950        INTERRUPT,
    50         IO_RANGE, 
     51        IO_RANGE,
    5152        MEM_RANGE
    5253} hw_res_type_t;
     
    6667                        size_t size;
    6768                } mem_range;
    68 
     69               
    6970                struct {
    7071                        uint64_t address;
     
    7273                        size_t size;
    7374                } io_range;
    74 
     75               
    7576                struct {
    7677                        int irq;
     
    8889        if (hw_res->resources != NULL) {
    8990                free(hw_res->resources);
    90 
    9191                hw_res->resources = NULL;
    9292        }
    93 
     93       
    9494        hw_res->count = 0;
    9595}
    9696
    97 extern int hw_res_get_resource_list(int, hw_resource_list_t *);
    98 extern bool hw_res_enable_interrupt(int);
     97extern int hw_res_get_resource_list(async_sess_t *, hw_resource_list_t *);
     98extern bool hw_res_enable_interrupt(async_sess_t *);
    9999
    100100#endif
  • uspace/lib/c/include/devman.h

    r52a79081 ra33f0a6  
    4141#include <bool.h>
    4242
    43 extern int devman_get_phone(devman_interface_t, unsigned int);
    44 extern void devman_hangup_phone(devman_interface_t);
     43extern async_exch_t *devman_exchange_begin_blocking(devman_interface_t);
     44extern async_exch_t *devman_exchange_begin(devman_interface_t);
     45extern void devman_exchange_end(async_exch_t *);
    4546
    4647extern int devman_driver_register(const char *, async_client_conn_t);
     
    4849    devman_handle_t, devman_handle_t *);
    4950
    50 extern int devman_device_connect(devman_handle_t, unsigned int);
    51 extern int devman_parent_device_connect(devman_handle_t, unsigned int);
     51extern async_sess_t *devman_device_connect(exch_mgmt_t, devman_handle_t,
     52    unsigned int);
     53extern async_sess_t *devman_parent_device_connect(exch_mgmt_t, devman_handle_t,
     54    unsigned int);
    5255
    5356extern int devman_device_get_handle(const char *, devman_handle_t *,
     
    5558extern int devman_device_get_handle_by_class(const char *, const char *,
    5659    devman_handle_t *, unsigned int);
     60extern int devman_get_device_path(devman_handle_t, char *, size_t);
    5761
    5862extern int devman_add_device_to_class(devman_handle_t, const char *);
  • uspace/lib/c/include/devmap.h

    r52a79081 ra33f0a6  
    4040#include <bool.h>
    4141
    42 extern int devmap_get_phone(devmap_interface_t, unsigned int);
    43 extern void devmap_hangup_phone(devmap_interface_t iface);
     42extern async_exch_t *devmap_exchange_begin_blocking(devmap_interface_t);
     43extern async_exch_t *devmap_exchange_begin(devmap_interface_t);
     44extern void devmap_exchange_end(async_exch_t *);
    4445
    4546extern int devmap_driver_register(const char *, async_client_conn_t);
    4647extern int devmap_device_register(const char *, devmap_handle_t *);
    47 extern int devmap_device_register_with_iface(const char *, devmap_handle_t *, sysarg_t);
     48extern int devmap_device_register_with_iface(const char *, devmap_handle_t *,
     49    sysarg_t);
    4850
    49 extern int devmap_device_get_handle(const char *, devmap_handle_t *, unsigned int);
    50 extern int devmap_namespace_get_handle(const char *, devmap_handle_t *, unsigned int);
     51extern int devmap_device_get_handle(const char *, devmap_handle_t *,
     52    unsigned int);
     53extern int devmap_namespace_get_handle(const char *, devmap_handle_t *,
     54    unsigned int);
    5155extern devmap_handle_type_t devmap_handle_probe(devmap_handle_t);
    5256
    53 extern int devmap_device_connect(devmap_handle_t, unsigned int);
     57extern async_sess_t *devmap_device_connect(exch_mgmt_t, devmap_handle_t,
     58    unsigned int);
    5459
    5560extern int devmap_null_create(void);
  • uspace/lib/c/include/elf/elf_load.h

    r52a79081 ra33f0a6  
    11/*
     2 * Copyright (c) 2006 Sergey Bondari
    23 * Copyright (c) 2008 Jiri Svoboda
    34 * All rights reserved.
     
    3839
    3940#include <arch/elf.h>
     41#include <elf/elf.h>
    4042#include <sys/types.h>
    4143#include <loader/pcb.h>
    4244
    43 #include "elf.h"
     45/**
     46 * ELF error return codes
     47 */
     48#define EE_OK                   0       /* No error */
     49#define EE_INVALID              1       /* Invalid ELF image */
     50#define EE_MEMORY               2       /* Cannot allocate address space */
     51#define EE_INCOMPATIBLE         3       /* ELF image is not compatible with current architecture */
     52#define EE_UNSUPPORTED          4       /* Non-supported ELF (e.g. dynamic ELFs) */
     53#define EE_LOADER               5       /* The image is actually a program loader. */
     54#define EE_IRRECOVERABLE        6
     55
     56typedef enum {
     57        /** Leave all segments in RW access mode. */
     58        ELDF_RW = 1
     59} eld_flags_t;
    4460
    4561/**
     
    6783        uintptr_t bias;
    6884
     85        /** Flags passed to the ELF loader. */
     86        eld_flags_t flags;
     87
    6988        /** A copy of the ELF file header */
    7089        elf_header_t *header;
     
    7493} elf_ld_t;
    7594
    76 int elf_load_file(const char *file_name, size_t so_bias, elf_info_t *info);
    77 void elf_run(elf_info_t *info, pcb_t *pcb);
    78 void elf_create_pcb(elf_info_t *info, pcb_t *pcb);
     95extern const char *elf_error(unsigned int);
     96extern int elf_load_file(const char *, size_t, eld_flags_t, elf_info_t *);
     97extern void elf_create_pcb(elf_info_t *, pcb_t *);
    7998
    8099#endif
  • uspace/lib/c/include/errno.h

    r52a79081 ra33f0a6  
    5656#define EMLINK        (-266)
    5757
     58/** Bad checksum. */
     59#define EBADCHECKSUM  (-300)
     60
     61/** USB: stalled operation. */
     62#define ESTALL (-301)
     63
     64/** Empty resource (no data). */
     65#define EEMPTY (-302)
     66
     67/** Negative acknowledgment. */
     68#define ENAK (-303)
     69
    5870/** An API function is called while another blocking function is in progress. */
    5971#define EINPROGRESS  (-10036)
  • uspace/lib/c/include/event.h

    r52a79081 ra33f0a6  
    3939
    4040extern int event_subscribe(event_type_t, sysarg_t);
     41extern int event_unmask(event_type_t);
    4142
    4243#endif
  • uspace/lib/c/include/fibril.h

    r52a79081 ra33f0a6  
    7070        int (*func)(void *);
    7171        tcb_t *tcb;
    72 
     72       
    7373        struct fibril *clean_after_me;
    7474        int retval;
    7575        int flags;
    76 
     76       
    7777        fibril_owner_info_t *waits_for;
    7878} fibril_t;
  • uspace/lib/c/include/fibril_synch.h

    r52a79081 ra33f0a6  
    4545        fibril_owner_info_t oi;  /**< Keep this the first thing. */
    4646        int counter;
    47         link_t waiters;
     47        list_t waiters;
    4848} fibril_mutex_t;
    4949
     
    5555                .counter = 1, \
    5656                .waiters = { \
    57                         .prev = &name.waiters, \
    58                         .next = &name.waiters, \
     57                        .head = { \
     58                                .prev = &(name).waiters.head, \
     59                                .next = &(name).waiters.head, \
     60                        } \
    5961                } \
    6062        }
     
    6769        unsigned writers;
    6870        unsigned readers;
    69         link_t waiters;
     71        list_t waiters;
    7072} fibril_rwlock_t;
    7173
     
    7880                .writers = 0, \
    7981                .waiters = { \
    80                         .prev = &name.waiters, \
    81                         .next = &name.waiters, \
     82                        .head = { \
     83                                .prev = &(name).waiters.head, \
     84                                .next = &(name).waiters.head, \
     85                        } \
    8286                } \
    8387        }
     
    8791
    8892typedef struct {
    89         link_t waiters;
     93        list_t waiters;
    9094} fibril_condvar_t;
    9195
     
    9397        { \
    9498                .waiters = { \
    95                         .next = &name.waiters, \
    96                         .prev = &name.waiters, \
     99                        .head = { \
     100                                .next = &(name).waiters.head, \
     101                                .prev = &(name).waiters.head, \
     102                        } \
    97103                } \
    98104        }
  • uspace/lib/c/include/io/console.h

    r52a79081 ra33f0a6  
    3636#define LIBC_IO_CONSOLE_H_
    3737
     38#include <sys/time.h>
     39#include <async.h>
    3840#include <bool.h>
    39 
    40 typedef enum {
    41         KEY_PRESS,
    42         KEY_RELEASE
    43 } console_ev_type_t;
     41#include <stdio.h>
    4442
    4543typedef enum {
     
    5048} console_caps_t;
    5149
     50/** Console control structure. */
     51typedef struct {
     52        /** Console input file */
     53        FILE *input;
     54       
     55        /** Console output file */
     56        FILE *output;
     57       
     58        /** Console input session */
     59        async_sess_t *input_sess;
     60       
     61        /** Console output session */
     62        async_sess_t *output_sess;
     63       
     64        /** Input request call with timeout */
     65        ipc_call_t input_call;
     66       
     67        /** Input response with timeout */
     68        aid_t input_aid;
     69} console_ctrl_t;
     70
     71typedef enum {
     72        KEY_PRESS,
     73        KEY_RELEASE
     74} kbd_event_type_t;
     75
    5276/** Console event structure. */
    5377typedef struct {
    5478        /** Press or release event. */
    55         console_ev_type_t type;
     79        kbd_event_type_t type;
    5680       
    5781        /** Keycode of the key that was pressed or released. */
     
    6387        /** The character that was generated or '\0' for none. */
    6488        wchar_t c;
    65 } console_event_t;
     89} kbd_event_t;
    6690
    67 extern void console_clear(int phone);
     91extern console_ctrl_t *console_init(FILE *, FILE *);
     92extern void console_done(console_ctrl_t *);
     93extern bool console_kcon(void);
    6894
    69 extern int console_get_size(int phone, sysarg_t *cols, sysarg_t *rows);
    70 extern int console_get_pos(int phone, sysarg_t *col, sysarg_t *row);
    71 extern void console_set_pos(int phone, sysarg_t col, sysarg_t row);
     95extern void console_flush(console_ctrl_t *);
     96extern void console_clear(console_ctrl_t *);
    7297
    73 extern void console_set_style(int phone, uint8_t style);
    74 extern void console_set_color(int phone, uint8_t fg_color, uint8_t bg_color,
    75     uint8_t flags);
    76 extern void console_set_rgb_color(int phone, uint32_t fg_color, uint32_t bg_color);
     98extern int console_get_size(console_ctrl_t *, sysarg_t *, sysarg_t *);
     99extern int console_get_pos(console_ctrl_t *, sysarg_t *, sysarg_t *);
     100extern void console_set_pos(console_ctrl_t *, sysarg_t, sysarg_t);
    77101
    78 extern void console_cursor_visibility(int phone, bool show);
    79 extern int console_get_color_cap(int phone, sysarg_t *ccap);
    80 extern void console_kcon_enable(int phone);
     102extern void console_set_style(console_ctrl_t *, uint8_t);
     103extern void console_set_color(console_ctrl_t *, uint8_t, uint8_t, uint8_t);
     104extern void console_set_rgb_color(console_ctrl_t *, uint32_t, uint32_t);
    81105
    82 extern bool console_get_event(int phone, console_event_t *event);
     106extern void console_cursor_visibility(console_ctrl_t *, bool);
     107extern int console_get_color_cap(console_ctrl_t *, sysarg_t *);
     108extern bool console_get_kbd_event(console_ctrl_t *, kbd_event_t *);
     109extern bool console_get_kbd_event_timeout(console_ctrl_t *, kbd_event_t *,
     110    suseconds_t *);
    83111
    84112#endif
  • uspace/lib/c/include/io/klog.h

    r52a79081 ra33f0a6  
    3737
    3838#include <sys/types.h>
     39#include <stdarg.h>
    3940
    4041extern size_t klog_write(const void *, size_t);
    4142extern void klog_update(void);
     43extern int klog_printf(const char *, ...);
     44extern int klog_vprintf(const char *, va_list);
    4245
    4346#endif
  • uspace/lib/c/include/ipc/clipboard.h

    r52a79081 ra33f0a6  
    3636#define LIBC_IPC_CLIPBOARD_H_
    3737
     38#include <ipc/common.h>
     39
    3840typedef enum {
    3941        CLIPBOARD_PUT_DATA = IPC_FIRST_USER_METHOD,
  • uspace/lib/c/include/ipc/console.h

    r52a79081 ra33f0a6  
    4848        CONSOLE_SET_COLOR,
    4949        CONSOLE_SET_RGB_COLOR,
    50         CONSOLE_CURSOR_VISIBILITY,
    51         CONSOLE_KCON_ENABLE
     50        CONSOLE_CURSOR_VISIBILITY
    5251} console_request_t;
    5352
  • uspace/lib/c/include/ipc/dev_iface.h

    r52a79081 ra33f0a6  
    3737        HW_RES_DEV_IFACE = 0,
    3838        CHAR_DEV_IFACE,
     39
     40        /** Interface provided by any PCI device. */
     41        PCI_DEV_IFACE,
     42
     43        /** Interface provided by any USB device. */
     44        USB_DEV_IFACE,
     45        /** Interface provided by USB host controller. */
     46        USBHC_DEV_IFACE,
     47        /** Interface provided by USB HID devices. */
     48        USBHID_DEV_IFACE,
     49
    3950        DEV_IFACE_MAX
    4051} dev_inferface_idx_t;
     
    4859        DEV_IFACE_ID(DEV_FIRST_CUSTOM_METHOD_IDX)
    4960
     61/*
     62 * The first argument is actually method (as the "real" method is used
     63 * for indexing into interfaces.
     64 */
     65
     66#define DEV_IPC_GET_ARG1(call) IPC_GET_ARG2((call))
     67#define DEV_IPC_GET_ARG2(call) IPC_GET_ARG3((call))
     68#define DEV_IPC_GET_ARG3(call) IPC_GET_ARG4((call))
     69#define DEV_IPC_GET_ARG4(call) IPC_GET_ARG5((call))
     70
    5071
    5172#endif
  • uspace/lib/c/include/ipc/devman.h

    r52a79081 ra33f0a6  
    7272 */
    7373typedef struct match_id_list {
    74         link_t ids;
     74        list_t ids;
    7575} match_id_list_t;
    7676
     
    9595{
    9696        match_id_t *mid = NULL;
    97         link_t *link = ids->ids.next;
     97        link_t *link = ids->ids.head.next;
    9898       
    99         while (link != &ids->ids) {
     99        while (link != &ids->ids.head) {
    100100                mid = list_get_instance(link, match_id_t,link);
    101101                if (mid->score < id->score) {
    102102                        break;
    103                 }       
     103                }
    104104                link = link->next;
    105105        }
     
    118118        match_id_t *id;
    119119       
    120         while(!list_empty(&ids->ids)) {
    121                 link = ids->ids.next;
    122                 list_remove(link);             
     120        while (!list_empty(&ids->ids)) {
     121                link = list_first(&ids->ids);
     122                list_remove(link);
    123123                id = list_get_instance(link, match_id_t, link);
    124                 delete_match_id(id);           
    125         }       
     124                delete_match_id(id);
     125        }
    126126}
    127127
     
    149149typedef enum {
    150150        DEVMAN_DEVICE_GET_HANDLE = IPC_FIRST_USER_METHOD,
    151         DEVMAN_DEVICE_GET_HANDLE_BY_CLASS
     151        DEVMAN_DEVICE_GET_HANDLE_BY_CLASS,
     152        DEVMAN_DEVICE_GET_DEVICE_PATH
    152153} client_to_devman_t;
    153154
  • uspace/lib/c/include/ipc/devmap.h

    r52a79081 ra33f0a6  
    3131 */
    3232
    33 #ifndef DEVMAP_DEVMAP_H_
    34 #define DEVMAP_DEVMAP_H_
     33#ifndef LIBC_IPC_DEVMAP_H_
     34#define LIBC_IPC_DEVMAP_H_
    3535
    3636#include <ipc/common.h>
  • uspace/lib/c/include/ipc/ipc.h

    r52a79081 ra33f0a6  
    4242#include <sys/types.h>
    4343#include <ipc/common.h>
     44#include <kernel/ipc/ipc_methods.h>
    4445#include <kernel/synch/synch.h>
    4546#include <task.h>
     
    255256extern int ipc_connect_to_me(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t *,
    256257    sysarg_t *);
     258extern int ipc_connect_me(int);
    257259extern int ipc_connect_me_to(int, sysarg_t, sysarg_t, sysarg_t);
    258260extern int ipc_connect_me_to_blocking(int, sysarg_t, sysarg_t, sysarg_t);
  • uspace/lib/c/include/ipc/mouseev.h

    r52a79081 ra33f0a6  
    2727 */
    2828
    29 /** @addtogroup kbdgen generic
    30  * @brief HelenOS generic uspace keyboard handler.
    31  * @ingroup kbd
     29/** @addtogroup mouse
     30 * @brief
    3231 * @{
    3332 */
     
    3534 */
    3635
    37 #ifndef LIBC_IPC_KBD_H_
    38 #define LIBC_IPC_KBD_H_
     36#ifndef LIBC_IPC_MOUSEEV_H_
     37#define LIBC_IPC_MOUSEEV_H_
    3938
    4039#include <ipc/common.h>
     40#include <ipc/dev_iface.h>
    4141
    4242typedef enum {
    43         KBD_YIELD = IPC_FIRST_USER_METHOD,
    44         KBD_RECLAIM
    45 } kbd_request_t;
     43        MOUSEEV_YIELD = DEV_FIRST_CUSTOM_METHOD,
     44        MOUSEEV_RECLAIM
     45} mouseev_request_t;
    4646
    4747typedef enum {
    48         KBD_EVENT = IPC_FIRST_USER_METHOD
    49 } kbd_notif_t;
     48        MOUSEEV_MOVE_EVENT = IPC_FIRST_USER_METHOD,
     49        MOUSEEV_BUTTON_EVENT
     50} mouseev_notif_t;
    5051
    5152#endif
  • uspace/lib/c/include/ipc/net.h

    r52a79081 ra33f0a6  
    335335#define IPC_GET_ERROR(call)  ((services_t) IPC_GET_ARG4(call))
    336336
    337 /** Return the phone message argument.
    338  *
    339  * @param[in] call Message call structure.
    340  *
    341  */
    342 #define IPC_GET_PHONE(call)  ((int) IPC_GET_ARG5(call))
    343 
    344337/** Set the device identifier in the message answer.
    345338 *
  • uspace/lib/c/include/ipc/ns.h

    r52a79081 ra33f0a6  
    3333 */
    3434
    35 #ifndef LIBC_NS_H_
    36 #define LIBC_NS_H_
     35#ifndef LIBC_IPC_NS_H_
     36#define LIBC_IPC_NS_H_
    3737
    38 #include <sys/types.h>
    3938#include <ipc/common.h>
    4039
     
    4645} ns_request_t;
    4746
    48 extern int service_register(sysarg_t);
    49 extern int service_connect(sysarg_t, sysarg_t, sysarg_t);
    50 extern int service_connect_blocking(sysarg_t, sysarg_t, sysarg_t);
    51 
    5247#endif
    5348
  • uspace/lib/c/include/ipc/serial_ctl.h

    r52a79081 ra33f0a6  
    3232#include <ipc/dev_iface.h>
    3333
    34 /** ipc methods for getting/setting serial communication properties
    35  *      1st ipc arg: baud rate
    36  *      2nd ipc arg: parity
    37  *      3rd ipc arg: number of bits in one word
    38  *      4th ipc arg: number of stop bits
     34/** IPC methods for getting/setting serial communication properties
     35 *
     36 * 1st IPC arg: baud rate
     37 * 2nd IPC arg: parity
     38 * 3rd IPC arg: number of bits in one word
     39 * 4th IPC arg: number of stop bits
     40 *
    3941 */
    40 typedef enum { 
     42typedef enum {
    4143        SERIAL_GET_COM_PROPS = DEV_FIRST_CUSTOM_METHOD,
    4244        SERIAL_SET_COM_PROPS
     
    4850        SERIAL_EVEN_PARITY = 3,
    4951        SERIAL_MARK_PARITY = 5,
    50         SERIAL_SPACE_PARITY = 7 
     52        SERIAL_SPACE_PARITY = 7
    5153} serial_parity_t;
    5254
  • uspace/lib/c/include/ipc/services.h

    r52a79081 ra33f0a6  
    3838#define LIBC_SERVICES_H_
    3939
     40#include <fourcc.h>
     41
    4042typedef enum {
    41         SERVICE_NONE = 0,
    42         SERVICE_LOAD,
    43         SERVICE_PCI,
    44         SERVICE_VIDEO,
    45         SERVICE_CONSOLE,
    46         SERVICE_VFS,
    47         SERVICE_DEVMAP,
    48         SERVICE_DEVMAN,
    49         SERVICE_IRC,
    50         SERVICE_CLIPBOARD,
    51         SERVICE_NETWORKING,
    52         SERVICE_LO,
    53         SERVICE_NE2000,
    54         SERVICE_ETHERNET,
    55         SERVICE_NILDUMMY,
    56         SERVICE_IP,
    57         SERVICE_ARP,
    58         SERVICE_RARP,
    59         SERVICE_ICMP,
    60         SERVICE_UDP,
    61         SERVICE_TCP,
    62         SERVICE_SOCKET
     43        SERVICE_NONE       = 0,
     44        SERVICE_LOAD       = FOURCC('l', 'o', 'a', 'd'),
     45        SERVICE_VIDEO      = FOURCC('v', 'i', 'd', ' '),
     46        SERVICE_VFS        = FOURCC('v', 'f', 's', ' '),
     47        SERVICE_DEVMAP     = FOURCC('d', 'e', 'v', 'p'),
     48        SERVICE_DEVMAN     = FOURCC('d', 'e', 'v', 'n'),
     49        SERVICE_IRC        = FOURCC('i', 'r', 'c', ' '),
     50        SERVICE_CLIPBOARD  = FOURCC('c', 'l', 'i', 'p'),
     51        SERVICE_NETWORKING = FOURCC('n', 'e', 't', ' '),
     52        SERVICE_LO         = FOURCC('l', 'o', ' ', ' '),
     53        SERVICE_NE2000     = FOURCC('n', 'e', '2', 'k'),
     54        SERVICE_ETHERNET   = FOURCC('e', 't', 'h', ' '),
     55        SERVICE_NILDUMMY   = FOURCC('n', 'i', 'l', 'd'),
     56        SERVICE_IP         = FOURCC('i', 'p', 'v', '4'),
     57        SERVICE_ARP        = FOURCC('a', 'r', 'p', ' '),
     58        SERVICE_ICMP       = FOURCC('i', 'c', 'm', 'p'),
     59        SERVICE_UDP        = FOURCC('u', 'd', 'p', ' '),
     60        SERVICE_TCP        = FOURCC('t', 'c', 'p', ' ')
    6361} services_t;
    6462
  • uspace/lib/c/include/ipc/vfs.h

    r52a79081 ra33f0a6  
    6969        VFS_IN_FSTAT,
    7070        VFS_IN_CLOSE,
     71        VFS_IN_PING,
    7172        VFS_IN_MOUNT,
    7273        VFS_IN_UNMOUNT,
  • uspace/lib/c/include/loader/loader.h

    r52a79081 ra33f0a6  
    4040#include <vfs/vfs.h>
    4141
    42 /** Abstraction of a loader connection */
    43 typedef struct {
    44         /** ID of the phone connected to the loader. */
    45         int phone_id;
    46 } loader_t;
     42/** Forward declararion */
     43struct loader;
     44typedef struct loader loader_t;
    4745
    4846extern int loader_spawn(const char *);
  • uspace/lib/c/include/loader/pcb.h

    r52a79081 ra33f0a6  
    7272        /** Pointer to ELF dynamic section of the program. */
    7373        void *dynamic;
     74        /** Pointer to dynamic linker state structure (runtime_env_t). */
     75        void *rtld_runtime;
    7476} pcb_t;
    7577
  • uspace/lib/c/include/malloc.h

    r52a79081 ra33f0a6  
    4646extern void *realloc(const void *addr, const size_t size);
    4747extern void free(const void *addr);
     48extern void *heap_check(void);
    4849
    4950#endif
  • uspace/lib/c/include/net/icmp_api.h

    r52a79081 ra33f0a6  
    4242#include <sys/types.h>
    4343#include <sys/time.h>
    44 
    4544#include <adt/measured_strings.h>
    4645#include <net/ip_codes.h>
    4746#include <net/icmp_codes.h>
    4847#include <net/icmp_common.h>
     48#include <async.h>
    4949
    5050/** @name ICMP module application interface
     
    5353/*@{*/
    5454
    55 extern int icmp_echo_msg(int, size_t, mseconds_t, ip_ttl_t, ip_tos_t, int,
    56     const struct sockaddr *, socklen_t);
     55extern int icmp_echo_msg(async_sess_t *, size_t, mseconds_t, ip_ttl_t, ip_tos_t,
     56    int, const struct sockaddr *, socklen_t);
    5757
    5858/*@}*/
  • uspace/lib/c/include/net/icmp_common.h

    r52a79081 ra33f0a6  
    4040#include <ipc/services.h>
    4141#include <sys/time.h>
     42#include <async.h>
    4243
    43 /** Default timeout for incoming connections in microseconds (1 sec). */
    44 #define ICMP_CONNECT_TIMEOUT  1000000
    45 
    46 extern int icmp_connect_module(suseconds_t);
     44extern async_sess_t *icmp_connect_module(void);
    4745
    4846#endif
  • uspace/lib/c/include/net/modules.h

    r52a79081 ra33f0a6  
    4646#include <sys/time.h>
    4747
    48 /** Connect to the needed module function type definition.
     48/** Connect to module function type definition.
    4949 *
    50  * @param[in] need The needed module service.
    51  *
    52  * @return The phone of the needed service.
     50 * @return Session to the service.
    5351 *
    5452 */
    55 typedef int connect_module_t(services_t need);
     53typedef async_sess_t *connect_module_t(services_t);
    5654
    5755extern void answer_call(ipc_callid_t, int, ipc_call_t *, size_t);
    58 extern int bind_service(services_t, sysarg_t, sysarg_t, sysarg_t,
     56extern async_sess_t *bind_service(services_t, sysarg_t, sysarg_t, sysarg_t,
    5957    async_client_conn_t);
    60 extern int bind_service_timeout(services_t, sysarg_t, sysarg_t, sysarg_t,
    61     async_client_conn_t, suseconds_t);
    62 extern int connect_to_service(services_t);
    63 extern int connect_to_service_timeout(services_t, suseconds_t);
     58extern async_sess_t *connect_to_service(services_t);
    6459extern int data_reply(void *, size_t);
    6560extern void refresh_answer(ipc_call_t *, size_t *);
  • uspace/lib/c/include/ns.h

    r52a79081 ra33f0a6  
    11/*
    2  * Copyright (c) 2009 Jiri Svoboda
     2 * Copyright (c) 2006 Ondrej Palkovsky
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup kbdgen generic
    30  * @brief HelenOS generic uspace keyboard handler.
    31  * @ingroup kbd
     29/** @addtogroup libc
    3230 * @{
    3331 */
     
    3533 */
    3634
    37 #ifndef KBD_LAYOUT_H_
    38 #define KBD_LAYOUT_H_
     35#ifndef LIBC_NS_H_
     36#define LIBC_NS_H_
    3937
    4038#include <sys/types.h>
    41 #include <io/console.h>
     39#include <task.h>
     40#include <async.h>
    4241
    43 typedef struct {
    44         void (*reset)(void);
    45         wchar_t (*parse_ev)(console_event_t *);
    46 } layout_op_t;
     42extern int service_register(sysarg_t);
     43extern async_sess_t *service_connect(exch_mgmt_t, sysarg_t, sysarg_t, sysarg_t);
     44extern async_sess_t *service_connect_blocking(exch_mgmt_t, sysarg_t, sysarg_t,
     45    sysarg_t);
    4746
    48 extern layout_op_t us_qwerty_op;
    49 extern layout_op_t us_dvorak_op;
    50 extern layout_op_t cz_op;
     47extern int ns_ping(void);
     48extern int ns_intro(task_id_t);
    5149
    5250#endif
    5351
    54 /**
    55  * @}
     52/** @}
    5653 */
  • uspace/lib/c/include/stdio.h

    r52a79081 ra33f0a6  
    9797};
    9898
    99 typedef struct {
    100         /** Linked list pointer. */
    101         link_t link;
    102        
    103         /** Underlying file descriptor. */
    104         int fd;
    105        
    106         /** Error indicator. */
    107         int error;
    108        
    109         /** End-of-file indicator. */
    110         int eof;
    111        
    112         /** Klog indicator */
    113         int klog;
    114        
    115         /** Phone to the file provider */
    116         int phone;
    117 
    118         /**
    119          * Non-zero if the stream needs sync on fflush(). XXX change
    120          * console semantics so that sync is not needed.
    121          */
    122         int need_sync;
    123 
    124         /** Buffering type */
    125         enum _buffer_type btype;
    126 
    127         /** Buffer */
    128         uint8_t *buf;
    129 
    130         /** Buffer size */
    131         size_t buf_size;
    132 
    133         /** Buffer state */
    134         enum _buffer_state buf_state;
    135 
    136         /** Buffer I/O pointer */
    137         uint8_t *buf_head;
    138 
    139         /** Points to end of occupied space when in read mode. */
    140         uint8_t *buf_tail;
    141 } FILE;
     99/** Forward declaration */
     100struct _IO_FILE;
     101typedef struct _IO_FILE FILE;
    142102
    143103extern FILE *stdin;
  • uspace/lib/c/include/str.h

    r52a79081 ra33f0a6  
    4949#define STR_BOUNDS(length)  ((length) << 2)
    5050
     51/**
     52 * Maximum size of a buffer needed to a string converted from space-padded
     53 * ASCII of size @a spa_size using spascii_to_str().
     54 */
     55#define SPASCII_STR_BUFSIZE(spa_size) ((spa_size) + 1)
     56
    5157extern wchar_t str_decode(const char *str, size_t *offset, size_t sz);
    5258extern int chr_encode(const wchar_t ch, char *str, size_t *offset, size_t sz);
     
    7682
    7783extern int wstr_to_str(char *dest, size_t size, const wchar_t *src);
     84extern int spascii_to_str(char *dest, size_t size, const uint8_t *src, size_t n);
     85extern void wstr_to_str(char *dest, size_t size, const wchar_t *src);
    7886extern char *wstr_to_astr(const wchar_t *src);
    7987extern int str_to_wstr(wchar_t *dest, size_t dlen, const char *src);
  • uspace/lib/c/include/sys/time.h

    r52a79081 ra33f0a6  
    6262extern int gettimeofday(struct timeval *tv, struct timezone *tz);
    6363
     64extern void udelay(useconds_t);
     65
    6466#endif
    6567
  • uspace/lib/c/include/task.h

    r52a79081 ra33f0a6  
    3737
    3838#include <sys/types.h>
     39#include <vfs/vfs.h>
    3940
    4041typedef uint64_t task_id_t;
     
    5152extern task_id_t task_spawn(const char *, const char *const[], int *);
    5253extern int task_spawnv(task_id_t *, const char *path, const char *const []);
     54extern int task_spawnvf(task_id_t *, const char *path, const char *const [],
     55    fdi_node_t *const []);
    5356extern int task_spawnl(task_id_t *, const char *path, ...);
    5457
  • uspace/lib/c/include/udebug.h

    r52a79081 ra33f0a6  
    3838#include <kernel/udebug/udebug.h>
    3939#include <sys/types.h>
     40#include <async.h>
    4041
    4142typedef sysarg_t thash_t;
    4243
    43 int udebug_begin(int);
    44 int udebug_end(int);
    45 int udebug_set_evmask(int, udebug_evmask_t);
    46 int udebug_thread_read(int, void *, size_t , size_t *, size_t *);
    47 int udebug_name_read(int, void *, size_t, size_t *, size_t *);
    48 int udebug_areas_read(int, void *, size_t, size_t *, size_t *);
    49 int udebug_mem_read(int, void *, uintptr_t, size_t);
    50 int udebug_args_read(int, thash_t, sysarg_t *);
    51 int udebug_regs_read(int, thash_t, void *);
    52 int udebug_go(int, thash_t, udebug_event_t *, sysarg_t *, sysarg_t *);
    53 int udebug_stop(int, thash_t);
     44extern int udebug_begin(async_sess_t *);
     45extern int udebug_end(async_sess_t *);
     46extern int udebug_set_evmask(async_sess_t *, udebug_evmask_t);
     47extern int udebug_thread_read(async_sess_t *, void *, size_t , size_t *,
     48    size_t *);
     49extern int udebug_name_read(async_sess_t *, void *, size_t, size_t *,
     50    size_t *);
     51extern int udebug_areas_read(async_sess_t *, void *, size_t, size_t *,
     52    size_t *);
     53extern int udebug_mem_read(async_sess_t *, void *, uintptr_t, size_t);
     54extern int udebug_args_read(async_sess_t *, thash_t, sysarg_t *);
     55extern int udebug_regs_read(async_sess_t *, thash_t, void *);
     56extern int udebug_go(async_sess_t *, thash_t, udebug_event_t *, sysarg_t *,
     57    sysarg_t *);
     58extern int udebug_stop(async_sess_t *, thash_t);
    5459
    5560#endif
  • uspace/lib/c/include/unistd.h

    r52a79081 ra33f0a6  
    6363extern ssize_t read(int, void *, size_t);
    6464
     65extern ssize_t read_all(int, void *, size_t);
     66extern ssize_t write_all(int, const void *, size_t);
     67
    6568extern off64_t lseek(int, off64_t, int);
    6669extern int ftruncate(int, aoff64_t);
  • uspace/lib/c/include/vfs/vfs.h

    r52a79081 ra33f0a6  
    4141#include <stdio.h>
    4242
    43 /**
    44  * This type is a libc version of the VFS triplet.
    45  * It uniquely identifies a file system node within a file system instance.
     43/** Libc version of the VFS triplet.
     44 *
     45 * Unique identification of a file system node
     46 * within a file system instance.
     47 *
    4648 */
    4749typedef struct {
     
    5860
    5961extern int open_node(fdi_node_t *, int);
    60 extern int fd_phone(int);
    6162extern int fd_node(int, fdi_node_t *);
    6263
    6364extern FILE *fopen_node(fdi_node_t *, const char *);
    64 extern int fphone(FILE *);
    6565extern int fnode(FILE *, fdi_node_t *);
    6666
Note: See TracChangeset for help on using the changeset viewer.