Changes in / [b093a62:84876aa4] in mainline


Ignore:
Files:
12 added
3 deleted
50 edited

Legend:

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

    rb093a62 r84876aa4  
    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 */
    3844typedef enum {
    3945        SYS_KIO = 0,
  • kernel/generic/include/cap/cap.h

    rb093a62 r84876aa4  
    7070} kobject_ops_t;
    7171
     72extern kobject_ops_t *kobject_ops[];
     73
     74#define KOBJECT_OP(k)   kobject_ops[(k)->type]
     75
    7276/*
    7377 * Everything in kobject_t except for the atomic reference count, the capability
     
    8286        /** List of published capabilities associated with the kobject */
    8387        list_t caps_list;
    84 
    85         kobject_ops_t *ops;
    8688
    8789        union {
     
    139141extern kobject_t *kobject_alloc(unsigned int);
    140142extern void kobject_free(kobject_t *);
    141 extern void kobject_initialize(kobject_t *, kobject_type_t, void *,
    142     kobject_ops_t *);
     143extern void kobject_initialize(kobject_t *, kobject_type_t, void *);
    143144extern kobject_t *kobject_get(struct task *, cap_handle_t, kobject_type_t);
    144145extern void kobject_add_ref(kobject_t *);
  • kernel/generic/include/ipc/ipc.h

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

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

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

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

    rb093a62 r84876aa4  
    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>
    8589
    8690#include <limits.h>
     
    9498static slab_cache_t *cap_cache;
    9599static slab_cache_t *kobject_cache;
     100
     101kobject_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};
    96107
    97108static size_t caps_hash(const ht_link_t *item)
     
    412423 * @param type  Type of the kernel object.
    413424 * @param raw   Raw pointer to the encapsulated object.
    414  * @param ops   Pointer to kernel object operations for the respective type.
    415  */
    416 void kobject_initialize(kobject_t *kobj, kobject_type_t type, void *raw,
    417     kobject_ops_t *ops)
     425 */
     426void kobject_initialize(kobject_t *kobj, kobject_type_t type, void *raw)
    418427{
    419428        atomic_store(&kobj->refcnt, 1);
     
    424433        kobj->type = type;
    425434        kobj->raw = raw;
    426         kobj->ops = ops;
    427435}
    428436
     
    474482{
    475483        if (atomic_postdec(&kobj->refcnt) == 1) {
    476                 kobj->ops->destroy(kobj->raw);
     484                KOBJECT_OP(kobj)->destroy(kobj->raw);
    477485                kobject_free(kobj);
    478486        }
  • kernel/generic/src/ipc/ipc.c

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

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

    rb093a62 r84876aa4  
    306306}
    307307
    308 static kobject_ops_t irq_kobject_ops = {
     308kobject_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, &irq_kobject_ops);
     387        kobject_initialize(kobject, KOBJECT_TYPE_IRQ, irq);
    388388        cap_publish(TASK, handle, kobject);
    389389
  • kernel/generic/src/mm/malloc.c

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

    rb093a62 r84876aa4  
    5454}
    5555
    56 static kobject_ops_t waitq_kobject_ops = {
     56kobject_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, &waitq_kobject_ops);
     102        kobject_initialize(kobj, KOBJECT_TYPE_WAITQ, wq);
    103103
    104104        cap_handle_t handle;
  • kernel/generic/src/udebug/udebug.c

    rb093a62 r84876aa4  
    479479        mutex_unlock(&THREAD->udebug.lock);
    480480
    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 
     481        /*
     482         * This is where we will typically block until a post-mortem debugger
     483         * terminates the debugging session.
     484         */
    487485        udebug_stoppable_end();
    488486}
  • meson/part/exports/config.mk.in

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

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

    rb093a62 r84876aa4  
    7272        )
    7373
    74         run_target('doxygen', command: [ doxygen, _dox_cfg ])
     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        ])
    7582endif
    7683
  • tools/xcw/bin/helenos-cc

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

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

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

    rb093a62 r84876aa4  
    3636#
    3737#    cd <helenos-source-dir>
    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
     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
    4145#    make
    4246#
     
    4448CC = helenos-cc
    4549LD = helenos-ld
     50INSTALL = install
     51TEST = helenos-test
    4652CFLAGS = -std=gnu11 -Wall `helenos-pkg-config --cflags libgui libdraw libmath` \
    4753    -D_HELENOS_SOURCE
    4854LIBS = `helenos-pkg-config --libs libgui libdraw libmath`
     55PREFIX = `helenos-bld-config --install-dir`
    4956output = viewer
    5057objects = viewer.o
     
    5663        rm -f $(output) $(objects)
    5764
     65install: $(output)
     66        mkdir -p $(PREFIX)/app
     67        $(INSTALL) -T $(output) $(PREFIX)/app/$(output)-xcw
     68
     69uninstall:
     70        rm -f $(PREFIX)/app/$(output)-xcw
     71
     72test: install
     73        $(TEST)
     74
    5875$(output): $(objects)
    5976        $(CC) -o $@ $^ $(LIBS)
  • uspace/app/bdsh/cmds/modules/ls/ls.c

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

    rb093a62 r84876aa4  
    3535 */
    3636
    37 #include <cap.h>
     37#include <capa.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         cap_spec_t cap;
    127 
    128         cap_from_blocks(nblocks, block_size, &cap);
    129         cap_simplify(&cap);
    130         return cap_format(&cap, rptr);
     126        capa_spec_t capa;
     127
     128        capa_from_blocks(nblocks, block_size, &capa);
     129        capa_simplify(&capa);
     130        return capa_format(&capa, rptr);
    131131}
    132132
  • uspace/app/fdisk/fdisk.c

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

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

    rb093a62 r84876aa4  
    3838
    3939const sc_desc_t syscall_desc[] = {
     40        /* System management syscalls. */
    4041        [SYS_KIO] = { "kio", 3, V_INT_ERRNO },
    4142
     43        /* Thread and task related syscalls. */
    4244        [SYS_THREAD_CREATE] = { "thread_create", 3, V_ERRNO },
    4345        [SYS_THREAD_EXIT] = { "thread_exit", 1, V_ERRNO },
    4446        [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 },
    4549
    4650        [SYS_TASK_GET_ID] = { "task_get_id", 1, V_ERRNO },
    4751        [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 },
    4855
     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. */
    4964        [SYS_AS_AREA_CREATE] = { "as_area_create", 5, V_ERRNO },
    5065        [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 },
    5168        [SYS_AS_AREA_DESTROY] = { "as_area_destroy", 1, V_ERRNO },
    5269
     70        /* Page mapping related syscalls. */
     71        [SYS_PAGE_FIND_MAPPING] = { "page_find_mapping", 2, V_ERRNO },
     72
     73        /* IPC related syscalls. */
    5374        [SYS_IPC_CALL_ASYNC_FAST] = { "ipc_call_async_fast", 6, V_HASH },
    5475        [SYS_IPC_CALL_ASYNC_SLOW] = { "ipc_call_async_slow", 3, V_HASH },
    55 
    5676        [SYS_IPC_ANSWER_FAST] = { "ipc_answer_fast", 6, V_ERRNO },
    5777        [SYS_IPC_ANSWER_SLOW] = { "ipc_answer_slow", 2, V_ERRNO },
     
    6181        [SYS_IPC_POKE] = { "ipc_poke", 0, V_ERRNO },
    6282        [SYS_IPC_HANGUP] = { "ipc_hangup", 1, V_ERRNO },
     83        [SYS_IPC_CONNECT_KBOX] = { "ipc_connect_kbox", 2, V_ERRNO },
    6384
     85        /* Event notification syscalls. */
    6486        [SYS_IPC_EVENT_SUBSCRIBE] = { "ipc_event_subscribe", 2, V_ERRNO },
    6587        [SYS_IPC_EVENT_UNSUBSCRIBE] = { "ipc_event_unsubscribe", 1, V_ERRNO },
    6688        [SYS_IPC_EVENT_UNMASK] = { "ipc_event_unmask", 1, V_ERRNO },
    6789
     90        /* Permission related syscalls. */
    6891        [SYS_PERM_GRANT] = { "perm_grant", 2, V_ERRNO },
    6992        [SYS_PERM_REVOKE] = { "perm_revoke", 2, V_ERRNO },
     93
     94        /* DDI related syscalls. */
    7095        [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 },
    7199        [SYS_IOSPACE_ENABLE] = { "iospace_enable", 1, V_ERRNO },
     100        [SYS_IOSPACE_DISABLE] = { "iospace_disable", 1, V_ERRNO },
    72101
    73102        [SYS_IPC_IRQ_SUBSCRIBE] = { "ipc_irq_subscribe", 4, V_ERRNO },
    74103        [SYS_IPC_IRQ_UNSUBSCRIBE] = { "ipc_irq_unsubscribe", 2, V_ERRNO },
    75104
     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 },
    76108        [SYS_SYSINFO_GET_VAL_TYPE] = { "sysinfo_get_val_type", 2, V_INTEGER },
    77109        [SYS_SYSINFO_GET_VALUE] = { "sysinfo_get_value", 3, V_ERRNO },
     
    79111        [SYS_SYSINFO_GET_DATA] = { "sysinfo_get_data", 5, V_ERRNO },
    80112
     113        /* Kernel console syscalls. */
    81114        [SYS_DEBUG_CONSOLE] = { "debug_console", 0, V_ERRNO },
    82         [SYS_IPC_CONNECT_KBOX] = { "ipc_connect_kbox", 1, V_ERRNO }
     115
     116        [SYS_KLOG] = { "klog", 5, V_ERRNO }
    83117};
    84118
  • uspace/app/trace/trace.c

    rb093a62 r84876aa4  
    4747#include <mem.h>
    4848#include <str.h>
    49 #include <loader/loader.h>
    5049#include <io/console.h>
    5150#include <io/keycode.h>
     
    8685void thread_trace_start(uintptr_t thread_hash);
    8786
     87static char *cmd_path;
     88static char **cmd_args;
     89
    8890static task_id_t task_id;
    89 static loader_t *task_ldr;
     91static task_wait_t task_w;
    9092static bool task_wait_for;
    9193
     
    9395display_mask_t display_mask;
    9496
    95 static errno_t program_run_fibril(void *arg);
    9697static errno_t cev_fibril(void *arg);
    97 
    98 static 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 }
    11098
    11199static void cev_fibril_start(void)
     
    122110}
    123111
    124 static errno_t program_run_fibril(void *arg)
    125 {
    126         errno_t rc;
    127 
    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);
     112static errno_t program_run(void)
     113{
     114        errno_t rc;
     115
     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
    133126        if (rc != EOK) {
    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;
     127                printf("Error running program (%s)\n", str_error_name(rc));
     128                return rc;
     129        }
     130
     131        return EOK;
    142132}
    143133
    144134static errno_t connect_task(task_id_t task_id)
    145135{
    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));
    165                 return rc;
    166         }
    167 
    168         rc = udebug_set_evmask(ksess, UDEBUG_EM_ALL);
     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);
    169167        if (rc != EOK) {
    170168                printf("udebug_set_evmask(0x%x) -> %s\n ", UDEBUG_EM_ALL, str_error_name(rc));
     
    172170        }
    173171
    174         sess = ksess;
    175         return 0;
     172        return EOK;
     173error:
     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;
    176181}
    177182
     
    198203        printf("\ntotal of %zu threads\n", tb_needed / sizeof(uintptr_t));
    199204
    200         return 0;
     205        return EOK;
    201206}
    202207
     
    488493
    489494        printf("Finished tracing thread [%d].\n", thread_id);
    490         return 0;
     495        return EOK;
    491496}
    492497
     
    502507        }
    503508        fibril_add_ready(fid);
    504 }
    505 
    506 static 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 */
    573 error:
    574         loader_abort(ldr);
    575         return NULL;
    576509}
    577510
     
    807740                                ++argv;
    808741                                task_id = strtol(*argv, &err_p, 10);
    809                                 task_ldr = NULL;
    810742                                task_wait_for = false;
    811743                                if (*err_p) {
     
    848780                printf("'%s'\n", *cp++);
    849781
    850         task_ldr = preload_task(*argv, argv, &task_id);
     782        cmd_path = *argv;
     783        cmd_args = argv;
    851784        task_wait_for = true;
    852785
     
    869802
    870803        main_init();
     804
     805        if (cmd_path != NULL)
     806                program_run();
    871807
    872808        rc = connect_task(task_id);
     
    878814        printf("Connected to task %" PRIu64 ".\n", task_id);
    879815
    880         if (task_ldr != NULL)
    881                 program_run();
    882 
    883816        cev_fibril_start();
    884817        trace_task(task_id);
     
    887820                printf("Waiting for task to exit.\n");
    888821
    889                 rc = task_wait_task_id(task_id, &texit, &retval);
     822                rc = task_wait(&task_w, &texit, &retval);
    890823                if (rc != EOK) {
    891824                        printf("Failed waiting for task.\n");
  • uspace/lib/c/generic/loader.c

    rb093a62 r84876aa4  
    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 */
     360void 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
    347370/** Cancel the loader session.
    348371 *
  • uspace/lib/c/generic/task.c

    rb093a62 r84876aa4  
    3535 */
    3636
     37#include <async.h>
    3738#include <task.h>
    3839#include <loader/loader.h>
     
    4647#include <ns.h>
    4748#include <stdlib.h>
     49#include <udebug.h>
    4850#include <libc.h>
    4951#include "private/ns.h"
     
    9496 * This is really just a convenience wrapper over the more complicated
    9597 * loader API. Arguments are passed as a null-terminated array of strings.
     98 * A debug session is created optionally.
    9699 *
    97100 * @param id   If not NULL, the ID of the task is stored here on success.
     
    100103 * @param path Pathname of the binary to execute.
    101104 * @param argv Command-line arguments.
    102  *
    103  * @return Zero on success or an error code.
    104  *
    105  */
    106 errno_t task_spawnv(task_id_t *id, task_wait_t *wait, const char *path,
    107     const char *const args[])
     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 */
     111errno_t task_spawnv_debug(task_id_t *id, task_wait_t *wait, const char *path,
     112    const char *const args[], async_sess_t **rsess)
    108113{
    109114        /* Send default files */
     
    125130        }
    126131
    127         return task_spawnvf(id, wait, path, args, fd_stdin, fd_stdout,
    128             fd_stderr);
     132        return task_spawnvf_debug(id, wait, path, args, fd_stdin, fd_stdout,
     133            fd_stderr, rsess);
    129134}
    130135
    131136/** 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 */
     150errno_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.
    132157 *
    133158 * This is really just a convenience wrapper over the more complicated
    134159 * loader API. Arguments are passed as a null-terminated array of strings.
    135160 * Files are passed as null-terminated array of pointers to fdi_node_t.
     161 * A debug session is created optionally.
    136162 *
    137163 * @param id      If not NULL, the ID of the task is stored here on success.
    138  * @param wait    If not NULL, setup waiting for task's return value and store
     164 * @param wait    If not NULL, setup waiting for task's return value and store.
    139165 * @param path    Pathname of the binary to execute.
    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  */
    148 errno_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 {
     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 */
     176errno_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
    151182        /* Connect to a program loader. */
    152183        loader_t *ldr = loader_connect();
     
    217248        }
    218249
    219         /* Run it. */
    220         rc = loader_run(ldr);
    221         if (rc != EOK)
    222                 goto error;
     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        }
    223274
    224275        /* Success */
    225276        if (id != NULL)
    226277                *id = task_id;
    227 
     278        if (rsess != NULL)
     279                *rsess = ksess;
    228280        return EOK;
    229281
    230282error:
     283        if (ksess != NULL)
     284                async_hangup(ksess);
    231285        if (wait_initialized)
    232286                task_cancel_wait(wait);
     
    235289        loader_abort(ldr);
    236290        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 */
     309errno_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);
    237314}
    238315
  • uspace/lib/c/include/loader/loader.h

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

    rb093a62 r84876aa4  
    3636#define _LIBC_TASK_H_
    3737
     38#include <async.h>
    3839#include <stdint.h>
    3940#include <stdarg.h>
     
    5657extern errno_t task_spawnv(task_id_t *, task_wait_t *, const char *path,
    5758    const char *const []);
     59extern errno_t task_spawnv_debug(task_id_t *, task_wait_t *, const char *path,
     60    const char *const [], async_sess_t **);
    5861extern errno_t task_spawnvf(task_id_t *, task_wait_t *, const char *path,
    5962    const char *const [], int, int, int);
     63extern errno_t task_spawnvf_debug(task_id_t *, task_wait_t *, const char *path,
     64    const char *const [], int, int, int, async_sess_t **);
    6065extern errno_t task_spawn(task_id_t *, task_wait_t *, const char *path, int,
    6166    va_list ap);
  • uspace/lib/c/meson.build

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

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

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

    rb093a62 r84876aa4  
    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 *, cap_spec_t *);
     52extern errno_t fdisk_dev_info_capacity(fdisk_dev_info_t *, capa_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 *, cap_spec_t *);
     59extern errno_t fdisk_dev_capacity(fdisk_dev_t *, capa_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, cap_spec_t *);
    69 extern errno_t fdisk_part_get_tot_avail(fdisk_dev_t *, fdisk_spc_t, cap_spec_t *);
     68extern errno_t fdisk_part_get_max_avail(fdisk_dev_t *, fdisk_spc_t, capa_spec_t *);
     69extern errno_t fdisk_part_get_tot_avail(fdisk_dev_t *, fdisk_spc_t, capa_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

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

    rb093a62 r84876aa4  
    3535
    3636#include <adt/list.h>
    37 #include <cap.h>
     37#include <capa.h>
    3838#include <errno.h>
    3939#include <fdisk.h>
     
    219219}
    220220
    221 errno_t fdisk_dev_info_capacity(fdisk_dev_info_t *info, cap_spec_t *cap)
     221errno_t fdisk_dev_info_capacity(fdisk_dev_info_t *info, capa_spec_t *capa)
    222222{
    223223        vbd_disk_info_t vinfo;
     
    228228                return EIO;
    229229
    230         cap_from_blocks(vinfo.nblocks, vinfo.block_size, cap);
     230        capa_from_blocks(vinfo.nblocks, vinfo.block_size, capa);
    231231        return EOK;
    232232}
     
    295295                dev->ext_part = part;
    296296
    297         cap_from_blocks(part->nblocks, dev->dinfo.block_size,
     297        capa_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, cap_spec_t *cap)
    539 {
    540         cap_from_blocks(dev->dinfo.nblocks, dev->dinfo.block_size, cap);
     538errno_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);
    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, cap_spec_t *cap)
     681errno_t fdisk_part_get_max_avail(fdisk_dev_t *dev, fdisk_spc_t spc,
     682    capa_spec_t *capa)
    682683{
    683684        errno_t rc;
     
    698699        }
    699700
    700         cap_from_blocks(nb, dev->dinfo.block_size, cap);
     701        capa_from_blocks(nb, dev->dinfo.block_size, capa);
    701702        return EOK;
    702703}
     
    704705/** Get total free space capacity. */
    705706errno_t fdisk_part_get_tot_avail(fdisk_dev_t *dev, fdisk_spc_t spc,
    706     cap_spec_t *cap)
     707    capa_spec_t *capa)
    707708{
    708709        fdisk_free_range_t fr;
     
    726727        } while (fdisk_free_range_next(&fr));
    727728
    728         cap_from_blocks(totb, dev->dinfo.block_size, cap);
     729        capa_from_blocks(totb, dev->dinfo.block_size, capa);
    729730        return EOK;
    730731}
     
    938939        errno_t rc;
    939940
    940         rc = cap_to_blocks(&pspec->capacity, cv_nom, dev->dinfo.block_size,
     941        rc = capa_to_blocks(&pspec->capacity, cv_nom, dev->dinfo.block_size,
    941942            &nom_blocks);
    942943        if (rc != EOK)
    943944                return rc;
    944945
    945         rc = cap_to_blocks(&pspec->capacity, cv_min, dev->dinfo.block_size,
     946        rc = capa_to_blocks(&pspec->capacity, cv_min, dev->dinfo.block_size,
    946947            &min_blocks);
    947948        if (rc != EOK)
    948949                return rc;
    949950
    950         rc = cap_to_blocks(&pspec->capacity, cv_max, dev->dinfo.block_size,
     951        rc = capa_to_blocks(&pspec->capacity, cv_max, dev->dinfo.block_size,
    951952            &max_blocks);
    952953        if (rc != EOK)
  • uspace/lib/meson.build

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

    rb093a62 r84876aa4  
    6666#include "serial.h"
    6767
    68 #define NUM_LAYOUTS  4
     68#define NUM_LAYOUTS 5
    6969
    7070static layout_ops_t *layout[NUM_LAYOUTS] = {
     
    7272        &us_dvorak_ops,
    7373        &cz_ops,
    74         &ar_ops
     74        &ar_ops,
     75        &fr_azerty_ops
    7576};
    7677
     
    208209        // TODO: More elegant layout switching
    209210
    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;
     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                }
    236236        }
    237237
  • uspace/srv/hid/input/layout.h

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

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

    rb093a62 r84876aa4  
    3232
    3333#include "../conn.h"
     34#include "../segment.h"
    3435#include "../tqueue.h"
    3536
     
    117118        PCUT_ASSERT_EQUALS(CTL_SYN, trans_seg[0]->ctrl);
    118119        PCUT_ASSERT_EQUALS(10, trans_seg[0]->seq);
     120        tcp_segment_delete(trans_seg[0]);
    119121}
    120122
     
    156158        PCUT_ASSERT_EQUALS(CTL_FIN | CTL_ACK, trans_seg[0]->ctrl);
    157159        PCUT_ASSERT_EQUALS(10, trans_seg[0]->seq);
     160        tcp_segment_delete(trans_seg[0]);
    158161}
    159162
     
    198201        PCUT_ASSERT_EQUALS(CTL_ACK, trans_seg[0]->ctrl);
    199202        PCUT_ASSERT_EQUALS(10, trans_seg[0]->seq);
     203        tcp_segment_delete(trans_seg[0]);
    200204}
    201205
     
    256260static void tqueue_test_transmit_seg(inet_ep2_t *epp, tcp_segment_t *seg)
    257261{
    258         trans_seg[seg_cnt++] = seg;
     262        trans_seg[seg_cnt++] = tcp_segment_dup(seg);
    259263}
    260264
  • uspace/srv/net/udp/assoc.c

    rb093a62 r84876aa4  
    4040#include <fibril_synch.h>
    4141#include <inet/endpoint.h>
    42 #include <inet/inet.h>
    4342#include <io/log.h>
    4443#include <nettl/amap.h>
     
    4847#include "msg.h"
    4948#include "pdu.h"
    50 #include "udp_inet.h"
    5149#include "udp_type.h"
    5250
     
    5755static udp_assoc_t *udp_assoc_find_ref(inet_ep2_t *);
    5856static errno_t udp_assoc_queue_msg(udp_assoc_t *, inet_ep2_t *, udp_msg_t *);
     57static udp_assocs_dep_t *assocs_dep;
    5958
    6059/** Initialize associations. */
    61 errno_t udp_assocs_init(void)
     60errno_t udp_assocs_init(udp_assocs_dep_t *dep)
    6261{
    6362        errno_t rc;
     
    6968        }
    7069
     70        assocs_dep = dep;
    7171        return EOK;
     72}
     73
     74/** Finalize associations. */
     75void udp_assocs_fini(void)
     76{
     77        assert(list_empty(&assoc_list));
     78
     79        amap_destroy(amap);
     80        amap = NULL;
    7281}
    7382
     
    174183
    175184        assert(assoc->deleted == false);
     185        assoc->deleted = true;
    176186        udp_assoc_delref(assoc);
    177         assoc->deleted = true;
    178187}
    179188
     
    244253errno_t udp_assoc_send(udp_assoc_t *assoc, inet_ep_t *remote, udp_msg_t *msg)
    245254{
    246         udp_pdu_t *pdu;
    247255        inet_ep2_t epp;
    248256        errno_t rc;
     
    266274        if (inet_addr_is_any(&epp.local.addr) && !assoc->nolocal) {
    267275                log_msg(LOG_DEFAULT, LVL_DEBUG, "Determine local address.");
    268                 rc = inet_get_srcaddr(&epp.remote.addr, 0, &epp.local.addr);
     276                rc = (*assocs_dep->get_srcaddr)(&epp.remote.addr, 0,
     277                    &epp.local.addr);
    269278                if (rc != EOK) {
    270279                        log_msg(LOG_DEFAULT, LVL_DEBUG, "Cannot determine "
     
    280289                return EINVAL;
    281290
    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 
    288291        log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_send - transmit");
    289 
    290         rc = udp_transmit_pdu(pdu);
    291         udp_pdu_delete(pdu);
     292        rc = (*assocs_dep->transmit_msg)(&epp, msg);
    292293
    293294        if (rc != EOK)
  • uspace/srv/net/udp/assoc.h

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

    rb093a62 r84876aa4  
    2828
    2929deps = [ 'nettl' ]
    30 src = files(
     30
     31_common_src = files(
    3132        'assoc.c',
     33        'cassoc.c',
    3234        'msg.c',
    3335        'pdu.c',
     36)
     37
     38src = files(
    3439        'service.c',
    3540        'udp.c',
    3641        'udp_inet.c',
    3742)
     43
     44test_src = files(
     45        'test/assoc.c',
     46        'test/msg.c',
     47        'test/main.c',
     48        'test/pdu.c',
     49)
     50
     51src = [ _common_src, src ]
     52test_src = [ _common_src, test_src ]
  • uspace/srv/net/udp/service.c

    rb093a62 r84876aa4  
    4646
    4747#include "assoc.h"
     48#include "cassoc.h"
    4849#include "msg.h"
    4950#include "service.h"
     
    5556#define MAX_MSG_SIZE DATA_XFER_LIMIT
    5657
    57 static void udp_cassoc_recv_msg(void *, inet_ep2_t *, udp_msg_t *);
     58static void udp_recv_msg_cassoc(void *, inet_ep2_t *, udp_msg_t *);
    5859
    5960/** Callbacks to tie us to association layer */
    6061static udp_assoc_cb_t udp_cassoc_cb = {
    61         .recv_msg = udp_cassoc_recv_msg
     62        .recv_msg = udp_recv_msg_cassoc
    6263};
    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  */
    72 static 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 }
    9264
    9365/** Send 'data' event to client.
     
    10880}
    10981
    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  */
    120 static 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  */
    150 static 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  */
    165 static 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 
    17882/** Message received on client association.
    17983 *
     
    18488 * @param msg Message
    18589 */
    186 static void udp_cassoc_recv_msg(void *arg, inet_ep2_t *epp, udp_msg_t *msg)
     90static void udp_recv_msg_cassoc(void *arg, inet_ep2_t *epp, udp_msg_t *msg)
    18791{
    18892        udp_cassoc_t *cassoc = (udp_cassoc_t *) arg;
  • uspace/srv/net/udp/udp.c

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

    rb093a62 r84876aa4  
    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 */
     143errno_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. */
     149errno_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
    136168/**
    137169 * @}
  • uspace/srv/net/udp/udp_inet.h

    rb093a62 r84876aa4  
    3636#define UDP_INET_H
    3737
     38#include <inet/addr.h>
     39#include <stdint.h>
    3840#include "udp_type.h"
    3941
    4042extern errno_t udp_inet_init(void);
    4143extern errno_t udp_transmit_pdu(udp_pdu_t *);
     44extern errno_t udp_get_srcaddr(inet_addr_t *, uint8_t, inet_addr_t *);
     45extern errno_t udp_transmit_msg(inet_ep2_t *, udp_msg_t *);
    4246
    4347#endif
  • uspace/srv/net/udp/udp_type.h

    rb093a62 r84876aa4  
    3737
    3838#include <async.h>
     39#include <errno.h>
    3940#include <fibril.h>
    4041#include <fibril_synch.h>
     
    4445#include <stdbool.h>
    4546#include <stddef.h>
     47#include <stdint.h>
    4648#include <inet/addr.h>
    4749
     
    8789} udp_pdu_t;
    8890
    89 /** Association callbacks */
     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 */
     96typedef 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 */
    90106typedef struct {
    91107        /** Message received */
  • uspace/srv/volsrv/volume.c

    rb093a62 r84876aa4  
    367367        if (refcount_down(&volume->refcnt)) {
    368368                /* No more references. Check if volume is persistent. */
    369                 if (!vol_volume_is_persist(volume)) {
    370                         list_remove(&volume->lvolumes);
    371                         vol_volume_delete(volume);
    372                 }
     369                list_remove(&volume->lvolumes);
     370                vol_volume_delete(volume);
    373371        }
    374372}
     
    399397                /* Volume is now persistent */
    400398                if (volume->nvolume == NULL) {
     399                        /* Prevent volume from being freed */
     400                        refcount_up(&volume->refcnt);
     401
    401402                        /* Create volume node */
    402403                        rc = sif_trans_begin(volume->volumes->repo, &trans);
     
    426427                        volume->nvolume = nvolume;
    427428                } else {
     429                        /* Allow volume to be freed */
     430                        vol_volume_del_ref(volume);
     431
    428432                        /* Update volume node */
    429433                        rc = sif_trans_begin(volume->volumes->repo, &trans);
Note: See TracChangeset for help on using the changeset viewer.