Changeset e28175d in mainline for uspace/srv


Ignore:
Timestamp:
2020-03-15T10:44:02Z (5 years ago)
Author:
GitHub <noreply@…>
Parents:
b401b33 (diff), 44dde42 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
heiducteam <tristanided@…> (2020-03-15 10:44:02)
git-committer:
GitHub <noreply@…> (2020-03-15 10:44:02)
Message:

Merge pull request #1 from HelenOS/master

sync

Location:
uspace/srv
Files:
36 added
30 deleted
23 edited
15 moved

Legend:

Unmodified
Added
Removed
  • uspace/srv/audio/hound/meson.build

    rb401b33 re28175d  
    2727#
    2828
    29 USPACE_PREFIX = ../..
    30 BINARY = wavplay
    31 
    32 LIBS = drv hound pcm
    33 
    34 SOURCES = \
    35         dplay.c \
    36         drec.c \
    37         main.c \
    38         wave.c
    39 
    40 include $(USPACE_PREFIX)/Makefile.common
    41 
     29deps = [ 'drv', 'hound', 'pcm' ]
     30c_args += '-DNAME="hound"'
     31src = files(
     32        'audio_data.c',
     33        'audio_device.c',
     34        'audio_sink.c',
     35        'audio_source.c',
     36        'connection.c',
     37        'hound.c',
     38        'hound_ctx.c',
     39        'iface.c',
     40        'main.c',
     41)
  • uspace/srv/devman/meson.build

    rb401b33 re28175d  
    2828#
    2929
    30 USPACE_PREFIX = ../..
    31 LIBS = block scsi
    32 BINARY = blkdump
    33 
    34 SOURCES = \
    35         blkdump.c
    36 
    37 include $(USPACE_PREFIX)/Makefile.common
     30src = files(
     31        'client_conn.c',
     32        'dev.c',
     33        'devtree.c',
     34        'drv_conn.c',
     35        'driver.c',
     36        'loc.c',
     37        'fun.c',
     38        'main.c',
     39        'match.c',
     40        'util.c',
     41)
  • uspace/srv/fs/cdfs/cdfs.c

    rb401b33 re28175d  
    7575        }
    7676
     77        errno_t rc;
    7778        async_sess_t *vfs_sess = service_connect_blocking(SERVICE_VFS,
    78             INTERFACE_VFS_DRIVER, 0);
     79            INTERFACE_VFS_DRIVER, 0, &rc);
    7980        if (!vfs_sess) {
    80                 printf("%s: Unable to connect to VFS\n", NAME);
     81                printf("%s: Unable to connect to VFS: %s\n", NAME, str_error(rc));
    8182                return -1;
    8283        }
    8384
    84         errno_t rc = fs_register(vfs_sess, &cdfs_vfs_info, &cdfs_ops,
     85        rc = fs_register(vfs_sess, &cdfs_vfs_info, &cdfs_ops,
    8586            &cdfs_libfs_ops);
    8687        if (rc != EOK) {
  • uspace/srv/fs/exfat/exfat.c

    rb401b33 re28175d  
    7777
    7878        async_sess_t *vfs_sess = service_connect_blocking(SERVICE_VFS,
    79             INTERFACE_VFS_DRIVER, 0);
     79            INTERFACE_VFS_DRIVER, 0, &rc);
    8080        if (!vfs_sess) {
    81                 printf(NAME ": failed to connect to VFS\n");
     81                printf(NAME ": failed to connect to VFS: %s\n", str_error(rc));
    8282                return -1;
    8383        }
  • uspace/srv/fs/ext4fs/ext4fs.c

    rb401b33 re28175d  
    4343#include <ipc/services.h>
    4444#include <str.h>
     45#include <str_error.h>
    4546#include "ext4/ops.h"
    4647#include "../../vfs/vfs.h"
     
    6667        }
    6768
     69        errno_t rc;
    6870        async_sess_t *vfs_sess = service_connect_blocking(SERVICE_VFS,
    69             INTERFACE_VFS_DRIVER, 0);
     71            INTERFACE_VFS_DRIVER, 0, &rc);
    7072        if (!vfs_sess) {
    71                 printf("%s: Failed to connect to VFS\n", NAME);
     73                printf("%s: Failed to connect to VFS: %s\n", NAME, str_error(rc));
    7274                return 2;
    7375        }
    7476
    75         errno_t rc = ext4_global_init();
     77        rc = ext4_global_init();
    7678        if (rc != EOK) {
    77                 printf("%s: Global initialization failed\n", NAME);
     79                printf("%s: Global initialization failed: %s\n", NAME,
     80                    str_error(rc));
    7881                return rc;
    7982        }
     
    8285            &ext4_libfs_ops);
    8386        if (rc != EOK) {
    84                 printf("%s: Failed to register file system\n", NAME);
     87                printf("%s: Failed to register file system: %s\n", NAME,
     88                    str_error(rc));
    8589                return rc;
    8690        }
  • uspace/srv/fs/fat/fat.c

    rb401b33 re28175d  
    7777
    7878        async_sess_t *vfs_sess = service_connect_blocking(SERVICE_VFS,
    79             INTERFACE_VFS_DRIVER, 0);
     79            INTERFACE_VFS_DRIVER, 0, &rc);
    8080        if (!vfs_sess) {
    81                 printf(NAME ": failed to connect to VFS\n");
     81                printf(NAME ": failed to connect to VFS: %s\n", str_error(rc));
    8282                return -1;
    8383        }
  • uspace/srv/fs/fat/meson.build

    rb401b33 re28175d  
    2828#
    2929
    30 USPACE_PREFIX = ../..
    31 BINARY = edit
    32 
    33 SOURCES = \
    34         edit.c \
    35         sheet.c \
    36         search.c
    37 
    38 include $(USPACE_PREFIX)/Makefile.common
     30deps = [ 'block', 'fs' ]
     31src = files(
     32        'fat.c',
     33        'fat_ops.c',
     34        'fat_idx.c',
     35        'fat_dentry.c',
     36        'fat_directory.c',
     37        'fat_fat.c',
     38)
  • uspace/srv/fs/locfs/locfs.c

    rb401b33 re28175d  
    7878        }
    7979
     80        errno_t rc;
    8081        async_sess_t *vfs_sess = service_connect_blocking(SERVICE_VFS,
    81             INTERFACE_VFS_DRIVER, 0);
     82            INTERFACE_VFS_DRIVER, 0, &rc);
    8283        if (!vfs_sess) {
    83                 printf("%s: Unable to connect to VFS\n", NAME);
     84                printf("%s: Unable to connect to VFS: %s\n", NAME, str_error(rc));
    8485                return -1;
    8586        }
    8687
    87         errno_t rc = fs_register(vfs_sess, &locfs_vfs_info, &locfs_ops,
     88        rc = fs_register(vfs_sess, &locfs_vfs_info, &locfs_ops,
    8889            &locfs_libfs_ops);
    8990        if (rc != EOK) {
  • uspace/srv/fs/mfs/meson.build

    rb401b33 re28175d  
    2828#
    2929
    30 USPACE_PREFIX = ../..
    31 BINARY = init
    32 STATIC_NEEDED = y
    33 
    34 LIBS = untar block
    35 
    36 SOURCES = \
    37         init.c \
    38         untar.c
    39 
    40 include $(USPACE_PREFIX)/Makefile.common
     30deps = [ 'block', 'fs', 'minix' ]
     31src = files(
     32        'mfs.c',
     33        'mfs_ops.c',
     34        'mfs_inode.c',
     35        'mfs_rw.c',
     36        'mfs_dentry.c',
     37        'mfs_balloc.c',
     38        'mfs_utils.c',
     39)
  • uspace/srv/fs/mfs/mfs.c

    rb401b33 re28175d  
    7474
    7575        async_sess_t *vfs_sess = service_connect_blocking(SERVICE_VFS,
    76             INTERFACE_VFS_DRIVER, 0);
    77 
     76            INTERFACE_VFS_DRIVER, 0, &rc);
    7877        if (!vfs_sess) {
    79                 printf(NAME ": failed to connect to VFS\n");
     78                printf(NAME ": failed to connect to VFS: %s\n", str_error(rc));
    8079                rc = errno;
    8180                goto err;
  • uspace/srv/fs/tmpfs/tmpfs.c

    rb401b33 re28175d  
    8080        }
    8181
     82        errno_t rc;
    8283        async_sess_t *vfs_sess = service_connect_blocking(SERVICE_VFS,
    83             INTERFACE_VFS_DRIVER, 0);
     84            INTERFACE_VFS_DRIVER, 0, &rc);
    8485        if (!vfs_sess) {
    85                 printf("%s: Unable to connect to VFS\n", NAME);
     86                printf("%s: Unable to connect to VFS: %s\n", NAME, str_error(rc));
    8687                return -1;
    8788        }
    8889
    89         errno_t rc = fs_register(vfs_sess, &tmpfs_vfs_info, &tmpfs_ops,
     90        rc = fs_register(vfs_sess, &tmpfs_vfs_info, &tmpfs_ops,
    9091            &tmpfs_libfs_ops);
    9192        if (rc != EOK) {
  • uspace/srv/fs/udf/udf.c

    rb401b33 re28175d  
    7373        }
    7474
     75        errno_t rc;
    7576        async_sess_t *vfs_sess =
    76             service_connect_blocking(SERVICE_VFS, INTERFACE_VFS_DRIVER, 0);
     77            service_connect_blocking(SERVICE_VFS, INTERFACE_VFS_DRIVER, 0, &rc);
    7778        if (!vfs_sess) {
    78                 log_msg(LOG_DEFAULT, LVL_FATAL, "Failed to connect to VFS");
     79                log_msg(LOG_DEFAULT, LVL_FATAL, "Failed to connect to VFS: %s",
     80                    str_error(rc));
    7981                return 2;
    8082        }
    8183
    82         errno_t rc = fs_register(vfs_sess, &udf_vfs_info, &udf_ops,
     84        rc = fs_register(vfs_sess, &udf_vfs_info, &udf_ops,
    8385            &udf_libfs_ops);
    8486        if (rc != EOK)
  • uspace/srv/fs/udf/udf_ops.c

    rb401b33 re28175d  
    328328        /* initialize block cache */
    329329        errno_t rc = block_init(service_id, MAX_SIZE);
    330         if (rc != EOK)
    331                 return rc;
     330        if (rc != EOK) {
     331                free(instance);
     332                return rc;
     333        }
    332334
    333335        rc = fs_instance_create(service_id, instance);
  • uspace/srv/hid/compositor/compositor.c

    rb401b33 re28175d  
    6767#include <transform.h>
    6868#include <rectangle.h>
    69 #include <surface.h>
    70 #include <cursor.h>
    71 #include <source.h>
    72 #include <drawctx.h>
    73 #include <codec/tga.h>
     69#include <draw/surface.h>
     70#include <draw/cursor.h>
     71#include <draw/source.h>
     72#include <draw/drawctx.h>
     73#include <draw/codec.h>
    7474
    7575#include "compositor.h"
  • uspace/srv/hid/input/input.c

    rb401b33 re28175d  
    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

    rb401b33 re28175d  
    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

    rb401b33 re28175d  
    2828#
    2929
    30 USPACE_PREFIX = ../..
    31 DEFS = -DRELEASE=$(RELEASE) "-DCOPYRIGHT=$(COPYRIGHT)" "-DNAME=$(NAME)"
    32 BINARY = getterm
    33 
    34 SOURCES = \
    35         getterm.c \
    36         version.c \
    37         welcome.c
    38 
    39 include $(USPACE_PREFIX)/Makefile.common
     30deps = [ 'drv' ]
     31src = files(
     32        'layout/cz.c',
     33        'layout/fr_azerty.c',
     34        'layout/us_qwerty.c',
     35        'layout/us_dvorak.c',
     36        'layout/ar.c',
     37        'port/chardev.c',
     38        'proto/mousedev.c',
     39        'ctl/kbdev.c',
     40        'ctl/stty.c',
     41        'ctl/sun.c',
     42        'gsp.c',
     43        'input.c',
     44        'layout.c',
     45        'stroke.c',
     46)
  • uspace/srv/hid/output/meson.build

    rb401b33 re28175d  
    2828#
    2929
    30 USPACE_PREFIX = ../..
    31 LIBS = block
    32 BINARY = mkfat
    33 
    34 SOURCES = \
    35         mkfat.c
    36 
    37 include $(USPACE_PREFIX)/Makefile.common
     30deps = [ 'drv' ]
     31src = files(
     32        'ctl/serial.c',
     33        'port/ega.c',
     34        'port/chardev.c',
     35        'proto/vt100.c',
     36        'output.c',
     37)
  • uspace/srv/logger/meson.build

    rb401b33 re28175d  
    2727#
    2828
    29 USPACE_PREFIX = ../../..
    30 BINARY = remcons
    31 
    32 SOURCES = \
    33         remcons.c \
    34         user.c
    35 
    36 include $(USPACE_PREFIX)/Makefile.common
     29src = files(
     30        'ctl.c',
     31        'initlvl.c',
     32        'level.c',
     33        'logs.c',
     34        'main.c',
     35        'writer.c',
     36)
  • uspace/srv/net/dnsrsrv/meson.build

    rb401b33 re28175d  
    2727#
    2828
    29 USPACE_PREFIX = ../..
    30 BINARY = ping
    31 
    32 SOURCES = \
    33         ping.c
    34 
    35 include $(USPACE_PREFIX)/Makefile.common
     29src = files(
     30        'dns_msg.c',
     31        'dnsrsrv.c',
     32        'query.c',
     33        'transport.c',
     34)
  • uspace/srv/net/ethip/meson.build

    rb401b33 re28175d  
    2727#
    2828
    29 USPACE_PREFIX = ../../..
    30 BINARY = loopip
    31 
    32 SOURCES = \
    33         loopip.c
    34 
    35 include $(USPACE_PREFIX)/Makefile.common
     29deps = [ 'drv' ]
     30src = files(
     31        'arp.c',
     32        'atrans.c',
     33        'ethip.c',
     34        'ethip_nic.c',
     35        'pdu.c',
     36)
  • uspace/srv/net/inetsrv/meson.build

    rb401b33 re28175d  
    2727#
    2828
    29 USPACE_PREFIX = ../..
    30 BINARY = nterm
    31 
    32 SOURCES = \
    33         conn.c \
    34         nterm.c
    35 
    36 include $(USPACE_PREFIX)/Makefile.common
     29src = files(
     30        'addrobj.c',
     31        'icmp.c',
     32        'icmpv6.c',
     33        'inetsrv.c',
     34        'inet_link.c',
     35        'inetcfg.c',
     36        'inetping.c',
     37        'ndp.c',
     38        'ntrans.c',
     39        'pdu.c',
     40        'reass.c',
     41        'sroute.c',
     42)
  • uspace/srv/net/tcp/meson.build

    rb401b33 re28175d  
    2727#
    2828
    29 USPACE_PREFIX = ../..
    30 LIBRARY = libscsi
     29deps = [ 'nettl' ]
    3130
    32 SOURCES = \
    33         src/spc.c
     31_common_src = files(
     32        'conn.c',
     33        'inet.c',
     34        'iqueue.c',
     35        'ncsim.c',
     36        'pdu.c',
     37        'rqueue.c',
     38        'segment.c',
     39        'seq_no.c',
     40        'test.c',
     41        'tqueue.c',
     42        'ucall.c',
     43)
    3444
    35 include $(USPACE_PREFIX)/Makefile.common
     45src = files(
     46        'service.c',
     47        'tcp.c',
     48)
     49
     50test_src = files(
     51        'test/conn.c',
     52        'test/iqueue.c',
     53        'test/main.c',
     54        'test/pdu.c',
     55        'test/rqueue.c',
     56        'test/segment.c',
     57        'test/seq_no.c',
     58        'test/tqueue.c',
     59        'test/ucall.c',
     60)
     61
     62src = [ _common_src, src ]
     63test_src = [ _common_src, test_src ]
  • uspace/srv/net/tcp/test/tqueue.c

    rb401b33 re28175d  
    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

    rb401b33 re28175d  
    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

    rb401b33 re28175d  
    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

    rb401b33 re28175d  
    2727#
    2828
    29 USPACE_PREFIX = ../../..
     29deps = [ 'nettl' ]
    3030
    31 LIBS = nettl
     31_common_src = files(
     32        'assoc.c',
     33        'cassoc.c',
     34        'msg.c',
     35        'pdu.c',
     36)
    3237
    33 BINARY = udp
     38src = files(
     39        'service.c',
     40        'udp.c',
     41        'udp_inet.c',
     42)
    3443
    35 SOURCES = \
    36         assoc.c \
    37         msg.c \
    38         pdu.c \
    39         service.c \
    40         udp.c \
    41         udp_inet.c
     44test_src = files(
     45        'test/assoc.c',
     46        'test/msg.c',
     47        'test/main.c',
     48        'test/pdu.c',
     49)
    4250
    43 include $(USPACE_PREFIX)/Makefile.common
     51src = [ _common_src, src ]
     52test_src = [ _common_src, test_src ]
  • uspace/srv/net/udp/service.c

    rb401b33 re28175d  
    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/test/main.c

    rb401b33 re28175d  
    11/*
    2  * Copyright (c) 2012 Petr Koupy
     2 * Copyright (c) 2019 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup draw
    30  * @{
    31  */
    32 /**
    33  * @file
    34  */
     29#include <pcut/pcut.h>
    3530
    36 #ifndef DRAW_FONT_EMBEDDED_H_
    37 #define DRAW_FONT_EMBEDDED_H_
     31PCUT_INIT;
    3832
    39 #include "../font.h"
     33PCUT_IMPORT(assoc);
     34PCUT_IMPORT(msg);
     35PCUT_IMPORT(pdu);
    4036
    41 extern errno_t embedded_font_create(font_t **, uint16_t points);
    42 
    43 #endif
    44 
    45 /** @}
    46  */
     37PCUT_MAIN();
  • uspace/srv/net/udp/udp.c

    rb401b33 re28175d  
    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

    rb401b33 re28175d  
    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

    rb401b33 re28175d  
    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

    rb401b33 re28175d  
    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/vfs/meson.build

    rb401b33 re28175d  
    2828#
    2929
    30 USPACE_PREFIX = ../..
    31 LIBS = clui
    32 BINARY = kio
    33 
    34 SOURCES = \
    35         kio.c
    36 
    37 include $(USPACE_PREFIX)/Makefile.common
     30src = files(
     31        'vfs.c',
     32        'vfs_node.c',
     33        'vfs_file.c',
     34        'vfs_ops.c',
     35        'vfs_lookup.c',
     36        'vfs_register.c',
     37        'vfs_ipc.c',
     38        'vfs_pager.c',
     39)
  • uspace/srv/volsrv/meson.build

    rb401b33 re28175d  
    2727#
    2828
    29 USPACE_PREFIX = ../..
     29deps = [ 'block', 'label', 'sif' ]
    3030
    31 LIBRARY = libfdisk
     31src = files(
     32        'empty.c',
     33        'mkfs.c',
     34        'part.c',
     35        'volsrv.c',
     36        'volume.c',
     37)
    3238
    33 SOURCES = \
    34         src/fdisk.c
    35 
    36 include $(USPACE_PREFIX)/Makefile.common
     39test_src = files(
     40        'volume.c',
     41        'test/main.c',
     42        'test/volume.c',
     43)
  • uspace/srv/volsrv/part.c

    rb401b33 re28175d  
    129129
    130130                if (!already_known) {
    131                         log_msg(LOG_DEFAULT, LVL_NOTE, "Found partition '%lu'",
     131                        log_msg(LOG_DEFAULT, LVL_DEBUG, "Found partition '%lu'",
    132132                            (unsigned long) svcs[i]);
    133133                        rc = vol_part_add_locked(parts, svcs[i]);
     
    155155
    156156                if (!still_exists) {
    157                         log_msg(LOG_DEFAULT, LVL_NOTE, "Partition '%zu' is gone",
     157                        log_msg(LOG_DEFAULT, LVL_DEBUG, "Partition '%zu' is gone",
    158158                            part->svc_id);
    159159                        vol_part_remove_locked(part);
     
    210210        errno_t rc;
    211211
    212         log_msg(LOG_DEFAULT, LVL_NOTE, "Probe partition %s", part->svc_name);
     212        log_msg(LOG_DEFAULT, LVL_DEBUG, "Probe partition %s", part->svc_name);
    213213
    214214        assert(fibril_mutex_is_locked(&part->parts->lock));
     
    223223
    224224        if (fst->name != NULL) {
    225                 log_msg(LOG_DEFAULT, LVL_NOTE, "Found %s, label '%s'",
     225                log_msg(LOG_DEFAULT, LVL_DEBUG, "Found %s, label '%s'",
    226226                    fst->name, info.label);
    227227                label = str_dup(info.label);
     
    317317        if (str_size(part->volume->mountp) > 0) {
    318318                cfg_mp = part->volume->mountp;
    319                 log_msg(LOG_DEFAULT, LVL_NOTE, "Configured mount point '%s'",
     319                log_msg(LOG_DEFAULT, LVL_DEBUG, "Configured mount point '%s'",
    320320                    cfg_mp);
    321321        } else {
    322322                cfg_mp = vol_part_def_mountp(part);
    323                 log_msg(LOG_DEFAULT, LVL_NOTE, "Default mount point '%s'",
     323                log_msg(LOG_DEFAULT, LVL_DEBUG, "Default mount point '%s'",
    324324                    cfg_mp);
    325325        }
     
    334334                }
    335335
    336                 log_msg(LOG_DEFAULT, LVL_NOTE, "Determine MP label='%s'", part->label);
     336                log_msg(LOG_DEFAULT, LVL_DEBUG, "Determine MP label='%s'", part->label);
    337337                err = asprintf(&mp, "/vol/%s", part->label);
    338338                if (err < 0) {
     
    378378        if (mp_auto) {
    379379                /* Create directory for automatic mount point */
    380                 log_msg(LOG_DEFAULT, LVL_NOTE, "Create mount point '%s'", mp);
     380                log_msg(LOG_DEFAULT, LVL_DEBUG, "Create mount point '%s'", mp);
    381381                rc = vfs_link_path(mp, KIND_DIRECTORY, NULL);
    382382                if (rc != EOK) {
     
    388388        }
    389389
    390         log_msg(LOG_DEFAULT, LVL_NOTE, "Call vfs_mount_path mp='%s' fstype='%s' svc_name='%s'",
     390        log_msg(LOG_DEFAULT, LVL_DEBUG, "Call vfs_mount_path mp='%s' fstype='%s' svc_name='%s'",
    391391            mp, fstype_str(part->fstype), part->svc_name);
    392392        rc = vfs_mount_path(mp, fstype_str(part->fstype),
    393393            part->svc_name, "", 0, 0);
    394394        if (rc != EOK) {
    395                 log_msg(LOG_DEFAULT, LVL_NOTE, "Failed mounting to %s", mp);
    396         }
    397         log_msg(LOG_DEFAULT, LVL_NOTE, "Mount to %s -> %d\n", mp, rc);
     395                log_msg(LOG_DEFAULT, LVL_ERROR, "Failed mounting %s at %s to %s",
     396                    fstype_str(part->fstype), part->svc_name, mp);
     397        } else {
     398                log_msg(LOG_DEFAULT, LVL_NOTE, "Mounted %s at %s to %s\n",
     399                    fstype_str(part->fstype), part->svc_name, mp);
     400        }
    398401
    399402        part->cur_mp = mp;
     
    409412
    410413        assert(fibril_mutex_is_locked(&parts->lock));
    411         log_msg(LOG_DEFAULT, LVL_NOTE, "vol_part_add_locked(%zu)", sid);
     414        log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_add_locked(%zu)", sid);
    412415
    413416        /* Check for duplicates */
     
    418421        }
    419422
    420         log_msg(LOG_DEFAULT, LVL_NOTE, "partition %zu is new", sid);
     423        log_msg(LOG_DEFAULT, LVL_DEBUG, "partition %zu is new", sid);
    421424
    422425        part = vol_part_new();
     
    443446        list_append(&part->lparts, &parts->parts);
    444447
    445         log_msg(LOG_DEFAULT, LVL_NOTE, "Added partition %zu", part->svc_id);
     448        log_msg(LOG_DEFAULT, LVL_DEBUG, "Added partition %zu", part->svc_id);
    446449
    447450        return EOK;
     
    455458{
    456459        assert(fibril_mutex_is_locked(&part->parts->lock));
    457         log_msg(LOG_DEFAULT, LVL_NOTE, "vol_part_remove_locked(%zu)",
     460        log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_remove_locked(%zu)",
    458461            part->svc_id);
    459462
    460463        list_remove(&part->lparts);
    461464
    462         log_msg(LOG_DEFAULT, LVL_NOTE, "Removed partition.");
     465        log_msg(LOG_DEFAULT, LVL_DEBUG, "Removed partition.");
    463466        vol_part_del_ref(part);
    464467}
  • uspace/srv/volsrv/volsrv.c

    rb401b33 re28175d  
    256256        errno_t rc;
    257257
    258         log_msg(LOG_DEFAULT, LVL_NOTE, "vol_part_insert_by_path_srv()");
     258        log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_insert_by_path_srv()");
    259259
    260260        rc = async_data_write_accept((void **)&path, true, 0, VOL_MOUNTP_MAXLEN,
     
    360360        errno_t rc;
    361361
    362         log_msg(LOG_DEFAULT, LVL_NOTE, "vol_part_mkfs_srv()");
     362        log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_mkfs_srv()");
    363363
    364364        sid = ipc_get_arg1(icall);
     
    373373
    374374        if (label != NULL) {
    375                 log_msg(LOG_DEFAULT, LVL_NOTE, "vol_part_mkfs_srv: label='%s'",
     375                log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_mkfs_srv: label='%s'",
    376376                    label);
    377377        }
     
    385385
    386386        if (mountp != NULL) {
    387                 log_msg(LOG_DEFAULT, LVL_NOTE, "vol_part_mkfs_srv: mountp='%s'",
     387                log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_mkfs_srv: mountp='%s'",
    388388                    mountp);
    389389        }
     
    422422        errno_t rc;
    423423
    424         log_msg(LOG_DEFAULT, LVL_NOTE, "vol_part_set_mountp_srv()");
     424        log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_set_mountp_srv()");
    425425
    426426        sid = ipc_get_arg1(icall);
     
    434434
    435435        if (mountp != NULL) {
    436                 log_msg(LOG_DEFAULT, LVL_NOTE,
     436                log_msg(LOG_DEFAULT, LVL_DEBUG,
    437437                    "vol_part_set_mountp_srv: mountp='%s'", mountp);
    438438        }
     
    464464        errno_t rc;
    465465
    466         log_msg(LOG_DEFAULT, LVL_NOTE, "vol_get_volumes_srv()");
     466        log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_get_volumes_srv()");
    467467
    468468        if (!async_data_read_receive(&call, &size)) {
  • uspace/srv/volsrv/volume.c

    rb401b33 re28175d  
    9696static void vol_volume_delete(vol_volume_t *volume)
    9797{
    98         log_msg(LOG_DEFAULT, LVL_NOTE, "Freeing volume %p", volume);
     98        log_msg(LOG_DEFAULT, LVL_DEBUG, "Freeing volume %p", volume);
    9999
    100100        free(volume->label);
     
    219219{
    220220        assert(fibril_mutex_is_locked(&volumes->lock));
    221         log_msg(LOG_DEFAULT, LVL_NOTE, "vol_volume_add_locked(%p)", volume);
     221        log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_volume_add_locked(%p)", volume);
    222222
    223223        volume->volumes = volumes;
     
    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.