Changeset e28175d in mainline for uspace/srv
- Timestamp:
- 2020-03-15T10:44:02Z (5 years ago)
- 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)
- Location:
- uspace/srv
- Files:
-
- 36 added
- 30 deleted
- 23 edited
- 15 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/audio/hound/meson.build
rb401b33 re28175d 27 27 # 28 28 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.c39 40 include $(USPACE_PREFIX)/Makefile.common 41 29 deps = [ 'drv', 'hound', 'pcm' ] 30 c_args += '-DNAME="hound"' 31 src = 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 28 28 # 29 29 30 USPACE_PREFIX = ../.. 31 LIBS = block scsi 32 BINARY = blkdump 33 34 SOURCES = \ 35 blkdump.c 36 37 include $(USPACE_PREFIX)/Makefile.common 30 src = 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 75 75 } 76 76 77 errno_t rc; 77 78 async_sess_t *vfs_sess = service_connect_blocking(SERVICE_VFS, 78 INTERFACE_VFS_DRIVER, 0 );79 INTERFACE_VFS_DRIVER, 0, &rc); 79 80 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)); 81 82 return -1; 82 83 } 83 84 84 errno_trc = fs_register(vfs_sess, &cdfs_vfs_info, &cdfs_ops,85 rc = fs_register(vfs_sess, &cdfs_vfs_info, &cdfs_ops, 85 86 &cdfs_libfs_ops); 86 87 if (rc != EOK) { -
uspace/srv/fs/exfat/exfat.c
rb401b33 re28175d 77 77 78 78 async_sess_t *vfs_sess = service_connect_blocking(SERVICE_VFS, 79 INTERFACE_VFS_DRIVER, 0 );79 INTERFACE_VFS_DRIVER, 0, &rc); 80 80 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)); 82 82 return -1; 83 83 } -
uspace/srv/fs/ext4fs/ext4fs.c
rb401b33 re28175d 43 43 #include <ipc/services.h> 44 44 #include <str.h> 45 #include <str_error.h> 45 46 #include "ext4/ops.h" 46 47 #include "../../vfs/vfs.h" … … 66 67 } 67 68 69 errno_t rc; 68 70 async_sess_t *vfs_sess = service_connect_blocking(SERVICE_VFS, 69 INTERFACE_VFS_DRIVER, 0 );71 INTERFACE_VFS_DRIVER, 0, &rc); 70 72 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)); 72 74 return 2; 73 75 } 74 76 75 errno_trc = ext4_global_init();77 rc = ext4_global_init(); 76 78 if (rc != EOK) { 77 printf("%s: Global initialization failed\n", NAME); 79 printf("%s: Global initialization failed: %s\n", NAME, 80 str_error(rc)); 78 81 return rc; 79 82 } … … 82 85 &ext4_libfs_ops); 83 86 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)); 85 89 return rc; 86 90 } -
uspace/srv/fs/fat/fat.c
rb401b33 re28175d 77 77 78 78 async_sess_t *vfs_sess = service_connect_blocking(SERVICE_VFS, 79 INTERFACE_VFS_DRIVER, 0 );79 INTERFACE_VFS_DRIVER, 0, &rc); 80 80 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)); 82 82 return -1; 83 83 } -
uspace/srv/fs/fat/meson.build
rb401b33 re28175d 28 28 # 29 29 30 USPACE_PREFIX = ../.. 31 BINARY = edit 32 33 SOURCES = \ 34 edit.c \35 sheet.c \36 search.c37 38 include $(USPACE_PREFIX)/Makefile.common 30 deps = [ 'block', 'fs' ] 31 src = 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 78 78 } 79 79 80 errno_t rc; 80 81 async_sess_t *vfs_sess = service_connect_blocking(SERVICE_VFS, 81 INTERFACE_VFS_DRIVER, 0 );82 INTERFACE_VFS_DRIVER, 0, &rc); 82 83 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)); 84 85 return -1; 85 86 } 86 87 87 errno_trc = fs_register(vfs_sess, &locfs_vfs_info, &locfs_ops,88 rc = fs_register(vfs_sess, &locfs_vfs_info, &locfs_ops, 88 89 &locfs_libfs_ops); 89 90 if (rc != EOK) { -
uspace/srv/fs/mfs/meson.build
rb401b33 re28175d 28 28 # 29 29 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 30 deps = [ 'block', 'fs', 'minix' ] 31 src = 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 74 74 75 75 async_sess_t *vfs_sess = service_connect_blocking(SERVICE_VFS, 76 INTERFACE_VFS_DRIVER, 0); 77 76 INTERFACE_VFS_DRIVER, 0, &rc); 78 77 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)); 80 79 rc = errno; 81 80 goto err; -
uspace/srv/fs/tmpfs/tmpfs.c
rb401b33 re28175d 80 80 } 81 81 82 errno_t rc; 82 83 async_sess_t *vfs_sess = service_connect_blocking(SERVICE_VFS, 83 INTERFACE_VFS_DRIVER, 0 );84 INTERFACE_VFS_DRIVER, 0, &rc); 84 85 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)); 86 87 return -1; 87 88 } 88 89 89 errno_trc = fs_register(vfs_sess, &tmpfs_vfs_info, &tmpfs_ops,90 rc = fs_register(vfs_sess, &tmpfs_vfs_info, &tmpfs_ops, 90 91 &tmpfs_libfs_ops); 91 92 if (rc != EOK) { -
uspace/srv/fs/udf/udf.c
rb401b33 re28175d 73 73 } 74 74 75 errno_t rc; 75 76 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); 77 78 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)); 79 81 return 2; 80 82 } 81 83 82 errno_trc = fs_register(vfs_sess, &udf_vfs_info, &udf_ops,84 rc = fs_register(vfs_sess, &udf_vfs_info, &udf_ops, 83 85 &udf_libfs_ops); 84 86 if (rc != EOK) -
uspace/srv/fs/udf/udf_ops.c
rb401b33 re28175d 328 328 /* initialize block cache */ 329 329 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 } 332 334 333 335 rc = fs_instance_create(service_id, instance); -
uspace/srv/hid/compositor/compositor.c
rb401b33 re28175d 67 67 #include <transform.h> 68 68 #include <rectangle.h> 69 #include < surface.h>70 #include < cursor.h>71 #include < source.h>72 #include <draw ctx.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> 74 74 75 75 #include "compositor.h" -
uspace/srv/hid/input/input.c
rb401b33 re28175d 66 66 #include "serial.h" 67 67 68 #define NUM_LAYOUTS 468 #define NUM_LAYOUTS 5 69 69 70 70 static layout_ops_t *layout[NUM_LAYOUTS] = { … … 72 72 &us_dvorak_ops, 73 73 &cz_ops, 74 &ar_ops 74 &ar_ops, 75 &fr_azerty_ops 75 76 }; 76 77 … … 208 209 // TODO: More elegant layout switching 209 210 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 } 236 236 } 237 237 -
uspace/srv/hid/input/layout.h
rb401b33 re28175d 60 60 extern layout_ops_t cz_ops; 61 61 extern layout_ops_t ar_ops; 62 extern layout_ops_t fr_azerty_ops; 62 63 63 64 extern layout_t *layout_create(layout_ops_t *); -
uspace/srv/hid/input/meson.build
rb401b33 re28175d 28 28 # 29 29 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 30 deps = [ 'drv' ] 31 src = 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 28 28 # 29 29 30 USPACE_PREFIX = ../.. 31 LIBS = block 32 BINARY = mkfat 33 34 SOURCES = \ 35 mkfat.c36 37 include $(USPACE_PREFIX)/Makefile.common 30 deps = [ 'drv' ] 31 src = 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 27 27 # 28 28 29 USPACE_PREFIX = ../../.. 30 BINARY = remcons 31 32 SOURCES = \ 33 remcons.c \34 user.c35 36 include $(USPACE_PREFIX)/Makefile.common 29 src = 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 27 27 # 28 28 29 USPACE_PREFIX = ../.. 30 BINARY = ping 31 32 SOURCES = \ 33 ping.c 34 35 include $(USPACE_PREFIX)/Makefile.common 29 src = files( 30 'dns_msg.c', 31 'dnsrsrv.c', 32 'query.c', 33 'transport.c', 34 ) -
uspace/srv/net/ethip/meson.build
rb401b33 re28175d 27 27 # 28 28 29 USPACE_PREFIX = ../../.. 30 BINARY = loopip 31 32 SOURCES = \ 33 loopip.c 34 35 include $(USPACE_PREFIX)/Makefile.common 29 deps = [ 'drv' ] 30 src = 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 27 27 # 28 28 29 USPACE_PREFIX = ../.. 30 BINARY = nterm 31 32 SOURCES = \ 33 conn.c \ 34 nterm.c 35 36 include $(USPACE_PREFIX)/Makefile.common 29 src = 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 27 27 # 28 28 29 USPACE_PREFIX = ../.. 30 LIBRARY = libscsi 29 deps = [ 'nettl' ] 31 30 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 ) 34 44 35 include $(USPACE_PREFIX)/Makefile.common 45 src = files( 46 'service.c', 47 'tcp.c', 48 ) 49 50 test_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 62 src = [ _common_src, src ] 63 test_src = [ _common_src, test_src ] -
uspace/srv/net/tcp/test/tqueue.c
rb401b33 re28175d 32 32 33 33 #include "../conn.h" 34 #include "../segment.h" 34 35 #include "../tqueue.h" 35 36 … … 117 118 PCUT_ASSERT_EQUALS(CTL_SYN, trans_seg[0]->ctrl); 118 119 PCUT_ASSERT_EQUALS(10, trans_seg[0]->seq); 120 tcp_segment_delete(trans_seg[0]); 119 121 } 120 122 … … 156 158 PCUT_ASSERT_EQUALS(CTL_FIN | CTL_ACK, trans_seg[0]->ctrl); 157 159 PCUT_ASSERT_EQUALS(10, trans_seg[0]->seq); 160 tcp_segment_delete(trans_seg[0]); 158 161 } 159 162 … … 198 201 PCUT_ASSERT_EQUALS(CTL_ACK, trans_seg[0]->ctrl); 199 202 PCUT_ASSERT_EQUALS(10, trans_seg[0]->seq); 203 tcp_segment_delete(trans_seg[0]); 200 204 } 201 205 … … 256 260 static void tqueue_test_transmit_seg(inet_ep2_t *epp, tcp_segment_t *seg) 257 261 { 258 trans_seg[seg_cnt++] = seg;262 trans_seg[seg_cnt++] = tcp_segment_dup(seg); 259 263 } 260 264 -
uspace/srv/net/udp/assoc.c
rb401b33 re28175d 40 40 #include <fibril_synch.h> 41 41 #include <inet/endpoint.h> 42 #include <inet/inet.h>43 42 #include <io/log.h> 44 43 #include <nettl/amap.h> … … 48 47 #include "msg.h" 49 48 #include "pdu.h" 50 #include "udp_inet.h"51 49 #include "udp_type.h" 52 50 … … 57 55 static udp_assoc_t *udp_assoc_find_ref(inet_ep2_t *); 58 56 static errno_t udp_assoc_queue_msg(udp_assoc_t *, inet_ep2_t *, udp_msg_t *); 57 static udp_assocs_dep_t *assocs_dep; 59 58 60 59 /** Initialize associations. */ 61 errno_t udp_assocs_init( void)60 errno_t udp_assocs_init(udp_assocs_dep_t *dep) 62 61 { 63 62 errno_t rc; … … 69 68 } 70 69 70 assocs_dep = dep; 71 71 return EOK; 72 } 73 74 /** Finalize associations. */ 75 void udp_assocs_fini(void) 76 { 77 assert(list_empty(&assoc_list)); 78 79 amap_destroy(amap); 80 amap = NULL; 72 81 } 73 82 … … 174 183 175 184 assert(assoc->deleted == false); 185 assoc->deleted = true; 176 186 udp_assoc_delref(assoc); 177 assoc->deleted = true;178 187 } 179 188 … … 244 253 errno_t udp_assoc_send(udp_assoc_t *assoc, inet_ep_t *remote, udp_msg_t *msg) 245 254 { 246 udp_pdu_t *pdu;247 255 inet_ep2_t epp; 248 256 errno_t rc; … … 266 274 if (inet_addr_is_any(&epp.local.addr) && !assoc->nolocal) { 267 275 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); 269 278 if (rc != EOK) { 270 279 log_msg(LOG_DEFAULT, LVL_DEBUG, "Cannot determine " … … 280 289 return EINVAL; 281 290 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 288 291 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); 292 293 293 294 if (rc != EOK) -
uspace/srv/net/udp/assoc.h
rb401b33 re28175d 40 40 #include "udp_type.h" 41 41 42 extern errno_t udp_assocs_init(void); 42 extern errno_t udp_assocs_init(udp_assocs_dep_t *); 43 extern void udp_assocs_fini(void); 43 44 extern udp_assoc_t *udp_assoc_new(inet_ep2_t *, udp_assoc_cb_t *, void *); 44 45 extern void udp_assoc_delete(udp_assoc_t *); -
uspace/srv/net/udp/meson.build
rb401b33 re28175d 27 27 # 28 28 29 USPACE_PREFIX = ../../.. 29 deps = [ 'nettl' ] 30 30 31 LIBS = nettl 31 _common_src = files( 32 'assoc.c', 33 'cassoc.c', 34 'msg.c', 35 'pdu.c', 36 ) 32 37 33 BINARY = udp 38 src = files( 39 'service.c', 40 'udp.c', 41 'udp_inet.c', 42 ) 34 43 35 SOURCES = \ 36 assoc.c \ 37 msg.c \ 38 pdu.c \ 39 service.c \ 40 udp.c \ 41 udp_inet.c 44 test_src = files( 45 'test/assoc.c', 46 'test/msg.c', 47 'test/main.c', 48 'test/pdu.c', 49 ) 42 50 43 include $(USPACE_PREFIX)/Makefile.common 51 src = [ _common_src, src ] 52 test_src = [ _common_src, test_src ] -
uspace/srv/net/udp/service.c
rb401b33 re28175d 46 46 47 47 #include "assoc.h" 48 #include "cassoc.h" 48 49 #include "msg.h" 49 50 #include "service.h" … … 55 56 #define MAX_MSG_SIZE DATA_XFER_LIMIT 56 57 57 static void udp_ cassoc_recv_msg(void *, inet_ep2_t *, udp_msg_t *);58 static void udp_recv_msg_cassoc(void *, inet_ep2_t *, udp_msg_t *); 58 59 59 60 /** Callbacks to tie us to association layer */ 60 61 static udp_assoc_cb_t udp_cassoc_cb = { 61 .recv_msg = udp_ cassoc_recv_msg62 .recv_msg = udp_recv_msg_cassoc 62 63 }; 63 64 /** Add message to client receive queue.65 *66 * @param cassoc Client association67 * @param epp Endpoint pair on which message was received68 * @param msg Message69 *70 * @return EOK on success, ENOMEM if out of memory71 */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 }92 64 93 65 /** Send 'data' event to client. … … 108 80 } 109 81 110 /** Create client association.111 *112 * This effectively adds an association into a client's namespace.113 *114 * @param client Client115 * @param assoc Association116 * @param rcassoc Place to store pointer to new client association117 *118 * @return EOK on soccess, ENOMEM if out of memory119 */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 association149 */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 Client159 * @param id Client association ID160 * @param rcassoc Place to store pointer to client association161 *162 * @return EOK on success, ENOENT if no client association with the given ID163 * 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 178 82 /** Message received on client association. 179 83 * … … 184 88 * @param msg Message 185 89 */ 186 static void udp_ cassoc_recv_msg(void *arg, inet_ep2_t *epp, udp_msg_t *msg)90 static void udp_recv_msg_cassoc(void *arg, inet_ep2_t *epp, udp_msg_t *msg) 187 91 { 188 92 udp_cassoc_t *cassoc = (udp_cassoc_t *) arg; -
uspace/srv/net/udp/test/main.c
rb401b33 re28175d 1 1 /* 2 * Copyright (c) 201 2 Petr Koupy2 * Copyright (c) 2019 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup draw 30 * @{ 31 */ 32 /** 33 * @file 34 */ 29 #include <pcut/pcut.h> 35 30 36 #ifndef DRAW_FONT_EMBEDDED_H_ 37 #define DRAW_FONT_EMBEDDED_H_ 31 PCUT_INIT; 38 32 39 #include "../font.h" 33 PCUT_IMPORT(assoc); 34 PCUT_IMPORT(msg); 35 PCUT_IMPORT(pdu); 40 36 41 extern errno_t embedded_font_create(font_t **, uint16_t points); 42 43 #endif 44 45 /** @} 46 */ 37 PCUT_MAIN(); -
uspace/srv/net/udp/udp.c
rb401b33 re28175d 47 47 #define NAME "udp" 48 48 49 static udp_assocs_dep_t udp_assocs_dep = { 50 .get_srcaddr = udp_get_srcaddr, 51 .transmit_msg = udp_transmit_msg 52 }; 53 49 54 static errno_t udp_init(void) 50 55 { … … 53 58 log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_init()"); 54 59 55 rc = udp_assocs_init( );60 rc = udp_assocs_init(&udp_assocs_dep); 56 61 if (rc != EOK) { 57 62 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed initializing associations."); -
uspace/srv/net/udp/udp_inet.c
rb401b33 re28175d 134 134 } 135 135 136 /** Get source address. 137 * 138 * @param remote Remote address 139 * @param tos Type of service 140 * @param local Place to store local address 141 * @return EOK on success or an error code 142 */ 143 errno_t udp_get_srcaddr(inet_addr_t *remote, uint8_t tos, inet_addr_t *local) 144 { 145 return inet_get_srcaddr(remote, tos, local); 146 } 147 148 /** Transmit message over network layer. */ 149 errno_t udp_transmit_msg(inet_ep2_t *epp, udp_msg_t *msg) 150 { 151 udp_pdu_t *pdu; 152 errno_t rc; 153 154 log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_transmit_msg()"); 155 156 rc = udp_pdu_encode(epp, msg, &pdu); 157 if (rc != EOK) { 158 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed encoding PDU"); 159 return rc; 160 } 161 162 rc = udp_transmit_pdu(pdu); 163 udp_pdu_delete(pdu); 164 165 return rc; 166 } 167 136 168 /** 137 169 * @} -
uspace/srv/net/udp/udp_inet.h
rb401b33 re28175d 36 36 #define UDP_INET_H 37 37 38 #include <inet/addr.h> 39 #include <stdint.h> 38 40 #include "udp_type.h" 39 41 40 42 extern errno_t udp_inet_init(void); 41 43 extern errno_t udp_transmit_pdu(udp_pdu_t *); 44 extern errno_t udp_get_srcaddr(inet_addr_t *, uint8_t, inet_addr_t *); 45 extern errno_t udp_transmit_msg(inet_ep2_t *, udp_msg_t *); 42 46 43 47 #endif -
uspace/srv/net/udp/udp_type.h
rb401b33 re28175d 37 37 38 38 #include <async.h> 39 #include <errno.h> 39 40 #include <fibril.h> 40 41 #include <fibril_synch.h> … … 44 45 #include <stdbool.h> 45 46 #include <stddef.h> 47 #include <stdint.h> 46 48 #include <inet/addr.h> 47 49 … … 87 89 } udp_pdu_t; 88 90 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 */ 96 typedef struct { 97 errno_t (*get_srcaddr)(inet_addr_t *, uint8_t, inet_addr_t *); 98 errno_t (*transmit_msg)(inet_ep2_t *, udp_msg_t *); 99 } udp_assocs_dep_t; 100 101 /** Association callbacks. 102 * 103 * Callbacks for a particular association, to notify caller of events 104 * on the association. 105 */ 90 106 typedef struct { 91 107 /** Message received */ -
uspace/srv/vfs/meson.build
rb401b33 re28175d 28 28 # 29 29 30 USPACE_PREFIX = ../.. 31 LIBS = clui 32 BINARY = kio 33 34 SOURCES = \ 35 kio.c 36 37 include $(USPACE_PREFIX)/Makefile.common 30 src = 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 27 27 # 28 28 29 USPACE_PREFIX = ../.. 29 deps = [ 'block', 'label', 'sif' ] 30 30 31 LIBRARY = libfdisk 31 src = files( 32 'empty.c', 33 'mkfs.c', 34 'part.c', 35 'volsrv.c', 36 'volume.c', 37 ) 32 38 33 SOURCES = \ 34 src/fdisk.c 35 36 include $(USPACE_PREFIX)/Makefile.common 39 test_src = files( 40 'volume.c', 41 'test/main.c', 42 'test/volume.c', 43 ) -
uspace/srv/volsrv/part.c
rb401b33 re28175d 129 129 130 130 if (!already_known) { 131 log_msg(LOG_DEFAULT, LVL_ NOTE, "Found partition '%lu'",131 log_msg(LOG_DEFAULT, LVL_DEBUG, "Found partition '%lu'", 132 132 (unsigned long) svcs[i]); 133 133 rc = vol_part_add_locked(parts, svcs[i]); … … 155 155 156 156 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", 158 158 part->svc_id); 159 159 vol_part_remove_locked(part); … … 210 210 errno_t rc; 211 211 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); 213 213 214 214 assert(fibril_mutex_is_locked(&part->parts->lock)); … … 223 223 224 224 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'", 226 226 fst->name, info.label); 227 227 label = str_dup(info.label); … … 317 317 if (str_size(part->volume->mountp) > 0) { 318 318 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'", 320 320 cfg_mp); 321 321 } else { 322 322 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'", 324 324 cfg_mp); 325 325 } … … 334 334 } 335 335 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); 337 337 err = asprintf(&mp, "/vol/%s", part->label); 338 338 if (err < 0) { … … 378 378 if (mp_auto) { 379 379 /* 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); 381 381 rc = vfs_link_path(mp, KIND_DIRECTORY, NULL); 382 382 if (rc != EOK) { … … 388 388 } 389 389 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'", 391 391 mp, fstype_str(part->fstype), part->svc_name); 392 392 rc = vfs_mount_path(mp, fstype_str(part->fstype), 393 393 part->svc_name, "", 0, 0); 394 394 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 } 398 401 399 402 part->cur_mp = mp; … … 409 412 410 413 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); 412 415 413 416 /* Check for duplicates */ … … 418 421 } 419 422 420 log_msg(LOG_DEFAULT, LVL_ NOTE, "partition %zu is new", sid);423 log_msg(LOG_DEFAULT, LVL_DEBUG, "partition %zu is new", sid); 421 424 422 425 part = vol_part_new(); … … 443 446 list_append(&part->lparts, &parts->parts); 444 447 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); 446 449 447 450 return EOK; … … 455 458 { 456 459 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)", 458 461 part->svc_id); 459 462 460 463 list_remove(&part->lparts); 461 464 462 log_msg(LOG_DEFAULT, LVL_ NOTE, "Removed partition.");465 log_msg(LOG_DEFAULT, LVL_DEBUG, "Removed partition."); 463 466 vol_part_del_ref(part); 464 467 } -
uspace/srv/volsrv/volsrv.c
rb401b33 re28175d 256 256 errno_t rc; 257 257 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()"); 259 259 260 260 rc = async_data_write_accept((void **)&path, true, 0, VOL_MOUNTP_MAXLEN, … … 360 360 errno_t rc; 361 361 362 log_msg(LOG_DEFAULT, LVL_ NOTE, "vol_part_mkfs_srv()");362 log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_mkfs_srv()"); 363 363 364 364 sid = ipc_get_arg1(icall); … … 373 373 374 374 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'", 376 376 label); 377 377 } … … 385 385 386 386 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'", 388 388 mountp); 389 389 } … … 422 422 errno_t rc; 423 423 424 log_msg(LOG_DEFAULT, LVL_ NOTE, "vol_part_set_mountp_srv()");424 log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_set_mountp_srv()"); 425 425 426 426 sid = ipc_get_arg1(icall); … … 434 434 435 435 if (mountp != NULL) { 436 log_msg(LOG_DEFAULT, LVL_ NOTE,436 log_msg(LOG_DEFAULT, LVL_DEBUG, 437 437 "vol_part_set_mountp_srv: mountp='%s'", mountp); 438 438 } … … 464 464 errno_t rc; 465 465 466 log_msg(LOG_DEFAULT, LVL_ NOTE, "vol_get_volumes_srv()");466 log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_get_volumes_srv()"); 467 467 468 468 if (!async_data_read_receive(&call, &size)) { -
uspace/srv/volsrv/volume.c
rb401b33 re28175d 96 96 static void vol_volume_delete(vol_volume_t *volume) 97 97 { 98 log_msg(LOG_DEFAULT, LVL_ NOTE, "Freeing volume %p", volume);98 log_msg(LOG_DEFAULT, LVL_DEBUG, "Freeing volume %p", volume); 99 99 100 100 free(volume->label); … … 219 219 { 220 220 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); 222 222 223 223 volume->volumes = volumes; … … 367 367 if (refcount_down(&volume->refcnt)) { 368 368 /* 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); 373 371 } 374 372 } … … 399 397 /* Volume is now persistent */ 400 398 if (volume->nvolume == NULL) { 399 /* Prevent volume from being freed */ 400 refcount_up(&volume->refcnt); 401 401 402 /* Create volume node */ 402 403 rc = sif_trans_begin(volume->volumes->repo, &trans); … … 426 427 volume->nvolume = nvolume; 427 428 } else { 429 /* Allow volume to be freed */ 430 vol_volume_del_ref(volume); 431 428 432 /* Update volume node */ 429 433 rc = sif_trans_begin(volume->volumes->repo, &trans);
Note:
See TracChangeset
for help on using the changeset viewer.