Changeset fdbc3ff in mainline for uspace/lib/c
- Timestamp:
- 2010-11-19T23:50:06Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 46d4d9f
- Parents:
- b4c9c61 (diff), a9c6b966 (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. - Location:
- uspace/lib/c
- Files:
-
- 1 deleted
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/adt/char_map.c
rb4c9c61 rfdbc3ff 60 60 * @param[in] value The integral value to be stored for the key character 61 61 * string. 62 * @return sEOK on success.63 * @return sENOMEM if there is not enough memory left.64 * @return sEEXIST if the key character string is already used.62 * @return EOK on success. 63 * @return ENOMEM if there is not enough memory left. 64 * @return EEXIST if the key character string is already used. 65 65 */ 66 66 static int 67 char_map_add_item(char_map_ refmap, const char *identifier, size_t length,67 char_map_add_item(char_map_t *map, const char *identifier, size_t length, 68 68 const int value) 69 69 { 70 70 if (map->next == (map->size - 1)) { 71 char_map_ ref*tmp;72 73 tmp = (char_map_ ref*) realloc(map->items,74 sizeof(char_map_ ref) * 2 * map->size);71 char_map_t **tmp; 72 73 tmp = (char_map_t **) realloc(map->items, 74 sizeof(char_map_t *) * 2 * map->size); 75 75 if (!tmp) 76 76 return ENOMEM; … … 80 80 } 81 81 82 map->items[map->next] = (char_map_ ref) malloc(sizeof(char_map_t));82 map->items[map->next] = (char_map_t *) malloc(sizeof(char_map_t)); 83 83 if (!map->items[map->next]) 84 84 return ENOMEM; … … 107 107 * 108 108 * @param[in] map The character string to integer map. 109 * @return sTRUE if the map is valid.110 * @return sFALSE otherwise.111 */ 112 static int char_map_is_valid(const char_map_ refmap)109 * @return TRUE if the map is valid. 110 * @return FALSE otherwise. 111 */ 112 static int char_map_is_valid(const char_map_t *map) 113 113 { 114 114 return map && (map->magic == CHAR_MAP_MAGIC_VALUE); … … 127 127 * @param[in] value The integral value to be stored for the key character 128 128 * string. 129 * @return sEOK on success.130 * @return sEINVAL if the map is not valid.131 * @return sEINVAL if the identifier parameter is NULL.132 * @return sEINVAL if the length parameter zero (0) and the129 * @return EOK on success. 130 * @return EINVAL if the map is not valid. 131 * @return EINVAL if the identifier parameter is NULL. 132 * @return EINVAL if the length parameter zero (0) and the 133 133 * identifier parameter is an empty character string (the 134 134 * first character is the terminating zero ('\0') 135 135 * character. 136 * @return sEEXIST if the key character string is already used.137 * @return sOther error codes as defined for the136 * @return EEXIST if the key character string is already used. 137 * @return Other error codes as defined for the 138 138 * char_map_add_item() function. 139 139 */ 140 140 int 141 char_map_add(char_map_ refmap, const char *identifier, size_t length,141 char_map_add(char_map_t *map, const char *identifier, size_t length, 142 142 const int value) 143 143 { … … 172 172 * @param[in,out] map The character string to integer map. 173 173 */ 174 void char_map_destroy(char_map_ refmap)174 void char_map_destroy(char_map_t *map) 175 175 { 176 176 if (char_map_is_valid(map)) { … … 196 196 * zero (0) which means that the string is processed until 197 197 * the terminating zero ('\0') character is found. 198 * @return sThe node holding the integral value assigned to the key198 * @return The node holding the integral value assigned to the key 199 199 * character string. 200 * @return sNULL if the key is not assigned a node.201 */ 202 static char_map_ ref203 char_map_find_node(const char_map_ refmap, const char *identifier,200 * @return NULL if the key is not assigned a node. 201 */ 202 static char_map_t * 203 char_map_find_node(const char_map_t *map, const char *identifier, 204 204 size_t length) 205 205 { … … 224 224 } 225 225 226 return map;226 return (char_map_t *) map; 227 227 } 228 228 … … 239 239 * zero (0) which means that the string is processed until 240 240 * the terminating zero ('\0') character is found. 241 * @return sThe integral value assigned to the key character string.242 * @return sCHAR_MAP_NULL if the key is not assigned a value.243 */ 244 int char_map_exclude(char_map_ refmap, const char *identifier, size_t length)245 { 246 char_map_ refnode;241 * @return The integral value assigned to the key character string. 242 * @return CHAR_MAP_NULL if the key is not assigned a value. 243 */ 244 int char_map_exclude(char_map_t *map, const char *identifier, size_t length) 245 { 246 char_map_t *node; 247 247 248 248 node = char_map_find_node(map, identifier, length); … … 267 267 * zero (0) which means that the string is processed until 268 268 * the terminating zero ('\0') character is found. 269 * @return sThe integral value assigned to the key character string.270 * @return sCHAR_MAP_NULL if the key is not assigned a value.271 */ 272 int char_map_find(const char_map_ refmap, const char *identifier, size_t length)273 { 274 char_map_ refnode;269 * @return The integral value assigned to the key character string. 270 * @return CHAR_MAP_NULL if the key is not assigned a value. 271 */ 272 int char_map_find(const char_map_t *map, const char *identifier, size_t length) 273 { 274 char_map_t *node; 275 275 276 276 node = char_map_find_node(map, identifier, length); … … 281 281 * 282 282 * @param[in,out] map The character string to integer map. 283 * @return sEOK on success.284 * @return sEINVAL if the map parameter is NULL.285 * @return sENOMEM if there is not enough memory left.286 */ 287 int char_map_initialize(char_map_ refmap)283 * @return EOK on success. 284 * @return EINVAL if the map parameter is NULL. 285 * @return ENOMEM if there is not enough memory left. 286 */ 287 int char_map_initialize(char_map_t *map) 288 288 { 289 289 if (!map) … … 295 295 map->next = 0; 296 296 297 map->items = malloc(sizeof(char_map_ ref) * map->size);297 map->items = malloc(sizeof(char_map_t *) * map->size); 298 298 if (!map->items) { 299 299 map->magic = 0; … … 319 319 * @param[in] value The integral value to be stored for the key character 320 320 * string. 321 * @return sEOK on success.322 * @return sEINVAL if the map is not valid.323 * @return sEINVAL if the identifier parameter is NULL.324 * @return sEINVAL if the length parameter zero (0) and the321 * @return EOK on success. 322 * @return EINVAL if the map is not valid. 323 * @return EINVAL if the identifier parameter is NULL. 324 * @return EINVAL if the length parameter zero (0) and the 325 325 * identifier parameter is an empty character string (the 326 326 * first character is the terminating zero ('\0) character. 327 * @return sEEXIST if the key character string is already used.328 * @return sOther error codes as defined for the char_map_add_item()327 * @return EEXIST if the key character string is already used. 328 * @return Other error codes as defined for the char_map_add_item() 329 329 * function. 330 330 */ 331 331 int 332 char_map_update(char_map_ refmap, const char *identifier, const size_t length,332 char_map_update(char_map_t *map, const char *identifier, const size_t length, 333 333 const int value) 334 334 { 335 char_map_ refnode;335 char_map_t *node; 336 336 337 337 node = char_map_find_node(map, identifier, length); -
uspace/lib/c/generic/adt/dynamic_fifo.c
rb4c9c61 rfdbc3ff 56 56 * 57 57 * @param[in] fifo The dynamic queue. 58 * @return sTRUE if the queue is valid.59 * @return sFALSE otherwise.60 */ 61 static int dyn_fifo_is_valid(dyn_fifo_ reffifo)58 * @return TRUE if the queue is valid. 59 * @return FALSE otherwise. 60 */ 61 static int dyn_fifo_is_valid(dyn_fifo_t *fifo) 62 62 { 63 63 return fifo && (fifo->magic_value == DYN_FIFO_MAGIC_VALUE); … … 68 68 * @param[in,out] fifo The dynamic queue. 69 69 * @param[in] size The initial queue size. 70 * @return sEOK on success.71 * @return sEINVAL if the queue is not valid.72 * @return sEBADMEM if the fifo parameter is NULL.73 * @return sENOMEM if there is not enough memory left.74 */ 75 int dyn_fifo_initialize(dyn_fifo_ reffifo, int size)70 * @return EOK on success. 71 * @return EINVAL if the queue is not valid. 72 * @return EBADMEM if the fifo parameter is NULL. 73 * @return ENOMEM if there is not enough memory left. 74 */ 75 int dyn_fifo_initialize(dyn_fifo_t *fifo, int size) 76 76 { 77 77 if (!fifo) … … 100 100 * this limit. May be zero or negative to indicate no 101 101 * limit. 102 * @return sEOK on success.103 * @return sEINVAL if the queue is not valid.104 * @return sENOMEM if there is not enough memory left.105 */ 106 int dyn_fifo_push(dyn_fifo_ reffifo, int value, int max_size)102 * @return EOK on success. 103 * @return EINVAL if the queue is not valid. 104 * @return ENOMEM if there is not enough memory left. 105 */ 106 int dyn_fifo_push(dyn_fifo_t *fifo, int value, int max_size) 107 107 { 108 108 int *new_items; … … 150 150 * 151 151 * @param[in,out] fifo The dynamic queue. 152 * @return sValue of the first item in the queue.153 * @return sEINVAL if the queue is not valid.154 * @return sENOENT if the queue is empty.155 */ 156 int dyn_fifo_pop(dyn_fifo_ reffifo)152 * @return Value of the first item in the queue. 153 * @return EINVAL if the queue is not valid. 154 * @return ENOENT if the queue is empty. 155 */ 156 int dyn_fifo_pop(dyn_fifo_t *fifo) 157 157 { 158 158 int value; … … 172 172 * 173 173 * @param[in,out] fifo The dynamic queue. 174 * @return siValue of the first item in the queue.175 * @return sEINVAL if the queue is not valid.176 * @return sENOENT if the queue is empty.177 */ 178 int dyn_fifo_value(dyn_fifo_ reffifo)174 * @return Value of the first item in the queue. 175 * @return EINVAL if the queue is not valid. 176 * @return ENOENT if the queue is empty. 177 */ 178 int dyn_fifo_value(dyn_fifo_t *fifo) 179 179 { 180 180 if (!dyn_fifo_is_valid(fifo)) … … 190 190 * 191 191 * @param[in,out] fifo The dynamic queue. 192 * @return sEOK on success.193 * @return sEINVAL if the queue is not valid.194 */ 195 int dyn_fifo_destroy(dyn_fifo_ reffifo)192 * @return EOK on success. 193 * @return EINVAL if the queue is not valid. 194 */ 195 int dyn_fifo_destroy(dyn_fifo_t *fifo) 196 196 { 197 197 if (!dyn_fifo_is_valid(fifo)) -
uspace/lib/c/generic/adt/measured_strings.c
rb4c9c61 rfdbc3ff 55 55 * appended with the terminating zero ('\0') character 56 56 * otherwise. 57 * @return sThe new bundled character string with measured length.58 * @return sNULL if there is not enough memory left.59 */ 60 measured_string_ ref57 * @return The new bundled character string with measured length. 58 * @return NULL if there is not enough memory left. 59 */ 60 measured_string_t * 61 61 measured_string_create_bulk(const char *string, size_t length) 62 62 { 63 measured_string_ refnew;63 measured_string_t *new; 64 64 65 65 if (length == 0) { … … 67 67 length++; 68 68 } 69 new = (measured_string_ ref) malloc(sizeof(measured_string_t) +69 new = (measured_string_t *) malloc(sizeof(measured_string_t) + 70 70 (sizeof(char) * (length + 1))); 71 71 if (!new) … … 84 84 * 85 85 * @param[in] source The source measured string to be copied. 86 * @return sThe copy of the given measured string.87 * @return sNULL if the source parameter is NULL.88 * @return sNULL if there is not enough memory left.89 */ 90 measured_string_ ref measured_string_copy(measured_string_refsource)91 { 92 measured_string_ refnew;86 * @return The copy of the given measured string. 87 * @return NULL if the source parameter is NULL. 88 * @return NULL if there is not enough memory left. 89 */ 90 measured_string_t *measured_string_copy(measured_string_t *source) 91 { 92 measured_string_t *new; 93 93 94 94 if (!source) 95 95 return NULL; 96 96 97 new = (measured_string_ ref) malloc(sizeof(measured_string_t));97 new = (measured_string_t *) malloc(sizeof(measured_string_t)); 98 98 if (new) { 99 99 new->value = (char *) malloc(source->length + 1); … … 120 120 * actual character strings. 121 121 * @param[in] count The size of the measured strings array. 122 * @return sEOK on success.123 * @return sEINVAL if the strings or data parameter is NULL.124 * @return sEINVAL if the count parameter is zero (0).125 * @return sEINVAL if the sent array differs in size.126 * @return sEINVAL if there is inconsistency in sent measured122 * @return EOK on success. 123 * @return EINVAL if the strings or data parameter is NULL. 124 * @return EINVAL if the count parameter is zero (0). 125 * @return EINVAL if the sent array differs in size. 126 * @return EINVAL if there is inconsistency in sent measured 127 127 * strings' lengths (should not occur). 128 * @return sENOMEM if there is not enough memory left.129 * @return sOther error codes as defined for the128 * @return ENOMEM if there is not enough memory left. 129 * @return Other error codes as defined for the 130 130 * async_data_write_finalize() function. 131 131 */ 132 132 int 133 measured_strings_receive(measured_string_ ref*strings, char **data,133 measured_strings_receive(measured_string_t **strings, char **data, 134 134 size_t count) 135 135 { … … 166 166 (*data)[lengths[count] - 1] = '\0'; 167 167 168 *strings = (measured_string_ ref) malloc(sizeof(measured_string_t) *168 *strings = (measured_string_t *) malloc(sizeof(measured_string_t) * 169 169 count); 170 170 if (!*strings) { … … 209 209 * @param[in] strings The measured strings array to be processed. 210 210 * @param[in] count The measured strings array size. 211 * @return sThe computed sizes array.212 * @return sNULL if there is not enough memory left.213 */ 214 static size_t *prepare_lengths(const measured_string_ refstrings, size_t count)211 * @return The computed sizes array. 212 * @return NULL if there is not enough memory left. 213 */ 214 static size_t *prepare_lengths(const measured_string_t *strings, size_t count) 215 215 { 216 216 size_t *lengths; … … 238 238 * @param[in] strings The measured strings array to be transferred. 239 239 * @param[in] count The measured strings array size. 240 * @return sEOK on success.241 * @return sEINVAL if the strings parameter is NULL.242 * @return sEINVAL if the count parameter is zero (0).243 * @return sEINVAL if the calling module does not accept the given240 * @return EOK on success. 241 * @return EINVAL if the strings parameter is NULL. 242 * @return EINVAL if the count parameter is zero (0). 243 * @return EINVAL if the calling module does not accept the given 244 244 * array size. 245 * @return sEINVAL if there is inconsistency in sent measured245 * @return EINVAL if there is inconsistency in sent measured 246 246 * strings' lengths (should not occur). 247 * @return sOther error codes as defined for the247 * @return Other error codes as defined for the 248 248 * async_data_read_finalize() function. 249 249 */ 250 int measured_strings_reply(const measured_string_ refstrings, size_t count)250 int measured_strings_reply(const measured_string_t *strings, size_t count) 251 251 { 252 252 size_t *lengths; … … 302 302 * actual character strings. 303 303 * @param[in] count The size of the measured strings array. 304 * @return sEOK on success.305 * @return sEINVAL if the strings or data parameter is NULL.306 * @return sEINVAL if the phone or count parameter is not positive.307 * @return sEINVAL if the sent array differs in size.308 * @return sENOMEM if there is not enough memory left.309 * @return sOther error codes as defined for the304 * @return EOK on success. 305 * @return EINVAL if the strings or data parameter is NULL. 306 * @return EINVAL if the phone or count parameter is not positive. 307 * @return EINVAL if the sent array differs in size. 308 * @return ENOMEM if there is not enough memory left. 309 * @return Other error codes as defined for the 310 310 * async_data_read_start() function. 311 311 */ 312 312 int 313 measured_strings_return(int phone, measured_string_ ref*strings, char **data,313 measured_strings_return(int phone, measured_string_t **strings, char **data, 314 314 size_t count) 315 315 { … … 339 339 } 340 340 341 *strings = (measured_string_ ref) malloc(sizeof(measured_string_t) *341 *strings = (measured_string_t *) malloc(sizeof(measured_string_t) * 342 342 count); 343 343 if (!*strings) { … … 378 378 * @param[in] strings The measured strings array to be transferred. 379 379 * @param[in] count The measured strings array size. 380 * @return sEOK on success.381 * @return sEINVAL if the strings parameter is NULL.382 * @return sEINVAL if the phone or count parameter is not positive.383 * @return sOther error codes as defined for the380 * @return EOK on success. 381 * @return EINVAL if the strings parameter is NULL. 382 * @return EINVAL if the phone or count parameter is not positive. 383 * @return Other error codes as defined for the 384 384 * async_data_write_start() function. 385 385 */ 386 386 int 387 measured_strings_send(int phone, const measured_string_ refstrings,387 measured_strings_send(int phone, const measured_string_t *strings, 388 388 size_t count) 389 389 { -
uspace/lib/c/generic/devman.c
rb4c9c61 rfdbc3ff 141 141 142 142 int devman_child_device_register( 143 const char *name, match_id_list_t *match_ids, dev ice_handle_t parent_handle, device_handle_t *handle)143 const char *name, match_id_list_t *match_ids, devman_handle_t parent_handle, devman_handle_t *handle) 144 144 { 145 145 int phone = devman_get_phone(DEVMAN_DRIVER, IPC_FLAG_BLOCKING); … … 180 180 } 181 181 182 int devman_add_device_to_class(dev ice_handle_t dev_handle, const char *class_name)182 int devman_add_device_to_class(devman_handle_t devman_handle, const char *class_name) 183 183 { 184 184 int phone = devman_get_phone(DEVMAN_DRIVER, IPC_FLAG_BLOCKING); … … 189 189 async_serialize_start(); 190 190 ipc_call_t answer; 191 aid_t req = async_send_1(phone, DEVMAN_ADD_DEVICE_TO_CLASS, dev _handle, &answer);191 aid_t req = async_send_1(phone, DEVMAN_ADD_DEVICE_TO_CLASS, devman_handle, &answer); 192 192 193 193 ipcarg_t retval = async_data_write_start(phone, class_name, str_size(class_name)); … … 224 224 } 225 225 226 int devman_device_connect(dev ice_handle_t handle, unsigned int flags)226 int devman_device_connect(devman_handle_t handle, unsigned int flags) 227 227 { 228 228 int phone; … … 239 239 } 240 240 241 int devman_parent_device_connect(dev ice_handle_t handle, unsigned int flags)241 int devman_parent_device_connect(devman_handle_t handle, unsigned int flags) 242 242 { 243 243 int phone; … … 254 254 } 255 255 256 int devman_device_get_handle(const char *pathname, dev ice_handle_t *handle, unsigned int flags)256 int devman_device_get_handle(const char *pathname, devman_handle_t *handle, unsigned int flags) 257 257 { 258 258 int phone = devman_get_phone(DEVMAN_CLIENT, flags); … … 280 280 if (retval != EOK) { 281 281 if (handle != NULL) 282 *handle = (dev ice_handle_t) -1;282 *handle = (devman_handle_t) -1; 283 283 return retval; 284 284 } 285 285 286 286 if (handle != NULL) 287 *handle = (dev ice_handle_t) IPC_GET_ARG1(answer);287 *handle = (devman_handle_t) IPC_GET_ARG1(answer); 288 288 289 289 return retval; -
uspace/lib/c/generic/devmap.c
rb4c9c61 rfdbc3ff 132 132 * 133 133 */ 134 int devmap_device_register(const char *fqdn, dev _handle_t *handle)134 int devmap_device_register(const char *fqdn, devmap_handle_t *handle) 135 135 { 136 136 int phone = devmap_get_phone(DEVMAP_DRIVER, IPC_FLAG_BLOCKING); … … 163 163 164 164 if (handle != NULL) 165 *handle = (dev _handle_t) IPC_GET_ARG1(answer);165 *handle = (devmap_handle_t) IPC_GET_ARG1(answer); 166 166 167 167 return retval; 168 168 } 169 169 170 int devmap_device_get_handle(const char *fqdn, dev _handle_t *handle, unsigned int flags)170 int devmap_device_get_handle(const char *fqdn, devmap_handle_t *handle, unsigned int flags) 171 171 { 172 172 int phone = devmap_get_phone(DEVMAP_CLIENT, flags); … … 194 194 if (retval != EOK) { 195 195 if (handle != NULL) 196 *handle = (dev _handle_t) -1;196 *handle = (devmap_handle_t) -1; 197 197 return retval; 198 198 } 199 199 200 200 if (handle != NULL) 201 *handle = (dev _handle_t) IPC_GET_ARG1(answer);201 *handle = (devmap_handle_t) IPC_GET_ARG1(answer); 202 202 203 203 return retval; 204 204 } 205 205 206 int devmap_namespace_get_handle(const char *name, dev _handle_t *handle, unsigned int flags)206 int devmap_namespace_get_handle(const char *name, devmap_handle_t *handle, unsigned int flags) 207 207 { 208 208 int phone = devmap_get_phone(DEVMAP_CLIENT, flags); … … 230 230 if (retval != EOK) { 231 231 if (handle != NULL) 232 *handle = (dev _handle_t) -1;232 *handle = (devmap_handle_t) -1; 233 233 return retval; 234 234 } 235 235 236 236 if (handle != NULL) 237 *handle = (dev _handle_t) IPC_GET_ARG1(answer);237 *handle = (devmap_handle_t) IPC_GET_ARG1(answer); 238 238 239 239 return retval; 240 240 } 241 241 242 devmap_handle_type_t devmap_handle_probe(dev _handle_t handle)242 devmap_handle_type_t devmap_handle_probe(devmap_handle_t handle) 243 243 { 244 244 int phone = devmap_get_phone(DEVMAP_CLIENT, IPC_FLAG_BLOCKING); … … 255 255 } 256 256 257 int devmap_device_connect(dev _handle_t handle, unsigned int flags)257 int devmap_device_connect(devmap_handle_t handle, unsigned int flags) 258 258 { 259 259 int phone; … … 305 305 } 306 306 307 static size_t devmap_count_devices_internal(int phone, dev _handle_t ns_handle)307 static size_t devmap_count_devices_internal(int phone, devmap_handle_t ns_handle) 308 308 { 309 309 ipcarg_t count; … … 325 325 } 326 326 327 size_t devmap_count_devices(dev _handle_t ns_handle)327 size_t devmap_count_devices(devmap_handle_t ns_handle) 328 328 { 329 329 int phone = devmap_get_phone(DEVMAP_CLIENT, IPC_FLAG_BLOCKING); … … 387 387 } 388 388 389 size_t devmap_get_devices(dev _handle_t ns_handle, dev_desc_t **data)389 size_t devmap_get_devices(devmap_handle_t ns_handle, dev_desc_t **data) 390 390 { 391 391 int phone = devmap_get_phone(DEVMAP_CLIENT, IPC_FLAG_BLOCKING); -
uspace/lib/c/generic/net/icmp_api.c
rb4c9c61 rfdbc3ff 66 66 * @param[in] addr The target host address. 67 67 * @param[in] addrlen The torget host address length. 68 * @return sICMP_ECHO on success.69 * @return sETIMEOUT if the reply has not arrived before the68 * @return ICMP_ECHO on success. 69 * @return ETIMEOUT if the reply has not arrived before the 70 70 * timeout. 71 * @return sICMP type of the received error notification.72 * @return sEINVAL if the addrlen parameter is less or equal to71 * @return ICMP type of the received error notification. 72 * @return EINVAL if the addrlen parameter is less or equal to 73 73 * zero. 74 * @return sENOMEM if there is not enough memory left.75 * @return sEPARTY if there was an internal error.74 * @return ENOMEM if there is not enough memory left. 75 * @return EPARTY if there was an internal error. 76 76 */ 77 77 int -
uspace/lib/c/generic/net/icmp_common.c
rb4c9c61 rfdbc3ff 50 50 * @param[in] timeout The connection timeout in microseconds. No timeout if 51 51 * set to zero. 52 * @return sThe ICMP module phone on success.53 * @return sETIMEOUT if the connection timeouted.52 * @return The ICMP module phone on success. 53 * @return ETIMEOUT if the connection timeouted. 54 54 */ 55 55 int icmp_connect_module(services_t service, suseconds_t timeout) -
uspace/lib/c/generic/net/inet.c
rb4c9c61 rfdbc3ff 51 51 * @param[out] address The character buffer to be filled. 52 52 * @param[in] length The buffer length. 53 * @return sEOK on success.54 * @return sEINVAL if the data or address parameter is NULL.55 * @return sENOMEM if the character buffer is not long enough.56 * @return sENOTSUP if the address family is not supported.53 * @return EOK on success. 54 * @return EINVAL if the data or address parameter is NULL. 55 * @return ENOMEM if the character buffer is not long enough. 56 * @return ENOTSUP if the address family is not supported. 57 57 */ 58 58 int … … 101 101 * @param[in] address The character buffer to be parsed. 102 102 * @param[out] data The address data to be filled. 103 * @return sEOK on success.104 * @return sEINVAL if the data parameter is NULL.105 * @return sENOENT if the address parameter is NULL.106 * @return sENOTSUP if the address family is not supported.103 * @return EOK on success. 104 * @return EINVAL if the data parameter is NULL. 105 * @return ENOENT if the address parameter is NULL. 106 * @return ENOTSUP if the address family is not supported. 107 107 */ 108 108 int inet_pton(uint16_t family, const char *address, uint8_t *data) -
uspace/lib/c/generic/net/modules.c
rb4c9c61 rfdbc3ff 159 159 * 160 160 * @param[in] need The needed module service. 161 * @return sThe phone of the needed service.161 * @return The phone of the needed service. 162 162 */ 163 163 int connect_to_service(services_t need) … … 171 171 * @param[in] timeout The connection timeout in microseconds. No timeout if 172 172 * set to zero (0). 173 * @return sThe phone of the needed service.174 * @return sETIMEOUT if the connection timeouted.173 * @return The phone of the needed service. 174 * @return ETIMEOUT if the connection timeouted. 175 175 */ 176 176 int connect_to_service_timeout(services_t need, suseconds_t timeout) … … 204 204 * @param[out] data The data buffer to be filled. 205 205 * @param[out] length The buffer length. 206 * @return sEOK on success.207 * @return sEBADMEM if the data or the length parameter is NULL.208 * @return sEINVAL if the client does not send data.209 * @return sENOMEM if there is not enough memory left.210 * @return sOther error codes as defined for the206 * @return EOK on success. 207 * @return EBADMEM if the data or the length parameter is NULL. 208 * @return EINVAL if the client does not send data. 209 * @return ENOMEM if there is not enough memory left. 210 * @return Other error codes as defined for the 211 211 * async_data_write_finalize() function. 212 212 */ … … 242 242 * @param[in] data The data buffer to be sent. 243 243 * @param[in] data_length The buffer length. 244 * @return sEOK on success.245 * @return sEINVAL if the client does not expect the data.246 * @return sEOVERFLOW if the client does not expect all the data.244 * @return EOK on success. 245 * @return EINVAL if the client does not expect the data. 246 * @return EOVERFLOW if the client does not expect all the data. 247 247 * Only partial data are transfered. 248 * @return sOther error codes as defined for the248 * @return Other error codes as defined for the 249 249 * async_data_read_finalize() function. 250 250 */ -
uspace/lib/c/generic/net/packet.c
rb4c9c61 rfdbc3ff 64 64 typedef packet_t packet_map_t[PACKET_MAP_SIZE]; 65 65 66 /** Type definition of the packet map page pointer. */67 typedef packet_map_t * packet_map_ref;68 69 66 /** Packet map. 70 67 * Maps packet identifiers to the packet references. … … 85 82 /** Initializes the packet map. 86 83 * 87 * @return sEOK on success.88 * @return sENOMEM if there is not enough memory left.84 * @return EOK on success. 85 * @return ENOMEM if there is not enough memory left. 89 86 */ 90 87 int pm_init(void) … … 104 101 * 105 102 * @param[in] packet_id The packet identifier to be found. 106 * @return sThe found packet reference.107 * @return sNULL if the mapping does not exist.103 * @return The found packet reference. 104 * @return NULL if the mapping does not exist. 108 105 */ 109 106 packet_t pm_find(packet_id_t packet_id) 110 107 { 111 packet_map_ refmap;108 packet_map_t *map; 112 109 packet_t packet; 113 110 … … 133 130 * 134 131 * @param[in] packet The packet to be remembered. 135 * @return sEOK on success.136 * @return sEINVAL if the packet is not valid.137 * @return sEINVAL if the packet map is not initialized.138 * @return sENOMEM if there is not enough memory left.132 * @return EOK on success. 133 * @return EINVAL if the packet is not valid. 134 * @return EINVAL if the packet map is not initialized. 135 * @return ENOMEM if there is not enough memory left. 139 136 */ 140 137 int pm_add(packet_t packet) 141 138 { 142 packet_map_ refmap;139 packet_map_t *map; 143 140 int rc; 144 141 … … 154 151 } else { 155 152 do { 156 map = (packet_map_ ref) malloc(sizeof(packet_map_t));153 map = (packet_map_t *) malloc(sizeof(packet_map_t)); 157 154 if (!map) { 158 155 fibril_rwlock_write_unlock(&pm_globals.lock); … … 180 177 int count; 181 178 int index; 182 packet_map_ refmap;179 packet_map_t *map; 183 180 packet_t packet; 184 181 … … 208 205 * @param[in] order The packet order value. 209 206 * @param[in] metric The metric value of the packet. 210 * @return sEOK on success.211 * @return sEINVAL if the first parameter is NULL.212 * @return sEINVAL if the packet is not valid.207 * @return EOK on success. 208 * @return EINVAL if the first parameter is NULL. 209 * @return EINVAL if the packet is not valid. 213 210 */ 214 211 int pq_add(packet_t * first, packet_t packet, size_t order, size_t metric) … … 252 249 * @param[in] first The first packet of the queue. 253 250 * @param[in] order The packet order value. 254 * @return sThe packet with the given order.255 * @return sNULL if the first packet is not valid.256 * @return sNULL if the packet is not found.251 * @return The packet with the given order. 252 * @return NULL if the first packet is not valid. 253 * @return NULL if the packet is not found. 257 254 */ 258 255 packet_t pq_find(packet_t packet, size_t order) … … 278 275 * @param[in] packet The packet in the queue. 279 276 * @param[in] new_packet The new packet to be inserted. 280 * @return sEOK on success.281 * @return sEINVAL if etiher of the packets is invalid.277 * @return EOK on success. 278 * @return EINVAL if etiher of the packets is invalid. 282 279 */ 283 280 int pq_insert_after(packet_t packet, packet_t new_packet) … … 301 298 * 302 299 * @param[in] packet The packet to be detached. 303 * @return sThe next packet in the queue. If the packet is the first300 * @return The next packet in the queue. If the packet is the first 304 301 * one of the queue, this becomes the new first one. 305 * @return sNULL if there is no packet left.306 * @return sNULL if the packet is not valid.302 * @return NULL if there is no packet left. 303 * @return NULL if the packet is not valid. 307 304 */ 308 305 packet_t pq_detach(packet_t packet) … … 331 328 * @param[in] order The packet order value. 332 329 * @param[in] metric The metric value of the packet. 333 * @return sEOK on success.334 * @return sEINVAL if the packet is invalid.330 * @return EOK on success. 331 * @return EINVAL if the packet is invalid. 335 332 */ 336 333 int pq_set_order(packet_t packet, size_t order, size_t metric) … … 349 346 * @param[out] order The packet order value. 350 347 * @param[out] metric The metric value of the packet. 351 * @return sEOK on success.352 * @return sEINVAL if the packet is invalid.348 * @return EOK on success. 349 * @return EINVAL if the packet is invalid. 353 350 */ 354 351 int pq_get_order(packet_t packet, size_t *order, size_t *metric) … … 394 391 * 395 392 * @param[in] packet The packet queue member. 396 * @return sThe next packet in the queue.397 * @return sNULL if there is no next packet.398 * @return sNULL if the packet is not valid.393 * @return The next packet in the queue. 394 * @return NULL if there is no next packet. 395 * @return NULL if the packet is not valid. 399 396 */ 400 397 packet_t pq_next(packet_t packet) … … 409 406 * 410 407 * @param[in] packet The packet queue member. 411 * @return sThe previous packet in the queue.412 * @return sNULL if there is no previous packet.413 * @return sNULL if the packet is not valid.408 * @return The previous packet in the queue. 409 * @return NULL if there is no previous packet. 410 * @return NULL if the packet is not valid. 414 411 */ 415 412 packet_t pq_previous(packet_t packet) -
uspace/lib/c/generic/net/socket_client.c
rb4c9c61 rfdbc3ff 79 79 typedef struct socket socket_t; 80 80 81 /** Type definition of the socket specific data pointer.82 * @see socket83 */84 typedef socket_t *socket_ref;85 86 81 /** Socket specific data. 87 82 * … … 162 157 163 158 /** Active sockets. */ 164 sockets_ refsockets;159 sockets_t *sockets; 165 160 166 161 /** Safety lock. … … 183 178 /** Returns the active sockets. 184 179 * 185 * @return sThe active sockets.186 */ 187 static sockets_ refsocket_get_sockets(void)180 * @return The active sockets. 181 */ 182 static sockets_t *socket_get_sockets(void) 188 183 { 189 184 if (!socket_globals.sockets) { 190 185 socket_globals.sockets = 191 (sockets_ ref) malloc(sizeof(sockets_t));186 (sockets_t *) malloc(sizeof(sockets_t)); 192 187 if (!socket_globals.sockets) 193 188 return NULL; … … 213 208 ipc_callid_t callid; 214 209 ipc_call_t call; 215 socket_ refsocket;210 socket_t *socket; 216 211 int rc; 217 212 … … 291 286 * Connects to the TCP module if necessary. 292 287 * 293 * @return sThe TCP module phone.294 * @return sOther error codes as defined for the288 * @return The TCP module phone. 289 * @return Other error codes as defined for the 295 290 * bind_service_timeout() function. 296 291 */ … … 310 305 * Connects to the UDP module if necessary. 311 306 * 312 * @return sThe UDP module phone.313 * @return sOther error codes as defined for the307 * @return The UDP module phone. 308 * @return Other error codes as defined for the 314 309 * bind_service_timeout() function. 315 310 */ … … 327 322 /** Tries to find a new free socket identifier. 328 323 * 329 * @return sThe new socket identifier.330 * @return sELIMIT if there is no socket identifier available.324 * @return The new socket identifier. 325 * @return ELIMIT if there is no socket identifier available. 331 326 */ 332 327 static int socket_generate_new_id(void) 333 328 { 334 sockets_ refsockets;329 sockets_t *sockets; 335 330 int socket_id = 0; 336 331 int count; … … 372 367 */ 373 368 static void 374 socket_initialize(socket_ refsocket, int socket_id, int phone,369 socket_initialize(socket_t *socket, int socket_id, int phone, 375 370 services_t service) 376 371 { … … 392 387 * @param[in] type Socket type. 393 388 * @param[in] protocol Socket protocol. 394 * @return sThe socket identifier on success.395 * @return sEPFNOTSUPPORT if the protocol family is not supported.396 * @return sESOCKNOTSUPPORT if the socket type is not supported.397 * @return sEPROTONOSUPPORT if the protocol is not supported.398 * @return sENOMEM if there is not enough memory left.399 * @return sELIMIT if there was not a free socket identifier found389 * @return The socket identifier on success. 390 * @return EPFNOTSUPPORT if the protocol family is not supported. 391 * @return ESOCKNOTSUPPORT if the socket type is not supported. 392 * @return EPROTONOSUPPORT if the protocol is not supported. 393 * @return ENOMEM if there is not enough memory left. 394 * @return ELIMIT if there was not a free socket identifier found 400 395 * this time. 401 * @return sOther error codes as defined for the NET_SOCKET message.402 * @return sOther error codes as defined for the396 * @return Other error codes as defined for the NET_SOCKET message. 397 * @return Other error codes as defined for the 403 398 * bind_service_timeout() function. 404 399 */ 405 400 int socket(int domain, int type, int protocol) 406 401 { 407 socket_ refsocket;402 socket_t *socket; 408 403 int phone; 409 404 int socket_id; … … 463 458 464 459 // create a new socket structure 465 socket = (socket_ ref) malloc(sizeof(socket_t));460 socket = (socket_t *) malloc(sizeof(socket_t)); 466 461 if (!socket) 467 462 return ENOMEM; … … 514 509 * @param[in] data The data to be sent. 515 510 * @param[in] datalength The data length. 516 * @return sEOK on success.517 * @return sENOTSOCK if the socket is not found.518 * @return sEBADMEM if the data parameter is NULL.519 * @return sNO_DATA if the datalength parameter is zero (0).520 * @return sOther error codes as defined for the spcific message.511 * @return EOK on success. 512 * @return ENOTSOCK if the socket is not found. 513 * @return EBADMEM if the data parameter is NULL. 514 * @return NO_DATA if the datalength parameter is zero (0). 515 * @return Other error codes as defined for the spcific message. 521 516 */ 522 517 static int … … 524 519 const void *data, size_t datalength) 525 520 { 526 socket_ refsocket;521 socket_t *socket; 527 522 aid_t message_id; 528 523 ipcarg_t result; … … 559 554 * @param[in] my_addr The port address. 560 555 * @param[in] addrlen The address length. 561 * @return sEOK on success.562 * @return sENOTSOCK if the socket is not found.563 * @return sEBADMEM if the my_addr parameter is NULL.564 * @return sNO_DATA if the addlen parameter is zero.565 * @return sOther error codes as defined for the NET_SOCKET_BIND556 * @return EOK on success. 557 * @return ENOTSOCK if the socket is not found. 558 * @return EBADMEM if the my_addr parameter is NULL. 559 * @return NO_DATA if the addlen parameter is zero. 560 * @return Other error codes as defined for the NET_SOCKET_BIND 566 561 * message. 567 562 */ … … 580 575 * @param[in] socket_id Socket identifier. 581 576 * @param[in] backlog The maximum number of waiting sockets to be accepted. 582 * @return sEOK on success.583 * @return sEINVAL if the backlog parameter is not positive (<=0).584 * @return sENOTSOCK if the socket is not found.585 * @return sOther error codes as defined for the NET_SOCKET_LISTEN577 * @return EOK on success. 578 * @return EINVAL if the backlog parameter is not positive (<=0). 579 * @return ENOTSOCK if the socket is not found. 580 * @return Other error codes as defined for the NET_SOCKET_LISTEN 586 581 * message. 587 582 */ 588 583 int listen(int socket_id, int backlog) 589 584 { 590 socket_ refsocket;585 socket_t *socket; 591 586 int result; 592 587 … … 618 613 * @param[out] cliaddr The remote client address. 619 614 * @param[in] addrlen The address length. 620 * @return sEOK on success.621 * @return sEBADMEM if the cliaddr or addrlen parameter is NULL.622 * @return sEINVAL if the backlog parameter is not positive (<=0).623 * @return sENOTSOCK if the socket is not found.624 * @return sOther error codes as defined for the NET_SOCKET_ACCEPT615 * @return EOK on success. 616 * @return EBADMEM if the cliaddr or addrlen parameter is NULL. 617 * @return EINVAL if the backlog parameter is not positive (<=0). 618 * @return ENOTSOCK if the socket is not found. 619 * @return Other error codes as defined for the NET_SOCKET_ACCEPT 625 620 * message. 626 621 */ 627 622 int accept(int socket_id, struct sockaddr * cliaddr, socklen_t * addrlen) 628 623 { 629 socket_ refsocket;630 socket_ refnew_socket;624 socket_t *socket; 625 socket_t *new_socket; 631 626 aid_t message_id; 632 627 ipcarg_t ipc_result; … … 661 656 662 657 // create a new scoket 663 new_socket = (socket_ ref) malloc(sizeof(socket_t));658 new_socket = (socket_t *) malloc(sizeof(socket_t)); 664 659 if (!new_socket) { 665 660 fibril_mutex_unlock(&socket->accept_lock); … … 721 716 * @param[in] serv_addr The remote server address. 722 717 * @param[in] addrlen The address length. 723 * @return sEOK on success.724 * @return sEBADMEM if the serv_addr parameter is NULL.725 * @return sNO_DATA if the addlen parameter is zero.726 * @return sENOTSOCK if the socket is not found.727 * @return sOther error codes as defined for the NET_SOCKET_CONNECT718 * @return EOK on success. 719 * @return EBADMEM if the serv_addr parameter is NULL. 720 * @return NO_DATA if the addlen parameter is zero. 721 * @return ENOTSOCK if the socket is not found. 722 * @return Other error codes as defined for the NET_SOCKET_CONNECT 728 723 * message. 729 724 */ … … 745 740 * @param[in] socket The socket to be destroyed. 746 741 */ 747 static void socket_destroy(socket_ refsocket)742 static void socket_destroy(socket_t *socket) 748 743 { 749 744 int accepted_id; … … 761 756 * 762 757 * @param[in] socket_id Socket identifier. 763 * @return sEOK on success.764 * @return sENOTSOCK if the socket is not found.765 * @return sEINPROGRESS if there is another blocking function in758 * @return EOK on success. 759 * @return ENOTSOCK if the socket is not found. 760 * @return EINPROGRESS if there is another blocking function in 766 761 * progress. 767 * @return sOther error codes as defined for the NET_SOCKET_CLOSE762 * @return Other error codes as defined for the NET_SOCKET_CLOSE 768 763 * message. 769 764 */ 770 765 int closesocket(int socket_id) 771 766 { 772 socket_ refsocket;767 socket_t *socket; 773 768 int rc; 774 769 … … 811 806 * sockets. 812 807 * @param[in] addrlen The address length. Used only if toaddr is not NULL. 813 * @return sEOK on success.814 * @return sENOTSOCK if the socket is not found.815 * @return sEBADMEM if the data or toaddr parameter is NULL.816 * @return sNO_DATA if the datalength or the addrlen parameter is808 * @return EOK on success. 809 * @return ENOTSOCK if the socket is not found. 810 * @return EBADMEM if the data or toaddr parameter is NULL. 811 * @return NO_DATA if the datalength or the addrlen parameter is 817 812 * zero (0). 818 * @return sOther error codes as defined for the NET_SOCKET_SENDTO813 * @return Other error codes as defined for the NET_SOCKET_SENDTO 819 814 * message. 820 815 */ … … 824 819 socklen_t addrlen) 825 820 { 826 socket_ refsocket;821 socket_t *socket; 827 822 aid_t message_id; 828 823 ipcarg_t result; … … 913 908 * @param[in] datalength The data length. 914 909 * @param[in] flags Various send flags. 915 * @return sEOK on success.916 * @return sENOTSOCK if the socket is not found.917 * @return sEBADMEM if the data parameter is NULL.918 * @return sNO_DATA if the datalength parameter is zero.919 * @return sOther error codes as defined for the NET_SOCKET_SEND910 * @return EOK on success. 911 * @return ENOTSOCK if the socket is not found. 912 * @return EBADMEM if the data parameter is NULL. 913 * @return NO_DATA if the datalength parameter is zero. 914 * @return Other error codes as defined for the NET_SOCKET_SEND 920 915 * message. 921 916 */ … … 937 932 * @param[in] toaddr The destination address. 938 933 * @param[in] addrlen The address length. 939 * @return sEOK on success.940 * @return sENOTSOCK if the socket is not found.941 * @return sEBADMEM if the data or toaddr parameter is NULL.942 * @return sNO_DATA if the datalength or the addrlen parameter is934 * @return EOK on success. 935 * @return ENOTSOCK if the socket is not found. 936 * @return EBADMEM if the data or toaddr parameter is NULL. 937 * @return NO_DATA if the datalength or the addrlen parameter is 943 938 * zero. 944 * @return sOther error codes as defined for the NET_SOCKET_SENDTO939 * @return Other error codes as defined for the NET_SOCKET_SENDTO 945 940 * message. 946 941 */ … … 971 966 * read. The actual address length is set. Used only if 972 967 * fromaddr is not NULL. 973 * @return sEOK on success.974 * @return sENOTSOCK if the socket is not found.975 * @return sEBADMEM if the data parameter is NULL.976 * @return sNO_DATA if the datalength or addrlen parameter is zero.977 * @return sOther error codes as defined for the spcific message.968 * @return EOK on success. 969 * @return ENOTSOCK if the socket is not found. 970 * @return EBADMEM if the data parameter is NULL. 971 * @return NO_DATA if the datalength or addrlen parameter is zero. 972 * @return Other error codes as defined for the spcific message. 978 973 */ 979 974 static int … … 981 976 int flags, struct sockaddr *fromaddr, socklen_t *addrlen) 982 977 { 983 socket_ refsocket;978 socket_t *socket; 984 979 aid_t message_id; 985 980 ipcarg_t ipc_result; … … 1100 1095 * @param[in] datalength The data length. 1101 1096 * @param[in] flags Various receive flags. 1102 * @return sEOK on success.1103 * @return sENOTSOCK if the socket is not found.1104 * @return sEBADMEM if the data parameter is NULL.1105 * @return sNO_DATA if the datalength parameter is zero.1106 * @return sOther error codes as defined for the NET_SOCKET_RECV1097 * @return EOK on success. 1098 * @return ENOTSOCK if the socket is not found. 1099 * @return EBADMEM if the data parameter is NULL. 1100 * @return NO_DATA if the datalength parameter is zero. 1101 * @return Other error codes as defined for the NET_SOCKET_RECV 1107 1102 * message. 1108 1103 */ … … 1123 1118 * @param[in,out] addrlen The address length. The maximum address length is 1124 1119 * read. The actual address length is set. 1125 * @return sEOK on success.1126 * @return sENOTSOCK if the socket is not found.1127 * @return sEBADMEM if the data or fromaddr parameter is NULL.1128 * @return sNO_DATA if the datalength or addrlen parameter is zero.1129 * @return sOther error codes as defined for the NET_SOCKET_RECVFROM1120 * @return EOK on success. 1121 * @return ENOTSOCK if the socket is not found. 1122 * @return EBADMEM if the data or fromaddr parameter is NULL. 1123 * @return NO_DATA if the datalength or addrlen parameter is zero. 1124 * @return Other error codes as defined for the NET_SOCKET_RECVFROM 1130 1125 * message. 1131 1126 */ … … 1153 1148 * @param[in,out] optlen The value buffer length. The maximum length is read. 1154 1149 * The actual length is set. 1155 * @return sEOK on success.1156 * @return sENOTSOCK if the socket is not found.1157 * @return sEBADMEM if the value or optlen parameter is NULL.1158 * @return sNO_DATA if the optlen parameter is zero.1159 * @return sOther error codes as defined for the1150 * @return EOK on success. 1151 * @return ENOTSOCK if the socket is not found. 1152 * @return EBADMEM if the value or optlen parameter is NULL. 1153 * @return NO_DATA if the optlen parameter is zero. 1154 * @return Other error codes as defined for the 1160 1155 * NET_SOCKET_GETSOCKOPT message. 1161 1156 */ … … 1163 1158 getsockopt(int socket_id, int level, int optname, void *value, size_t *optlen) 1164 1159 { 1165 socket_ refsocket;1160 socket_t *socket; 1166 1161 aid_t message_id; 1167 1162 ipcarg_t result; … … 1206 1201 * @param[in] value The value to be set. 1207 1202 * @param[in] optlen The value length. 1208 * @return sEOK on success.1209 * @return sENOTSOCK if the socket is not found.1210 * @return sEBADMEM if the value parameter is NULL.1211 * @return sNO_DATA if the optlen parameter is zero.1212 * @return sOther error codes as defined for the1203 * @return EOK on success. 1204 * @return ENOTSOCK if the socket is not found. 1205 * @return EBADMEM if the value parameter is NULL. 1206 * @return NO_DATA if the optlen parameter is zero. 1207 * @return Other error codes as defined for the 1213 1208 * NET_SOCKET_SETSOCKOPT message. 1214 1209 */ -
uspace/lib/c/generic/vfs/vfs.c
rb4c9c61 rfdbc3ff 136 136 } 137 137 138 dev _handle_t dev_handle;139 int res = devmap_device_get_handle(fqdn, &dev _handle, flags);138 devmap_handle_t devmap_handle; 139 int res = devmap_device_get_handle(fqdn, &devmap_handle, flags); 140 140 if (res != EOK) { 141 141 if (null_id != -1) … … 159 159 160 160 ipcarg_t rc_orig; 161 aid_t req = async_send_2(vfs_phone, VFS_IN_MOUNT, dev _handle, flags, NULL);161 aid_t req = async_send_2(vfs_phone, VFS_IN_MOUNT, devmap_handle, flags, NULL); 162 162 ipcarg_t rc = async_data_write_start(vfs_phone, (void *) mpa, mpa_size); 163 163 if (rc != EOK) { … … 328 328 ipc_call_t answer; 329 329 aid_t req = async_send_4(vfs_phone, VFS_IN_OPEN_NODE, node->fs_handle, 330 node->dev _handle, node->index, oflag, &answer);330 node->devmap_handle, node->index, oflag, &answer); 331 331 332 332 ipcarg_t rc; … … 797 797 if (rc == EOK) { 798 798 node->fs_handle = stat.fs_handle; 799 node->dev _handle = stat.dev_handle;799 node->devmap_handle = stat.devmap_handle; 800 800 node->index = stat.index; 801 801 } -
uspace/lib/c/include/adt/char_map.h
rb4c9c61 rfdbc3ff 48 48 typedef struct char_map char_map_t; 49 49 50 /** Type definition of the character string to integer map pointer.51 * @see char_map52 */53 typedef char_map_t *char_map_ref;54 55 50 /** Character string to integer map item. 56 51 * … … 69 64 int next; 70 65 /** Next character array. */ 71 char_map_ ref*items;66 char_map_t **items; 72 67 /** Consistency check magic value. */ 73 68 int magic; 74 69 }; 75 70 76 extern int char_map_initialize(char_map_ ref);77 extern void char_map_destroy(char_map_ ref);78 extern int char_map_exclude(char_map_ ref, const char *, size_t);79 extern int char_map_add(char_map_ ref, const char *, size_t, const int);80 extern int char_map_find(const char_map_ ref, const char *, size_t);81 extern int char_map_update(char_map_ ref, const char *, size_t, const int);71 extern int char_map_initialize(char_map_t *); 72 extern void char_map_destroy(char_map_t *); 73 extern int char_map_exclude(char_map_t *, const char *, size_t); 74 extern int char_map_add(char_map_t *, const char *, size_t, const int); 75 extern int char_map_find(const char_map_t *, const char *, size_t); 76 extern int char_map_update(char_map_t *, const char *, size_t, const int); 82 77 83 78 #endif -
uspace/lib/c/include/adt/dynamic_fifo.h
rb4c9c61 rfdbc3ff 44 44 typedef struct dyn_fifo dyn_fifo_t; 45 45 46 /** Type definition of the dynamic fifo queue pointer.47 * @see dyn_fifo48 */49 typedef dyn_fifo_t *dyn_fifo_ref;50 51 46 /** Dynamic first in first out positive integer queue. 52 47 * Possitive integer values only. … … 66 61 }; 67 62 68 extern int dyn_fifo_initialize(dyn_fifo_ ref, int);69 extern int dyn_fifo_destroy(dyn_fifo_ ref);70 extern int dyn_fifo_push(dyn_fifo_ ref, int, int);71 extern int dyn_fifo_pop(dyn_fifo_ ref);72 extern int dyn_fifo_value(dyn_fifo_ ref);63 extern int dyn_fifo_initialize(dyn_fifo_t *, int); 64 extern int dyn_fifo_destroy(dyn_fifo_t *); 65 extern int dyn_fifo_push(dyn_fifo_t *, int, int); 66 extern int dyn_fifo_pop(dyn_fifo_t *); 67 extern int dyn_fifo_value(dyn_fifo_t *); 73 68 74 69 #endif -
uspace/lib/c/include/adt/generic_char_map.h
rb4c9c61 rfdbc3ff 55 55 \ 56 56 typedef struct name name##_t; \ 57 typedef name##_t *name##_ref; \58 57 \ 59 58 struct name { \ … … 63 62 }; \ 64 63 \ 65 int name##_add(name##_ ref, const char *, const size_t, type *); \66 int name##_count(name##_ ref); \67 void name##_destroy(name##_ ref); \68 void name##_exclude(name##_ ref, const char *, const size_t); \69 type *name##_find(name##_ ref, const char *, const size_t); \70 int name##_initialize(name##_ ref); \71 int name##_is_valid(name##_ ref);64 int name##_add(name##_t *, const char *, const size_t, type *); \ 65 int name##_count(name##_t *); \ 66 void name##_destroy(name##_t *); \ 67 void name##_exclude(name##_t *, const char *, const size_t); \ 68 type *name##_find(name##_t *, const char *, const size_t); \ 69 int name##_initialize(name##_t *); \ 70 int name##_is_valid(name##_t *); 72 71 73 72 /** Character string to generic type map implementation. … … 81 80 GENERIC_FIELD_IMPLEMENT(name##_items, type) \ 82 81 \ 83 int name##_add(name##_ refmap, const char *name, const size_t length, \82 int name##_add(name##_t *map, const char *name, const size_t length, \ 84 83 type *value) \ 85 84 { \ … … 99 98 } \ 100 99 \ 101 int name##_count(name##_ refmap) \100 int name##_count(name##_t *map) \ 102 101 { \ 103 102 return name##_is_valid(map) ? \ … … 105 104 } \ 106 105 \ 107 void name##_destroy(name##_ refmap) \106 void name##_destroy(name##_t *map) \ 108 107 { \ 109 108 if (name##_is_valid(map)) { \ … … 113 112 } \ 114 113 \ 115 void name##_exclude(name##_ refmap, const char *name, \114 void name##_exclude(name##_t *map, const char *name, \ 116 115 const size_t length) \ 117 116 { \ … … 125 124 } \ 126 125 \ 127 type *name##_find(name##_ refmap, const char *name, \126 type *name##_find(name##_t *map, const char *name, \ 128 127 const size_t length) \ 129 128 { \ … … 138 137 } \ 139 138 \ 140 int name##_initialize(name##_ refmap) \139 int name##_initialize(name##_t *map) \ 141 140 { \ 142 141 int rc; \ … … 155 154 } \ 156 155 \ 157 int name##_is_valid(name##_ refmap) \156 int name##_is_valid(name##_t *map) \ 158 157 { \ 159 158 return map && (map->magic == GENERIC_CHAR_MAP_MAGIC_VALUE); \ -
uspace/lib/c/include/adt/generic_field.h
rb4c9c61 rfdbc3ff 53 53 #define GENERIC_FIELD_DECLARE(name, type) \ 54 54 typedef struct name name##_t; \ 55 typedef name##_t *name##_ref; \56 55 \ 57 56 struct name { \ … … 62 61 }; \ 63 62 \ 64 int name##_add(name##_ ref, type *); \65 int name##_count(name##_ ref); \66 void name##_destroy(name##_ ref); \67 void name##_exclude_index(name##_ ref, int); \68 type **name##_get_field(name##_ ref); \69 type *name##_get_index(name##_ ref, int); \70 int name##_initialize(name##_ ref); \71 int name##_is_valid(name##_ ref);63 int name##_add(name##_t *, type *); \ 64 int name##_count(name##_t *); \ 65 void name##_destroy(name##_t *); \ 66 void name##_exclude_index(name##_t *, int); \ 67 type **name##_get_field(name##_t *); \ 68 type *name##_get_index(name##_t *, int); \ 69 int name##_initialize(name##_t *); \ 70 int name##_is_valid(name##_t *); 72 71 73 72 /** Generic type field implementation. … … 79 78 */ 80 79 #define GENERIC_FIELD_IMPLEMENT(name, type) \ 81 int name##_add(name##_ reffield, type *value) \80 int name##_add(name##_t *field, type *value) \ 82 81 { \ 83 82 if (name##_is_valid(field)) { \ … … 99 98 } \ 100 99 \ 101 int name##_count(name##_ reffield) \100 int name##_count(name##_t *field) \ 102 101 { \ 103 102 return name##_is_valid(field) ? field->next : -1; \ 104 103 } \ 105 104 \ 106 void name##_destroy(name##_ reffield) \105 void name##_destroy(name##_t *field) \ 107 106 { \ 108 107 if (name##_is_valid(field)) { \ … … 117 116 } \ 118 117 \ 119 void name##_exclude_index(name##_ reffield, int index) \118 void name##_exclude_index(name##_t *field, int index) \ 120 119 { \ 121 120 if (name##_is_valid(field) && (index >= 0) && \ … … 126 125 } \ 127 126 \ 128 type *name##_get_index(name##_ reffield, int index) \127 type *name##_get_index(name##_t *field, int index) \ 129 128 { \ 130 129 if (name##_is_valid(field) && (index >= 0) && \ … … 134 133 } \ 135 134 \ 136 type **name##_get_field(name##_ reffield) \135 type **name##_get_field(name##_t *field) \ 137 136 { \ 138 137 return name##_is_valid(field) ? field->items : NULL; \ 139 138 } \ 140 139 \ 141 int name##_initialize(name##_ reffield) \140 int name##_initialize(name##_t *field) \ 142 141 { \ 143 142 if (!field) \ … … 153 152 } \ 154 153 \ 155 int name##_is_valid(name##_ reffield) \154 int name##_is_valid(name##_t *field) \ 156 155 { \ 157 156 return field && (field->magic == GENERIC_FIELD_MAGIC_VALUE); \ -
uspace/lib/c/include/adt/int_map.h
rb4c9c61 rfdbc3ff 56 56 #define INT_MAP_DECLARE(name, type) \ 57 57 typedef struct name name##_t; \ 58 typedef name##_t *name##_ref; \59 58 typedef struct name##_item name##_item_t; \ 60 typedef name##_item_t *name##_item_ref; \61 59 \ 62 60 struct name##_item { \ … … 69 67 int size; \ 70 68 int next; \ 71 name##_item_ refitems; \69 name##_item_t *items; \ 72 70 int magic; \ 73 71 }; \ 74 72 \ 75 int name##_add(name##_ ref, int, type *); \76 void name##_clear(name##_ ref); \77 int name##_count(name##_ ref); \78 void name##_destroy(name##_ ref); \79 void name##_exclude(name##_ ref, int); \80 void name##_exclude_index(name##_ ref, int); \81 type *name##_find(name##_ ref, int); \82 int name##_update(name##_ ref, int, int); \83 type *name##_get_index(name##_ ref, int); \84 int name##_initialize(name##_ ref); \85 int name##_is_valid(name##_ ref); \86 void name##_item_destroy(name##_item_ ref); \87 int name##_item_is_valid(name##_item_ ref);73 int name##_add(name##_t *, int, type *); \ 74 void name##_clear(name##_t *); \ 75 int name##_count(name##_t *); \ 76 void name##_destroy(name##_t *); \ 77 void name##_exclude(name##_t *, int); \ 78 void name##_exclude_index(name##_t *, int); \ 79 type *name##_find(name##_t *, int); \ 80 int name##_update(name##_t *, int, int); \ 81 type *name##_get_index(name##_t *, int); \ 82 int name##_initialize(name##_t *); \ 83 int name##_is_valid(name##_t *); \ 84 void name##_item_destroy(name##_item_t *); \ 85 int name##_item_is_valid(name##_item_t *); 88 86 89 87 /** Integer to generic type map implementation. … … 95 93 */ 96 94 #define INT_MAP_IMPLEMENT(name, type) \ 97 int name##_add(name##_ refmap, int key, type *value) \95 int name##_add(name##_t *map, int key, type *value) \ 98 96 { \ 99 97 if (name##_is_valid(map)) { \ 100 98 if (map->next == (map->size - 1)) { \ 101 name##_item_ reftmp; \102 tmp = (name##_item_ ref) realloc(map->items, \99 name##_item_t *tmp; \ 100 tmp = (name##_item_t *) realloc(map->items, \ 103 101 sizeof(name##_item_t) * 2 * map->size); \ 104 102 if (!tmp) \ … … 117 115 } \ 118 116 \ 119 void name##_clear(name##_ refmap) \117 void name##_clear(name##_t *map) \ 120 118 { \ 121 119 if (name##_is_valid(map)) { \ … … 132 130 } \ 133 131 \ 134 int name##_count(name##_ refmap) \132 int name##_count(name##_t *map) \ 135 133 { \ 136 134 return name##_is_valid(map) ? map->next : -1; \ 137 135 } \ 138 136 \ 139 void name##_destroy(name##_ refmap) \137 void name##_destroy(name##_t *map) \ 140 138 { \ 141 139 if (name##_is_valid(map)) { \ … … 152 150 } \ 153 151 \ 154 void name##_exclude(name##_ refmap, int key) \152 void name##_exclude(name##_t *map, int key) \ 155 153 { \ 156 154 if (name##_is_valid(map)) { \ … … 166 164 } \ 167 165 \ 168 void name##_exclude_index(name##_ refmap, int index) \166 void name##_exclude_index(name##_t *map, int index) \ 169 167 { \ 170 168 if (name##_is_valid(map) && (index >= 0) && \ … … 175 173 } \ 176 174 \ 177 type *name##_find(name##_ refmap, int key) \175 type *name##_find(name##_t *map, int key) \ 178 176 { \ 179 177 if (name##_is_valid(map)) { \ … … 189 187 } \ 190 188 \ 191 int name##_update(name##_ refmap, int key, int new_key) \189 int name##_update(name##_t *map, int key, int new_key) \ 192 190 { \ 193 191 if (name##_is_valid(map)) { \ … … 208 206 } \ 209 207 \ 210 type *name##_get_index(name##_ refmap, int index) \208 type *name##_get_index(name##_t *map, int index) \ 211 209 { \ 212 210 if (name##_is_valid(map) && (index >= 0) && \ … … 218 216 } \ 219 217 \ 220 int name##_initialize(name##_ refmap) \218 int name##_initialize(name##_t *map) \ 221 219 { \ 222 220 if (!map) \ … … 224 222 map->size = 2; \ 225 223 map->next = 0; \ 226 map->items = (name##_item_ ref) malloc(sizeof(name##_item_t) * \224 map->items = (name##_item_t *) malloc(sizeof(name##_item_t) * \ 227 225 map->size); \ 228 226 if (!map->items) \ … … 233 231 } \ 234 232 \ 235 int name##_is_valid(name##_ refmap) \233 int name##_is_valid(name##_t *map) \ 236 234 { \ 237 235 return map && (map->magic == INT_MAP_MAGIC_VALUE); \ 238 236 } \ 239 237 \ 240 void name##_item_destroy(name##_item_ refitem) \238 void name##_item_destroy(name##_item_t *item) \ 241 239 { \ 242 240 if (name##_item_is_valid(item)) { \ … … 249 247 } \ 250 248 \ 251 int name##_item_is_valid(name##_item_ refitem) \249 int name##_item_is_valid(name##_item_t *item) \ 252 250 { \ 253 251 return item && (item->magic == INT_MAP_ITEM_MAGIC_VALUE); \ -
uspace/lib/c/include/adt/measured_strings.h
rb4c9c61 rfdbc3ff 47 47 typedef struct measured_string measured_string_t; 48 48 49 /** Type definition of the character string with measured length pointer.50 * @see measured_string51 */52 typedef measured_string_t *measured_string_ref;53 54 49 /** Character string with measured length. 55 50 * … … 64 59 }; 65 60 66 extern measured_string_ refmeasured_string_create_bulk(const char *, size_t);67 extern measured_string_ ref measured_string_copy(measured_string_ref);68 extern int measured_strings_receive(measured_string_ ref*, char **, size_t);69 extern int measured_strings_reply(const measured_string_ ref, size_t);70 extern int measured_strings_return(int, measured_string_ ref*, char **, size_t);71 extern int measured_strings_send(int, const measured_string_ ref, size_t);61 extern measured_string_t *measured_string_create_bulk(const char *, size_t); 62 extern measured_string_t *measured_string_copy(measured_string_t *); 63 extern int measured_strings_receive(measured_string_t **, char **, size_t); 64 extern int measured_strings_reply(const measured_string_t *, size_t); 65 extern int measured_strings_return(int, measured_string_t **, char **, size_t); 66 extern int measured_strings_send(int, const measured_string_t *, size_t); 72 67 73 68 #endif -
uspace/lib/c/include/devman.h
rb4c9c61 rfdbc3ff 42 42 43 43 44 int devman_get_phone(devman_interface_t, unsigned int);45 void devman_hangup_phone(devman_interface_t iface);44 extern int devman_get_phone(devman_interface_t, unsigned int); 45 extern void devman_hangup_phone(devman_interface_t); 46 46 47 int devman_driver_register(const char *, async_client_conn_t); 48 int devman_child_device_register(const char *, match_id_list_t *, device_handle_t, device_handle_t *); 47 extern int devman_driver_register(const char *, async_client_conn_t); 48 extern int devman_child_device_register(const char *, match_id_list_t *, 49 devman_handle_t, devman_handle_t *); 49 50 50 int devman_device_connect(device_handle_t handle, unsigned int flags);51 int devman_parent_device_connect(device_handle_t handle, unsigned int flags);51 extern int devman_device_connect(devman_handle_t, unsigned int); 52 extern int devman_parent_device_connect(devman_handle_t, unsigned int); 52 53 53 int devman_device_get_handle(const char *pathname, device_handle_t *handle, unsigned int flags); 54 extern int devman_device_get_handle(const char *, devman_handle_t *, 55 unsigned int); 54 56 55 int devman_add_device_to_class(device_handle_t dev_handle, const char *class_name);57 extern int devman_add_device_to_class(devman_handle_t, const char *); 56 58 57 59 #endif -
uspace/lib/c/include/devmap.h
rb4c9c61 rfdbc3ff 44 44 45 45 extern int devmap_driver_register(const char *, async_client_conn_t); 46 extern int devmap_device_register(const char *, dev _handle_t *);46 extern int devmap_device_register(const char *, devmap_handle_t *); 47 47 48 extern int devmap_device_get_handle(const char *, dev _handle_t *, unsigned int);49 extern int devmap_namespace_get_handle(const char *, dev _handle_t *, unsigned int);50 extern devmap_handle_type_t devmap_handle_probe(dev _handle_t);48 extern int devmap_device_get_handle(const char *, devmap_handle_t *, unsigned int); 49 extern int devmap_namespace_get_handle(const char *, devmap_handle_t *, unsigned int); 50 extern devmap_handle_type_t devmap_handle_probe(devmap_handle_t); 51 51 52 extern int devmap_device_connect(dev _handle_t, unsigned int);52 extern int devmap_device_connect(devmap_handle_t, unsigned int); 53 53 54 54 extern int devmap_null_create(void); … … 56 56 57 57 extern size_t devmap_count_namespaces(void); 58 extern size_t devmap_count_devices(dev _handle_t);58 extern size_t devmap_count_devices(devmap_handle_t); 59 59 60 60 extern size_t devmap_get_namespaces(dev_desc_t **); 61 extern size_t devmap_get_devices(dev _handle_t, dev_desc_t **);61 extern size_t devmap_get_devices(devmap_handle_t, dev_desc_t **); 62 62 63 63 #endif -
uspace/lib/c/include/ipc/devman.h
rb4c9c61 rfdbc3ff 42 42 #define DEVMAN_NAME_MAXLEN 256 43 43 44 typedef ipcarg_t dev ice_handle_t;44 typedef ipcarg_t devman_handle_t; 45 45 46 46 /** Ids of device models used for device-to-driver matching. -
uspace/lib/c/include/ipc/devmap.h
rb4c9c61 rfdbc3ff 40 40 #define DEVMAP_NAME_MAXLEN 255 41 41 42 typedef ipcarg_t dev _handle_t;42 typedef ipcarg_t devmap_handle_t; 43 43 44 44 typedef enum { … … 81 81 82 82 typedef struct { 83 dev _handle_t handle;83 devmap_handle_t handle; 84 84 char name[DEVMAP_NAME_MAXLEN + 1]; 85 85 } dev_desc_t; -
uspace/lib/c/include/net/device.h
rb4c9c61 rfdbc3ff 59 59 */ 60 60 typedef struct device_stats device_stats_t; 61 62 /** Type definition of the device usage statistics pointer.63 * @see device_stats64 */65 typedef device_stats_t *device_stats_ref;66 61 67 62 /** Device state. */ -
uspace/lib/c/include/net/modules.h
rb4c9c61 rfdbc3ff 69 69 * 70 70 * @param[in] need The needed module service. 71 * @return sThe phone of the needed service.71 * @return The phone of the needed service. 72 72 */ 73 73 typedef int connect_module_t(services_t need); -
uspace/lib/c/include/net/packet.h
rb4c9c61 rfdbc3ff 48 48 typedef struct packet * packet_t; 49 49 50 /** Type definition of the packet pointer.51 * @see packet52 */53 typedef packet_t * packet_ref;54 55 50 /** Type definition of the packet dimension. 56 51 * @see packet_dimension 57 52 */ 58 53 typedef struct packet_dimension packet_dimension_t; 59 60 /** Type definition of the packet dimension pointer.61 * @see packet_dimension62 */63 typedef packet_dimension_t * packet_dimension_ref;64 54 65 55 /** Packet dimension. */ -
uspace/lib/c/include/net/packet_header.h
rb4c9c61 rfdbc3ff 124 124 /** Returns whether the packet is valid. 125 125 * @param[in] packet The packet to be checked. 126 * @return sTrue if the packet is not NULL and the magic value is126 * @return True if the packet is not NULL and the magic value is 127 127 * correct. 128 * @return sFalse otherwise.128 * @return False otherwise. 129 129 */ 130 130 static inline int packet_is_valid(const packet_t packet) -
uspace/lib/c/include/sys/stat.h
rb4c9c61 rfdbc3ff 43 43 struct stat { 44 44 fs_handle_t fs_handle; 45 dev _handle_t dev_handle;45 devmap_handle_t devmap_handle; 46 46 fs_index_t index; 47 47 unsigned int lnkcnt; … … 49 49 bool is_directory; 50 50 aoff64_t size; 51 dev _handle_t device;51 devmap_handle_t device; 52 52 }; 53 53 -
uspace/lib/c/include/unistd.h
rb4c9c61 rfdbc3ff 41 41 42 42 #ifndef NULL 43 #define NULL 0 43 #define NULL 0UL 44 44 #endif 45 45 -
uspace/lib/c/include/vfs/vfs.h
rb4c9c61 rfdbc3ff 47 47 typedef struct { 48 48 fs_handle_t fs_handle; 49 dev _handle_t dev_handle;49 devmap_handle_t devmap_handle; 50 50 fs_index_t index; 51 51 } fdi_node_t;
Note:
See TracChangeset
for help on using the changeset viewer.