Changeset 89ac5513 in mainline for uspace/lib


Ignore:
Timestamp:
2013-06-23T19:54:53Z (13 years ago)
Author:
Jakub Jermar <jakub@…>
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.
Message:

Merge mainline changes.

Location:
uspace/lib
Files:
5 added
49 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/bithenge/src/blob.c

    r3abf0760 r89ac5513  
    477477                if (rc != EOK)
    478478                        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) {
    480480                        *out = false;
    481481                        return EOK;
  • uspace/lib/c/Makefile

    r3abf0760 r89ac5513  
    7474        generic/device/pci.c \
    7575        generic/device/ahci.c \
     76        generic/dnsr.c \
    7677        generic/dlfcn.c \
    7778        generic/elf/elf_load.c \
     
    9192        generic/task.c \
    9293        generic/futex.c \
     94        generic/inet/addr.c \
    9395        generic/inet.c \
    9496        generic/inetcfg.c \
     
    161163
    162164$(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 "^\#" > $@
    164166
    165167$(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 "^\#" > $@
    167169
    168170$(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 "^\#" > $@
    170172
    171173$(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 "^\#" > $@
    173175
    174176$(COMMON_HEADER_ARCH): $(COMMON_HEADER)
  • uspace/lib/c/arch/abs32le/Makefile.common

    r3abf0760 r89ac5513  
    2727#
    2828
    29 ifeq ($(COMPILER),clang)
    30         CLANG_ARCH = i386
    31 endif
    32 
    3329ENDIANESS = LE
  • uspace/lib/c/arch/amd64/Makefile.common

    r3abf0760 r89ac5513  
    2727#
    2828
    29 CLANG_ARCH = x86_64
    3029GCC_CFLAGS += -fno-omit-frame-pointer
     30CLANG_CFLAGS += -fno-omit-frame-pointer
    3131
    3232ENDIANESS = LE
  • uspace/lib/c/arch/amd64/src/entry.s

    r3abf0760 r89ac5513  
    4242        #
    4343        pushq $0
     44        pushq $0
    4445        movq %rsp, %rbp
    4546       
  • uspace/lib/c/arch/amd64/src/entryjmp.s

    r3abf0760 r89ac5513  
    3636# Jump to program entry point
    3737entry_point_jmp:
     38        # use standard amd32 prologue not to confuse anybody
     39        push %rbp
     40        movq %rsp, %rbp
     41       
    3842        # pcb must be passed in %rdi, use %rdx as a scratch register
    3943        mov %rdi, %rdx
    4044        mov %rsi, %rdi
    41 
     45       
    4246        # jump to entry point
    4347        jmp %rdx
  • uspace/lib/c/arch/amd64/src/fibril.S

    r3abf0760 r89ac5513  
    4242        movq (%rsp), %rdx     # the caller's return %eip
    4343       
    44         # In %edi is passed 1st argument
     44        # in %edi is passed 1st argument
    4545        CONTEXT_SAVE_ARCH_CORE %rdi %rdx
    4646       
    47         # Save TLS
     47        # save TLS
    4848        movq %fs:0, %rax
    4949        movq %rax, OFFSET_TLS(%rdi)
    50                
    51         xorl %eax, %eax         # context_save returns 1
     50       
     51        xorl %eax, %eax       # context_save returns 1
    5252        incl %eax
    5353        ret
    54 
    5554
    5655## Restore current CPU context
     
    6463       
    6564        movq %rdx,(%rsp)
    66 
     65       
    6766        # Set thread local storage
    68         movq OFFSET_TLS(%rdi), %rdi   # Set arg1 to TLS addr
    69         movl $1, %eax           # SYS_TLS_SET
     67        movq OFFSET_TLS(%rdi), %rdi  # Set arg1 to TLS addr
     68        movl $1, %eax                # SYS_TLS_SET
    7069        syscall
    71 
    72         xorl %eax, %eax         # context_restore returns 0
     70       
     71        xorl %eax, %eax              # context_restore returns 0
    7372        ret
  • uspace/lib/c/arch/amd64/src/thread_entry.s

    r3abf0760 r89ac5513  
    3939        #
    4040        pushq $0
     41        pushq $0
    4142        movq %rsp, %rbp
    42 
     43       
    4344        #
    4445        # RAX contains address of uarg
  • uspace/lib/c/arch/ia32/Makefile.common

    r3abf0760 r89ac5513  
    2727#
    2828
    29 CLANG_ARCH = i386
    30 
    3129ifeq ($(PROCESSOR),i486)
    3230        GCC_CFLAGS += -march=i486 -fno-omit-frame-pointer
     
    3432        GCC_CFLAGS += -march=pentium -fno-omit-frame-pointer
    3533endif
     34CLANG_CFLAGS += -fno-omit-frame-pointer
    3635
    3736ENDIANESS = LE
  • uspace/lib/c/arch/ia32/include/libarch/fibril.h

    r3abf0760 r89ac5513  
    4343 * panic sooner or later
    4444 */
    45 #define SP_DELTA  12
     45#define SP_DELTA  8
    4646
    4747#define context_set(c, _pc, stack, size, ptls) \
  • uspace/lib/c/arch/ia32/src/entry.S

    r3abf0760 r89ac5513  
    4747        # Do not set %gs, it contains descriptor that can see TLS
    4848       
    49 #ifndef PROCESSOR_i486 
     49#ifndef PROCESSOR_i486
    5050        # Detect the mechanism used for making syscalls
    5151        movl $(INTEL_CPUID_STANDARD), %eax
     
    6262        #
    6363        pushl $0
     64        pushl $0
    6465        movl %esp, %ebp
    6566       
  • uspace/lib/c/arch/ia32/src/entryjmp.s

    r3abf0760 r89ac5513  
    3636        push %ebp
    3737        movl %esp, %ebp
    38 
     38       
    3939        # %eax := entry_point
    4040        movl 0x8(%ebp), %eax
    41 
     41       
    4242        # %edi := pcb
    4343        # pcb is passed to the entry point in %edi
    4444        mov 0xc(%ebp), %edi
    45 
     45       
    4646        # Save a tiny bit of stack space
    4747        pop %ebp
    48 
     48       
    4949        jmp *%eax
  • uspace/lib/c/arch/ia32/src/fibril.S

    r3abf0760 r89ac5513  
    3434.global context_restore
    3535
    36 
    3736## Save current CPU context
    3837#
     
    4140#
    4241context_save:
    43         movl 0(%esp),%eax       # the caller's return %eip
    44         movl 4(%esp),%edx       # address of the context variable to save context to
    45 
    46                 # save registers to the context structure
     42        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
    4746        CONTEXT_SAVE_ARCH_CORE %edx %eax
    48 
    49         # Save TLS
     47       
     48        # save TLS
    5049        movl %gs:0, %eax
    5150        movl %eax, OFFSET_TLS(%edx)     # tls -> ctx->tls
    5251       
    53         xorl %eax,%eax          # context_save returns 1
     52        xorl %eax, %eax     # context_save returns 1
    5453        incl %eax
    5554        ret
    56 
    5755
    5856## Restore saved CPU context
     
    6260#
    6361context_restore:
    64         movl 4(%esp),%eax       # address of the context variable to restore context from
    65 
    66                 # restore registers from the context structure
     62        movl 4(%esp), %eax  # address of the context variable to restore context from
     63       
     64        # restore registers from the context structure
    6765        CONTEXT_RESTORE_ARCH_CORE %eax %edx
    68 
    69         movl %edx,0(%esp)       # ctx->pc -> saver's return %eip
    70 
    71         # Set thread local storage
     66       
     67        movl %edx, 0(%esp)  # ctx->pc -> saver's return %eip
     68       
     69        # set thread local storage
    7270        pushl %edx
    73         movl OFFSET_TLS(%eax), %edx   # Set arg1 to TLS addr
    74         movl $1, %eax         # Syscall SYS_TLS_SET
     71        movl OFFSET_TLS(%eax), %edx  # Set arg1 to TLS addr
     72        movl $1, %eax                # Syscall SYS_TLS_SET
    7573        int $0x30
    7674        popl %edx
    7775       
    78         xorl %eax,%eax          # context_restore returns 0
     76        xorl %eax, %eax     # context_restore returns 0
    7977        ret
  • uspace/lib/c/arch/ia32/src/setjmp.S

    r3abf0760 r89ac5513  
    3535.type setjmp,@function
    3636setjmp:
    37         movl 0(%esp),%eax  # save pc value into eax
    38         movl 4(%esp),%edx  # address of the jmp_buf structure to save context to
     37        movl 0(%esp), %eax  # save pc value into eax
     38        movl 4(%esp), %edx  # address of the jmp_buf structure to save context to
    3939       
    4040        # save registers to the jmp_buf structure
    4141        CONTEXT_SAVE_ARCH_CORE %edx %eax
    4242       
    43         xorl %eax,%eax  # set_jmp returns 0
     43        xorl %eax, %eax     # set_jmp returns 0
    4444        ret
    4545
     
    5252        CONTEXT_RESTORE_ARCH_CORE %ecx %edx
    5353       
    54         movl %edx,0(%esp)  # put saved pc on stack
     54        movl %edx, 0(%esp)  # put saved pc on stack
    5555        ret
  • uspace/lib/c/arch/ia32/src/thread_entry.s

    r3abf0760 r89ac5513  
    4040        mov %dx, %fs
    4141        # Do not set %gs, it contains descriptor that can see TLS
    42 
     42       
    4343        #
    4444        # Create the first stack frame.
    4545        #
    4646        pushl $0
     47        pushl $0
    4748        mov %esp, %ebp
    48 
     49       
    4950        #
    5051        # EAX contains address of uarg.
  • uspace/lib/c/generic/device/hw_res_parsed.c

    r3abf0760 r89ac5513  
    188188        hw_resource_list_t hw_resources;
    189189        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));
    191191       
    192192        int rc = hw_res_get_resource_list(sess, &hw_resources);
  • uspace/lib/c/generic/inet.c

    r3abf0760 r89ac5513  
    107107int inet_send(inet_dgram_t *dgram, uint8_t ttl, inet_df_t df)
    108108{
    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       
    111121        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       
    117128        if (rc != EOK) {
    118129                async_forget(req);
    119130                return rc;
    120131        }
    121 
     132       
    122133        sysarg_t retval;
    123134        async_wait_for(req, &retval);
    124135        if (retval != EOK)
    125136                return retval;
    126 
     137       
    127138        return EOK;
    128139}
     
    130141int inet_get_srcaddr(inet_addr_t *remote, uint8_t tos, inet_addr_t *local)
    131142{
     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       
    132150        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,
    136152            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);
    143160        return EOK;
    144161}
     
    148165        int rc;
    149166        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);
    153170        dgram.tos = IPC_GET_ARG3(*call);
    154171
  • uspace/lib/c/generic/inetcfg.c

    r3abf0760 r89ac5513  
    136136    sysarg_t link_id, sysarg_t *addr_id)
    137137{
    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);
    143149        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       
    152158        async_wait_for(req, &retval);
    153159        *addr_id = IPC_GET_ARG1(answer);
    154 
     160       
    155161        return retval;
    156162}
     
    196202        assert(act_size <= LOC_NAME_MAXLEN);
    197203        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);
    201207        ainfo->ilink = IPC_GET_ARG3(answer);
    202208        ainfo->name = str_dup(name_buf);
     
    284290    inet_addr_t *router, sysarg_t *sroute_id)
    285291{
    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       
    288305        ipc_call_t answer;
    289306        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);
    291309        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       
    300318        async_wait_for(req, &retval);
    301319        *sroute_id = IPC_GET_ARG1(answer);
    302 
     320       
    303321        return retval;
    304322}
     
    345363        name_buf[act_size] = '\0';
    346364
    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);
    350368        srinfo->name = str_dup(name_buf);
    351369
  • uspace/lib/c/generic/inetping.c

    r3abf0760 r89ac5513  
    7979{
    8080        async_exch_t *exch = async_exchange_begin(inetping_sess);
    81 
     81       
    8282        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);
    8585        sysarg_t retval = async_data_write_start(exch, sdu->data, sdu->size);
    86 
     86       
    8787        async_exchange_end(exch);
    88 
     88       
    8989        if (retval != EOK) {
    9090                async_forget(req);
    9191                return retval;
    9292        }
    93 
     93       
    9494        async_wait_for(req, &retval);
    9595        return retval;
    9696}
    9797
    98 int inetping_get_srcaddr(inet_addr_t *remote, inet_addr_t *local)
     98int inetping_get_srcaddr(uint32_t remote, uint32_t *local)
    9999{
     100        async_exch_t *exch = async_exchange_begin(inetping_sess);
     101       
    100102        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,
    104104            &local_addr);
     105       
    105106        async_exchange_end(exch);
    106 
     107       
    107108        if (rc != EOK)
    108109                return rc;
    109 
    110         local->ipv4 = local_addr;
     110       
     111        *local = (uint32_t) local_addr;
    111112        return EOK;
    112113}
     
    114115static void inetping_ev_recv(ipc_callid_t callid, ipc_call_t *call)
    115116{
    116         int rc;
    117117        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);
    121121        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);
    124124        if (rc != EOK) {
    125125                async_answer_0(callid, rc);
    126126                return;
    127127        }
    128 
     128       
    129129        rc = inetping_ev_ops->recv(&sdu);
    130130        free(sdu.data);
  • uspace/lib/c/generic/iplink.c

    r3abf0760 r89ac5513  
    3939#include <errno.h>
    4040#include <inet/iplink.h>
     41#include <inet/addr.h>
    4142#include <ipc/iplink.h>
    4243#include <ipc/services.h>
     
    8384{
    8485        async_exch_t *exch = async_exchange_begin(iplink->sess);
    85 
     86       
    8687        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);
    8990        int rc = async_data_write_start(exch, sdu->data, sdu->size);
     91       
    9092        async_exchange_end(exch);
    91 
     93       
    9294        if (rc != EOK) {
    9395                async_forget(req);
    9496                return rc;
    9597        }
    96 
     98       
    9799        sysarg_t retval;
    98100        async_wait_for(req, &retval);
    99101        if (retval != EOK)
    100102                return retval;
    101 
     103       
    102104        return EOK;
    103105}
     
    118120}
    119121
    120 int iplink_addr_add(iplink_t *iplink, iplink_addr_t *addr)
     122int iplink_addr_add(iplink_t *iplink, inet_addr_t *addr)
    121123{
     124        uint32_t addr_addr;
     125        int rc = inet_addr_pack(addr, &addr_addr);
     126        if (rc != EOK)
     127                return rc;
     128       
    122129        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);
    125131        async_exchange_end(exch);
    126 
     132       
    127133        return rc;
    128134}
    129135
    130 int iplink_addr_remove(iplink_t *iplink, iplink_addr_t *addr)
     136int iplink_addr_remove(iplink_t *iplink, inet_addr_t *addr)
    131137{
     138        uint32_t addr_addr;
     139        int rc = inet_addr_pack(addr, &addr_addr);
     140        if (rc != EOK)
     141                return rc;
     142       
    132143        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);
    135145        async_exchange_end(exch);
    136 
     146       
    137147        return rc;
    138148}
     
    141151    ipc_call_t *call)
    142152{
    143         int rc;
    144153        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);
    150159        if (rc != EOK) {
    151160                async_answer_0(callid, rc);
    152161                return;
    153162        }
    154 
     163       
    155164        rc = iplink->ev_ops->recv(iplink, &sdu);
    156165        free(sdu.data);
  • uspace/lib/c/generic/iplink_srv.c

    r3abf0760 r89ac5513  
    5454    ipc_call_t *call)
    5555{
    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));
    6257        async_answer_0(callid, rc);
    6358}
     
    6661    ipc_call_t *call)
    6762{
    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));
    7464        async_answer_0(callid, rc);
    7565}
     
    8171        int rc;
    8272
    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);
    8575
    8676        rc = async_data_write_accept(&sdu.data, false, 0, 0, 0, &sdu.size);
     
    139129                if (!method) {
    140130                        /* The other side has hung up */
    141                         fibril_mutex_lock(&srv->lock);
     131                        fibril_mutex_lock(&srv->lock);
    142132                        srv->connected = false;
    143                         fibril_mutex_unlock(&srv->lock);
     133                        fibril_mutex_unlock(&srv->lock);
    144134                        async_answer_0(callid, EOK);
    145135                        break;
     
    175165
    176166        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);
    179169        int rc = async_data_write_start(exch, sdu->data, sdu->size);
    180170        async_exchange_end(exch);
  • uspace/lib/c/generic/mem.c

    r3abf0760 r89ac5513  
    224224 * @param s1  Pointer to the first area to compare.
    225225 * @param s2  Pointer to the second area to compare.
    226  * @param len Size of the first area in bytes. Both areas must have
    227  *            the same length.
    228  *
    229  * @return If len is 0, return zero. If the areas match, return
    230  *         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 */
     233int memcmp(const void *s1, const void *s2, size_t len)
    234234{
    235235        uint8_t *u1 = (uint8_t *) s1;
    236236        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;
    241247}
    242248
  • uspace/lib/c/generic/net/inet.c

    r3abf0760 r89ac5513  
    3939#include <net/in6.h>
    4040#include <net/inet.h>
    41 
     41#include <inet/addr.h>
    4242#include <errno.h>
    4343#include <mem.h>
     
    9494}
    9595
     96static 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
     126static int inet_pton6(const char *address, uint8_t *data)
     127{
     128        // FIXME TODO
     129        return ENOTSUP;
     130}
     131
    96132/** Parses the character string into the address.
    97133 *
    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.
    99137 *
    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 *
    107143 */
    108144int inet_pton(uint16_t family, const char *address, uint8_t *data)
    109145{
    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 */
    127146        switch (family) {
    128147        case AF_INET:
    129                 count = 4;
    130                 base = 10;
    131                 bytes = 1;
    132                 break;
    133 
     148                return inet_pton4(address, data);
    134149        case AF_INET6:
    135                 count = 16;
    136                 base = 16;
    137                 bytes = 4;
    138                 break;
    139 
     150                return inet_pton6(address, data);
    140151        default:
     152                /** Unknown address family */
    141153                return ENOTSUP;
    142154        }
    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 character
    167                          * should be either '.' or ':' but is ignored to be
    168                          * more generic
    169                          */
    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;
    189155}
    190156
  • uspace/lib/c/generic/net/socket_client.c

    r3abf0760 r89ac5513  
    8787        /** Parent module service. */
    8888        services_t service;
     89        /** Socket family */
     90        int family;
    8991
    9092        /**
     
    395397        switch (domain) {
    396398        case PF_INET:
     399        case PF_INET6:
    397400                switch (type) {
    398401                case SOCK_STREAM:
     
    433436                break;
    434437
    435         case PF_INET6:
    436438        default:
    437439                return EPFNOSUPPORT;
     
    446448                return ENOMEM;
    447449
    448         bzero(socket, sizeof(*socket));
     450        memset(socket, 0, sizeof(*socket));
     451        socket->family = domain;
    449452        fibril_rwlock_write_lock(&socket_globals.lock);
    450453
     
    657660                return ENOMEM;
    658661        }
    659         bzero(new_socket, sizeof(*new_socket));
     662        memset(new_socket, 0, sizeof(*new_socket));
    660663        socket_id = socket_generate_new_id();
    661664        if (socket_id <= 0) {
  • uspace/lib/c/generic/net/socket_parse.c

    r3abf0760 r89ac5513  
    7979int socket_parse_protocol_family(const char *name, int *pf)
    8080{
     81        if (str_lcmp(name, "PF_INET6", 8) == 0) {
     82                *pf = PF_INET6;
     83                return EOK;
     84        }
     85
    8186        if (str_lcmp(name, "PF_INET", 7) == 0) {
    8287                *pf = PF_INET;
    83                 return EOK;
    84         }
    85        
    86         if (str_lcmp(name, "PF_INET6", 8) == 0) {
    87                 *pf = PF_INET6;
    8888                return EOK;
    8989        }
  • uspace/lib/c/generic/str.c

    r3abf0760 r89ac5513  
    15241524 *
    15251525 */
    1526 int str_uint8_t(const char *nptr, char **endptr, unsigned int base,
     1526int str_uint8_t(const char *nptr, const char **endptr, unsigned int base,
    15271527    bool strict, uint8_t *result)
    15281528{
     
    15711571 *
    15721572 */
    1573 int str_uint16_t(const char *nptr, char **endptr, unsigned int base,
     1573int str_uint16_t(const char *nptr, const char **endptr, unsigned int base,
    15741574    bool strict, uint16_t *result)
    15751575{
     
    16181618 *
    16191619 */
    1620 int str_uint32_t(const char *nptr, char **endptr, unsigned int base,
     1620int str_uint32_t(const char *nptr, const char **endptr, unsigned int base,
    16211621    bool strict, uint32_t *result)
    16221622{
     
    16651665 *
    16661666 */
    1667 int str_uint64_t(const char *nptr, char **endptr, unsigned int base,
     1667int str_uint64_t(const char *nptr, const char **endptr, unsigned int base,
    16681668    bool strict, uint64_t *result)
    16691669{
     
    17041704 *
    17051705 */
    1706 int str_size_t(const char *nptr, char **endptr, unsigned int base,
     1706int str_size_t(const char *nptr, const char **endptr, unsigned int base,
    17071707    bool strict, size_t *result)
    17081708{
  • uspace/lib/c/include/device/hw_res_parsed.h

    r3abf0760 r89ac5513  
    127127        free(list->dma_channels.channels);
    128128       
    129         bzero(list, sizeof(hw_res_list_parsed_t));
     129        memset(list, 0, sizeof(hw_res_list_parsed_t));
    130130}
    131131
     
    136136static inline void hw_res_list_parsed_init(hw_res_list_parsed_t *list)
    137137{
    138         bzero(list, sizeof(hw_res_list_parsed_t));
     138        memset(list, 0, sizeof(hw_res_list_parsed_t));
    139139}
    140140
  • uspace/lib/c/include/inet/inet.h

    r3abf0760 r89ac5513  
    3636#define LIBC_INET_INET_H_
    3737
     38#include <inet/addr.h>
    3839#include <sys/types.h>
    3940
    4041#define INET_TTL_MAX 255
    41 
    42 typedef struct {
    43         uint32_t ipv4;
    44 } inet_addr_t;
    4542
    4643typedef struct {
  • uspace/lib/c/include/inet/inetcfg.h

    r3abf0760 r89ac5513  
    3838#include <inet/inet.h>
    3939#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;
    4840
    4941/** Address object info */
  • uspace/lib/c/include/inet/inetping.h

    r3abf0760 r89ac5513  
    4040
    4141typedef struct {
    42         inet_addr_t src;
    43         inet_addr_t dest;
     42        uint32_t src;
     43        uint32_t dest;
    4444        uint16_t seq_no;
    4545        void *data;
     
    5353extern int inetping_init(inetping_ev_ops_t *);
    5454extern int inetping_send(inetping_sdu_t *);
    55 extern int inetping_get_srcaddr(inet_addr_t *, inet_addr_t *);
    56 
     55extern int inetping_get_srcaddr(uint32_t, uint32_t *);
    5756
    5857#endif
  • uspace/lib/c/include/inet/iplink.h

    r3abf0760 r89ac5513  
    3838#include <async.h>
    3939#include <sys/types.h>
     40#include <inet/addr.h>
    4041
    4142struct iplink_ev_ops;
     
    4647} iplink_t;
    4748
    48 typedef struct {
    49         uint32_t ipv4;
    50 } iplink_addr_t;
    51 
    52 /** IP link Service Data Unit */
     49/** IPv4 link Service Data Unit */
    5350typedef struct {
    5451        /** Local source address */
    55         iplink_addr_t lsrc;
     52        uint32_t lsrc;
    5653        /** Local destination address */
    57         iplink_addr_t ldest;
     54        uint32_t ldest;
    5855        /** Serialized IP packet */
    5956        void *data;
     
    6158        size_t size;
    6259} iplink_sdu_t;
     60
     61/** IPv6 link Service Data Unit */
     62typedef 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;
    6370
    6471typedef struct iplink_ev_ops {
     
    6976extern void iplink_close(iplink_t *);
    7077extern int iplink_send(iplink_t *, iplink_sdu_t *);
    71 extern int iplink_addr_add(iplink_t *, iplink_addr_t *);
    72 extern int iplink_addr_remove(iplink_t *, iplink_addr_t *);
     78extern int iplink_addr_add(iplink_t *, inet_addr_t *);
     79extern int iplink_addr_remove(iplink_t *, inet_addr_t *);
    7380extern int iplink_get_mtu(iplink_t *, size_t *);
    7481
  • uspace/lib/c/include/inet/iplink_srv.h

    r3abf0760 r89ac5513  
    5151} iplink_srv_t;
    5252
    53 typedef struct {
    54         uint32_t ipv4;
    55 } iplink_srv_addr_t;
    56 
    5753/** IP link Service Data Unit */
    5854typedef struct {
    5955        /** Local source address */
    60         iplink_srv_addr_t lsrc;
     56        uint32_t lsrc;
    6157        /** Local destination address */
    62         iplink_srv_addr_t ldest;
     58        uint32_t ldest;
    6359        /** Serialized IP packet */
    6460        void *data;
     
    7268        int (*send)(iplink_srv_t *, iplink_srv_sdu_t *);
    7369        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);
    7672} iplink_ops_t;
    7773
  • uspace/lib/c/include/io/verify.h

    r3abf0760 r89ac5513  
    3838#ifndef NVERIFY_PRINTF
    3939
     40#ifdef __clang__
     41#define PRINTF_ATTRIBUTE(start, end) \
     42        __attribute__((format(__printf__, start, end)))
     43#else
    4044#define PRINTF_ATTRIBUTE(start, end) \
    4145        __attribute__((format(gnu_printf, start, end)))
     46#endif
    4247
    4348#else /* NVERIFY_PRINTF */
  • uspace/lib/c/include/ipc/services.h

    r3abf0760 r89ac5513  
    5353} services_t;
    5454
     55#define SERVICE_NAME_DNSR     "net/dnsr"
    5556#define SERVICE_NAME_INET     "net/inet"
    5657#define SERVICE_NAME_INETCFG  "net/inetcfg"
  • uspace/lib/c/include/mem.h

    r3abf0760 r89ac5513  
    3838#include <sys/types.h>
    3939
    40 #define bzero(ptr, len)  memset((ptr), 0, (len))
    41 
    4240extern void *memset(void *, int, size_t)
    4341    __attribute__ ((optimize("-fno-tree-loop-distribute-patterns")));
     
    4543    __attribute__ ((optimize("-fno-tree-loop-distribute-patterns")));
    4644extern void *memmove(void *, const void *, size_t);
    47 
    48 extern int bcmp(const void *, const void *, size_t);
     45extern int memcmp(const void *, const void *, size_t);
    4946
    5047#endif
  • uspace/lib/c/include/net/in.h

    r3abf0760 r89ac5513  
    4747#define INADDR_ANY 0
    4848
    49 /** Type definition of the INET address.
    50  * @see in_addr
    51  */
    52 typedef struct in_addr in_addr_t;
    53 
    54 /** Type definition of the INET socket address.
    55  * @see sockaddr_in
    56  */
    57 typedef struct sockaddr_in      sockaddr_in_t;
    58 
    5949/** INET address. */
    60 struct in_addr {
     50typedef struct in_addr {
    6151        /** 4 byte IP address. */
    6252        uint32_t s_addr;
    63 };
     53} in_addr_t;
    6454
    6555/** INET socket address.
    6656 * @see sockaddr
    6757 */
    68 struct sockaddr_in {
     58typedef struct sockaddr_in {
    6959        /** Address family. Should be AF_INET. */
    7060        uint16_t sin_family;
     
    7262        uint16_t sin_port;
    7363        /** Internet address. */
    74         struct in_addr sin_addr;
     64        in_addr_t sin_addr;
    7565        /** Padding to meet the sockaddr size. */
    7666        uint8_t sin_zero[8];
    77 };
     67} sockaddr_in_t;
    7868
    7969#endif
  • uspace/lib/c/include/net/ip_protocols.h

    r3abf0760 r89ac5513  
    4444/*@{*/
    4545
    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
    4950
    5051/*@}*/
  • uspace/lib/c/include/net/socket_codes.h

    r3abf0760 r89ac5513  
    4545
    4646enum {
    47         AF_UNKNOWN = 0,
     47        AF_NONE = 0,
    4848        AF_INET,        /* IPv4 address */
    4949        AF_INET6        /* IPv6 address */
  • uspace/lib/c/include/str.h

    r3abf0760 r89ac5513  
    109109extern char *str_ndup(const char *, size_t max_size);
    110110
    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 *);
     111extern int str_uint8_t(const char *, const char **, unsigned int, bool,
     112    uint8_t *);
     113extern int str_uint16_t(const char *, const char **, unsigned int, bool,
     114    uint16_t *);
     115extern int str_uint32_t(const char *, const char **, unsigned int, bool,
     116    uint32_t *);
     117extern int str_uint64_t(const char *, const char **, unsigned int, bool,
     118    uint64_t *);
     119extern int str_size_t(const char *, const char **, unsigned int, bool,
     120    size_t *);
    116121
    117122extern void order_suffix(const uint64_t, uint64_t *, char *);
  • uspace/lib/drv/generic/remote_nic.c

    r3abf0760 r89ac5513  
    104104       
    105105        nic_address_t address;
    106         bzero(&address, sizeof(nic_address_t));
     106        memset(&address, 0, sizeof(nic_address_t));
    107107       
    108108        int rc = nic_iface->get_address(dev, &address);
     
    173173       
    174174        nic_device_stats_t stats;
    175         bzero(&stats, sizeof(nic_device_stats_t));
     175        memset(&stats, 0, sizeof(nic_device_stats_t));
    176176       
    177177        int rc = nic_iface->get_stats(dev, &stats);
     
    208208       
    209209        nic_device_info_t info;
    210         bzero(&info, sizeof(nic_device_info_t));
     210        memset(&info, 0, sizeof(nic_device_info_t));
    211211       
    212212        int rc = nic_iface->get_device_info(dev, &info);
     
    399399        }
    400400       
    401         bzero(address_list, max_count * sizeof(nic_address_t));
     401        memset(address_list, 0, max_count * sizeof(nic_address_t));
    402402        nic_unicast_mode_t mode = NIC_UNICAST_DEFAULT;
    403403        size_t address_count = 0;
     
    503503        }
    504504       
    505         bzero(address_list, max_count * sizeof(nic_address_t));
     505        memset(address_list, 0, max_count * sizeof(nic_address_t));
    506506        nic_multicast_mode_t mode = NIC_MULTICAST_BLOCKED;
    507507        size_t address_count = 0;
     
    667667        }
    668668       
    669         bzero(address_list, max_count * sizeof(nic_address_t));
     669        memset(address_list, 0, max_count * sizeof(nic_address_t));
    670670        size_t address_count = 0;
    671671       
     
    759759       
    760760        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));
    762762       
    763763        int rc = nic_iface->vlan_get_mask(dev, &vlan_mask);
     
    932932        }
    933933       
    934         bzero(data, max_length);
     934        memset(data, 0, max_length);
    935935       
    936936        int rc = nic_iface->wol_virtue_probe(dev, id, &type, max_length,
     
    982982        }
    983983       
    984         bzero(id_list, max_count * sizeof (nic_wv_id_t));
     984        memset(id_list, 0, max_count * sizeof (nic_wv_id_t));
    985985       
    986986        int rc = nic_iface->wol_virtue_list(dev, type, max_count, id_list,
     
    10471047        }
    10481048       
    1049         bzero(data, max_length);
     1049        memset(data, 0, max_length);
    10501050       
    10511051        int rc = nic_iface->wol_load_info(dev, &type, max_length, data,
  • uspace/lib/ext4/libext4_directory.c

    r3abf0760 r89ac5513  
    725725                            name_len) {
    726726                                /* Compare names */
    727                                 if (bcmp((uint8_t *) name, dentry->name, name_len) == 0) {
     727                                if (memcmp((uint8_t *) name, dentry->name, name_len) == 0) {
    728728                                        *res_entry = dentry;
    729729                                        return EOK;
  • uspace/lib/nic/src/nic_addr_db.c

    r3abf0760 r89ac5513  
    7070        nic_addr_entry_t *entry = member_to_inst(item, nic_addr_entry_t, link);
    7171       
    72         return 0 == bcmp(entry->addr, key->addr, entry->len);
     72        return memcmp(entry->addr, key->addr, entry->len) == 0;
    7373}
    7474
  • uspace/lib/nic/src/nic_driver.c

    r3abf0760 r89ac5513  
    682682        fibril_rwlock_initialize(&nic_data->wv_lock);
    683683       
    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));
    687687       
    688688        return nic_data;
  • uspace/lib/nic/src/nic_impl.c

    r3abf0760 r89ac5513  
    129129
    130130                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));
    132132                fibril_rwlock_write_unlock(&nic_data->stats_lock);
    133133
     
    535535                return ENOMEM;
    536536        }
    537         bzero(virtue, sizeof (nic_wol_virtue_t));
     537        memset(virtue, 0, sizeof(nic_wol_virtue_t));
    538538        if (length != 0) {
    539539                virtue->data = malloc(length);
  • uspace/lib/nic/src/nic_rx_control.c

    r3abf0760 r89ac5513  
    5555int nic_rxc_init(nic_rxc_t *rxc)
    5656{
    57         bzero(rxc, sizeof (nic_rxc_t));
     57        memset(rxc, 0, sizeof(nic_rxc_t));
    5858        int rc;
    5959        rc = nic_addr_db_init(&rxc->blocked_sources, ETH_ADDR);
  • uspace/lib/nic/src/nic_wol_virtues.c

    r3abf0760 r89ac5513  
    7373int nic_wol_virtues_init(nic_wol_virtues_t *wvs)
    7474{
    75         bzero(wvs, sizeof(nic_wol_virtues_t));
     75        memset(wvs, 0, sizeof(nic_wol_virtues_t));
    7676        wvs->table_operations.hash = nic_wv_hash;
    7777        wvs->table_operations.key_hash = nic_wv_key_hash;
  • uspace/lib/posix/source/strings.c

    r3abf0760 r89ac5513  
    131131int posix_bcmp(const void *mem1, const void *mem2, size_t n)
    132132{
    133         return bcmp(mem1, mem2, n);
     133        return memcmp(mem1, mem2, n);
    134134}
    135135
     
    155155void posix_bzero(void *mem, size_t n)
    156156{
    157         bzero(mem, n);
     157        memset(mem, 0, n);
    158158}
    159159
  • uspace/lib/usb/src/debug.c

    r3abf0760 r89ac5513  
    8484         * Remove previous string.
    8585         */
    86         bzero(buffer_dump[buffer_dump_index], BUFFER_DUMP_LEN);
     86        memset(buffer_dump[buffer_dump_index], 0, BUFFER_DUMP_LEN);
    8787
    8888        /* Do the actual dump. */
  • uspace/lib/usb/src/dev.c

    r3abf0760 r89ac5513  
    114114
    115115static bool try_parse_bus_and_address(const char *path,
    116     char **func_start,
     116    const char **func_start,
    117117    devman_handle_t *out_hc_handle, usb_address_t *out_device_address)
    118118{
     
    120120        size_t address;
    121121        int rc;
    122         char *ptr;
     122        const char *ptr;
    123123
    124124        rc = str_uint64_t(path, &ptr, 10, false, &sid);
     
    188188        int rc;
    189189        bool is_bus_addr;
    190         char *func_start = NULL;
     190        const char *func_start = NULL;
    191191        char *path = NULL;
    192192
Note: See TracChangeset for help on using the changeset viewer.