Changeset 89ac5513 in mainline for uspace/lib
- Timestamp:
- 2013-06-23T19:54:53Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ddb1922
- Parents:
- 3abf0760 (diff), 96cbd18 (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
- Files:
-
- 5 added
- 49 edited
-
bithenge/src/blob.c (modified) (1 diff)
-
c/Makefile (modified) (3 diffs)
-
c/arch/abs32le/Makefile.common (modified) (1 diff)
-
c/arch/amd64/Makefile.common (modified) (1 diff)
-
c/arch/amd64/src/entry.s (modified) (1 diff)
-
c/arch/amd64/src/entryjmp.s (modified) (1 diff)
-
c/arch/amd64/src/fibril.S (modified) (2 diffs)
-
c/arch/amd64/src/thread_entry.s (modified) (1 diff)
-
c/arch/ia32/Makefile.common (modified) (2 diffs)
-
c/arch/ia32/include/libarch/fibril.h (modified) (1 diff)
-
c/arch/ia32/src/entry.S (modified) (2 diffs)
-
c/arch/ia32/src/entryjmp.s (modified) (1 diff)
-
c/arch/ia32/src/fibril.S (modified) (3 diffs)
-
c/arch/ia32/src/setjmp.S (modified) (2 diffs)
-
c/arch/ia32/src/thread_entry.s (modified) (1 diff)
-
c/generic/device/hw_res_parsed.c (modified) (1 diff)
-
c/generic/dnsr.c (added)
-
c/generic/inet.c (modified) (3 diffs)
-
c/generic/inet/addr.c (added)
-
c/generic/inetcfg.c (modified) (4 diffs)
-
c/generic/inetping.c (modified) (2 diffs)
-
c/generic/iplink.c (modified) (4 diffs)
-
c/generic/iplink_srv.c (modified) (5 diffs)
-
c/generic/mem.c (modified) (1 diff)
-
c/generic/net/inet.c (modified) (2 diffs)
-
c/generic/net/socket_client.c (modified) (5 diffs)
-
c/generic/net/socket_parse.c (modified) (1 diff)
-
c/generic/str.c (modified) (5 diffs)
-
c/include/device/hw_res_parsed.h (modified) (2 diffs)
-
c/include/inet/addr.h (added)
-
c/include/inet/dnsr.h (added)
-
c/include/inet/inet.h (modified) (1 diff)
-
c/include/inet/inetcfg.h (modified) (1 diff)
-
c/include/inet/inetping.h (modified) (2 diffs)
-
c/include/inet/iplink.h (modified) (4 diffs)
-
c/include/inet/iplink_srv.h (modified) (2 diffs)
-
c/include/io/verify.h (modified) (1 diff)
-
c/include/ipc/dnsr.h (added)
-
c/include/ipc/services.h (modified) (1 diff)
-
c/include/mem.h (modified) (2 diffs)
-
c/include/net/in.h (modified) (2 diffs)
-
c/include/net/ip_protocols.h (modified) (1 diff)
-
c/include/net/socket_codes.h (modified) (1 diff)
-
c/include/str.h (modified) (1 diff)
-
drv/generic/remote_nic.c (modified) (10 diffs)
-
ext4/libext4_directory.c (modified) (1 diff)
-
nic/src/nic_addr_db.c (modified) (1 diff)
-
nic/src/nic_driver.c (modified) (1 diff)
-
nic/src/nic_impl.c (modified) (2 diffs)
-
nic/src/nic_rx_control.c (modified) (1 diff)
-
nic/src/nic_wol_virtues.c (modified) (1 diff)
-
posix/source/strings.c (modified) (2 diffs)
-
usb/src/debug.c (modified) (1 diff)
-
usb/src/dev.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/bithenge/src/blob.c
r3abf0760 r89ac5513 477 477 if (rc != EOK) 478 478 return rc; 479 if (size_a != size_b || bcmp(buffer_a, buffer_b, size_a)) {479 if (size_a != size_b || memcmp(buffer_a, buffer_b, size_a) != 0) { 480 480 *out = false; 481 481 return EOK; -
uspace/lib/c/Makefile
r3abf0760 r89ac5513 74 74 generic/device/pci.c \ 75 75 generic/device/ahci.c \ 76 generic/dnsr.c \ 76 77 generic/dlfcn.c \ 77 78 generic/elf/elf_load.c \ … … 91 92 generic/task.c \ 92 93 generic/futex.c \ 94 generic/inet/addr.c \ 93 95 generic/inet.c \ 94 96 generic/inetcfg.c \ … … 161 163 162 164 $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld: $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld.in 163 $( GCC) $(DEFS) $(CFLAGS) -DLIBC_PATH=$(CURDIR) -E -x c $< | grep -v "^\#" > $@165 $(CC) $(DEFS) $(CFLAGS) -DLIBC_PATH=$(CURDIR) -E -x c $< | grep -v "^\#" > $@ 164 166 165 167 $(LIBC_PREFIX)/arch/$(UARCH)/_link-loader.ld: $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld.in 166 $( GCC) $(DEFS) $(CFLAGS) -DLIBC_PATH=$(CURDIR) -DLOADER -E -x c $< | grep -v "^\#" > $@168 $(CC) $(DEFS) $(CFLAGS) -DLIBC_PATH=$(CURDIR) -DLOADER -E -x c $< | grep -v "^\#" > $@ 167 169 168 170 $(LIBC_PREFIX)/arch/$(UARCH)/_link-shlib.ld: $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld.in 169 $( GCC) $(DEFS) $(CFLAGS) -DLIBC_PATH=$(CURDIR) -DSHLIB -E -x c $< | grep -v "^\#" > $@171 $(CC) $(DEFS) $(CFLAGS) -DLIBC_PATH=$(CURDIR) -DSHLIB -E -x c $< | grep -v "^\#" > $@ 170 172 171 173 $(LIBC_PREFIX)/arch/$(UARCH)/_link-dlexe.ld: $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld.in 172 $( GCC) $(DEFS) $(CFLAGS) -DLIBC_PATH=$(CURDIR) -DDLEXE -E -x c $< | grep -v "^\#" > $@174 $(CC) $(DEFS) $(CFLAGS) -DLIBC_PATH=$(CURDIR) -DDLEXE -E -x c $< | grep -v "^\#" > $@ 173 175 174 176 $(COMMON_HEADER_ARCH): $(COMMON_HEADER) -
uspace/lib/c/arch/abs32le/Makefile.common
r3abf0760 r89ac5513 27 27 # 28 28 29 ifeq ($(COMPILER),clang)30 CLANG_ARCH = i38631 endif32 33 29 ENDIANESS = LE -
uspace/lib/c/arch/amd64/Makefile.common
r3abf0760 r89ac5513 27 27 # 28 28 29 CLANG_ARCH = x86_6430 29 GCC_CFLAGS += -fno-omit-frame-pointer 30 CLANG_CFLAGS += -fno-omit-frame-pointer 31 31 32 32 ENDIANESS = LE -
uspace/lib/c/arch/amd64/src/entry.s
r3abf0760 r89ac5513 42 42 # 43 43 pushq $0 44 pushq $0 44 45 movq %rsp, %rbp 45 46 -
uspace/lib/c/arch/amd64/src/entryjmp.s
r3abf0760 r89ac5513 36 36 # Jump to program entry point 37 37 entry_point_jmp: 38 # use standard amd32 prologue not to confuse anybody 39 push %rbp 40 movq %rsp, %rbp 41 38 42 # pcb must be passed in %rdi, use %rdx as a scratch register 39 43 mov %rdi, %rdx 40 44 mov %rsi, %rdi 41 45 42 46 # jump to entry point 43 47 jmp %rdx -
uspace/lib/c/arch/amd64/src/fibril.S
r3abf0760 r89ac5513 42 42 movq (%rsp), %rdx # the caller's return %eip 43 43 44 # In %edi is passed 1st argument44 # in %edi is passed 1st argument 45 45 CONTEXT_SAVE_ARCH_CORE %rdi %rdx 46 46 47 # Save TLS47 # save TLS 48 48 movq %fs:0, %rax 49 49 movq %rax, OFFSET_TLS(%rdi) 50 51 xorl %eax, %eax # context_save returns 150 51 xorl %eax, %eax # context_save returns 1 52 52 incl %eax 53 53 ret 54 55 54 56 55 ## Restore current CPU context … … 64 63 65 64 movq %rdx,(%rsp) 66 65 67 66 # Set thread local storage 68 movq OFFSET_TLS(%rdi), %rdi # Set arg1 to TLS addr69 movl $1, %eax # SYS_TLS_SET67 movq OFFSET_TLS(%rdi), %rdi # Set arg1 to TLS addr 68 movl $1, %eax # SYS_TLS_SET 70 69 syscall 71 72 xorl %eax, %eax # context_restore returns 070 71 xorl %eax, %eax # context_restore returns 0 73 72 ret -
uspace/lib/c/arch/amd64/src/thread_entry.s
r3abf0760 r89ac5513 39 39 # 40 40 pushq $0 41 pushq $0 41 42 movq %rsp, %rbp 42 43 43 44 # 44 45 # RAX contains address of uarg -
uspace/lib/c/arch/ia32/Makefile.common
r3abf0760 r89ac5513 27 27 # 28 28 29 CLANG_ARCH = i38630 31 29 ifeq ($(PROCESSOR),i486) 32 30 GCC_CFLAGS += -march=i486 -fno-omit-frame-pointer … … 34 32 GCC_CFLAGS += -march=pentium -fno-omit-frame-pointer 35 33 endif 34 CLANG_CFLAGS += -fno-omit-frame-pointer 36 35 37 36 ENDIANESS = LE -
uspace/lib/c/arch/ia32/include/libarch/fibril.h
r3abf0760 r89ac5513 43 43 * panic sooner or later 44 44 */ 45 #define SP_DELTA 1245 #define SP_DELTA 8 46 46 47 47 #define context_set(c, _pc, stack, size, ptls) \ -
uspace/lib/c/arch/ia32/src/entry.S
r3abf0760 r89ac5513 47 47 # Do not set %gs, it contains descriptor that can see TLS 48 48 49 #ifndef PROCESSOR_i486 49 #ifndef PROCESSOR_i486 50 50 # Detect the mechanism used for making syscalls 51 51 movl $(INTEL_CPUID_STANDARD), %eax … … 62 62 # 63 63 pushl $0 64 pushl $0 64 65 movl %esp, %ebp 65 66 -
uspace/lib/c/arch/ia32/src/entryjmp.s
r3abf0760 r89ac5513 36 36 push %ebp 37 37 movl %esp, %ebp 38 38 39 39 # %eax := entry_point 40 40 movl 0x8(%ebp), %eax 41 41 42 42 # %edi := pcb 43 43 # pcb is passed to the entry point in %edi 44 44 mov 0xc(%ebp), %edi 45 45 46 46 # Save a tiny bit of stack space 47 47 pop %ebp 48 48 49 49 jmp *%eax -
uspace/lib/c/arch/ia32/src/fibril.S
r3abf0760 r89ac5513 34 34 .global context_restore 35 35 36 37 36 ## Save current CPU context 38 37 # … … 41 40 # 42 41 context_save: 43 movl 0(%esp), %eax# the caller's return %eip44 movl 4(%esp), %edx# address of the context variable to save context to45 46 # save registers to the context structure42 movl 0(%esp), %eax # the caller's return %eip 43 movl 4(%esp), %edx # address of the context variable to save context to 44 45 # save registers to the context structure 47 46 CONTEXT_SAVE_ARCH_CORE %edx %eax 48 49 # Save TLS47 48 # save TLS 50 49 movl %gs:0, %eax 51 50 movl %eax, OFFSET_TLS(%edx) # tls -> ctx->tls 52 51 53 xorl %eax, %eax# context_save returns 152 xorl %eax, %eax # context_save returns 1 54 53 incl %eax 55 54 ret 56 57 55 58 56 ## Restore saved CPU context … … 62 60 # 63 61 context_restore: 64 movl 4(%esp), %eax# address of the context variable to restore context from65 66 # restore registers from the context structure62 movl 4(%esp), %eax # address of the context variable to restore context from 63 64 # restore registers from the context structure 67 65 CONTEXT_RESTORE_ARCH_CORE %eax %edx 68 69 movl %edx, 0(%esp)# ctx->pc -> saver's return %eip70 71 # Set thread local storage66 67 movl %edx, 0(%esp) # ctx->pc -> saver's return %eip 68 69 # set thread local storage 72 70 pushl %edx 73 movl OFFSET_TLS(%eax), %edx # Set arg1 to TLS addr74 movl $1, %eax # Syscall SYS_TLS_SET71 movl OFFSET_TLS(%eax), %edx # Set arg1 to TLS addr 72 movl $1, %eax # Syscall SYS_TLS_SET 75 73 int $0x30 76 74 popl %edx 77 75 78 xorl %eax, %eax# context_restore returns 076 xorl %eax, %eax # context_restore returns 0 79 77 ret -
uspace/lib/c/arch/ia32/src/setjmp.S
r3abf0760 r89ac5513 35 35 .type setjmp,@function 36 36 setjmp: 37 movl 0(%esp), %eax # save pc value into eax38 movl 4(%esp), %edx # address of the jmp_buf structure to save context to37 movl 0(%esp), %eax # save pc value into eax 38 movl 4(%esp), %edx # address of the jmp_buf structure to save context to 39 39 40 40 # save registers to the jmp_buf structure 41 41 CONTEXT_SAVE_ARCH_CORE %edx %eax 42 42 43 xorl %eax, %eax# set_jmp returns 043 xorl %eax, %eax # set_jmp returns 0 44 44 ret 45 45 … … 52 52 CONTEXT_RESTORE_ARCH_CORE %ecx %edx 53 53 54 movl %edx, 0(%esp) # put saved pc on stack54 movl %edx, 0(%esp) # put saved pc on stack 55 55 ret -
uspace/lib/c/arch/ia32/src/thread_entry.s
r3abf0760 r89ac5513 40 40 mov %dx, %fs 41 41 # Do not set %gs, it contains descriptor that can see TLS 42 42 43 43 # 44 44 # Create the first stack frame. 45 45 # 46 46 pushl $0 47 pushl $0 47 48 mov %esp, %ebp 48 49 49 50 # 50 51 # EAX contains address of uarg. -
uspace/lib/c/generic/device/hw_res_parsed.c
r3abf0760 r89ac5513 188 188 hw_resource_list_t hw_resources; 189 189 hw_res_list_parsed_clean(hw_res_parsed); 190 bzero(&hw_resources, sizeof(hw_resource_list_t));190 memset(&hw_resources, 0, sizeof(hw_resource_list_t)); 191 191 192 192 int rc = hw_res_get_resource_list(sess, &hw_resources); -
uspace/lib/c/generic/inet.c
r3abf0760 r89ac5513 107 107 int inet_send(inet_dgram_t *dgram, uint8_t ttl, inet_df_t df) 108 108 { 109 async_exch_t *exch = async_exchange_begin(inet_sess); 110 109 uint32_t src; 110 int rc = inet_addr_pack(&dgram->src, &src); 111 if (rc != EOK) 112 return rc; 113 114 uint32_t dest; 115 rc = inet_addr_pack(&dgram->dest, &dest); 116 if (rc != EOK) 117 return EOK; 118 119 async_exch_t *exch = async_exchange_begin(inet_sess); 120 111 121 ipc_call_t answer; 112 aid_t req = async_send_5(exch, INET_SEND, dgram->src.ipv4, 113 dgram->dest.ipv4, dgram->tos, ttl, df, &answer); 114 int rc = async_data_write_start(exch, dgram->data, dgram->size); 115 async_exchange_end(exch); 116 122 aid_t req = async_send_5(exch, INET_SEND, (sysarg_t) src, 123 (sysarg_t) dest, dgram->tos, ttl, df, &answer); 124 rc = async_data_write_start(exch, dgram->data, dgram->size); 125 126 async_exchange_end(exch); 127 117 128 if (rc != EOK) { 118 129 async_forget(req); 119 130 return rc; 120 131 } 121 132 122 133 sysarg_t retval; 123 134 async_wait_for(req, &retval); 124 135 if (retval != EOK) 125 136 return retval; 126 137 127 138 return EOK; 128 139 } … … 130 141 int inet_get_srcaddr(inet_addr_t *remote, uint8_t tos, inet_addr_t *local) 131 142 { 143 uint32_t remote_addr; 144 int rc = inet_addr_pack(remote, &remote_addr); 145 if (rc != EOK) 146 return rc; 147 148 async_exch_t *exch = async_exchange_begin(inet_sess); 149 132 150 sysarg_t local_addr; 133 async_exch_t *exch = async_exchange_begin(inet_sess); 134 135 int rc = async_req_2_1(exch, INET_GET_SRCADDR, remote->ipv4, 151 rc = async_req_2_1(exch, INET_GET_SRCADDR, (sysarg_t) remote_addr, 136 152 tos, &local_addr); 137 async_exchange_end(exch); 138 139 if (rc != EOK) 140 return rc; 141 142 local->ipv4 = local_addr; 153 154 async_exchange_end(exch); 155 156 if (rc != EOK) 157 return rc; 158 159 inet_addr_unpack(local_addr, local); 143 160 return EOK; 144 161 } … … 148 165 int rc; 149 166 inet_dgram_t dgram; 150 151 dgram.src.ipv4 = IPC_GET_ARG1(*call);152 dgram.dest.ipv4 = IPC_GET_ARG2(*call);167 168 inet_addr_unpack(IPC_GET_ARG1(*call), &dgram.src); 169 inet_addr_unpack(IPC_GET_ARG2(*call), &dgram.dest); 153 170 dgram.tos = IPC_GET_ARG3(*call); 154 171 -
uspace/lib/c/generic/inetcfg.c
r3abf0760 r89ac5513 136 136 sysarg_t link_id, sysarg_t *addr_id) 137 137 { 138 async_exch_t *exch = async_exchange_begin(inetcfg_sess); 139 140 ipc_call_t answer; 141 aid_t req = async_send_3(exch, INETCFG_ADDR_CREATE_STATIC, naddr->ipv4, 142 naddr->bits, link_id, &answer); 138 uint32_t naddr_addr; 139 uint8_t naddr_bits; 140 int rc = inet_naddr_pack(naddr, &naddr_addr, &naddr_bits); 141 if (rc != EOK) 142 return rc; 143 144 async_exch_t *exch = async_exchange_begin(inetcfg_sess); 145 146 ipc_call_t answer; 147 aid_t req = async_send_3(exch, INETCFG_ADDR_CREATE_STATIC, 148 (sysarg_t) naddr_addr, (sysarg_t) naddr_bits, link_id, &answer); 143 149 sysarg_t retval = async_data_write_start(exch, name, str_size(name)); 144 145 async_exchange_end(exch); 146 147 if (retval != EOK) { 148 async_forget(req); 149 return retval; 150 } 151 150 151 async_exchange_end(exch); 152 153 if (retval != EOK) { 154 async_forget(req); 155 return retval; 156 } 157 152 158 async_wait_for(req, &retval); 153 159 *addr_id = IPC_GET_ARG1(answer); 154 160 155 161 return retval; 156 162 } … … 196 202 assert(act_size <= LOC_NAME_MAXLEN); 197 203 name_buf[act_size] = '\0'; 198 199 ainfo->naddr.ipv4 = IPC_GET_ARG1(answer);200 ainfo->naddr.bits = IPC_GET_ARG2(answer);204 205 inet_naddr_unpack(IPC_GET_ARG1(answer), IPC_GET_ARG2(answer), 206 &ainfo->naddr); 201 207 ainfo->ilink = IPC_GET_ARG3(answer); 202 208 ainfo->name = str_dup(name_buf); … … 284 290 inet_addr_t *router, sysarg_t *sroute_id) 285 291 { 286 async_exch_t *exch = async_exchange_begin(inetcfg_sess); 287 292 uint32_t dest_addr; 293 uint8_t dest_bits; 294 int rc = inet_naddr_pack(dest, &dest_addr, &dest_bits); 295 if (rc != EOK) 296 return rc; 297 298 uint32_t router_addr; 299 rc = inet_addr_pack(router, &router_addr); 300 if (rc != EOK) 301 return rc; 302 303 async_exch_t *exch = async_exchange_begin(inetcfg_sess); 304 288 305 ipc_call_t answer; 289 306 aid_t req = async_send_3(exch, INETCFG_SROUTE_CREATE, 290 dest->ipv4, dest->bits, router->ipv4, &answer); 307 (sysarg_t) dest_addr, (sysarg_t) dest_bits, (sysarg_t) router_addr, 308 &answer); 291 309 sysarg_t retval = async_data_write_start(exch, name, str_size(name)); 292 293 async_exchange_end(exch); 294 295 if (retval != EOK) { 296 async_forget(req); 297 return retval; 298 } 299 310 311 async_exchange_end(exch); 312 313 if (retval != EOK) { 314 async_forget(req); 315 return retval; 316 } 317 300 318 async_wait_for(req, &retval); 301 319 *sroute_id = IPC_GET_ARG1(answer); 302 320 303 321 return retval; 304 322 } … … 345 363 name_buf[act_size] = '\0'; 346 364 347 srinfo->dest.ipv4 = IPC_GET_ARG1(answer);348 srinfo->dest.bits = IPC_GET_ARG2(answer);349 srinfo->router.ipv4 = IPC_GET_ARG3(answer);365 inet_naddr_unpack(IPC_GET_ARG1(answer), IPC_GET_ARG2(answer), 366 &srinfo->dest); 367 inet_addr_unpack(IPC_GET_ARG3(answer), &srinfo->router); 350 368 srinfo->name = str_dup(name_buf); 351 369 -
uspace/lib/c/generic/inetping.c
r3abf0760 r89ac5513 79 79 { 80 80 async_exch_t *exch = async_exchange_begin(inetping_sess); 81 81 82 82 ipc_call_t answer; 83 aid_t req = async_send_3(exch, INETPING_SEND, sdu->src.ipv4,84 sdu->dest.ipv4, sdu->seq_no, &answer);83 aid_t req = async_send_3(exch, INETPING_SEND, (sysarg_t) sdu->src, 84 (sysarg_t) sdu->dest, sdu->seq_no, &answer); 85 85 sysarg_t retval = async_data_write_start(exch, sdu->data, sdu->size); 86 86 87 87 async_exchange_end(exch); 88 88 89 89 if (retval != EOK) { 90 90 async_forget(req); 91 91 return retval; 92 92 } 93 93 94 94 async_wait_for(req, &retval); 95 95 return retval; 96 96 } 97 97 98 int inetping_get_srcaddr( inet_addr_t *remote, inet_addr_t *local)98 int inetping_get_srcaddr(uint32_t remote, uint32_t *local) 99 99 { 100 async_exch_t *exch = async_exchange_begin(inetping_sess); 101 100 102 sysarg_t local_addr; 101 async_exch_t *exch = async_exchange_begin(inetping_sess); 102 103 int rc = async_req_1_1(exch, INETPING_GET_SRCADDR, remote->ipv4, 103 int rc = async_req_1_1(exch, INETPING_GET_SRCADDR, (sysarg_t) remote, 104 104 &local_addr); 105 105 106 async_exchange_end(exch); 106 107 107 108 if (rc != EOK) 108 109 return rc; 109 110 local->ipv4 =local_addr;110 111 *local = (uint32_t) local_addr; 111 112 return EOK; 112 113 } … … 114 115 static void inetping_ev_recv(ipc_callid_t callid, ipc_call_t *call) 115 116 { 116 int rc;117 117 inetping_sdu_t sdu; 118 119 sdu.src .ipv4= IPC_GET_ARG1(*call);120 sdu.dest .ipv4= IPC_GET_ARG2(*call);118 119 sdu.src = IPC_GET_ARG1(*call); 120 sdu.dest = IPC_GET_ARG2(*call); 121 121 sdu.seq_no = IPC_GET_ARG3(*call); 122 123 rc = async_data_write_accept(&sdu.data, false, 0, 0, 0, &sdu.size);122 123 int rc = async_data_write_accept(&sdu.data, false, 0, 0, 0, &sdu.size); 124 124 if (rc != EOK) { 125 125 async_answer_0(callid, rc); 126 126 return; 127 127 } 128 128 129 129 rc = inetping_ev_ops->recv(&sdu); 130 130 free(sdu.data); -
uspace/lib/c/generic/iplink.c
r3abf0760 r89ac5513 39 39 #include <errno.h> 40 40 #include <inet/iplink.h> 41 #include <inet/addr.h> 41 42 #include <ipc/iplink.h> 42 43 #include <ipc/services.h> … … 83 84 { 84 85 async_exch_t *exch = async_exchange_begin(iplink->sess); 85 86 86 87 ipc_call_t answer; 87 aid_t req = async_send_2(exch, IPLINK_SEND, sdu->lsrc.ipv4,88 sdu->ldest.ipv4, &answer);88 aid_t req = async_send_2(exch, IPLINK_SEND, (sysarg_t) sdu->lsrc, 89 (sysarg_t) sdu->ldest, &answer); 89 90 int rc = async_data_write_start(exch, sdu->data, sdu->size); 91 90 92 async_exchange_end(exch); 91 93 92 94 if (rc != EOK) { 93 95 async_forget(req); 94 96 return rc; 95 97 } 96 98 97 99 sysarg_t retval; 98 100 async_wait_for(req, &retval); 99 101 if (retval != EOK) 100 102 return retval; 101 103 102 104 return EOK; 103 105 } … … 118 120 } 119 121 120 int iplink_addr_add(iplink_t *iplink, i plink_addr_t *addr)122 int iplink_addr_add(iplink_t *iplink, inet_addr_t *addr) 121 123 { 124 uint32_t addr_addr; 125 int rc = inet_addr_pack(addr, &addr_addr); 126 if (rc != EOK) 127 return rc; 128 122 129 async_exch_t *exch = async_exchange_begin(iplink->sess); 123 124 int rc = async_req_1_0(exch, IPLINK_ADDR_ADD, (sysarg_t)addr->ipv4); 130 rc = async_req_1_0(exch, IPLINK_ADDR_ADD, (sysarg_t) addr_addr); 125 131 async_exchange_end(exch); 126 132 127 133 return rc; 128 134 } 129 135 130 int iplink_addr_remove(iplink_t *iplink, i plink_addr_t *addr)136 int iplink_addr_remove(iplink_t *iplink, inet_addr_t *addr) 131 137 { 138 uint32_t addr_addr; 139 int rc = inet_addr_pack(addr, &addr_addr); 140 if (rc != EOK) 141 return rc; 142 132 143 async_exch_t *exch = async_exchange_begin(iplink->sess); 133 134 int rc = async_req_1_0(exch, IPLINK_ADDR_REMOVE, (sysarg_t)addr->ipv4); 144 rc = async_req_1_0(exch, IPLINK_ADDR_REMOVE, (sysarg_t) addr_addr); 135 145 async_exchange_end(exch); 136 146 137 147 return rc; 138 148 } … … 141 151 ipc_call_t *call) 142 152 { 143 int rc;144 153 iplink_sdu_t sdu; 145 146 sdu.lsrc .ipv4= IPC_GET_ARG1(*call);147 sdu.ldest .ipv4= IPC_GET_ARG2(*call);148 149 rc = async_data_write_accept(&sdu.data, false, 0, 0, 0, &sdu.size);154 155 sdu.lsrc = IPC_GET_ARG1(*call); 156 sdu.ldest = IPC_GET_ARG2(*call); 157 158 int rc = async_data_write_accept(&sdu.data, false, 0, 0, 0, &sdu.size); 150 159 if (rc != EOK) { 151 160 async_answer_0(callid, rc); 152 161 return; 153 162 } 154 163 155 164 rc = iplink->ev_ops->recv(iplink, &sdu); 156 165 free(sdu.data); -
uspace/lib/c/generic/iplink_srv.c
r3abf0760 r89ac5513 54 54 ipc_call_t *call) 55 55 { 56 int rc; 57 iplink_srv_addr_t addr; 58 59 addr.ipv4 = IPC_GET_ARG1(*call); 60 61 rc = srv->ops->addr_add(srv, &addr); 56 int rc = srv->ops->addr_add(srv, IPC_GET_ARG1(*call)); 62 57 async_answer_0(callid, rc); 63 58 } … … 66 61 ipc_call_t *call) 67 62 { 68 int rc; 69 iplink_srv_addr_t addr; 70 71 addr.ipv4 = IPC_GET_ARG1(*call); 72 73 rc = srv->ops->addr_remove(srv, &addr); 63 int rc = srv->ops->addr_remove(srv, IPC_GET_ARG1(*call)); 74 64 async_answer_0(callid, rc); 75 65 } … … 81 71 int rc; 82 72 83 sdu.lsrc .ipv4= IPC_GET_ARG1(*call);84 sdu.ldest .ipv4= IPC_GET_ARG2(*call);73 sdu.lsrc = IPC_GET_ARG1(*call); 74 sdu.ldest = IPC_GET_ARG2(*call); 85 75 86 76 rc = async_data_write_accept(&sdu.data, false, 0, 0, 0, &sdu.size); … … 139 129 if (!method) { 140 130 /* The other side has hung up */ 141 fibril_mutex_lock(&srv->lock);131 fibril_mutex_lock(&srv->lock); 142 132 srv->connected = false; 143 fibril_mutex_unlock(&srv->lock);133 fibril_mutex_unlock(&srv->lock); 144 134 async_answer_0(callid, EOK); 145 135 break; … … 175 165 176 166 ipc_call_t answer; 177 aid_t req = async_send_2(exch, IPLINK_EV_RECV, sdu->lsrc.ipv4,178 sdu->ldest.ipv4, &answer);167 aid_t req = async_send_2(exch, IPLINK_EV_RECV, (sysarg_t) sdu->lsrc, 168 (sysarg_t) sdu->ldest, &answer); 179 169 int rc = async_data_write_start(exch, sdu->data, sdu->size); 180 170 async_exchange_end(exch); -
uspace/lib/c/generic/mem.c
r3abf0760 r89ac5513 224 224 * @param s1 Pointer to the first area to compare. 225 225 * @param s2 Pointer to the second area to compare. 226 * @param len Size of the first area in bytes. Both areas must have227 * the same length.228 * 229 * @return If len is 0, return zero. If the areas match, return230 * zero. Otherwise return non-zero.231 * 232 */ 233 int bcmp(const void *s1, const void *s2, size_t len)226 * @param len Size of the areas in bytes. 227 * 228 * @return Zero if areas have the same contents. If they differ, 229 * the sign of the result is the same as the sign of the 230 * difference of the first pair of different bytes. 231 * 232 */ 233 int memcmp(const void *s1, const void *s2, size_t len) 234 234 { 235 235 uint8_t *u1 = (uint8_t *) s1; 236 236 uint8_t *u2 = (uint8_t *) s2; 237 238 for (; (len != 0) && (*u1++ == *u2++); len--); 239 240 return len; 237 size_t i; 238 239 for (i = 0; i < len; i++) { 240 if (*u1 != *u2) 241 return (int)(*u1) - (int)(*u2); 242 ++u1; 243 ++u2; 244 } 245 246 return 0; 241 247 } 242 248 -
uspace/lib/c/generic/net/inet.c
r3abf0760 r89ac5513 39 39 #include <net/in6.h> 40 40 #include <net/inet.h> 41 41 #include <inet/addr.h> 42 42 #include <errno.h> 43 43 #include <mem.h> … … 94 94 } 95 95 96 static int inet_pton4(const char *address, uint8_t *data) 97 { 98 memset(data, 0, 4); 99 100 const char *cur = address; 101 size_t i = 0; 102 103 while (i < 4) { 104 int rc = str_uint8_t(cur, &cur, 10, false, &data[i]); 105 if (rc != EOK) 106 return rc; 107 108 i++; 109 110 if (*cur == 0) 111 break; 112 113 if (*cur != '.') 114 return EINVAL; 115 116 if (i < 4) 117 cur++; 118 } 119 120 if ((i == 4) && (*cur != 0)) 121 return EINVAL; 122 123 return EOK; 124 } 125 126 static int inet_pton6(const char *address, uint8_t *data) 127 { 128 // FIXME TODO 129 return ENOTSUP; 130 } 131 96 132 /** Parses the character string into the address. 97 133 * 98 * If the string is shorter than the full address, zero bytes are added. 134 * @param[in] family The address family. 135 * @param[in] address The character buffer to be parsed. 136 * @param[out] data The address data to be filled. 99 137 * 100 * @param[in] family The address family. 101 * @param[in] address The character buffer to be parsed. 102 * @param[out] data The address data to be filled. 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. 138 * @return EOK on success. 139 * @return EINVAL if the data parameter is NULL. 140 * @return ENOENT if the address parameter is NULL. 141 * @return ENOTSUP if the address family is not supported. 142 * 107 143 */ 108 144 int inet_pton(uint16_t family, const char *address, uint8_t *data) 109 145 { 110 /** The base number of the values. */111 int base;112 /** The number of bytes per a section. */113 size_t bytes;114 /** The number of bytes of the address data. */115 int count;116 117 const char *next;118 char *last;119 int index;120 size_t shift;121 unsigned long value;122 123 if (!data)124 return EINVAL;125 126 /* Set processing parameters */127 146 switch (family) { 128 147 case AF_INET: 129 count = 4; 130 base = 10; 131 bytes = 1; 132 break; 133 148 return inet_pton4(address, data); 134 149 case AF_INET6: 135 count = 16; 136 base = 16; 137 bytes = 4; 138 break; 139 150 return inet_pton6(address, data); 140 151 default: 152 /** Unknown address family */ 141 153 return ENOTSUP; 142 154 } 143 144 /* Erase if no address */145 if (!address) {146 bzero(data, count);147 return ENOENT;148 }149 150 /* Process string from the beginning */151 next = address;152 index = 0;153 do {154 /* If the actual character is set */155 if (next && *next) {156 157 /* If not on the first character */158 if (index) {159 /* Move to the next character */160 ++next;161 }162 163 /* Parse the actual integral value */164 value = strtoul(next, &last, base);165 /*166 * Remember the last problematic character167 * should be either '.' or ':' but is ignored to be168 * more generic169 */170 next = last;171 172 /* Fill the address data byte by byte */173 shift = bytes - 1;174 do {175 /* like little endian */176 data[index + shift] = value;177 value >>= 8;178 } while(shift --);179 180 index += bytes;181 } else {182 /* Erase the rest of the address */183 bzero(data + index, count - index);184 return EOK;185 }186 } while (index < count);187 188 return EOK;189 155 } 190 156 -
uspace/lib/c/generic/net/socket_client.c
r3abf0760 r89ac5513 87 87 /** Parent module service. */ 88 88 services_t service; 89 /** Socket family */ 90 int family; 89 91 90 92 /** … … 395 397 switch (domain) { 396 398 case PF_INET: 399 case PF_INET6: 397 400 switch (type) { 398 401 case SOCK_STREAM: … … 433 436 break; 434 437 435 case PF_INET6:436 438 default: 437 439 return EPFNOSUPPORT; … … 446 448 return ENOMEM; 447 449 448 bzero(socket, sizeof(*socket)); 450 memset(socket, 0, sizeof(*socket)); 451 socket->family = domain; 449 452 fibril_rwlock_write_lock(&socket_globals.lock); 450 453 … … 657 660 return ENOMEM; 658 661 } 659 bzero(new_socket, sizeof(*new_socket));662 memset(new_socket, 0, sizeof(*new_socket)); 660 663 socket_id = socket_generate_new_id(); 661 664 if (socket_id <= 0) { -
uspace/lib/c/generic/net/socket_parse.c
r3abf0760 r89ac5513 79 79 int socket_parse_protocol_family(const char *name, int *pf) 80 80 { 81 if (str_lcmp(name, "PF_INET6", 8) == 0) { 82 *pf = PF_INET6; 83 return EOK; 84 } 85 81 86 if (str_lcmp(name, "PF_INET", 7) == 0) { 82 87 *pf = PF_INET; 83 return EOK;84 }85 86 if (str_lcmp(name, "PF_INET6", 8) == 0) {87 *pf = PF_INET6;88 88 return EOK; 89 89 } -
uspace/lib/c/generic/str.c
r3abf0760 r89ac5513 1524 1524 * 1525 1525 */ 1526 int str_uint8_t(const char *nptr, c har **endptr, unsigned int base,1526 int str_uint8_t(const char *nptr, const char **endptr, unsigned int base, 1527 1527 bool strict, uint8_t *result) 1528 1528 { … … 1571 1571 * 1572 1572 */ 1573 int str_uint16_t(const char *nptr, c har **endptr, unsigned int base,1573 int str_uint16_t(const char *nptr, const char **endptr, unsigned int base, 1574 1574 bool strict, uint16_t *result) 1575 1575 { … … 1618 1618 * 1619 1619 */ 1620 int str_uint32_t(const char *nptr, c har **endptr, unsigned int base,1620 int str_uint32_t(const char *nptr, const char **endptr, unsigned int base, 1621 1621 bool strict, uint32_t *result) 1622 1622 { … … 1665 1665 * 1666 1666 */ 1667 int str_uint64_t(const char *nptr, c har **endptr, unsigned int base,1667 int str_uint64_t(const char *nptr, const char **endptr, unsigned int base, 1668 1668 bool strict, uint64_t *result) 1669 1669 { … … 1704 1704 * 1705 1705 */ 1706 int str_size_t(const char *nptr, c har **endptr, unsigned int base,1706 int str_size_t(const char *nptr, const char **endptr, unsigned int base, 1707 1707 bool strict, size_t *result) 1708 1708 { -
uspace/lib/c/include/device/hw_res_parsed.h
r3abf0760 r89ac5513 127 127 free(list->dma_channels.channels); 128 128 129 bzero(list, sizeof(hw_res_list_parsed_t));129 memset(list, 0, sizeof(hw_res_list_parsed_t)); 130 130 } 131 131 … … 136 136 static inline void hw_res_list_parsed_init(hw_res_list_parsed_t *list) 137 137 { 138 bzero(list, sizeof(hw_res_list_parsed_t));138 memset(list, 0, sizeof(hw_res_list_parsed_t)); 139 139 } 140 140 -
uspace/lib/c/include/inet/inet.h
r3abf0760 r89ac5513 36 36 #define LIBC_INET_INET_H_ 37 37 38 #include <inet/addr.h> 38 39 #include <sys/types.h> 39 40 40 41 #define INET_TTL_MAX 255 41 42 typedef struct {43 uint32_t ipv4;44 } inet_addr_t;45 42 46 43 typedef struct { -
uspace/lib/c/include/inet/inetcfg.h
r3abf0760 r89ac5513 38 38 #include <inet/inet.h> 39 39 #include <sys/types.h> 40 41 /** Network address */42 typedef struct {43 /** Address */44 uint32_t ipv4;45 /** Number of valid bits in @c ipv4 */46 int bits;47 } inet_naddr_t;48 40 49 41 /** Address object info */ -
uspace/lib/c/include/inet/inetping.h
r3abf0760 r89ac5513 40 40 41 41 typedef struct { 42 inet_addr_t src;43 inet_addr_t dest;42 uint32_t src; 43 uint32_t dest; 44 44 uint16_t seq_no; 45 45 void *data; … … 53 53 extern int inetping_init(inetping_ev_ops_t *); 54 54 extern int inetping_send(inetping_sdu_t *); 55 extern int inetping_get_srcaddr(inet_addr_t *, inet_addr_t *); 56 55 extern int inetping_get_srcaddr(uint32_t, uint32_t *); 57 56 58 57 #endif -
uspace/lib/c/include/inet/iplink.h
r3abf0760 r89ac5513 38 38 #include <async.h> 39 39 #include <sys/types.h> 40 #include <inet/addr.h> 40 41 41 42 struct iplink_ev_ops; … … 46 47 } iplink_t; 47 48 48 typedef struct { 49 uint32_t ipv4; 50 } iplink_addr_t; 51 52 /** IP link Service Data Unit */ 49 /** IPv4 link Service Data Unit */ 53 50 typedef struct { 54 51 /** Local source address */ 55 iplink_addr_t lsrc;52 uint32_t lsrc; 56 53 /** Local destination address */ 57 iplink_addr_t ldest;54 uint32_t ldest; 58 55 /** Serialized IP packet */ 59 56 void *data; … … 61 58 size_t size; 62 59 } iplink_sdu_t; 60 61 /** IPv6 link Service Data Unit */ 62 typedef struct { 63 /** Target MAC address */ 64 uint64_t hwaddr; 65 /** Serialized IP packet */ 66 void *data; 67 /** Size of @c data in bytes */ 68 size_t size; 69 } iplink_sdu6_t; 63 70 64 71 typedef struct iplink_ev_ops { … … 69 76 extern void iplink_close(iplink_t *); 70 77 extern int iplink_send(iplink_t *, iplink_sdu_t *); 71 extern int iplink_addr_add(iplink_t *, i plink_addr_t *);72 extern int iplink_addr_remove(iplink_t *, i plink_addr_t *);78 extern int iplink_addr_add(iplink_t *, inet_addr_t *); 79 extern int iplink_addr_remove(iplink_t *, inet_addr_t *); 73 80 extern int iplink_get_mtu(iplink_t *, size_t *); 74 81 -
uspace/lib/c/include/inet/iplink_srv.h
r3abf0760 r89ac5513 51 51 } iplink_srv_t; 52 52 53 typedef struct {54 uint32_t ipv4;55 } iplink_srv_addr_t;56 57 53 /** IP link Service Data Unit */ 58 54 typedef struct { 59 55 /** Local source address */ 60 iplink_srv_addr_t lsrc;56 uint32_t lsrc; 61 57 /** Local destination address */ 62 iplink_srv_addr_t ldest;58 uint32_t ldest; 63 59 /** Serialized IP packet */ 64 60 void *data; … … 72 68 int (*send)(iplink_srv_t *, iplink_srv_sdu_t *); 73 69 int (*get_mtu)(iplink_srv_t *, size_t *); 74 int (*addr_add)(iplink_srv_t *, iplink_srv_addr_t *);75 int (*addr_remove)(iplink_srv_t *, iplink_srv_addr_t *);70 int (*addr_add)(iplink_srv_t *, uint32_t); 71 int (*addr_remove)(iplink_srv_t *, uint32_t); 76 72 } iplink_ops_t; 77 73 -
uspace/lib/c/include/io/verify.h
r3abf0760 r89ac5513 38 38 #ifndef NVERIFY_PRINTF 39 39 40 #ifdef __clang__ 41 #define PRINTF_ATTRIBUTE(start, end) \ 42 __attribute__((format(__printf__, start, end))) 43 #else 40 44 #define PRINTF_ATTRIBUTE(start, end) \ 41 45 __attribute__((format(gnu_printf, start, end))) 46 #endif 42 47 43 48 #else /* NVERIFY_PRINTF */ -
uspace/lib/c/include/ipc/services.h
r3abf0760 r89ac5513 53 53 } services_t; 54 54 55 #define SERVICE_NAME_DNSR "net/dnsr" 55 56 #define SERVICE_NAME_INET "net/inet" 56 57 #define SERVICE_NAME_INETCFG "net/inetcfg" -
uspace/lib/c/include/mem.h
r3abf0760 r89ac5513 38 38 #include <sys/types.h> 39 39 40 #define bzero(ptr, len) memset((ptr), 0, (len))41 42 40 extern void *memset(void *, int, size_t) 43 41 __attribute__ ((optimize("-fno-tree-loop-distribute-patterns"))); … … 45 43 __attribute__ ((optimize("-fno-tree-loop-distribute-patterns"))); 46 44 extern void *memmove(void *, const void *, size_t); 47 48 extern int bcmp(const void *, const void *, size_t); 45 extern int memcmp(const void *, const void *, size_t); 49 46 50 47 #endif -
uspace/lib/c/include/net/in.h
r3abf0760 r89ac5513 47 47 #define INADDR_ANY 0 48 48 49 /** Type definition of the INET address.50 * @see in_addr51 */52 typedef struct in_addr in_addr_t;53 54 /** Type definition of the INET socket address.55 * @see sockaddr_in56 */57 typedef struct sockaddr_in sockaddr_in_t;58 59 49 /** INET address. */ 60 struct in_addr {50 typedef struct in_addr { 61 51 /** 4 byte IP address. */ 62 52 uint32_t s_addr; 63 } ;53 } in_addr_t; 64 54 65 55 /** INET socket address. 66 56 * @see sockaddr 67 57 */ 68 struct sockaddr_in {58 typedef struct sockaddr_in { 69 59 /** Address family. Should be AF_INET. */ 70 60 uint16_t sin_family; … … 72 62 uint16_t sin_port; 73 63 /** Internet address. */ 74 struct in_addrsin_addr;64 in_addr_t sin_addr; 75 65 /** Padding to meet the sockaddr size. */ 76 66 uint8_t sin_zero[8]; 77 } ;67 } sockaddr_in_t; 78 68 79 69 #endif -
uspace/lib/c/include/net/ip_protocols.h
r3abf0760 r89ac5513 44 44 /*@{*/ 45 45 46 #define IPPROTO_ICMP 1 47 #define IPPROTO_TCP 6 48 #define IPPROTO_UDP 17 46 #define IPPROTO_ICMP 1 47 #define IPPROTO_TCP 6 48 #define IPPROTO_UDP 17 49 #define IPPROTO_ICMPV6 58 49 50 50 51 /*@}*/ -
uspace/lib/c/include/net/socket_codes.h
r3abf0760 r89ac5513 45 45 46 46 enum { 47 AF_ UNKNOWN= 0,47 AF_NONE = 0, 48 48 AF_INET, /* IPv4 address */ 49 49 AF_INET6 /* IPv6 address */ -
uspace/lib/c/include/str.h
r3abf0760 r89ac5513 109 109 extern char *str_ndup(const char *, size_t max_size); 110 110 111 extern int str_uint8_t(const char *, char **, unsigned int, bool, uint8_t *); 112 extern int str_uint16_t(const char *, char **, unsigned int, bool, uint16_t *); 113 extern int str_uint32_t(const char *, char **, unsigned int, bool, uint32_t *); 114 extern int str_uint64_t(const char *, char **, unsigned int, bool, uint64_t *); 115 extern int str_size_t(const char *, char **, unsigned int, bool, size_t *); 111 extern int str_uint8_t(const char *, const char **, unsigned int, bool, 112 uint8_t *); 113 extern int str_uint16_t(const char *, const char **, unsigned int, bool, 114 uint16_t *); 115 extern int str_uint32_t(const char *, const char **, unsigned int, bool, 116 uint32_t *); 117 extern int str_uint64_t(const char *, const char **, unsigned int, bool, 118 uint64_t *); 119 extern int str_size_t(const char *, const char **, unsigned int, bool, 120 size_t *); 116 121 117 122 extern void order_suffix(const uint64_t, uint64_t *, char *); -
uspace/lib/drv/generic/remote_nic.c
r3abf0760 r89ac5513 104 104 105 105 nic_address_t address; 106 bzero(&address, sizeof(nic_address_t));106 memset(&address, 0, sizeof(nic_address_t)); 107 107 108 108 int rc = nic_iface->get_address(dev, &address); … … 173 173 174 174 nic_device_stats_t stats; 175 bzero(&stats, sizeof(nic_device_stats_t));175 memset(&stats, 0, sizeof(nic_device_stats_t)); 176 176 177 177 int rc = nic_iface->get_stats(dev, &stats); … … 208 208 209 209 nic_device_info_t info; 210 bzero(&info, sizeof(nic_device_info_t));210 memset(&info, 0, sizeof(nic_device_info_t)); 211 211 212 212 int rc = nic_iface->get_device_info(dev, &info); … … 399 399 } 400 400 401 bzero(address_list, max_count * sizeof(nic_address_t));401 memset(address_list, 0, max_count * sizeof(nic_address_t)); 402 402 nic_unicast_mode_t mode = NIC_UNICAST_DEFAULT; 403 403 size_t address_count = 0; … … 503 503 } 504 504 505 bzero(address_list, max_count * sizeof(nic_address_t));505 memset(address_list, 0, max_count * sizeof(nic_address_t)); 506 506 nic_multicast_mode_t mode = NIC_MULTICAST_BLOCKED; 507 507 size_t address_count = 0; … … 667 667 } 668 668 669 bzero(address_list, max_count * sizeof(nic_address_t));669 memset(address_list, 0, max_count * sizeof(nic_address_t)); 670 670 size_t address_count = 0; 671 671 … … 759 759 760 760 nic_vlan_mask_t vlan_mask; 761 bzero(&vlan_mask, sizeof(nic_vlan_mask_t));761 memset(&vlan_mask, 0, sizeof(nic_vlan_mask_t)); 762 762 763 763 int rc = nic_iface->vlan_get_mask(dev, &vlan_mask); … … 932 932 } 933 933 934 bzero(data, max_length);934 memset(data, 0, max_length); 935 935 936 936 int rc = nic_iface->wol_virtue_probe(dev, id, &type, max_length, … … 982 982 } 983 983 984 bzero(id_list, max_count * sizeof (nic_wv_id_t));984 memset(id_list, 0, max_count * sizeof (nic_wv_id_t)); 985 985 986 986 int rc = nic_iface->wol_virtue_list(dev, type, max_count, id_list, … … 1047 1047 } 1048 1048 1049 bzero(data, max_length);1049 memset(data, 0, max_length); 1050 1050 1051 1051 int rc = nic_iface->wol_load_info(dev, &type, max_length, data, -
uspace/lib/ext4/libext4_directory.c
r3abf0760 r89ac5513 725 725 name_len) { 726 726 /* Compare names */ 727 if ( bcmp((uint8_t *) name, dentry->name, name_len) == 0) {727 if (memcmp((uint8_t *) name, dentry->name, name_len) == 0) { 728 728 *res_entry = dentry; 729 729 return EOK; -
uspace/lib/nic/src/nic_addr_db.c
r3abf0760 r89ac5513 70 70 nic_addr_entry_t *entry = member_to_inst(item, nic_addr_entry_t, link); 71 71 72 return 0 == bcmp(entry->addr, key->addr, entry->len);72 return memcmp(entry->addr, key->addr, entry->len) == 0; 73 73 } 74 74 -
uspace/lib/nic/src/nic_driver.c
r3abf0760 r89ac5513 682 682 fibril_rwlock_initialize(&nic_data->wv_lock); 683 683 684 bzero(&nic_data->mac, sizeof(nic_address_t));685 bzero(&nic_data->default_mac, sizeof(nic_address_t));686 bzero(&nic_data->stats, sizeof(nic_device_stats_t));684 memset(&nic_data->mac, 0, sizeof(nic_address_t)); 685 memset(&nic_data->default_mac, 0, sizeof(nic_address_t)); 686 memset(&nic_data->stats, 0, sizeof(nic_device_stats_t)); 687 687 688 688 return nic_data; -
uspace/lib/nic/src/nic_impl.c
r3abf0760 r89ac5513 129 129 130 130 fibril_rwlock_write_lock(&nic_data->stats_lock); 131 bzero(&nic_data->stats, sizeof(nic_device_stats_t));131 memset(&nic_data->stats, 0, sizeof(nic_device_stats_t)); 132 132 fibril_rwlock_write_unlock(&nic_data->stats_lock); 133 133 … … 535 535 return ENOMEM; 536 536 } 537 bzero(virtue, sizeof(nic_wol_virtue_t));537 memset(virtue, 0, sizeof(nic_wol_virtue_t)); 538 538 if (length != 0) { 539 539 virtue->data = malloc(length); -
uspace/lib/nic/src/nic_rx_control.c
r3abf0760 r89ac5513 55 55 int nic_rxc_init(nic_rxc_t *rxc) 56 56 { 57 bzero(rxc, sizeof(nic_rxc_t));57 memset(rxc, 0, sizeof(nic_rxc_t)); 58 58 int rc; 59 59 rc = nic_addr_db_init(&rxc->blocked_sources, ETH_ADDR); -
uspace/lib/nic/src/nic_wol_virtues.c
r3abf0760 r89ac5513 73 73 int nic_wol_virtues_init(nic_wol_virtues_t *wvs) 74 74 { 75 bzero(wvs, sizeof(nic_wol_virtues_t));75 memset(wvs, 0, sizeof(nic_wol_virtues_t)); 76 76 wvs->table_operations.hash = nic_wv_hash; 77 77 wvs->table_operations.key_hash = nic_wv_key_hash; -
uspace/lib/posix/source/strings.c
r3abf0760 r89ac5513 131 131 int posix_bcmp(const void *mem1, const void *mem2, size_t n) 132 132 { 133 return bcmp(mem1, mem2, n);133 return memcmp(mem1, mem2, n); 134 134 } 135 135 … … 155 155 void posix_bzero(void *mem, size_t n) 156 156 { 157 bzero(mem, n);157 memset(mem, 0, n); 158 158 } 159 159 -
uspace/lib/usb/src/debug.c
r3abf0760 r89ac5513 84 84 * Remove previous string. 85 85 */ 86 bzero(buffer_dump[buffer_dump_index], BUFFER_DUMP_LEN);86 memset(buffer_dump[buffer_dump_index], 0, BUFFER_DUMP_LEN); 87 87 88 88 /* Do the actual dump. */ -
uspace/lib/usb/src/dev.c
r3abf0760 r89ac5513 114 114 115 115 static bool try_parse_bus_and_address(const char *path, 116 c har **func_start,116 const char **func_start, 117 117 devman_handle_t *out_hc_handle, usb_address_t *out_device_address) 118 118 { … … 120 120 size_t address; 121 121 int rc; 122 c har *ptr;122 const char *ptr; 123 123 124 124 rc = str_uint64_t(path, &ptr, 10, false, &sid); … … 188 188 int rc; 189 189 bool is_bus_addr; 190 c har *func_start = NULL;190 const char *func_start = NULL; 191 191 char *path = NULL; 192 192
Note:
See TracChangeset
for help on using the changeset viewer.
