Changes in / [84876aa4:b093a62] in mainline


Ignore:
Files:
3 added
12 deleted
50 edited

Legend:

Unmodified
Added
Removed
  • abi/include/abi/syscall.h

    r84876aa4 rb093a62  
    3636#define _ABI_SYSCALL_H_
    3737
    38 /** System calls.
    39  *
    40  * If you are adding or removing syscalls, or changing the number of
    41  * their arguments, please update syscall description table
    42  * in @c uspace/app/trace/syscalls.c
    43  */
    4438typedef enum {
    4539        SYS_KIO = 0,
  • kernel/generic/include/cap/cap.h

    r84876aa4 rb093a62  
    7070} kobject_ops_t;
    7171
    72 extern kobject_ops_t *kobject_ops[];
    73 
    74 #define KOBJECT_OP(k)   kobject_ops[(k)->type]
    75 
    7672/*
    7773 * Everything in kobject_t except for the atomic reference count, the capability
     
    8682        /** List of published capabilities associated with the kobject */
    8783        list_t caps_list;
     84
     85        kobject_ops_t *ops;
    8886
    8987        union {
     
    141139extern kobject_t *kobject_alloc(unsigned int);
    142140extern void kobject_free(kobject_t *);
    143 extern void kobject_initialize(kobject_t *, kobject_type_t, void *);
     141extern void kobject_initialize(kobject_t *, kobject_type_t, void *,
     142    kobject_ops_t *);
    144143extern kobject_t *kobject_get(struct task *, cap_handle_t, kobject_type_t);
    145144extern void kobject_add_ref(kobject_t *);
  • kernel/generic/include/ipc/ipc.h

    r84876aa4 rb093a62  
    172172extern answerbox_t *ipc_box_0;
    173173
    174 extern kobject_ops_t call_kobject_ops;
    175 
    176174extern void ipc_init(void);
    177175
  • kernel/generic/include/ipc/ipcrsc.h

    r84876aa4 rb093a62  
    4040#include <cap/cap.h>
    4141
    42 extern kobject_ops_t phone_kobject_ops;
    43 
    4442extern errno_t phone_alloc(task_t *, bool, cap_phone_handle_t *, kobject_t **);
    4543extern void phone_dealloc(cap_phone_handle_t);
  • kernel/generic/include/ipc/irq.h

    r84876aa4 rb093a62  
    4646#include <typedefs.h>
    4747#include <adt/list.h>
    48 #include <cap/cap.h>
    49 
    50 extern kobject_ops_t irq_kobject_ops;
    5148
    5249extern irq_ownership_t ipc_irq_top_half_claim(irq_t *);
  • kernel/generic/include/synch/syswaitq.h

    r84876aa4 rb093a62  
    3838#include <typedefs.h>
    3939#include <abi/cap.h>
    40 #include <cap/cap.h>
    41 
    42 extern kobject_ops_t waitq_kobject_ops;
    4340
    4441extern void sys_waitq_init(void);
  • kernel/generic/src/cap/cap.c

    r84876aa4 rb093a62  
    8383#include <mm/slab.h>
    8484#include <adt/list.h>
    85 #include <synch/syswaitq.h>
    86 #include <ipc/ipcrsc.h>
    87 #include <ipc/ipc.h>
    88 #include <ipc/irq.h>
    8985
    9086#include <limits.h>
     
    9894static slab_cache_t *cap_cache;
    9995static slab_cache_t *kobject_cache;
    100 
    101 kobject_ops_t *kobject_ops[KOBJECT_TYPE_MAX] = {
    102         [KOBJECT_TYPE_CALL] = &call_kobject_ops,
    103         [KOBJECT_TYPE_IRQ] = &irq_kobject_ops,
    104         [KOBJECT_TYPE_PHONE] = &phone_kobject_ops,
    105         [KOBJECT_TYPE_WAITQ] = &waitq_kobject_ops
    106 };
    10796
    10897static size_t caps_hash(const ht_link_t *item)
     
    423412 * @param type  Type of the kernel object.
    424413 * @param raw   Raw pointer to the encapsulated object.
    425  */
    426 void kobject_initialize(kobject_t *kobj, kobject_type_t type, void *raw)
     414 * @param ops   Pointer to kernel object operations for the respective type.
     415 */
     416void kobject_initialize(kobject_t *kobj, kobject_type_t type, void *raw,
     417    kobject_ops_t *ops)
    427418{
    428419        atomic_store(&kobj->refcnt, 1);
     
    433424        kobj->type = type;
    434425        kobj->raw = raw;
     426        kobj->ops = ops;
    435427}
    436428
     
    482474{
    483475        if (atomic_postdec(&kobj->refcnt) == 1) {
    484                 KOBJECT_OP(kobj)->destroy(kobj->raw);
     476                kobj->ops->destroy(kobj->raw);
    485477                kobject_free(kobj);
    486478        }
  • kernel/generic/src/ipc/ipc.c

    r84876aa4 rb093a62  
    100100}
    101101
    102 kobject_ops_t call_kobject_ops = {
     102static kobject_ops_t call_kobject_ops = {
    103103        .destroy = call_destroy
    104104};
     
    127127
    128128        _ipc_call_init(call);
    129         kobject_initialize(kobj, KOBJECT_TYPE_CALL, call);
     129        kobject_initialize(kobj, KOBJECT_TYPE_CALL, call, &call_kobject_ops);
    130130        call->kobject = kobj;
    131131
  • kernel/generic/src/ipc/ipcrsc.c

    r84876aa4 rb093a62  
    5252}
    5353
    54 kobject_ops_t phone_kobject_ops = {
     54static kobject_ops_t phone_kobject_ops = {
    5555        .destroy = phone_destroy
    5656};
     
    9494                phone->hangup_call = hcall;
    9595
    96                 kobject_initialize(kobj, KOBJECT_TYPE_PHONE, phone);
     96                kobject_initialize(kobj, KOBJECT_TYPE_PHONE, phone,
     97                    &phone_kobject_ops);
    9798                phone->kobject = kobj;
    9899
  • kernel/generic/src/ipc/irq.c

    r84876aa4 rb093a62  
    306306}
    307307
    308 kobject_ops_t irq_kobject_ops = {
     308static kobject_ops_t irq_kobject_ops = {
    309309        .destroy = irq_destroy
    310310};
     
    385385        irq_spinlock_unlock(&irq_uspace_hash_table_lock, true);
    386386
    387         kobject_initialize(kobject, KOBJECT_TYPE_IRQ, irq);
     387        kobject_initialize(kobject, KOBJECT_TYPE_IRQ, irq, &irq_kobject_ops);
    388388        cap_publish(TASK, handle, kobject);
    389389
  • kernel/generic/src/mm/malloc.c

    r84876aa4 rb093a62  
    187187void *malloc(size_t size)
    188188{
    189         if (size + _offset < size)
    190                 return NULL;
    191 
    192189        void *obj = mem_alloc(alignof(max_align_t), size + _offset) + _offset;
    193190
  • kernel/generic/src/synch/syswaitq.c

    r84876aa4 rb093a62  
    5454}
    5555
    56 kobject_ops_t waitq_kobject_ops = {
     56static kobject_ops_t waitq_kobject_ops = {
    5757        .destroy = waitq_destroy
    5858};
     
    100100                return (sys_errno_t) ENOMEM;
    101101        }
    102         kobject_initialize(kobj, KOBJECT_TYPE_WAITQ, wq);
     102        kobject_initialize(kobj, KOBJECT_TYPE_WAITQ, wq, &waitq_kobject_ops);
    103103
    104104        cap_handle_t handle;
  • kernel/generic/src/udebug/udebug.c

    r84876aa4 rb093a62  
    479479        mutex_unlock(&THREAD->udebug.lock);
    480480
    481         /*
    482          * This is where we will typically block until a post-mortem debugger
    483          * terminates the debugging session.
    484          */
     481        /* Make sure the debugging session is over before proceeding. */
     482        mutex_lock(&THREAD->udebug.lock);
     483        while (THREAD->udebug.active)
     484                condvar_wait(&THREAD->udebug.active_cv, &THREAD->udebug.lock);
     485        mutex_unlock(&THREAD->udebug.lock);
     486
    485487        udebug_stoppable_end();
    486488}
  • meson/part/exports/config.mk.in

    r84876aa4 rb093a62  
    11# Generated from config.mk.in using Meson. Do not modify.
    22# Do not forget to set HELENOS_EXPORT_ROOT when using the file.
    3 HELENOS_OVERLAY_PATH="@HELENOS_OVERLAY_PATH@"
    43HELENOS_CROSS_PATH="@HELENOS_CROSS_PATH@"
    54HELENOS_ARCH="@HELENOS_ARCH@"
  • meson/part/exports/meson.build

    r84876aa4 rb093a62  
    6262
    6363conf_data = configuration_data({
    64         'HELENOS_OVERLAY_PATH' : meson.source_root() / 'uspace/overlay',
    6564        'HELENOS_CROSS_PATH' : cc_path,
    6665        'HELENOS_ARCH' : cc_arch,
  • meson/part/extra_targets/meson.build

    r84876aa4 rb093a62  
    7272        )
    7373
    74         run_target('doxygen', command: [
    75                 sh,
    76                 '-c', 'cd $1 && $2 $3',
    77                 '--',
    78                 meson.source_root() / 'doxygen',
    79                 doxygen.path(),
    80                 _dox_cfg,
    81         ])
     74        run_target('doxygen', command: [ doxygen, _dox_cfg ])
    8275endif
    8376
  • tools/xcw/bin/helenos-cc

    r84876aa4 rb093a62  
    3535
    3636XCW="$(dirname "$0")"
    37 BUILD_ROOT="$(dirname "$(dirname "$(dirname "$XCW")")")"
     37SRC_ROOT="$XCW/../../.."
    3838if [ -z "$EXPORT_DIR" ]; then
    39         EXPORT_DIR="$BUILD_ROOT/export"
     39        EXPORT_DIR="$SRC_ROOT/build/dist"
    4040fi
    4141
    4242HELENOS_EXPORT_ROOT="$EXPORT_DIR"
    4343
    44 source "${EXPORT_DIR}/config.sh"
     44source "${EXPORT_DIR}/config/config.sh"
    4545
    4646# CC is a compilation driver, so we should check which stage of compilation
  • tools/xcw/bin/helenos-pkg-config

    r84876aa4 rb093a62  
    3333
    3434XCW="$(dirname "$0")"
    35 BUILD_ROOT="$(dirname "$(dirname "$(dirname "$XCW")")")"
     35SRC_ROOT="$XCW/../../.."
    3636if [ -z "$EXPORT_DIR" ]; then
    37         EXPORT_DIR="$BUILD_ROOT/export"
     37        EXPORT_DIR="$SRC_ROOT/build/dist"
    3838fi
    39 
    4039INCLUDE_DIR="$EXPORT_DIR/include"
    4140LIB_DIR="$EXPORT_DIR/lib"
  • tools/xcw/bin/helenos-test

    r84876aa4 rb093a62  
    11#!/bin/bash
    22#
    3 # Copyright (c) 2019 Jiri Svoboda
     3# Copyright (c) 2018 Jiri Svoboda
    44# All rights reserved.
    55#
     
    3333
    3434XCW="$(dirname "$0")"
    35 BUILD_ROOT="$(dirname "$(dirname "$(dirname "$XCW")")")"
     35SRC_ROOT="$XCW/../../.."
    3636
    37 cd "$BUILD_ROOT"
    38 ninja image_path
     37cd "$SRC_ROOT"
     38make
    3939tools/ew.py
  • tools/xcw/demo/Makefile

    r84876aa4 rb093a62  
    3636#
    3737#    cd <helenos-source-dir>
    38 #    mkdir build
    39 #    cd build
    40 #    ../configure.sh
    41 #    ninja
    42 #    ../tools/export.sh export
    43 #    cd ../tools/xcw/demo
    44 #    export PATH=$PATH:<helenos-source-dir>/build/tools/xcw/bin
     38#    make distclean && make -j 4 PROFILE=amd64
     39#    cd <helenos-source-dir>/tools/xcw/demo
     40#    export PATH=$PATH:<helenos-source-dir>/tools/xcw/bin
    4541#    make
    4642#
     
    4844CC = helenos-cc
    4945LD = helenos-ld
    50 INSTALL = install
    51 TEST = helenos-test
    5246CFLAGS = -std=gnu11 -Wall `helenos-pkg-config --cflags libgui libdraw libmath` \
    5347    -D_HELENOS_SOURCE
    5448LIBS = `helenos-pkg-config --libs libgui libdraw libmath`
    55 PREFIX = `helenos-bld-config --install-dir`
    5649output = viewer
    5750objects = viewer.o
     
    6356        rm -f $(output) $(objects)
    6457
    65 install: $(output)
    66         mkdir -p $(PREFIX)/app
    67         $(INSTALL) -T $(output) $(PREFIX)/app/$(output)-xcw
    68 
    69 uninstall:
    70         rm -f $(PREFIX)/app/$(output)-xcw
    71 
    72 test: install
    73         $(TEST)
    74 
    7558$(output): $(objects)
    7659        $(CC) -o $@ $^ $(LIBS)
  • uspace/app/bdsh/cmds/modules/ls/ls.c

    r84876aa4 rb093a62  
    4242#include <vfs/vfs.h>
    4343#include <str.h>
    44 #include <capa.h>
     44#include <cap.h>
    4545
    4646#include "ls.h"
     
    106106                }
    107107
    108                 capa_spec_t capa;
    109                 capa_from_blocks(de->s.size, 1, &capa);
    110                 capa_simplify(&capa);
     108                cap_spec_t cap;
     109                cap_from_blocks(de->s.size, 1, &cap);
     110                cap_simplify(&cap);
    111111
    112112                char *rptr;
    113                 errno_t rc = capa_format(&capa, &rptr);
     113                errno_t rc = cap_format(&cap, &rptr);
    114114                if (rc != EOK) {
    115115                        return rc;
  • uspace/app/df/df.c

    r84876aa4 rb093a62  
    3535 */
    3636
    37 #include <capa.h>
     37#include <cap.h>
    3838#include <stdbool.h>
    3939#include <stdio.h>
     
    124124static errno_t size_to_human_readable(uint64_t nblocks, size_t block_size, char **rptr)
    125125{
    126         capa_spec_t capa;
    127 
    128         capa_from_blocks(nblocks, block_size, &capa);
    129         capa_simplify(&capa);
    130         return capa_format(&capa, rptr);
     126        cap_spec_t cap;
     127
     128        cap_from_blocks(nblocks, block_size, &cap);
     129        cap_simplify(&cap);
     130        return cap_format(&cap, rptr);
    131131}
    132132
  • uspace/app/fdisk/fdisk.c

    r84876aa4 rb093a62  
    3434 */
    3535
    36 #include <capa.h>
     36#include <cap.h>
    3737#include <errno.h>
    3838#include <fdisk.h>
     
    136136        nchoice_t *choice = NULL;
    137137        char *svcname = NULL;
    138         capa_spec_t capa;
     138        cap_spec_t cap;
    139139        fdisk_dev_info_t *sdev;
    140         char *scapa = NULL;
     140        char *scap = NULL;
    141141        char *dtext = NULL;
    142142        service_id_t svcid;
     
    177177                }
    178178
    179                 rc = fdisk_dev_info_capacity(info, &capa);
     179                rc = fdisk_dev_info_capacity(info, &cap);
    180180                if (rc != EOK) {
    181181                        printf("Error getting device capacity "
     
    185185                }
    186186
    187                 capa_simplify(&capa);
    188 
    189                 rc = capa_format(&capa, &scapa);
     187                cap_simplify(&cap);
     188
     189                rc = cap_format(&cap, &scap);
    190190                if (rc != EOK) {
    191191                        assert(rc == ENOMEM);
     
    194194                }
    195195
    196                 int ret = asprintf(&dtext, "%s (%s)", svcname, scapa);
     196                int ret = asprintf(&dtext, "%s (%s)", svcname, scap);
    197197                if (ret < 0) {
    198198                        rc = ENOMEM;
     
    203203                free(svcname);
    204204                svcname = NULL;
    205                 free(scapa);
    206                 scapa = NULL;
     205                free(scap);
     206                scap = NULL;
    207207
    208208                rc = nchoice_add(choice, dtext, info, 0);
     
    261261        free(dtext);
    262262        free(svcname);
    263         free(scapa);
     263        free(scap);
    264264        return rc;
    265265}
     
    432432        errno_t rc;
    433433        fdisk_part_spec_t pspec;
    434         capa_spec_t capa;
    435         capa_spec_t mcapa;
     434        cap_spec_t cap;
     435        cap_spec_t mcap;
    436436        vol_label_supp_t vlsupp;
    437437        vol_fstype_t fstype = 0;
    438438        tinput_t *tinput = NULL;
    439439        fdisk_spc_t spc;
    440         char *scapa;
    441         char *smcapa = NULL;
     440        char *scap;
     441        char *smcap = NULL;
    442442        char *label = NULL;
    443443        char *mountp = NULL;
     
    448448                spc = spc_pri;
    449449
    450         rc = fdisk_part_get_max_avail(dev, spc, &mcapa);
     450        rc = fdisk_part_get_max_avail(dev, spc, &mcap);
    451451        if (rc != EOK) {
    452452                rc = EIO;
     
    454454        }
    455455
    456         capa_simplify(&mcapa);
    457 
    458         rc = capa_format(&mcapa, &smcapa);
     456        cap_simplify(&mcap);
     457
     458        rc = cap_format(&mcap, &smcap);
    459459        if (rc != EOK) {
    460460                rc = ENOMEM;
     
    474474        while (true) {
    475475                printf("Enter capacity of new partition.\n");
    476                 rc = tinput_read_i(tinput, smcapa, &scapa);
     476                rc = tinput_read_i(tinput, smcap, &scap);
    477477                if (rc != EOK)
    478478                        goto error;
    479479
    480                 rc = capa_parse(scapa, &capa);
     480                rc = cap_parse(scap, &cap);
    481481                if (rc == EOK)
    482482                        break;
     
    485485        tinput_destroy(tinput);
    486486        tinput = NULL;
    487         free(smcapa);
    488         smcapa = NULL;
     487        free(smcap);
     488        smcap = NULL;
    489489
    490490        if (pkind != lpk_extended) {
     
    545545
    546546        fdisk_pspec_init(&pspec);
    547         pspec.capacity = capa;
     547        pspec.capacity = cap;
    548548        pspec.pkind = pkind;
    549549        pspec.fstype = fstype;
     
    561561        return EOK;
    562562error:
    563         free(smcapa);
     563        free(smcap);
    564564        free(label);
    565565        free(mountp);
     
    581581        fdisk_part_t *part;
    582582        fdisk_part_info_t pinfo;
    583         char *scapa = NULL;
     583        char *scap = NULL;
    584584        char *spkind = NULL;
    585585        char *sfstype = NULL;
     
    596596                }
    597597
    598                 capa_simplify(&pinfo.capacity);
    599 
    600                 rc = capa_format(&pinfo.capacity, &scapa);
     598                cap_simplify(&pinfo.capacity);
     599
     600                rc = cap_format(&pinfo.capacity, &scap);
    601601                if (rc != EOK) {
    602602                        printf("Out of memory.\n");
     
    623623
    624624                        int ret = asprintf(&sdesc, "%s %s, %s, %s", label,
    625                             scapa, spkind, sfstype);
     625                            scap, spkind, sfstype);
    626626                        if (ret < 0) {
    627627                                rc = ENOMEM;
     
    630630
    631631                } else {
    632                         int ret = asprintf(&sdesc, "%s, %s", scapa, spkind);
     632                        int ret = asprintf(&sdesc, "%s, %s", scap, spkind);
    633633                        if (ret < 0) {
    634634                                rc = ENOMEM;
     
    644644                }
    645645
    646                 free(scapa);
    647                 scapa = NULL;
     646                free(scap);
     647                scap = NULL;
    648648                free(spkind);
    649649                spkind = NULL;
     
    658658        return EOK;
    659659error:
    660         free(scapa);
     660        free(scap);
    661661        free(spkind);
    662662        free(sfstype);
     
    907907        fdisk_part_t *part;
    908908        fdisk_part_info_t pinfo;
    909         capa_spec_t capa;
    910         capa_spec_t mcapa;
     909        cap_spec_t cap;
     910        cap_spec_t mcap;
    911911        fdisk_dev_flags_t dflags;
    912912        char *sltype = NULL;
    913         char *sdcapa = NULL;
    914         char *scapa = NULL;
    915         char *smcapa = NULL;
     913        char *sdcap = NULL;
     914        char *scap = NULL;
     915        char *smcap = NULL;
    916916        char *sfstype = NULL;
    917917        char *svcname = NULL;
     
    936936        }
    937937
    938         rc = fdisk_dev_capacity(dev, &capa);
     938        rc = fdisk_dev_capacity(dev, &cap);
    939939        if (rc != EOK) {
    940940                printf("Error getting device capacity.\n");
     
    942942        }
    943943
    944         capa_simplify(&capa);
    945 
    946         rc = capa_format(&capa, &sdcapa);
     944        cap_simplify(&cap);
     945
     946        rc = cap_format(&cap, &sdcap);
    947947        if (rc != EOK) {
    948948                printf("Out of memory.\n");
     
    958958        fdisk_dev_get_flags(dev, &dflags);
    959959
    960         printf("Device: %s (%s)\n", svcname, sdcapa);
    961         free(sdcapa);
    962         sdcapa = NULL;
     960        printf("Device: %s (%s)\n", svcname, sdcap);
     961        free(sdcap);
     962        sdcap = NULL;
    963963
    964964        rc = fdisk_label_get_info(dev, &linfo);
     
    996996                }
    997997
    998                 capa_simplify(&pinfo.capacity);
    999 
    1000                 rc = capa_format(&pinfo.capacity, &scapa);
     998                cap_simplify(&pinfo.capacity);
     999
     1000                rc = cap_format(&pinfo.capacity, &scap);
    10011001                if (rc != EOK) {
    10021002                        printf("Out of memory.\n");
     
    10161016
    10171017                if (linfo.ltype == lt_none)
    1018                         printf("Entire disk: %s %s", label, scapa);
     1018                        printf("Entire disk: %s %s", label, scap);
    10191019                else
    1020                         printf("Partition %d: %s %s", npart, label, scapa);
     1020                        printf("Partition %d: %s %s", npart, label, scap);
    10211021
    10221022                if ((linfo.flags & lf_ext_supp) != 0) {
     
    10371037                printf("\n");
    10381038
    1039                 free(scapa);
    1040                 scapa = NULL;
     1039                free(scap);
     1040                scap = NULL;
    10411041                free(sfstype);
    10421042                sfstype = NULL;
     
    10471047        /* Display available space */
    10481048        if ((linfo.flags & lf_can_create_pri) != 0) {
    1049                 rc = fdisk_part_get_max_avail(dev, spc_pri, &mcapa);
     1049                rc = fdisk_part_get_max_avail(dev, spc_pri, &mcap);
    10501050                if (rc != EOK) {
    10511051                        rc = EIO;
     
    10531053                }
    10541054
    1055                 capa_simplify(&mcapa);
    1056 
    1057                 rc = capa_format(&mcapa, &smcapa);
     1055                cap_simplify(&mcap);
     1056
     1057                rc = cap_format(&mcap, &smcap);
    10581058                if (rc != EOK) {
    10591059                        rc = ENOMEM;
     
    10621062
    10631063                if ((linfo.flags & lf_ext_supp) != 0)
    1064                         printf("Maximum free primary block: %s\n", smcapa);
     1064                        printf("Maximum free primary block: %s\n", smcap);
    10651065                else
    1066                         printf("Maximum free block: %s\n", smcapa);
    1067 
    1068                 free(smcapa);
    1069                 smcapa = NULL;
    1070 
    1071                 rc = fdisk_part_get_tot_avail(dev, spc_pri, &mcapa);
     1066                        printf("Maximum free block: %s\n", smcap);
     1067
     1068                free(smcap);
     1069                smcap = NULL;
     1070
     1071                rc = fdisk_part_get_tot_avail(dev, spc_pri, &mcap);
    10721072                if (rc != EOK) {
    10731073                        rc = EIO;
     
    10751075                }
    10761076
    1077                 capa_simplify(&mcapa);
    1078 
    1079                 rc = capa_format(&mcapa, &smcapa);
     1077                cap_simplify(&mcap);
     1078
     1079                rc = cap_format(&mcap, &smcap);
    10801080                if (rc != EOK) {
    10811081                        rc = ENOMEM;
     
    10841084
    10851085                if ((linfo.flags & lf_ext_supp) != 0)
    1086                         printf("Total free primary space: %s\n", smcapa);
     1086                        printf("Total free primary space: %s\n", smcap);
    10871087                else
    1088                         printf("Total free space: %s\n", smcapa);
    1089 
    1090                 free(smcapa);
    1091                 smcapa = NULL;
     1088                        printf("Total free space: %s\n", smcap);
     1089
     1090                free(smcap);
     1091                smcap = NULL;
    10921092        }
    10931093
    10941094        /* Display available space */
    10951095        if ((linfo.flags & lf_can_create_log) != 0) {
    1096                 rc = fdisk_part_get_max_avail(dev, spc_log, &mcapa);
     1096                rc = fdisk_part_get_max_avail(dev, spc_log, &mcap);
    10971097                if (rc != EOK) {
    10981098                        rc = EIO;
     
    11001100                }
    11011101
    1102                 capa_simplify(&mcapa);
    1103 
    1104                 rc = capa_format(&mcapa, &smcapa);
     1102                cap_simplify(&mcap);
     1103
     1104                rc = cap_format(&mcap, &smcap);
    11051105                if (rc != EOK) {
    11061106                        rc = ENOMEM;
     
    11081108                }
    11091109
    1110                 printf("Maximum free logical block: %s\n", smcapa);
    1111                 free(smcapa);
    1112                 smcapa = NULL;
    1113 
    1114                 rc = fdisk_part_get_tot_avail(dev, spc_log, &mcapa);
     1110                printf("Maximum free logical block: %s\n", smcap);
     1111                free(smcap);
     1112                smcap = NULL;
     1113
     1114                rc = fdisk_part_get_tot_avail(dev, spc_log, &mcap);
    11151115                if (rc != EOK) {
    11161116                        rc = EIO;
     
    11181118                }
    11191119
    1120                 capa_simplify(&mcapa);
    1121 
    1122                 rc = capa_format(&mcapa, &smcapa);
     1120                cap_simplify(&mcap);
     1121
     1122                rc = cap_format(&mcap, &smcap);
    11231123                if (rc != EOK) {
    11241124                        rc = ENOMEM;
     
    11261126                }
    11271127
    1128                 printf("Total free logical space: %s\n", smcapa);
    1129                 free(smcapa);
    1130                 smcapa = NULL;
     1128                printf("Total free logical space: %s\n", smcap);
     1129                free(smcap);
     1130                smcap = NULL;
    11311131        }
    11321132
     
    12791279        return EOK;
    12801280error:
    1281         free(sdcapa);
    1282         free(scapa);
    1283         free(smcapa);
     1281        free(sdcap);
     1282        free(scap);
     1283        free(smcap);
    12841284        free(sfstype);
    12851285        free(svcname);
  • uspace/app/sysinst/sysinst.c

    r84876aa4 rb093a62  
    3838#include <block.h>
    3939#include <byteorder.h>
    40 #include <capa.h>
     40#include <cap.h>
    4141#include <errno.h>
    4242#include <fdisk.h>
     
    9898        fdisk_part_spec_t pspec;
    9999        fdisk_part_info_t pinfo;
    100         capa_spec_t capa;
     100        cap_spec_t cap;
    101101        service_id_t sid;
    102102        errno_t rc;
     
    137137        printf("sysinst_label_dev(): create partition\n");
    138138
    139         rc = fdisk_part_get_max_avail(fdev, spc_pri, &capa);
     139        rc = fdisk_part_get_max_avail(fdev, spc_pri, &cap);
    140140        if (rc != EOK) {
    141141                printf("Error getting available capacity: %s.\n", str_error(rc));
     
    144144
    145145        fdisk_pspec_init(&pspec);
    146         pspec.capacity = capa;
     146        pspec.capacity = cap;
    147147        pspec.pkind = lpk_primary;
    148148        pspec.fstype = fs_ext4; /* Cannot be changed without modifying core.img */
  • uspace/app/trace/syscalls.c

    r84876aa4 rb093a62  
    3838
    3939const sc_desc_t syscall_desc[] = {
    40         /* System management syscalls. */
    4140        [SYS_KIO] = { "kio", 3, V_INT_ERRNO },
    4241
    43         /* Thread and task related syscalls. */
    4442        [SYS_THREAD_CREATE] = { "thread_create", 3, V_ERRNO },
    4543        [SYS_THREAD_EXIT] = { "thread_exit", 1, V_ERRNO },
    4644        [SYS_THREAD_GET_ID] = { "thread_get_id", 1, V_ERRNO },
    47         [SYS_THREAD_USLEEP] = { "thread_usleep", 1, V_ERRNO },
    48         [SYS_THREAD_UDELAY] = { "thread_udelay", 1, V_ERRNO },
    4945
    5046        [SYS_TASK_GET_ID] = { "task_get_id", 1, V_ERRNO },
    5147        [SYS_TASK_SET_NAME] = { "task_set_name", 2, V_ERRNO },
    52         [SYS_TASK_KILL] = { "task_kill", 1, V_ERRNO },
    53         [SYS_TASK_EXIT] = { "task_exit", 1, V_ERRNO },
    54         [SYS_PROGRAM_SPAWN_LOADER] = { "program_spawn_loader", 2, V_ERRNO },
    5548
    56         /* Synchronization related syscalls. */
    57         [SYS_WAITQ_CREATE] = { "waitq_create", 1, V_ERRNO },
    58         [SYS_WAITQ_SLEEP] = { "waitq_sleep", 3, V_ERRNO },
    59         [SYS_WAITQ_WAKEUP] = { "waitq_wakeup", 1, V_ERRNO },
    60         [SYS_WAITQ_DESTROY] = { "waitq_destroy", 1, V_ERRNO },
    61         [SYS_SMC_COHERENCE] = { "smc_coherence", 2, V_ERRNO },
    62 
    63         /* Address space related syscalls. */
    6449        [SYS_AS_AREA_CREATE] = { "as_area_create", 5, V_ERRNO },
    6550        [SYS_AS_AREA_RESIZE] = { "as_area_resize", 3, V_ERRNO },
    66         [SYS_AS_AREA_CHANGE_FLAGS] = { "as_area_change_flags", 2, V_ERRNO },
    67         [SYS_AS_AREA_GET_INFO] = { "as_area_get_info", 2, V_ERRNO },
    6851        [SYS_AS_AREA_DESTROY] = { "as_area_destroy", 1, V_ERRNO },
    6952
    70         /* Page mapping related syscalls. */
    71         [SYS_PAGE_FIND_MAPPING] = { "page_find_mapping", 2, V_ERRNO },
    72 
    73         /* IPC related syscalls. */
    7453        [SYS_IPC_CALL_ASYNC_FAST] = { "ipc_call_async_fast", 6, V_HASH },
    7554        [SYS_IPC_CALL_ASYNC_SLOW] = { "ipc_call_async_slow", 3, V_HASH },
     55
    7656        [SYS_IPC_ANSWER_FAST] = { "ipc_answer_fast", 6, V_ERRNO },
    7757        [SYS_IPC_ANSWER_SLOW] = { "ipc_answer_slow", 2, V_ERRNO },
     
    8161        [SYS_IPC_POKE] = { "ipc_poke", 0, V_ERRNO },
    8262        [SYS_IPC_HANGUP] = { "ipc_hangup", 1, V_ERRNO },
    83         [SYS_IPC_CONNECT_KBOX] = { "ipc_connect_kbox", 2, V_ERRNO },
    8463
    85         /* Event notification syscalls. */
    8664        [SYS_IPC_EVENT_SUBSCRIBE] = { "ipc_event_subscribe", 2, V_ERRNO },
    8765        [SYS_IPC_EVENT_UNSUBSCRIBE] = { "ipc_event_unsubscribe", 1, V_ERRNO },
    8866        [SYS_IPC_EVENT_UNMASK] = { "ipc_event_unmask", 1, V_ERRNO },
    8967
    90         /* Permission related syscalls. */
    9168        [SYS_PERM_GRANT] = { "perm_grant", 2, V_ERRNO },
    9269        [SYS_PERM_REVOKE] = { "perm_revoke", 2, V_ERRNO },
    93 
    94         /* DDI related syscalls. */
    9570        [SYS_PHYSMEM_MAP] = { "physmem_map", 4, V_ERRNO },
    96         [SYS_PHYSMEM_UNMAP] = { "physmem_unmap", 1, V_ERRNO },
    97         [SYS_DMAMEM_MAP] = { "dmamem_map", 6, V_ERRNO },
    98         [SYS_DMAMEM_UNMAP] = { "dmamem_unmap", 3, V_ERRNO },
    9971        [SYS_IOSPACE_ENABLE] = { "iospace_enable", 1, V_ERRNO },
    100         [SYS_IOSPACE_DISABLE] = { "iospace_disable", 1, V_ERRNO },
    10172
    10273        [SYS_IPC_IRQ_SUBSCRIBE] = { "ipc_irq_subscribe", 4, V_ERRNO },
    10374        [SYS_IPC_IRQ_UNSUBSCRIBE] = { "ipc_irq_unsubscribe", 2, V_ERRNO },
    10475
    105         /* Sysinfo syscalls. */
    106         [SYS_SYSINFO_GET_KEYS_SIZE] = { "sysinfo_get_keys_size", 3, V_ERRNO },
    107         [SYS_SYSINFO_GET_KEYS] = { "sysinfo_get_keys", 5, V_ERRNO },
    10876        [SYS_SYSINFO_GET_VAL_TYPE] = { "sysinfo_get_val_type", 2, V_INTEGER },
    10977        [SYS_SYSINFO_GET_VALUE] = { "sysinfo_get_value", 3, V_ERRNO },
     
    11179        [SYS_SYSINFO_GET_DATA] = { "sysinfo_get_data", 5, V_ERRNO },
    11280
    113         /* Kernel console syscalls. */
    11481        [SYS_DEBUG_CONSOLE] = { "debug_console", 0, V_ERRNO },
    115 
    116         [SYS_KLOG] = { "klog", 5, V_ERRNO }
     82        [SYS_IPC_CONNECT_KBOX] = { "ipc_connect_kbox", 1, V_ERRNO }
    11783};
    11884
  • uspace/app/trace/trace.c

    r84876aa4 rb093a62  
    4747#include <mem.h>
    4848#include <str.h>
     49#include <loader/loader.h>
    4950#include <io/console.h>
    5051#include <io/keycode.h>
     
    8586void thread_trace_start(uintptr_t thread_hash);
    8687
    87 static char *cmd_path;
    88 static char **cmd_args;
    89 
    9088static task_id_t task_id;
    91 static task_wait_t task_w;
     89static loader_t *task_ldr;
    9290static bool task_wait_for;
    9391
     
    9593display_mask_t display_mask;
    9694
     95static errno_t program_run_fibril(void *arg);
    9796static errno_t cev_fibril(void *arg);
     97
     98static void program_run(void)
     99{
     100        fid_t fid;
     101
     102        fid = fibril_create(program_run_fibril, NULL);
     103        if (fid == 0) {
     104                printf("Error creating fibril\n");
     105                exit(1);
     106        }
     107
     108        fibril_add_ready(fid);
     109}
    98110
    99111static void cev_fibril_start(void)
     
    110122}
    111123
    112 static errno_t program_run(void)
     124static errno_t program_run_fibril(void *arg)
    113125{
    114126        errno_t rc;
    115127
    116         rc = task_spawnv_debug(&task_id, &task_w, cmd_path,
    117             (const char *const *)cmd_args, &sess);
    118 
    119         if (rc == ENOTSUP) {
    120                 printf("You do not have userspace debugging support "
    121                     "compiled in the kernel.\n");
    122                 printf("Compile kernel with 'Support for userspace debuggers' "
    123                     "(CONFIG_UDEBUG) enabled.\n");
    124         }
    125 
     128        /*
     129         * This must be done in background as it will block until
     130         * we let the task reply to this call.
     131         */
     132        rc = loader_run(task_ldr);
    126133        if (rc != EOK) {
    127                 printf("Error running program (%s)\n", str_error_name(rc));
     134                printf("Error running program\n");
     135                exit(1);
     136        }
     137
     138        task_ldr = NULL;
     139
     140        printf("program_run_fibril exiting\n");
     141        return 0;
     142}
     143
     144static errno_t connect_task(task_id_t task_id)
     145{
     146        async_sess_t *ksess = async_connect_kbox(task_id);
     147
     148        if (!ksess) {
     149                if (errno == ENOTSUP) {
     150                        printf("You do not have userspace debugging support "
     151                            "compiled in the kernel.\n");
     152                        printf("Compile kernel with 'Support for userspace debuggers' "
     153                            "(CONFIG_UDEBUG) enabled.\n");
     154                        return errno;
     155                }
     156
     157                printf("Error connecting\n");
     158                printf("ipc_connect_task(%" PRIu64 ") -> %s ", task_id, str_error_name(errno));
     159                return errno;
     160        }
     161
     162        errno_t rc = udebug_begin(ksess);
     163        if (rc != EOK) {
     164                printf("udebug_begin() -> %s\n", str_error_name(rc));
    128165                return rc;
    129166        }
    130167
    131         return EOK;
    132 }
    133 
    134 static errno_t connect_task(task_id_t task_id)
    135 {
    136         errno_t rc;
    137         bool debug_started = false;
    138         bool wait_set_up = false;
    139 
    140         if (sess == NULL) {
    141                 sess = async_connect_kbox(task_id);
    142                 if (sess == NULL) {
    143                         printf("Error connecting to task %" PRIu64 ".\n",
    144                             task_id);
    145                         rc = EIO;
    146                         goto error;
    147                 }
    148 
    149                 rc = udebug_begin(sess);
    150                 if (rc != EOK) {
    151                         printf("Error starting debug session.\n");
    152                         goto error;
    153                 }
    154 
    155                 debug_started = true;
    156 
    157                 rc = task_setup_wait(task_id, &task_w);
    158                 if (rc != EOK) {
    159                         printf("Error setting up wait for task termination.\n");
    160                         goto error;
    161                 }
    162 
    163                 wait_set_up = true;
    164         }
    165 
    166         rc = udebug_set_evmask(sess, UDEBUG_EM_ALL);
     168        rc = udebug_set_evmask(ksess, UDEBUG_EM_ALL);
    167169        if (rc != EOK) {
    168170                printf("udebug_set_evmask(0x%x) -> %s\n ", UDEBUG_EM_ALL, str_error_name(rc));
     
    170172        }
    171173
    172         return EOK;
    173 error:
    174         if (wait_set_up)
    175                 task_cancel_wait(&task_w);
    176         if (debug_started)
    177                 udebug_end(sess);
    178         if (sess != NULL)
    179                 async_hangup(sess);
    180         return rc;
     174        sess = ksess;
     175        return 0;
    181176}
    182177
     
    203198        printf("\ntotal of %zu threads\n", tb_needed / sizeof(uintptr_t));
    204199
    205         return EOK;
     200        return 0;
    206201}
    207202
     
    493488
    494489        printf("Finished tracing thread [%d].\n", thread_id);
    495         return EOK;
     490        return 0;
    496491}
    497492
     
    507502        }
    508503        fibril_add_ready(fid);
     504}
     505
     506static loader_t *preload_task(const char *path, char **argv,
     507    task_id_t *task_id)
     508{
     509        loader_t *ldr;
     510        errno_t rc;
     511
     512        /* Spawn a program loader */
     513        ldr = loader_connect();
     514        if (ldr == NULL)
     515                return NULL;
     516
     517        /* Get task ID. */
     518        rc = loader_get_task_id(ldr, task_id);
     519        if (rc != EOK)
     520                goto error;
     521
     522        /* Send program. */
     523        rc = loader_set_program_path(ldr, path);
     524        if (rc != EOK)
     525                goto error;
     526
     527        /* Send arguments */
     528        rc = loader_set_args(ldr, (const char **) argv);
     529        if (rc != EOK)
     530                goto error;
     531
     532        /* Send default files */
     533        int fd_root;
     534        int fd_stdin;
     535        int fd_stdout;
     536        int fd_stderr;
     537
     538        fd_root = vfs_root();
     539        if (fd_root >= 0) {
     540                rc = loader_add_inbox(ldr, "root", fd_root);
     541                vfs_put(fd_root);
     542                if (rc != EOK)
     543                        goto error;
     544        }
     545
     546        if ((stdin != NULL) && (vfs_fhandle(stdin, &fd_stdin) == EOK)) {
     547                rc = loader_add_inbox(ldr, "stdin", fd_stdin);
     548                if (rc != EOK)
     549                        goto error;
     550        }
     551
     552        if ((stdout != NULL) && (vfs_fhandle(stdout, &fd_stdout) == EOK)) {
     553                rc = loader_add_inbox(ldr, "stdout", fd_stdout);
     554                if (rc != EOK)
     555                        goto error;
     556        }
     557
     558        if ((stderr != NULL) && (vfs_fhandle(stderr, &fd_stderr) == EOK)) {
     559                rc = loader_add_inbox(ldr, "stderr", fd_stderr);
     560                if (rc != EOK)
     561                        goto error;
     562        }
     563
     564        /* Load the program. */
     565        rc = loader_load_program(ldr);
     566        if (rc != EOK)
     567                goto error;
     568
     569        /* Success */
     570        return ldr;
     571
     572        /* Error exit */
     573error:
     574        loader_abort(ldr);
     575        return NULL;
    509576}
    510577
     
    740807                                ++argv;
    741808                                task_id = strtol(*argv, &err_p, 10);
     809                                task_ldr = NULL;
    742810                                task_wait_for = false;
    743811                                if (*err_p) {
     
    780848                printf("'%s'\n", *cp++);
    781849
    782         cmd_path = *argv;
    783         cmd_args = argv;
     850        task_ldr = preload_task(*argv, argv, &task_id);
    784851        task_wait_for = true;
    785852
     
    802869
    803870        main_init();
    804 
    805         if (cmd_path != NULL)
    806                 program_run();
    807871
    808872        rc = connect_task(task_id);
     
    814878        printf("Connected to task %" PRIu64 ".\n", task_id);
    815879
     880        if (task_ldr != NULL)
     881                program_run();
     882
    816883        cev_fibril_start();
    817884        trace_task(task_id);
     
    820887                printf("Waiting for task to exit.\n");
    821888
    822                 rc = task_wait(&task_w, &texit, &retval);
     889                rc = task_wait_task_id(task_id, &texit, &retval);
    823890                if (rc != EOK) {
    824891                        printf("Failed waiting for task.\n");
  • uspace/lib/c/generic/loader.c

    r84876aa4 rb093a62  
    345345}
    346346
    347 /** Instruct loader to execute the program and do not wait for reply.
    348  *
    349  * This function does not block even if the loaded task is stopped
    350  * for debugging.
    351  *
    352  * After using this function, no further operations can be performed
    353  * on the loader structure and it is deallocated.
    354  *
    355  * @param ldr Loader connection structure.
    356  *
    357  * @return Zero on success or an error code.
    358  *
    359  */
    360 void loader_run_nowait(loader_t *ldr)
    361 {
    362         async_exch_t *exch = async_exchange_begin(ldr->sess);
    363         async_msg_0(exch, LOADER_RUN);
    364         async_exchange_end(exch);
    365 
    366         async_hangup(ldr->sess);
    367         free(ldr);
    368 }
    369 
    370347/** Cancel the loader session.
    371348 *
  • uspace/lib/c/generic/task.c

    r84876aa4 rb093a62  
    3535 */
    3636
    37 #include <async.h>
    3837#include <task.h>
    3938#include <loader/loader.h>
     
    4746#include <ns.h>
    4847#include <stdlib.h>
    49 #include <udebug.h>
    5048#include <libc.h>
    5149#include "private/ns.h"
     
    9694 * This is really just a convenience wrapper over the more complicated
    9795 * loader API. Arguments are passed as a null-terminated array of strings.
    98  * A debug session is created optionally.
    9996 *
    10097 * @param id   If not NULL, the ID of the task is stored here on success.
     
    103100 * @param path Pathname of the binary to execute.
    104101 * @param argv Command-line arguments.
    105  * @param rsess   Place to store pointer to debug session or @c NULL
    106  *                not to start a debug session
    107  *
    108  * @return Zero on success or an error code.
    109  *
    110  */
    111 errno_t task_spawnv_debug(task_id_t *id, task_wait_t *wait, const char *path,
    112     const char *const args[], async_sess_t **rsess)
     102 *
     103 * @return Zero on success or an error code.
     104 *
     105 */
     106errno_t task_spawnv(task_id_t *id, task_wait_t *wait, const char *path,
     107    const char *const args[])
    113108{
    114109        /* Send default files */
     
    130125        }
    131126
    132         return task_spawnvf_debug(id, wait, path, args, fd_stdin, fd_stdout,
    133             fd_stderr, rsess);
     127        return task_spawnvf(id, wait, path, args, fd_stdin, fd_stdout,
     128            fd_stderr);
    134129}
    135130
    136131/** Create a new task by running an executable from the filesystem.
    137  *
    138  * This is really just a convenience wrapper over the more complicated
    139  * loader API. Arguments are passed as a null-terminated array of strings.
    140  *
    141  * @param id   If not NULL, the ID of the task is stored here on success.
    142  * @param wait If not NULL, setup waiting for task's return value and store
    143  *             the information necessary for waiting here on success.
    144  * @param path Pathname of the binary to execute.
    145  * @param argv Command-line arguments.
    146  *
    147  * @return Zero on success or an error code.
    148  *
    149  */
    150 errno_t task_spawnv(task_id_t *id, task_wait_t *wait, const char *path,
    151     const char *const args[])
    152 {
    153         return task_spawnv_debug(id, wait, path, args, NULL);
    154 }
    155 
    156 /** Create a new task by loading an executable from the filesystem.
    157132 *
    158133 * This is really just a convenience wrapper over the more complicated
    159134 * loader API. Arguments are passed as a null-terminated array of strings.
    160135 * Files are passed as null-terminated array of pointers to fdi_node_t.
    161  * A debug session is created optionally.
    162136 *
    163137 * @param id      If not NULL, the ID of the task is stored here on success.
    164  * @param wait    If not NULL, setup waiting for task's return value and store.
     138 * @param wait    If not NULL, setup waiting for task's return value and store
    165139 * @param path    Pathname of the binary to execute.
    166  * @param argv    Command-line arguments
    167  * @param std_in  File to use as stdin
    168  * @param std_out File to use as stdout
    169  * @param std_err File to use as stderr
    170  * @param rsess   Place to store pointer to debug session or @c NULL
    171  *                not to start a debug session
    172  *
    173  * @return Zero on success or an error code
    174  *
    175  */
    176 errno_t task_spawnvf_debug(task_id_t *id, task_wait_t *wait,
    177     const char *path, const char *const args[], int fd_stdin, int fd_stdout,
    178     int fd_stderr, async_sess_t **rsess)
    179 {
    180         async_sess_t *ksess = NULL;
    181 
     140 * @param argv    Command-line arguments.
     141 * @param std_in  File to use as stdin.
     142 * @param std_out File to use as stdout.
     143 * @param std_err File to use as stderr.
     144 *
     145 * @return Zero on success or an error code.
     146 *
     147 */
     148errno_t task_spawnvf(task_id_t *id, task_wait_t *wait, const char *path,
     149    const char *const args[], int fd_stdin, int fd_stdout, int fd_stderr)
     150{
    182151        /* Connect to a program loader. */
    183152        loader_t *ldr = loader_connect();
     
    248217        }
    249218
    250         /* Start a debug session if requested */
    251         if (rsess != NULL) {
    252                 ksess = async_connect_kbox(task_id);
    253                 if (ksess == NULL) {
    254                         /* Most likely debugging support is not compiled in */
    255                         rc = ENOTSUP;
    256                         goto error;
    257                 }
    258 
    259                 rc = udebug_begin(ksess);
    260                 if (rc != EOK)
    261                         goto error;
    262 
    263                 /*
    264                  * Run it, not waiting for response. It would never come
    265                  * as the loader is stopped.
    266                  */
    267                 loader_run_nowait(ldr);
    268         } else {
    269                 /* Run it. */
    270                 rc = loader_run(ldr);
    271                 if (rc != EOK)
    272                         goto error;
    273         }
     219        /* Run it. */
     220        rc = loader_run(ldr);
     221        if (rc != EOK)
     222                goto error;
    274223
    275224        /* Success */
    276225        if (id != NULL)
    277226                *id = task_id;
    278         if (rsess != NULL)
    279                 *rsess = ksess;
     227
    280228        return EOK;
    281229
    282230error:
    283         if (ksess != NULL)
    284                 async_hangup(ksess);
    285231        if (wait_initialized)
    286232                task_cancel_wait(wait);
     
    289235        loader_abort(ldr);
    290236        return rc;
    291 }
    292 
    293 /** Create a new task by running an executable from the filesystem.
    294  *
    295  * Arguments are passed as a null-terminated array of strings.
    296  * Files are passed as null-terminated array of pointers to fdi_node_t.
    297  *
    298  * @param id      If not NULL, the ID of the task is stored here on success.
    299  * @param wait    If not NULL, setup waiting for task's return value and store.
    300  * @param path    Pathname of the binary to execute
    301  * @param argv    Command-line arguments
    302  * @param std_in  File to use as stdin
    303  * @param std_out File to use as stdout
    304  * @param std_err File to use as stderr
    305  *
    306  * @return Zero on success or an error code.
    307  *
    308  */
    309 errno_t task_spawnvf(task_id_t *id, task_wait_t *wait, const char *path,
    310     const char *const args[], int fd_stdin, int fd_stdout, int fd_stderr)
    311 {
    312         return task_spawnvf_debug(id, wait, path, args, fd_stdin, fd_stdout,
    313             fd_stderr, NULL);
    314237}
    315238
  • uspace/lib/c/include/loader/loader.h

    r84876aa4 rb093a62  
    5353extern errno_t loader_load_program(loader_t *);
    5454extern errno_t loader_run(loader_t *);
    55 extern void loader_run_nowait(loader_t *);
    5655extern void loader_abort(loader_t *);
    5756
  • uspace/lib/c/include/task.h

    r84876aa4 rb093a62  
    3636#define _LIBC_TASK_H_
    3737
    38 #include <async.h>
    3938#include <stdint.h>
    4039#include <stdarg.h>
     
    5756extern errno_t task_spawnv(task_id_t *, task_wait_t *, const char *path,
    5857    const char *const []);
    59 extern errno_t task_spawnv_debug(task_id_t *, task_wait_t *, const char *path,
    60     const char *const [], async_sess_t **);
    6158extern errno_t task_spawnvf(task_id_t *, task_wait_t *, const char *path,
    6259    const char *const [], int, int, int);
    63 extern errno_t task_spawnvf_debug(task_id_t *, task_wait_t *, const char *path,
    64     const char *const [], int, int, int, async_sess_t **);
    6560extern errno_t task_spawn(task_id_t *, task_wait_t *, const char *path, int,
    6661    va_list ap);
  • uspace/lib/c/meson.build

    r84876aa4 rb093a62  
    6565        'generic/bd_srv.c',
    6666        'generic/perm.c',
    67         'generic/capa.c',
     67        'generic/cap.c',
    6868        'generic/clipboard.c',
    6969        'generic/config.c',
     
    204204        'test/adt/circ_buf.c',
    205205        'test/adt/odict.c',
    206         'test/capa.c',
     206        'test/cap.c',
    207207        'test/casting.c',
    208208        'test/double_to_str.c',
  • uspace/lib/c/test/getopt.c

    r84876aa4 rb093a62  
    278278                "get_opt_test",
    279279                "-f",
    280                 "-pparam"
     280                "-p",
     281                "param"
    281282        };
    282283
  • uspace/lib/c/test/main.c

    r84876aa4 rb093a62  
    3232PCUT_INIT;
    3333
    34 PCUT_IMPORT(capa);
     34PCUT_IMPORT(cap);
    3535PCUT_IMPORT(casting);
    3636PCUT_IMPORT(circ_buf);
  • uspace/lib/fdisk/include/fdisk.h

    r84876aa4 rb093a62  
    5050extern errno_t fdisk_dev_info_get_svcname(fdisk_dev_info_t *, char **);
    5151extern void fdisk_dev_info_get_svcid(fdisk_dev_info_t *, service_id_t *);
    52 extern errno_t fdisk_dev_info_capacity(fdisk_dev_info_t *, capa_spec_t *);
     52extern errno_t fdisk_dev_info_capacity(fdisk_dev_info_t *, cap_spec_t *);
    5353
    5454extern errno_t fdisk_dev_open(fdisk_t *, service_id_t, fdisk_dev_t **);
     
    5757extern void fdisk_dev_get_flags(fdisk_dev_t *, fdisk_dev_flags_t *);
    5858extern errno_t fdisk_dev_get_svcname(fdisk_dev_t *, char **);
    59 extern errno_t fdisk_dev_capacity(fdisk_dev_t *, capa_spec_t *);
     59extern errno_t fdisk_dev_capacity(fdisk_dev_t *, cap_spec_t *);
    6060
    6161extern errno_t fdisk_label_get_info(fdisk_dev_t *, fdisk_label_info_t *);
     
    6666extern fdisk_part_t *fdisk_part_next(fdisk_part_t *);
    6767extern errno_t fdisk_part_get_info(fdisk_part_t *, fdisk_part_info_t *);
    68 extern errno_t fdisk_part_get_max_avail(fdisk_dev_t *, fdisk_spc_t, capa_spec_t *);
    69 extern errno_t fdisk_part_get_tot_avail(fdisk_dev_t *, fdisk_spc_t, capa_spec_t *);
     68extern errno_t fdisk_part_get_max_avail(fdisk_dev_t *, fdisk_spc_t, cap_spec_t *);
     69extern errno_t fdisk_part_get_tot_avail(fdisk_dev_t *, fdisk_spc_t, cap_spec_t *);
    7070extern errno_t fdisk_part_create(fdisk_dev_t *, fdisk_part_spec_t *,
    7171    fdisk_part_t **);
  • uspace/lib/fdisk/include/types/fdisk.h

    r84876aa4 rb093a62  
    3838
    3939#include <adt/list.h>
    40 #include <capa.h>
     40#include <cap.h>
    4141#include <loc.h>
    4242#include <stdint.h>
     
    126126        link_t llog_ba;
    127127        /** Capacity */
    128         capa_spec_t capacity;
     128        cap_spec_t capacity;
    129129        /** Partition kind */
    130130        label_pkind_t pkind;
     
    150150typedef struct {
    151151        /** Desired capacity */
    152         capa_spec_t capacity;
     152        cap_spec_t capacity;
    153153        /** Partition kind */
    154154        label_pkind_t pkind;
     
    164164typedef struct {
    165165        /** Capacity */
    166         capa_spec_t capacity;
     166        cap_spec_t capacity;
    167167        /** Partition kind */
    168168        label_pkind_t pkind;
  • uspace/lib/fdisk/src/fdisk.c

    r84876aa4 rb093a62  
    3535
    3636#include <adt/list.h>
    37 #include <capa.h>
     37#include <cap.h>
    3838#include <errno.h>
    3939#include <fdisk.h>
     
    219219}
    220220
    221 errno_t fdisk_dev_info_capacity(fdisk_dev_info_t *info, capa_spec_t *capa)
     221errno_t fdisk_dev_info_capacity(fdisk_dev_info_t *info, cap_spec_t *cap)
    222222{
    223223        vbd_disk_info_t vinfo;
     
    228228                return EIO;
    229229
    230         capa_from_blocks(vinfo.nblocks, vinfo.block_size, capa);
     230        cap_from_blocks(vinfo.nblocks, vinfo.block_size, cap);
    231231        return EOK;
    232232}
     
    295295                dev->ext_part = part;
    296296
    297         capa_from_blocks(part->nblocks, dev->dinfo.block_size,
     297        cap_from_blocks(part->nblocks, dev->dinfo.block_size,
    298298            &part->capacity);
    299299        part->part_id = partid;
     
    536536}
    537537
    538 errno_t fdisk_dev_capacity(fdisk_dev_t *dev, capa_spec_t *capa)
    539 {
    540         capa_from_blocks(dev->dinfo.nblocks, dev->dinfo.block_size, capa);
     538errno_t fdisk_dev_capacity(fdisk_dev_t *dev, cap_spec_t *cap)
     539{
     540        cap_from_blocks(dev->dinfo.nblocks, dev->dinfo.block_size, cap);
    541541        return EOK;
    542542}
     
    679679
    680680/** Get size of largest free block. */
    681 errno_t fdisk_part_get_max_avail(fdisk_dev_t *dev, fdisk_spc_t spc,
    682     capa_spec_t *capa)
     681errno_t fdisk_part_get_max_avail(fdisk_dev_t *dev, fdisk_spc_t spc, cap_spec_t *cap)
    683682{
    684683        errno_t rc;
     
    699698        }
    700699
    701         capa_from_blocks(nb, dev->dinfo.block_size, capa);
     700        cap_from_blocks(nb, dev->dinfo.block_size, cap);
    702701        return EOK;
    703702}
     
    705704/** Get total free space capacity. */
    706705errno_t fdisk_part_get_tot_avail(fdisk_dev_t *dev, fdisk_spc_t spc,
    707     capa_spec_t *capa)
     706    cap_spec_t *cap)
    708707{
    709708        fdisk_free_range_t fr;
     
    727726        } while (fdisk_free_range_next(&fr));
    728727
    729         capa_from_blocks(totb, dev->dinfo.block_size, capa);
     728        cap_from_blocks(totb, dev->dinfo.block_size, cap);
    730729        return EOK;
    731730}
     
    939938        errno_t rc;
    940939
    941         rc = capa_to_blocks(&pspec->capacity, cv_nom, dev->dinfo.block_size,
     940        rc = cap_to_blocks(&pspec->capacity, cv_nom, dev->dinfo.block_size,
    942941            &nom_blocks);
    943942        if (rc != EOK)
    944943                return rc;
    945944
    946         rc = capa_to_blocks(&pspec->capacity, cv_min, dev->dinfo.block_size,
     945        rc = cap_to_blocks(&pspec->capacity, cv_min, dev->dinfo.block_size,
    947946            &min_blocks);
    948947        if (rc != EOK)
    949948                return rc;
    950949
    951         rc = capa_to_blocks(&pspec->capacity, cv_max, dev->dinfo.block_size,
     950        rc = cap_to_blocks(&pspec->capacity, cv_max, dev->dinfo.block_size,
    952951            &max_blocks);
    953952        if (rc != EOK)
  • uspace/lib/meson.build

    r84876aa4 rb093a62  
    3737        'softrend',
    3838        'posix',
    39         'clui',
    40         'pcm',
    41         'hound'
    4239]
    4340
  • uspace/srv/hid/input/input.c

    r84876aa4 rb093a62  
    6666#include "serial.h"
    6767
    68 #define NUM_LAYOUTS 5
     68#define NUM_LAYOUTS  4
    6969
    7070static layout_ops_t *layout[NUM_LAYOUTS] = {
     
    7272        &us_dvorak_ops,
    7373        &cz_ops,
    74         &ar_ops,
    75         &fr_azerty_ops
     74        &ar_ops
    7675};
    7776
     
    209208        // TODO: More elegant layout switching
    210209
    211         if ((type == KEY_PRESS) && (kdev->mods & KM_LCTRL)) {
    212                 switch (key) {
    213                 case KC_F1:
    214                         layout_destroy(kdev->active_layout);
    215                         kdev->active_layout = layout_create(layout[0]);
    216                         break;
    217                 case KC_F2:
    218                         layout_destroy(kdev->active_layout);
    219                         kdev->active_layout = layout_create(layout[1]);
    220                         break;
    221                 case KC_F3:
    222                         layout_destroy(kdev->active_layout);
    223                         kdev->active_layout = layout_create(layout[2]);
    224                         break;
    225                 case KC_F4:
    226                         layout_destroy(kdev->active_layout);
    227                         kdev->active_layout = layout_create(layout[3]);
    228                         break;
    229                 case KC_F5:
    230                         layout_destroy(kdev->active_layout);
    231                         kdev->active_layout = layout_create(layout[4]);
    232                         break;
    233                 default: // default: is here to avoid compiler warning about unhandled cases
    234                         break;
    235                 }
     210        if ((type == KEY_PRESS) && (kdev->mods & KM_LCTRL) &&
     211            (key == KC_F1)) {
     212                layout_destroy(kdev->active_layout);
     213                kdev->active_layout = layout_create(layout[0]);
     214                return;
     215        }
     216
     217        if ((type == KEY_PRESS) && (kdev->mods & KM_LCTRL) &&
     218            (key == KC_F2)) {
     219                layout_destroy(kdev->active_layout);
     220                kdev->active_layout = layout_create(layout[1]);
     221                return;
     222        }
     223
     224        if ((type == KEY_PRESS) && (kdev->mods & KM_LCTRL) &&
     225            (key == KC_F3)) {
     226                layout_destroy(kdev->active_layout);
     227                kdev->active_layout = layout_create(layout[2]);
     228                return;
     229        }
     230
     231        if ((type == KEY_PRESS) && (kdev->mods & KM_LCTRL) &&
     232            (key == KC_F4)) {
     233                layout_destroy(kdev->active_layout);
     234                kdev->active_layout = layout_create(layout[3]);
     235                return;
    236236        }
    237237
  • uspace/srv/hid/input/layout.h

    r84876aa4 rb093a62  
    6060extern layout_ops_t cz_ops;
    6161extern layout_ops_t ar_ops;
    62 extern layout_ops_t fr_azerty_ops;
    6362
    6463extern layout_t *layout_create(layout_ops_t *);
  • uspace/srv/hid/input/meson.build

    r84876aa4 rb093a62  
    3131src = files(
    3232        'layout/cz.c',
    33         'layout/fr_azerty.c',
    3433        'layout/us_qwerty.c',
    3534        'layout/us_dvorak.c',
  • uspace/srv/net/tcp/test/tqueue.c

    r84876aa4 rb093a62  
    3232
    3333#include "../conn.h"
    34 #include "../segment.h"
    3534#include "../tqueue.h"
    3635
     
    118117        PCUT_ASSERT_EQUALS(CTL_SYN, trans_seg[0]->ctrl);
    119118        PCUT_ASSERT_EQUALS(10, trans_seg[0]->seq);
    120         tcp_segment_delete(trans_seg[0]);
    121119}
    122120
     
    158156        PCUT_ASSERT_EQUALS(CTL_FIN | CTL_ACK, trans_seg[0]->ctrl);
    159157        PCUT_ASSERT_EQUALS(10, trans_seg[0]->seq);
    160         tcp_segment_delete(trans_seg[0]);
    161158}
    162159
     
    201198        PCUT_ASSERT_EQUALS(CTL_ACK, trans_seg[0]->ctrl);
    202199        PCUT_ASSERT_EQUALS(10, trans_seg[0]->seq);
    203         tcp_segment_delete(trans_seg[0]);
    204200}
    205201
     
    260256static void tqueue_test_transmit_seg(inet_ep2_t *epp, tcp_segment_t *seg)
    261257{
    262         trans_seg[seg_cnt++] = tcp_segment_dup(seg);
     258        trans_seg[seg_cnt++] = seg;
    263259}
    264260
  • uspace/srv/net/udp/assoc.c

    r84876aa4 rb093a62  
    4040#include <fibril_synch.h>
    4141#include <inet/endpoint.h>
     42#include <inet/inet.h>
    4243#include <io/log.h>
    4344#include <nettl/amap.h>
     
    4748#include "msg.h"
    4849#include "pdu.h"
     50#include "udp_inet.h"
    4951#include "udp_type.h"
    5052
     
    5557static udp_assoc_t *udp_assoc_find_ref(inet_ep2_t *);
    5658static errno_t udp_assoc_queue_msg(udp_assoc_t *, inet_ep2_t *, udp_msg_t *);
    57 static udp_assocs_dep_t *assocs_dep;
    5859
    5960/** Initialize associations. */
    60 errno_t udp_assocs_init(udp_assocs_dep_t *dep)
     61errno_t udp_assocs_init(void)
    6162{
    6263        errno_t rc;
     
    6869        }
    6970
    70         assocs_dep = dep;
    7171        return EOK;
    72 }
    73 
    74 /** Finalize associations. */
    75 void udp_assocs_fini(void)
    76 {
    77         assert(list_empty(&assoc_list));
    78 
    79         amap_destroy(amap);
    80         amap = NULL;
    8172}
    8273
     
    183174
    184175        assert(assoc->deleted == false);
     176        udp_assoc_delref(assoc);
    185177        assoc->deleted = true;
    186         udp_assoc_delref(assoc);
    187178}
    188179
     
    253244errno_t udp_assoc_send(udp_assoc_t *assoc, inet_ep_t *remote, udp_msg_t *msg)
    254245{
     246        udp_pdu_t *pdu;
    255247        inet_ep2_t epp;
    256248        errno_t rc;
     
    274266        if (inet_addr_is_any(&epp.local.addr) && !assoc->nolocal) {
    275267                log_msg(LOG_DEFAULT, LVL_DEBUG, "Determine local address.");
    276                 rc = (*assocs_dep->get_srcaddr)(&epp.remote.addr, 0,
    277                     &epp.local.addr);
     268                rc = inet_get_srcaddr(&epp.remote.addr, 0, &epp.local.addr);
    278269                if (rc != EOK) {
    279270                        log_msg(LOG_DEFAULT, LVL_DEBUG, "Cannot determine "
     
    289280                return EINVAL;
    290281
     282        log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_send - encode pdu");
     283
     284        rc = udp_pdu_encode(&epp, msg, &pdu);
     285        if (rc != EOK)
     286                return ENOMEM;
     287
    291288        log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_send - transmit");
    292         rc = (*assocs_dep->transmit_msg)(&epp, msg);
     289
     290        rc = udp_transmit_pdu(pdu);
     291        udp_pdu_delete(pdu);
    293292
    294293        if (rc != EOK)
  • uspace/srv/net/udp/assoc.h

    r84876aa4 rb093a62  
    4040#include "udp_type.h"
    4141
    42 extern errno_t udp_assocs_init(udp_assocs_dep_t *);
    43 extern void udp_assocs_fini(void);
     42extern errno_t udp_assocs_init(void);
    4443extern udp_assoc_t *udp_assoc_new(inet_ep2_t *, udp_assoc_cb_t *, void *);
    4544extern void udp_assoc_delete(udp_assoc_t *);
  • uspace/srv/net/udp/meson.build

    r84876aa4 rb093a62  
    2828
    2929deps = [ 'nettl' ]
    30 
    31 _common_src = files(
     30src = files(
    3231        'assoc.c',
    33         'cassoc.c',
    3432        'msg.c',
    3533        'pdu.c',
    36 )
    37 
    38 src = files(
    3934        'service.c',
    4035        'udp.c',
    4136        'udp_inet.c',
    4237)
    43 
    44 test_src = files(
    45         'test/assoc.c',
    46         'test/msg.c',
    47         'test/main.c',
    48         'test/pdu.c',
    49 )
    50 
    51 src = [ _common_src, src ]
    52 test_src = [ _common_src, test_src ]
  • uspace/srv/net/udp/service.c

    r84876aa4 rb093a62  
    4646
    4747#include "assoc.h"
    48 #include "cassoc.h"
    4948#include "msg.h"
    5049#include "service.h"
     
    5655#define MAX_MSG_SIZE DATA_XFER_LIMIT
    5756
    58 static void udp_recv_msg_cassoc(void *, inet_ep2_t *, udp_msg_t *);
     57static void udp_cassoc_recv_msg(void *, inet_ep2_t *, udp_msg_t *);
    5958
    6059/** Callbacks to tie us to association layer */
    6160static udp_assoc_cb_t udp_cassoc_cb = {
    62         .recv_msg = udp_recv_msg_cassoc
     61        .recv_msg = udp_cassoc_recv_msg
    6362};
     63
     64/** Add message to client receive queue.
     65 *
     66 * @param cassoc Client association
     67 * @param epp    Endpoint pair on which message was received
     68 * @param msg    Message
     69 *
     70 * @return EOK on success, ENOMEM if out of memory
     71 */
     72static errno_t udp_cassoc_queue_msg(udp_cassoc_t *cassoc, inet_ep2_t *epp,
     73    udp_msg_t *msg)
     74{
     75        udp_crcv_queue_entry_t *rqe;
     76
     77        log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_cassoc_queue_msg(%p, %p, %p)",
     78            cassoc, epp, msg);
     79
     80        rqe = calloc(1, sizeof(udp_crcv_queue_entry_t));
     81        if (rqe == NULL)
     82                return ENOMEM;
     83
     84        link_initialize(&rqe->link);
     85        rqe->epp = *epp;
     86        rqe->msg = msg;
     87        rqe->cassoc = cassoc;
     88
     89        list_append(&rqe->link, &cassoc->client->crcv_queue);
     90        return EOK;
     91}
    6492
    6593/** Send 'data' event to client.
     
    80108}
    81109
     110/** Create client association.
     111 *
     112 * This effectively adds an association into a client's namespace.
     113 *
     114 * @param client  Client
     115 * @param assoc   Association
     116 * @param rcassoc Place to store pointer to new client association
     117 *
     118 * @return EOK on soccess, ENOMEM if out of memory
     119 */
     120static errno_t udp_cassoc_create(udp_client_t *client, udp_assoc_t *assoc,
     121    udp_cassoc_t **rcassoc)
     122{
     123        udp_cassoc_t *cassoc;
     124        sysarg_t id;
     125
     126        cassoc = calloc(1, sizeof(udp_cassoc_t));
     127        if (cassoc == NULL)
     128                return ENOMEM;
     129
     130        /* Allocate new ID */
     131        id = 0;
     132        list_foreach (client->cassoc, lclient, udp_cassoc_t, cassoc) {
     133                if (cassoc->id >= id)
     134                        id = cassoc->id + 1;
     135        }
     136
     137        cassoc->id = id;
     138        cassoc->client = client;
     139        cassoc->assoc = assoc;
     140
     141        list_append(&cassoc->lclient, &client->cassoc);
     142        *rcassoc = cassoc;
     143        return EOK;
     144}
     145
     146/** Destroy client association.
     147 *
     148 * @param cassoc Client association
     149 */
     150static void udp_cassoc_destroy(udp_cassoc_t *cassoc)
     151{
     152        list_remove(&cassoc->lclient);
     153        free(cassoc);
     154}
     155
     156/** Get client association by ID.
     157 *
     158 * @param client  Client
     159 * @param id      Client association ID
     160 * @param rcassoc Place to store pointer to client association
     161 *
     162 * @return EOK on success, ENOENT if no client association with the given ID
     163 *         is found.
     164 */
     165static errno_t udp_cassoc_get(udp_client_t *client, sysarg_t id,
     166    udp_cassoc_t **rcassoc)
     167{
     168        list_foreach (client->cassoc, lclient, udp_cassoc_t, cassoc) {
     169                if (cassoc->id == id) {
     170                        *rcassoc = cassoc;
     171                        return EOK;
     172                }
     173        }
     174
     175        return ENOENT;
     176}
     177
    82178/** Message received on client association.
    83179 *
     
    88184 * @param msg Message
    89185 */
    90 static void udp_recv_msg_cassoc(void *arg, inet_ep2_t *epp, udp_msg_t *msg)
     186static void udp_cassoc_recv_msg(void *arg, inet_ep2_t *epp, udp_msg_t *msg)
    91187{
    92188        udp_cassoc_t *cassoc = (udp_cassoc_t *) arg;
  • uspace/srv/net/udp/udp.c

    r84876aa4 rb093a62  
    4747#define NAME       "udp"
    4848
    49 static udp_assocs_dep_t udp_assocs_dep = {
    50         .get_srcaddr = udp_get_srcaddr,
    51         .transmit_msg = udp_transmit_msg
    52 };
    53 
    5449static errno_t udp_init(void)
    5550{
     
    5853        log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_init()");
    5954
    60         rc = udp_assocs_init(&udp_assocs_dep);
     55        rc = udp_assocs_init();
    6156        if (rc != EOK) {
    6257                log_msg(LOG_DEFAULT, LVL_ERROR, "Failed initializing associations.");
  • uspace/srv/net/udp/udp_inet.c

    r84876aa4 rb093a62  
    134134}
    135135
    136 /** Get source address.
    137  *
    138  * @param remote Remote address
    139  * @param tos Type of service
    140  * @param local Place to store local address
    141  * @return EOK on success or an error code
    142  */
    143 errno_t udp_get_srcaddr(inet_addr_t *remote, uint8_t tos, inet_addr_t *local)
    144 {
    145         return inet_get_srcaddr(remote, tos, local);
    146 }
    147 
    148 /** Transmit message over network layer. */
    149 errno_t udp_transmit_msg(inet_ep2_t *epp, udp_msg_t *msg)
    150 {
    151         udp_pdu_t *pdu;
    152         errno_t rc;
    153 
    154         log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_transmit_msg()");
    155 
    156         rc = udp_pdu_encode(epp, msg, &pdu);
    157         if (rc != EOK) {
    158                 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed encoding PDU");
    159                 return rc;
    160         }
    161 
    162         rc = udp_transmit_pdu(pdu);
    163         udp_pdu_delete(pdu);
    164 
    165         return rc;
    166 }
    167 
    168136/**
    169137 * @}
  • uspace/srv/net/udp/udp_inet.h

    r84876aa4 rb093a62  
    3636#define UDP_INET_H
    3737
    38 #include <inet/addr.h>
    39 #include <stdint.h>
    4038#include "udp_type.h"
    4139
    4240extern errno_t udp_inet_init(void);
    4341extern errno_t udp_transmit_pdu(udp_pdu_t *);
    44 extern errno_t udp_get_srcaddr(inet_addr_t *, uint8_t, inet_addr_t *);
    45 extern errno_t udp_transmit_msg(inet_ep2_t *, udp_msg_t *);
    4642
    4743#endif
  • uspace/srv/net/udp/udp_type.h

    r84876aa4 rb093a62  
    3737
    3838#include <async.h>
    39 #include <errno.h>
    4039#include <fibril.h>
    4140#include <fibril_synch.h>
     
    4544#include <stdbool.h>
    4645#include <stddef.h>
    47 #include <stdint.h>
    4846#include <inet/addr.h>
    4947
     
    8987} udp_pdu_t;
    9088
    91 /** Functions needed by associations module.
    92  *
    93  * Functions that need to be provided by the caller so that the associations
    94  * module can function.
    95  */
    96 typedef struct {
    97         errno_t (*get_srcaddr)(inet_addr_t *, uint8_t, inet_addr_t *);
    98         errno_t (*transmit_msg)(inet_ep2_t *, udp_msg_t *);
    99 } udp_assocs_dep_t;
    100 
    101 /** Association callbacks.
    102  *
    103  * Callbacks for a particular association, to notify caller of events
    104  * on the association.
    105  */
     89/** Association callbacks */
    10690typedef struct {
    10791        /** Message received */
  • uspace/srv/volsrv/volume.c

    r84876aa4 rb093a62  
    367367        if (refcount_down(&volume->refcnt)) {
    368368                /* No more references. Check if volume is persistent. */
    369                 list_remove(&volume->lvolumes);
    370                 vol_volume_delete(volume);
     369                if (!vol_volume_is_persist(volume)) {
     370                        list_remove(&volume->lvolumes);
     371                        vol_volume_delete(volume);
     372                }
    371373        }
    372374}
     
    397399                /* Volume is now persistent */
    398400                if (volume->nvolume == NULL) {
    399                         /* Prevent volume from being freed */
    400                         refcount_up(&volume->refcnt);
    401 
    402401                        /* Create volume node */
    403402                        rc = sif_trans_begin(volume->volumes->repo, &trans);
     
    427426                        volume->nvolume = nvolume;
    428427                } else {
    429                         /* Allow volume to be freed */
    430                         vol_volume_del_ref(volume);
    431 
    432428                        /* Update volume node */
    433429                        rc = sif_trans_begin(volume->volumes->repo, &trans);
Note: See TracChangeset for help on using the changeset viewer.