Changeset c431a83 in mainline for uspace/lib/c
- Timestamp:
- 2011-01-21T14:24:05Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c2020f7
- Parents:
- e8ad0de (diff), aa9f0a4 (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:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/as.c
re8ad0de rc431a83 35 35 #include <as.h> 36 36 #include <libc.h> 37 #include <errno.h> 37 38 #include <unistd.h> 38 39 #include <align.h> … … 128 129 } 129 130 131 /** Find mapping to physical address. 132 * 133 * @param address Virtual address in question (virtual). 134 * @param[out] frame Frame address (physical). 135 * @return Error code. 136 * @retval EOK No error, @p frame holds the translation. 137 * @retval ENOENT Mapping not found. 138 */ 139 int as_get_physical_mapping(void *address, uintptr_t *frame) 140 { 141 uintptr_t tmp_frame; 142 uintptr_t virt = (uintptr_t) address; 143 144 int rc = (int) __SYSCALL2(SYS_PAGE_FIND_MAPPING, 145 (sysarg_t) virt, (sysarg_t) &tmp_frame); 146 if (rc != EOK) { 147 return rc; 148 } 149 150 if (frame != NULL) { 151 *frame = tmp_frame; 152 } 153 154 return EOK; 155 } 156 130 157 /** @} 131 158 */ -
uspace/lib/c/generic/net/icmp_common.c
re8ad0de rc431a83 27 27 */ 28 28 29 /** @addtogroup libc 29 /** @addtogroup libc 30 30 * @{ 31 31 */ … … 38 38 #include <net/modules.h> 39 39 #include <net/icmp_common.h> 40 41 40 #include <ipc/services.h> 42 41 #include <ipc/icmp.h> 43 44 42 #include <sys/time.h> 45 43 #include <async.h> 46 44 47 /** Connect sto the ICMP module.45 /** Connect to the ICMP module. 48 46 * 49 * @param service The ICMP module service. Ignored parameter. 50 * @param[in] timeout The connection timeout in microseconds. No timeout if 51 * set to zero. 52 * @return The ICMP module phone on success. 53 * @return ETIMEOUT if the connection timeouted. 47 * @param[in] timeout Connection timeout in microseconds, zero 48 * for no timeout. 49 * 50 * @return ICMP module phone on success. 51 * @return ETIMEOUT if the connection timeouted. 52 * 54 53 */ 55 int icmp_connect_module(s ervices_t service, suseconds_t timeout)54 int icmp_connect_module(suseconds_t timeout) 56 55 { 57 int phone; 58 59 phone = connect_to_service_timeout(SERVICE_ICMP, timeout); 60 if (phone >= 0) 61 async_req_0_0(phone, NET_ICMP_INIT); 62 63 return phone; 56 return connect_to_service_timeout(SERVICE_ICMP, timeout); 64 57 } 65 58 -
uspace/lib/c/include/adt/hash_table.h
re8ad0de rc431a83 41 41 typedef unsigned long hash_count_t; 42 42 typedef unsigned long hash_index_t; 43 typedef struct hash_table hash_table_t; 44 typedef struct hash_table_operations hash_table_operations_t; 43 44 /** Set of operations for hash table. */ 45 typedef struct { 46 /** Hash function. 47 * 48 * @param key Array of keys needed to compute hash index. 49 * All keys must be passed. 50 * 51 * @return Index into hash table. 52 * 53 */ 54 hash_index_t (*hash)(unsigned long key[]); 55 56 /** Hash table item comparison function. 57 * 58 * @param key Array of keys that will be compared with item. It is 59 * not necessary to pass all keys. 60 * 61 * @return True if the keys match, false otherwise. 62 * 63 */ 64 int (*compare)(unsigned long key[], hash_count_t keys, link_t *item); 65 66 /** Hash table item removal callback. 67 * 68 * @param item Item that was removed from the hash table. 69 * 70 */ 71 void (*remove_callback)(link_t *item); 72 } hash_table_operations_t; 45 73 46 74 /** Hash table structure. */ 47 struct hash_table{75 typedef struct { 48 76 link_t *entry; 49 77 hash_count_t entries; 50 78 hash_count_t max_keys; 51 79 hash_table_operations_t *op; 52 }; 53 54 /** Set of operations for hash table. */ 55 struct hash_table_operations { 56 /** Hash function. 57 * 58 * @param key Array of keys needed to compute hash index. All keys 59 * must be passed. 60 * 61 * @return Index into hash table. 62 */ 63 hash_index_t (* hash)(unsigned long key[]); 64 65 /** Hash table item comparison function. 66 * 67 * @param key Array of keys that will be compared with item. It is 68 * not necessary to pass all keys. 69 * 70 * @return true if the keys match, false otherwise. 71 */ 72 int (*compare)(unsigned long key[], hash_count_t keys, link_t *item); 73 74 /** Hash table item removal callback. 75 * 76 * @param item Item that was removed from the hash table. 77 */ 78 void (*remove_callback)(link_t *item); 79 }; 80 } hash_table_t; 80 81 81 82 #define hash_table_get_instance(item, type, member) \ -
uspace/lib/c/include/as.h
re8ad0de rc431a83 47 47 extern void *set_maxheapsize(size_t mhs); 48 48 extern void * as_get_mappable_page(size_t sz); 49 extern int as_get_physical_mapping(void *address, uintptr_t *frame); 49 50 50 51 #endif -
uspace/lib/c/include/ipc/icmp.h
re8ad0de rc431a83 33 33 /** @file 34 34 * ICMP module messages. 35 * @see icmp_ interface.h35 * @see icmp_remote.h 36 36 */ 37 37 … … 48 48 /** ICMP module messages. */ 49 49 typedef enum { 50 /** Send secho request. @see icmp_echo() */50 /** Send echo request. @see icmp_echo() */ 51 51 NET_ICMP_ECHO = NET_ICMP_FIRST, 52 52 53 53 /** 54 * Send sdestination unreachable error message.54 * Send destination unreachable error message. 55 55 * @see icmp_destination_unreachable_msg() 56 56 */ … … 58 58 59 59 /** 60 * Send ssource quench error message.60 * Send source quench error message. 61 61 * @see icmp_source_quench_msg() 62 62 */ … … 64 64 65 65 /** 66 * Send stime exceeded error message.66 * Send time exceeded error message. 67 67 * @see icmp_time_exceeded_msg() 68 68 */ … … 70 70 71 71 /** 72 * Send sparameter problem error message.72 * Send parameter problem error message. 73 73 * @see icmp_parameter_problem_msg() 74 74 */ 75 NET_ICMP_PARAMETERPROB, 76 77 /** Initializes new connection. */ 78 NET_ICMP_INIT 79 } icmp_messages; 75 NET_ICMP_PARAMETERPROB 76 } icmp_messages_t; 80 77 81 78 /** @name ICMP specific message parameters definitions */ -
uspace/lib/c/include/net/icmp_common.h
re8ad0de rc431a83 41 41 #include <sys/time.h> 42 42 43 /** Default timeout for incoming connections in microseconds . */44 #define ICMP_CONNECT_TIMEOUT (1 * 1000 * 1000)43 /** Default timeout for incoming connections in microseconds (1 sec). */ 44 #define ICMP_CONNECT_TIMEOUT 1000000 45 45 46 extern int icmp_connect_module(s ervices_t, suseconds_t);46 extern int icmp_connect_module(suseconds_t); 47 47 48 48 #endif
Note:
See TracChangeset
for help on using the changeset viewer.