Changeset e89a06a in mainline
- Timestamp:
- 2018-07-06T22:13:20Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- be0f5e4
- Parents:
- 6419c6e
- Location:
- uspace
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/barber/barber.c
r6419c6e re89a06a 205 205 } 206 206 207 static void loc_callback(void )207 static void loc_callback(void *arg) 208 208 { 209 209 category_id_t led_cat; … … 255 255 256 256 list_initialize(&led_devs); 257 errno_t rc = loc_register_cat_change_cb(loc_callback );257 errno_t rc = loc_register_cat_change_cb(loc_callback, NULL); 258 258 if (rc != EOK) { 259 259 printf("Unable to register callback for device discovery.\n"); -
uspace/lib/c/generic/loc.c
r6419c6e re89a06a 48 48 static bool loc_callback_created = false; 49 49 static loc_cat_change_cb_t cat_change_cb = NULL; 50 static void *cat_change_arg = NULL; 50 51 51 52 static async_sess_t *loc_supp_block_sess = NULL; … … 70 71 fibril_mutex_lock(&loc_callback_mutex); 71 72 loc_cat_change_cb_t cb_fun = cat_change_cb; 73 void *cb_arg = cat_change_arg; 72 74 fibril_mutex_unlock(&loc_callback_mutex); 73 75 … … 75 77 76 78 if (cb_fun != NULL) 77 (*cb_fun)( );79 (*cb_fun)(cb_arg); 78 80 79 81 break; … … 859 861 } 860 862 861 errno_t loc_register_cat_change_cb(loc_cat_change_cb_t cb_fun )863 errno_t loc_register_cat_change_cb(loc_cat_change_cb_t cb_fun, void *cb_arg) 862 864 { 863 865 fibril_mutex_lock(&loc_callback_mutex); 866 if (cat_change_cb != NULL) { 867 fibril_mutex_unlock(&loc_callback_mutex); 868 return EEXIST; 869 } 870 864 871 if (loc_callback_create() != EOK) { 865 872 fibril_mutex_unlock(&loc_callback_mutex); … … 868 875 869 876 cat_change_cb = cb_fun; 877 cat_change_arg = cb_arg; 870 878 fibril_mutex_unlock(&loc_callback_mutex); 871 879 -
uspace/lib/c/include/loc.h
r6419c6e re89a06a 40 40 #include <stdbool.h> 41 41 42 typedef void (*loc_cat_change_cb_t)(void );42 typedef void (*loc_cat_change_cb_t)(void *); 43 43 44 44 extern async_exch_t *loc_exchange_begin_blocking(iface_t); … … 75 75 extern size_t loc_get_services(service_id_t, loc_sdesc_t **); 76 76 extern errno_t loc_get_categories(category_id_t **, size_t *); 77 extern errno_t loc_register_cat_change_cb(loc_cat_change_cb_t); 78 77 extern errno_t loc_register_cat_change_cb(loc_cat_change_cb_t, void *); 79 78 80 79 #endif -
uspace/lib/hound/include/hound/server.h
r6419c6e re89a06a 40 40 #include <loc.h> 41 41 42 typedef void (*dev_change_callback_t)(void );42 typedef void (*dev_change_callback_t)(void *); 43 43 typedef errno_t (*device_callback_t)(service_id_t, const char *); 44 44 45 45 errno_t hound_server_register(const char *name, service_id_t *id); 46 46 void hound_server_unregister(service_id_t id); 47 errno_t hound_server_set_device_change_callback(dev_change_callback_t cb); 47 errno_t hound_server_set_device_change_callback(dev_change_callback_t cb, 48 void *); 48 49 errno_t hound_server_devices_iterate(device_callback_t callback); 49 50 -
uspace/lib/hound/src/protocol.c
r6419c6e re89a06a 750 750 * @return Error code. 751 751 */ 752 errno_t hound_server_set_device_change_callback(dev_change_callback_t cb) 753 { 754 return loc_register_cat_change_cb(cb); 752 errno_t hound_server_set_device_change_callback(dev_change_callback_t cb, 753 void *arg) 754 { 755 return loc_register_cat_change_cb(cb, arg); 755 756 } 756 757 -
uspace/srv/audio/hound/main.c
r6419c6e re89a06a 62 62 } 63 63 64 static void scan_for_devices(void )64 static void scan_for_devices(void *arg) 65 65 { 66 66 hound_server_devices_iterate(device_callback); … … 94 94 } 95 95 96 ret = hound_server_set_device_change_callback(scan_for_devices );96 ret = hound_server_set_device_change_callback(scan_for_devices, NULL); 97 97 if (ret != EOK) { 98 98 log_fatal("Failed to register for device changes: %s", … … 103 103 log_info("Running with service id %" PRIun, id); 104 104 105 scan_for_devices( );105 scan_for_devices(NULL); 106 106 task_retval(0); 107 107 async_manager(); -
uspace/srv/bd/vbd/disk.c
r6419c6e re89a06a 447 447 } 448 448 449 static void vbds_disk_cat_change_cb(void )449 static void vbds_disk_cat_change_cb(void *arg) 450 450 { 451 451 (void) vbds_disks_check_new(); … … 456 456 errno_t rc; 457 457 458 rc = loc_register_cat_change_cb(vbds_disk_cat_change_cb );458 rc = loc_register_cat_change_cb(vbds_disk_cat_change_cb, NULL); 459 459 if (rc != EOK) { 460 460 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering callback " -
uspace/srv/hid/compositor/compositor.c
r6419c6e re89a06a 2262 2262 } 2263 2263 2264 static void category_change_cb(void )2264 static void category_change_cb(void *arg) 2265 2265 { 2266 2266 discover_viewports(); … … 2311 2311 } 2312 2312 2313 rc = loc_register_cat_change_cb(category_change_cb );2313 rc = loc_register_cat_change_cb(category_change_cb, NULL); 2314 2314 if (rc != EOK) { 2315 2315 printf("%s: Failed to register category change callback\n", NAME); -
uspace/srv/hid/input/input.c
r6419c6e re89a06a 818 818 } 819 819 820 static void cat_change_cb(void )820 static void cat_change_cb(void *arg) 821 821 { 822 822 dev_check_new(); … … 826 826 static errno_t input_start_dev_discovery(void) 827 827 { 828 errno_t rc = loc_register_cat_change_cb(cat_change_cb );828 errno_t rc = loc_register_cat_change_cb(cat_change_cb, NULL); 829 829 if (rc != EOK) { 830 830 printf("%s: Failed registering callback for device discovery: " -
uspace/srv/hid/output/port/chardev.c
r6419c6e re89a06a 155 155 * fibril blocked in chardev_init(). 156 156 */ 157 static void check_for_dev(void )157 static void check_for_dev(void *arg) 158 158 { 159 159 errno_t rc; … … 236 236 } 237 237 238 rc = loc_register_cat_change_cb(check_for_dev );238 rc = loc_register_cat_change_cb(check_for_dev, NULL); 239 239 if (rc != EOK) { 240 240 printf("%s: Failed to register callback for device discovery.\n", … … 243 243 } 244 244 245 check_for_dev( );245 check_for_dev(NULL); 246 246 247 247 fibril_mutex_lock(&discovery_lock); -
uspace/srv/net/ethip/ethip_nic.c
r6419c6e re89a06a 224 224 } 225 225 226 static void ethip_nic_cat_change_cb(void )226 static void ethip_nic_cat_change_cb(void *arg) 227 227 { 228 228 (void) ethip_nic_check_new(); … … 323 323 errno_t ethip_nic_discovery_start(void) 324 324 { 325 errno_t rc = loc_register_cat_change_cb(ethip_nic_cat_change_cb );325 errno_t rc = loc_register_cat_change_cb(ethip_nic_cat_change_cb, NULL); 326 326 if (rc != EOK) { 327 327 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering callback for NIC " -
uspace/srv/net/nconfsrv/iplink.c
r6419c6e re89a06a 170 170 } 171 171 172 static void ncs_link_cat_change_cb(void )172 static void ncs_link_cat_change_cb(void *arg) 173 173 { 174 174 (void) ncs_link_check_new(); … … 179 179 errno_t rc; 180 180 181 rc = loc_register_cat_change_cb(ncs_link_cat_change_cb );181 rc = loc_register_cat_change_cb(ncs_link_cat_change_cb, NULL); 182 182 if (rc != EOK) { 183 183 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering callback for IP link " -
uspace/srv/volsrv/part.c
r6419c6e re89a06a 35 35 */ 36 36 37 #include < stdbool.h>37 #include <adt/list.h> 38 38 #include <errno.h> 39 #include <str_error.h>40 39 #include <fibril_synch.h> 41 40 #include <io/log.h> 42 41 #include <loc.h> 42 #include <stdbool.h> 43 43 #include <stdlib.h> 44 44 #include <str.h> 45 #include <str_error.h> 45 46 #include <vfs/vfs.h> 46 47 … … 50 51 #include "types/part.h" 51 52 52 static errno_t vol_part_add_locked( service_id_t);53 static errno_t vol_part_add_locked(vol_parts_t *, service_id_t); 53 54 static void vol_part_remove_locked(vol_part_t *); 54 static errno_t vol_part_find_by_id_ref_locked(service_id_t, vol_part_t **); 55 56 static LIST_INITIALIZE(vol_parts); /* of vol_part_t */ 57 static FIBRIL_MUTEX_INITIALIZE(vol_parts_lock); 55 static errno_t vol_part_find_by_id_ref_locked(vol_parts_t *, service_id_t, 56 vol_part_t **); 58 57 59 58 struct fsname_type { … … 87 86 88 87 /** Check for new and removed partitions */ 89 static errno_t vol_part_check_new(vo id)88 static errno_t vol_part_check_new(vol_parts_t *parts) 90 89 { 91 90 bool already_known; … … 98 97 errno_t rc; 99 98 100 fibril_mutex_lock(& vol_parts_lock);99 fibril_mutex_lock(&parts->lock); 101 100 102 101 rc = loc_category_get_id("partition", &part_cat, IPC_FLAG_BLOCKING); 103 102 if (rc != EOK) { 104 103 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed resolving category 'partition'."); 105 fibril_mutex_unlock(& vol_parts_lock);104 fibril_mutex_unlock(&parts->lock); 106 105 return ENOENT; 107 106 } … … 111 110 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed getting list of partition " 112 111 "devices."); 113 fibril_mutex_unlock(& vol_parts_lock);112 fibril_mutex_unlock(&parts->lock); 114 113 return EIO; 115 114 } … … 120 119 121 120 // XXX Make this faster 122 list_foreach( vol_parts, lparts, vol_part_t, part) {121 list_foreach(parts->parts, lparts, vol_part_t, part) { 123 122 if (part->svc_id == svcs[i]) { 124 123 already_known = true; … … 130 129 log_msg(LOG_DEFAULT, LVL_NOTE, "Found partition '%lu'", 131 130 (unsigned long) svcs[i]); 132 rc = vol_part_add_locked( svcs[i]);131 rc = vol_part_add_locked(parts, svcs[i]); 133 132 if (rc != EOK) { 134 133 log_msg(LOG_DEFAULT, LVL_ERROR, "Could not add " … … 139 138 140 139 /* Check for removed partitions */ 141 cur = list_first(& vol_parts);140 cur = list_first(&parts->parts); 142 141 while (cur != NULL) { 143 next = list_next(cur, & vol_parts);142 next = list_next(cur, &parts->parts); 144 143 part = list_get_instance(cur, vol_part_t, lparts); 145 144 … … 164 163 free(svcs); 165 164 166 fibril_mutex_unlock(& vol_parts_lock);165 fibril_mutex_unlock(&parts->lock); 167 166 return EOK; 168 167 } … … 180 179 atomic_set(&part->refcnt, 1); 181 180 link_initialize(&part->lparts); 181 part->parts = NULL; 182 182 part->pcnt = vpc_empty; 183 183 … … 206 206 log_msg(LOG_DEFAULT, LVL_NOTE, "Probe partition %s", part->svc_name); 207 207 208 assert(fibril_mutex_is_locked(& vol_parts_lock));208 assert(fibril_mutex_is_locked(&part->parts->lock)); 209 209 210 210 fst = &fstab[0]; … … 324 324 } 325 325 326 static errno_t vol_part_add_locked( service_id_t sid)326 static errno_t vol_part_add_locked(vol_parts_t *parts, service_id_t sid) 327 327 { 328 328 vol_part_t *part; 329 329 errno_t rc; 330 330 331 assert(fibril_mutex_is_locked(& vol_parts_lock));331 assert(fibril_mutex_is_locked(&parts->lock)); 332 332 log_msg(LOG_DEFAULT, LVL_NOTE, "vol_part_add_locked(%zu)", sid); 333 333 334 334 /* Check for duplicates */ 335 rc = vol_part_find_by_id_ref_locked( sid, &part);335 rc = vol_part_find_by_id_ref_locked(parts, sid, &part); 336 336 if (rc == EOK) { 337 337 vol_part_del_ref(part); … … 346 346 347 347 part->svc_id = sid; 348 part->parts = parts; 348 349 349 350 rc = loc_service_get_name(sid, &part->svc_name); … … 361 362 goto error; 362 363 363 list_append(&part->lparts, & vol_parts);364 list_append(&part->lparts, &parts->parts); 364 365 365 366 log_msg(LOG_DEFAULT, LVL_NOTE, "Added partition %zu", part->svc_id); … … 374 375 static void vol_part_remove_locked(vol_part_t *part) 375 376 { 376 assert(fibril_mutex_is_locked(&vol_parts_lock)); 377 log_msg(LOG_DEFAULT, LVL_NOTE, "vol_part_remove_locked(%zu)", part->svc_id); 377 assert(fibril_mutex_is_locked(&part->parts->lock)); 378 log_msg(LOG_DEFAULT, LVL_NOTE, "vol_part_remove_locked(%zu)", 379 part->svc_id); 378 380 379 381 list_remove(&part->lparts); … … 383 385 } 384 386 385 errno_t vol_part_add( service_id_t sid)386 { 387 errno_t rc; 388 389 fibril_mutex_lock(& vol_parts_lock);390 rc = vol_part_add_locked( sid);391 fibril_mutex_unlock(& vol_parts_lock);387 errno_t vol_part_add(vol_parts_t *parts, service_id_t sid) 388 { 389 errno_t rc; 390 391 fibril_mutex_lock(&parts->lock); 392 rc = vol_part_add_locked(parts, sid); 393 fibril_mutex_unlock(&parts->lock); 392 394 393 395 return rc; 394 396 } 395 397 396 static void vol_part_cat_change_cb(void) 397 { 398 (void) vol_part_check_new(); 399 } 400 401 errno_t vol_part_init(void) 402 { 403 return EOK; 404 } 405 406 errno_t vol_part_discovery_start(void) 407 { 408 errno_t rc; 409 410 rc = loc_register_cat_change_cb(vol_part_cat_change_cb); 398 static void vol_part_cat_change_cb(void *arg) 399 { 400 vol_parts_t *parts = (vol_parts_t *) arg; 401 402 (void) vol_part_check_new(parts); 403 } 404 405 errno_t vol_parts_create(vol_parts_t **rparts) 406 { 407 vol_parts_t *parts; 408 409 parts = calloc(1, sizeof(vol_parts_t)); 410 if (parts == NULL) 411 return ENOMEM; 412 413 fibril_mutex_initialize(&parts->lock); 414 list_initialize(&parts->parts); 415 416 *rparts = parts; 417 return EOK; 418 } 419 420 void vol_parts_destroy(vol_parts_t *parts) 421 { 422 if (parts == NULL) 423 return; 424 425 assert(list_empty(&parts->parts)); 426 free(parts); 427 } 428 429 errno_t vol_part_discovery_start(vol_parts_t *parts) 430 { 431 errno_t rc; 432 433 rc = loc_register_cat_change_cb(vol_part_cat_change_cb, parts); 411 434 if (rc != EOK) { 412 435 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering callback " … … 415 438 } 416 439 417 return vol_part_check_new( );440 return vol_part_check_new(parts); 418 441 } 419 442 420 443 /** Get list of partitions as array of service IDs. */ 421 errno_t vol_part_get_ids(service_id_t *id_buf, size_t buf_size, size_t *act_size) 444 errno_t vol_part_get_ids(vol_parts_t *parts, service_id_t *id_buf, 445 size_t buf_size, size_t *act_size) 422 446 { 423 447 size_t act_cnt; 424 448 size_t buf_cnt; 425 449 426 fibril_mutex_lock(& vol_parts_lock);450 fibril_mutex_lock(&parts->lock); 427 451 428 452 buf_cnt = buf_size / sizeof(service_id_t); 429 453 430 act_cnt = list_count(& vol_parts);454 act_cnt = list_count(&parts->parts); 431 455 *act_size = act_cnt * sizeof(service_id_t); 432 456 433 457 if (buf_size % sizeof(service_id_t) != 0) { 434 fibril_mutex_unlock(& vol_parts_lock);458 fibril_mutex_unlock(&parts->lock); 435 459 return EINVAL; 436 460 } 437 461 438 462 size_t pos = 0; 439 list_foreach( vol_parts, lparts, vol_part_t, part) {463 list_foreach(parts->parts, lparts, vol_part_t, part) { 440 464 if (pos < buf_cnt) 441 465 id_buf[pos] = part->svc_id; … … 443 467 } 444 468 445 fibril_mutex_unlock(& vol_parts_lock);446 return EOK; 447 } 448 449 static errno_t vol_part_find_by_id_ref_locked( service_id_t sid,450 vol_part_t **rpart)451 { 452 assert(fibril_mutex_is_locked(& vol_parts_lock));453 454 list_foreach( vol_parts, lparts, vol_part_t, part) {469 fibril_mutex_unlock(&parts->lock); 470 return EOK; 471 } 472 473 static errno_t vol_part_find_by_id_ref_locked(vol_parts_t *parts, 474 service_id_t sid, vol_part_t **rpart) 475 { 476 assert(fibril_mutex_is_locked(&parts->lock)); 477 478 list_foreach(parts->parts, lparts, vol_part_t, part) { 455 479 if (part->svc_id == sid) { 456 480 /* Add reference */ … … 464 488 } 465 489 466 errno_t vol_part_find_by_id_ref(service_id_t sid, vol_part_t **rpart) 467 { 468 errno_t rc; 469 470 fibril_mutex_lock(&vol_parts_lock); 471 rc = vol_part_find_by_id_ref_locked(sid, rpart); 472 fibril_mutex_unlock(&vol_parts_lock); 490 errno_t vol_part_find_by_id_ref(vol_parts_t *parts, service_id_t sid, 491 vol_part_t **rpart) 492 { 493 errno_t rc; 494 495 fibril_mutex_lock(&parts->lock); 496 rc = vol_part_find_by_id_ref_locked(parts, sid, rpart); 497 fibril_mutex_unlock(&parts->lock); 473 498 474 499 return rc; … … 539 564 log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_mkfs_part()"); 540 565 541 fibril_mutex_lock(& vol_parts_lock);566 fibril_mutex_lock(&part->parts->lock); 542 567 543 568 rc = volsrv_part_mkfs(part->svc_id, fstype, label); … … 545 570 log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_mkfs_part() - failed %s", 546 571 str_error(rc)); 547 fibril_mutex_unlock(& vol_parts_lock);572 fibril_mutex_unlock(&part->parts->lock); 548 573 return rc; 549 574 } … … 556 581 rc = vol_part_probe(part); 557 582 if (rc != EOK) { 558 fibril_mutex_unlock(& vol_parts_lock);583 fibril_mutex_unlock(&part->parts->lock); 559 584 return rc; 560 585 } … … 562 587 rc = vol_part_mount(part); 563 588 if (rc != EOK) { 564 fibril_mutex_unlock(& vol_parts_lock);589 fibril_mutex_unlock(&part->parts->lock); 565 590 return rc; 566 591 } 567 592 568 fibril_mutex_unlock(& vol_parts_lock);593 fibril_mutex_unlock(&part->parts->lock); 569 594 return EOK; 570 595 } -
uspace/srv/volsrv/part.h
r6419c6e re89a06a 43 43 #include "types/part.h" 44 44 45 extern errno_t vol_part_init(void); 46 extern errno_t vol_part_discovery_start(void); 47 extern errno_t vol_part_add(service_id_t); 48 extern errno_t vol_part_get_ids(service_id_t *, size_t, size_t *); 49 extern errno_t vol_part_find_by_id_ref(service_id_t, vol_part_t **); 45 extern errno_t vol_parts_create(vol_parts_t **); 46 extern void vol_parts_destroy(vol_parts_t *); 47 extern errno_t vol_part_discovery_start(vol_parts_t *); 48 extern errno_t vol_part_add(vol_parts_t *, service_id_t); 49 extern errno_t vol_part_get_ids(vol_parts_t *, service_id_t *, size_t, 50 size_t *); 51 extern errno_t vol_part_find_by_id_ref(vol_parts_t *, service_id_t, 52 vol_part_t **); 50 53 extern void vol_part_del_ref(vol_part_t *); 51 54 extern errno_t vol_part_eject_part(vol_part_t *); -
uspace/srv/volsrv/types/part.h
r6419c6e re89a06a 40 40 #include <adt/list.h> 41 41 #include <atomic.h> 42 #include <fibril_synch.h> 42 43 #include <stdbool.h> 43 44 #include <types/label.h> … … 45 46 /** Partition */ 46 47 typedef struct { 48 /** Containing partition list */ 49 struct vol_parts *parts; 47 50 /** Link to vol_parts */ 48 51 link_t lparts; … … 65 68 } vol_part_t; 66 69 70 /** Partitions */ 71 typedef struct vol_parts { 72 /** Synchronize access to list of partitions */ 73 fibril_mutex_t lock; 74 /** Partitions (list of vol_part_t) */ 75 list_t parts; 76 } vol_parts_t; 77 67 78 #endif 68 79 -
uspace/srv/volsrv/volsrv.c
r6419c6e re89a06a 57 57 { 58 58 errno_t rc; 59 vol_parts_t *parts = NULL; 60 59 61 log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_init()"); 60 62 61 rc = vol_part _init();63 rc = vol_parts_create(&parts); 62 64 if (rc != EOK) 63 return rc;64 65 rc = vol_part_discovery_start( );65 goto error; 66 67 rc = vol_part_discovery_start(parts); 66 68 if (rc != EOK) 67 return rc;68 69 async_set_fallback_port_handler(vol_client_conn, NULL);69 goto error; 70 71 async_set_fallback_port_handler(vol_client_conn, parts); 70 72 71 73 rc = loc_server_register(NAME); 72 74 if (rc != EOK) { 73 75 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering server: %s.", str_error(rc)); 74 r eturnEEXIST;76 rc = EEXIST; 75 77 } 76 78 … … 79 81 if (rc != EOK) { 80 82 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering service: %s.", str_error(rc)); 81 return EEXIST; 83 rc = EEXIST; 84 goto error; 82 85 } 83 86 84 87 return EOK; 85 } 86 87 static void vol_get_parts_srv(ipc_call_t *icall) 88 error: 89 vol_parts_destroy(parts); 90 return rc; 91 } 92 93 static void vol_get_parts_srv(vol_parts_t *parts, ipc_call_t *icall) 88 94 { 89 95 ipc_call_t call; … … 105 111 } 106 112 107 rc = vol_part_get_ids( id_buf, size, &act_size);113 rc = vol_part_get_ids(parts, id_buf, size, &act_size); 108 114 if (rc != EOK) { 109 115 async_answer_0(&call, rc); … … 118 124 } 119 125 120 static void vol_part_add_srv( ipc_call_t *icall)121 { 122 service_id_t sid; 123 errno_t rc; 124 125 sid = IPC_GET_ARG1(*icall); 126 127 rc = vol_part_add( sid);128 if (rc != EOK) { 129 async_answer_0(icall, rc); 130 return; 131 } 132 133 async_answer_0(icall, EOK); 134 } 135 136 static void vol_part_info_srv( ipc_call_t *icall)126 static void vol_part_add_srv(vol_parts_t *parts, ipc_call_t *icall) 127 { 128 service_id_t sid; 129 errno_t rc; 130 131 sid = IPC_GET_ARG1(*icall); 132 133 rc = vol_part_add(parts, sid); 134 if (rc != EOK) { 135 async_answer_0(icall, rc); 136 return; 137 } 138 139 async_answer_0(icall, EOK); 140 } 141 142 static void vol_part_info_srv(vol_parts_t *parts, ipc_call_t *icall) 137 143 { 138 144 service_id_t sid; … … 144 150 log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_info_srv(%zu)", 145 151 sid); 146 rc = vol_part_find_by_id_ref( sid, &part);152 rc = vol_part_find_by_id_ref(parts, sid, &part); 147 153 if (rc != EOK) { 148 154 async_answer_0(icall, ENOENT); … … 183 189 } 184 190 185 static void vol_part_eject_srv( ipc_call_t *icall)191 static void vol_part_eject_srv(vol_parts_t *parts, ipc_call_t *icall) 186 192 { 187 193 service_id_t sid; … … 192 198 log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_eject_srv(%zu)", sid); 193 199 194 rc = vol_part_find_by_id_ref( sid, &part);200 rc = vol_part_find_by_id_ref(parts, sid, &part); 195 201 if (rc != EOK) { 196 202 async_answer_0(icall, ENOENT); … … 209 215 } 210 216 211 static void vol_part_empty_srv( ipc_call_t *icall)217 static void vol_part_empty_srv(vol_parts_t *parts, ipc_call_t *icall) 212 218 { 213 219 service_id_t sid; … … 218 224 log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_empty_srv(%zu)", sid); 219 225 220 rc = vol_part_find_by_id_ref( sid, &part);226 rc = vol_part_find_by_id_ref(parts, sid, &part); 221 227 if (rc != EOK) { 222 228 async_answer_0(icall, ENOENT); … … 235 241 } 236 242 237 static void vol_part_get_lsupp_srv( ipc_call_t *icall)243 static void vol_part_get_lsupp_srv(vol_parts_t *parts, ipc_call_t *icall) 238 244 { 239 245 vol_fstype_t fstype; … … 273 279 274 280 275 static void vol_part_mkfs_srv( ipc_call_t *icall)281 static void vol_part_mkfs_srv(vol_parts_t *parts, ipc_call_t *icall) 276 282 { 277 283 service_id_t sid; … … 298 304 } 299 305 300 rc = vol_part_find_by_id_ref( sid, &part);306 rc = vol_part_find_by_id_ref(parts, sid, &part); 301 307 if (rc != EOK) { 302 308 free(label); … … 319 325 static void vol_client_conn(ipc_call_t *icall, void *arg) 320 326 { 327 vol_parts_t *parts = (vol_parts_t *) arg; 328 321 329 log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_client_conn()"); 322 330 … … 337 345 switch (method) { 338 346 case VOL_GET_PARTS: 339 vol_get_parts_srv( &call);347 vol_get_parts_srv(parts, &call); 340 348 break; 341 349 case VOL_PART_ADD: 342 vol_part_add_srv( &call);350 vol_part_add_srv(parts, &call); 343 351 break; 344 352 case VOL_PART_INFO: 345 vol_part_info_srv( &call);353 vol_part_info_srv(parts, &call); 346 354 break; 347 355 case VOL_PART_EJECT: 348 vol_part_eject_srv( &call);356 vol_part_eject_srv(parts, &call); 349 357 break; 350 358 case VOL_PART_EMPTY: 351 vol_part_empty_srv( &call);359 vol_part_empty_srv(parts, &call); 352 360 break; 353 361 case VOL_PART_LSUPP: 354 vol_part_get_lsupp_srv( &call);362 vol_part_get_lsupp_srv(parts, &call); 355 363 break; 356 364 case VOL_PART_MKFS: 357 vol_part_mkfs_srv( &call);365 vol_part_mkfs_srv(parts, &call); 358 366 break; 359 367 default:
Note:
See TracChangeset
for help on using the changeset viewer.