Changes in uspace/srv/bd/vbd/disk.c [d5c1051:b7fd2a0] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/bd/vbd/disk.c
rd5c1051 rb7fd2a0 58 58 static category_id_t part_cid; 59 59 60 static int vbds_disk_parts_add(vbds_disk_t *, label_t *);61 static int vbds_disk_parts_remove(vbds_disk_t *, vbds_rem_flag_t);62 63 static int vbds_bd_open(bd_srvs_t *, bd_srv_t *);64 static int vbds_bd_close(bd_srv_t *);65 static int vbds_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t);66 static int vbds_bd_sync_cache(bd_srv_t *, aoff64_t, size_t);67 static int vbds_bd_write_blocks(bd_srv_t *, aoff64_t, size_t, const void *,60 static errno_t vbds_disk_parts_add(vbds_disk_t *, label_t *); 61 static errno_t vbds_disk_parts_remove(vbds_disk_t *, vbds_rem_flag_t); 62 63 static errno_t vbds_bd_open(bd_srvs_t *, bd_srv_t *); 64 static errno_t vbds_bd_close(bd_srv_t *); 65 static errno_t vbds_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t); 66 static errno_t vbds_bd_sync_cache(bd_srv_t *, aoff64_t, size_t); 67 static errno_t vbds_bd_write_blocks(bd_srv_t *, aoff64_t, size_t, const void *, 68 68 size_t); 69 static int vbds_bd_get_block_size(bd_srv_t *, size_t *);70 static int vbds_bd_get_num_blocks(bd_srv_t *, aoff64_t *);71 72 static int vbds_bsa_translate(vbds_part_t *, aoff64_t, size_t, aoff64_t *);73 74 static int vbds_part_svc_register(vbds_part_t *);75 static int vbds_part_svc_unregister(vbds_part_t *);76 static int vbds_part_indices_update(vbds_disk_t *);69 static errno_t vbds_bd_get_block_size(bd_srv_t *, size_t *); 70 static errno_t vbds_bd_get_num_blocks(bd_srv_t *, aoff64_t *); 71 72 static errno_t vbds_bsa_translate(vbds_part_t *, aoff64_t, size_t, aoff64_t *); 73 74 static errno_t vbds_part_svc_register(vbds_part_t *); 75 static errno_t vbds_part_svc_unregister(vbds_part_t *); 76 static errno_t vbds_part_indices_update(vbds_disk_t *); 77 77 78 78 static vbd_part_id_t vbds_part_id = 1; 79 79 80 static int vbds_label_get_bsize(void *, size_t *);81 static int vbds_label_get_nblocks(void *, aoff64_t *);82 static int vbds_label_read(void *, aoff64_t, size_t, void *);83 static int vbds_label_write(void *, aoff64_t, size_t, const void *);80 static errno_t vbds_label_get_bsize(void *, size_t *); 81 static errno_t vbds_label_get_nblocks(void *, aoff64_t *); 82 static errno_t vbds_label_read(void *, aoff64_t, size_t, void *); 83 static errno_t vbds_label_write(void *, aoff64_t, size_t, const void *); 84 84 85 85 /** Block device operations provided by VBD */ … … 132 132 } 133 133 134 int vbds_disks_init(void)135 { 136 int rc;134 errno_t vbds_disks_init(void) 135 { 136 errno_t rc; 137 137 138 138 fibril_mutex_initialize(&vbds_disks_lock); … … 152 152 153 153 /** Check for new/removed disk devices */ 154 static int vbds_disks_check_new(void)154 static errno_t vbds_disks_check_new(void) 155 155 { 156 156 bool already_known; … … 159 159 size_t count, i; 160 160 vbds_disk_t *cur, *next; 161 int rc;161 errno_t rc; 162 162 163 163 log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_disks_check_new()"); … … 229 229 230 230 231 static int vbds_disk_by_svcid(service_id_t sid, vbds_disk_t **rdisk)231 static errno_t vbds_disk_by_svcid(service_id_t sid, vbds_disk_t **rdisk) 232 232 { 233 233 list_foreach(vbds_disks, ldisks, vbds_disk_t, disk) { … … 256 256 } 257 257 258 static int vbds_part_by_pid(vbds_part_id_t partid, vbds_part_t **rpart)258 static errno_t vbds_part_by_pid(vbds_part_id_t partid, vbds_part_t **rpart) 259 259 { 260 260 log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_part_by_pid(%zu)", partid); … … 278 278 } 279 279 280 static int vbds_part_by_svcid(service_id_t svcid, vbds_part_t **rpart)280 static errno_t vbds_part_by_svcid(service_id_t svcid, vbds_part_t **rpart) 281 281 { 282 282 log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_part_by_svcid(%zu)", svcid); … … 301 301 302 302 /** Add partition to our inventory based on liblabel partition structure */ 303 static int vbds_part_add(vbds_disk_t *disk, label_part_t *lpart,303 static errno_t vbds_part_add(vbds_disk_t *disk, label_part_t *lpart, 304 304 vbds_part_t **rpart) 305 305 { … … 307 307 service_id_t psid = 0; 308 308 label_part_info_t lpinfo; 309 int rc;309 errno_t rc; 310 310 311 311 log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_part_add(%s, %p)", … … 362 362 * 363 363 */ 364 static int vbds_part_remove(vbds_part_t *part, vbds_rem_flag_t flag,364 static errno_t vbds_part_remove(vbds_part_t *part, vbds_rem_flag_t flag, 365 365 label_part_t **rlpart) 366 366 { 367 367 label_part_t *lpart; 368 int rc;368 errno_t rc; 369 369 370 370 log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_part_remove(%p)", part); … … 404 404 /** Remove all disk partitions from our inventory leaving only the underlying 405 405 * liblabel partition structures. */ 406 static int vbds_disk_parts_add(vbds_disk_t *disk, label_t *label)406 static errno_t vbds_disk_parts_add(vbds_disk_t *disk, label_t *label) 407 407 { 408 408 label_part_t *part; 409 int rc;409 errno_t rc; 410 410 411 411 part = label_part_first(label); … … 426 426 /** Remove all disk partitions from our inventory leaving only the underlying 427 427 * liblabel partition structures. */ 428 static int vbds_disk_parts_remove(vbds_disk_t *disk, vbds_rem_flag_t flag)428 static errno_t vbds_disk_parts_remove(vbds_disk_t *disk, vbds_rem_flag_t flag) 429 429 { 430 430 link_t *link; 431 431 vbds_part_t *part; 432 int rc;432 errno_t rc; 433 433 434 434 link = list_first(&disk->parts); … … 450 450 } 451 451 452 int vbds_disk_discovery_start(void)453 { 454 int rc;452 errno_t vbds_disk_discovery_start(void) 453 { 454 errno_t rc; 455 455 456 456 rc = loc_register_cat_change_cb(vbds_disk_cat_change_cb); … … 464 464 } 465 465 466 int vbds_disk_add(service_id_t sid)466 errno_t vbds_disk_add(service_id_t sid) 467 467 { 468 468 label_t *label = NULL; … … 472 472 size_t block_size; 473 473 aoff64_t nblocks; 474 int rc;474 errno_t rc; 475 475 476 476 log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_disk_add(%zu)", sid); … … 557 557 } 558 558 559 int vbds_disk_remove(service_id_t sid)559 errno_t vbds_disk_remove(service_id_t sid) 560 560 { 561 561 vbds_disk_t *disk; 562 int rc;562 errno_t rc; 563 563 564 564 log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_disk_remove(%zu)", sid); … … 583 583 584 584 /** Get list of disks as array of service IDs. */ 585 int vbds_disk_get_ids(service_id_t *id_buf, size_t buf_size, size_t *act_size)585 errno_t vbds_disk_get_ids(service_id_t *id_buf, size_t buf_size, size_t *act_size) 586 586 { 587 587 size_t act_cnt; … … 611 611 } 612 612 613 int vbds_disk_info(service_id_t sid, vbd_disk_info_t *info)613 errno_t vbds_disk_info(service_id_t sid, vbd_disk_info_t *info) 614 614 { 615 615 vbds_disk_t *disk; 616 616 label_info_t linfo; 617 int rc;617 errno_t rc; 618 618 619 619 log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_disk_info(%zu)", sid); … … 638 638 } 639 639 640 int vbds_get_parts(service_id_t sid, service_id_t *id_buf, size_t buf_size,640 errno_t vbds_get_parts(service_id_t sid, service_id_t *id_buf, size_t buf_size, 641 641 size_t *act_size) 642 642 { … … 644 644 size_t act_cnt; 645 645 size_t buf_cnt; 646 int rc;646 errno_t rc; 647 647 648 648 rc = vbds_disk_by_svcid(sid, &disk); … … 668 668 } 669 669 670 int vbds_label_create(service_id_t sid, label_type_t ltype)670 errno_t vbds_label_create(service_id_t sid, label_type_t ltype) 671 671 { 672 672 label_t *label; … … 674 674 label_info_t linfo; 675 675 vbds_disk_t *disk; 676 int rc, rc2;676 errno_t rc, rc2; 677 677 678 678 log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_label_create(%zu)", sid); … … 739 739 } 740 740 741 int vbds_label_delete(service_id_t sid)741 errno_t vbds_label_delete(service_id_t sid) 742 742 { 743 743 vbds_disk_t *disk; 744 744 label_t *label; 745 745 label_bd_t lbd; 746 int rc;746 errno_t rc; 747 747 748 748 log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_label_delete(%zu)", sid); … … 781 781 } 782 782 783 int vbds_part_get_info(vbds_part_id_t partid, vbd_part_info_t *pinfo)783 errno_t vbds_part_get_info(vbds_part_id_t partid, vbd_part_info_t *pinfo) 784 784 { 785 785 vbds_part_t *part; 786 786 label_part_info_t lpinfo; 787 int rc;787 errno_t rc; 788 788 789 789 rc = vbds_part_by_pid(partid, &part); … … 810 810 } 811 811 812 int vbds_part_create(service_id_t sid, vbd_part_spec_t *pspec,812 errno_t vbds_part_create(service_id_t sid, vbd_part_spec_t *pspec, 813 813 vbds_part_id_t *rpart) 814 814 { … … 817 817 label_part_spec_t lpspec; 818 818 label_part_t *lpart; 819 int rc;819 errno_t rc; 820 820 821 821 log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_part_create(%zu)", sid); … … 879 879 } 880 880 881 int vbds_part_delete(vbds_part_id_t partid)881 errno_t vbds_part_delete(vbds_part_id_t partid) 882 882 { 883 883 vbds_part_t *part; 884 884 vbds_disk_t *disk; 885 885 label_part_t *lpart; 886 int rc;886 errno_t rc; 887 887 888 888 rc = vbds_part_by_pid(partid, &part); … … 918 918 } 919 919 920 int vbds_suggest_ptype(service_id_t sid, label_pcnt_t pcnt,920 errno_t vbds_suggest_ptype(service_id_t sid, label_pcnt_t pcnt, 921 921 label_ptype_t *ptype) 922 922 { 923 923 vbds_disk_t *disk; 924 int rc;924 errno_t rc; 925 925 926 926 rc = vbds_disk_by_svcid(sid, &disk); … … 942 942 } 943 943 944 static int vbds_bd_open(bd_srvs_t *bds, bd_srv_t *bd)944 static errno_t vbds_bd_open(bd_srvs_t *bds, bd_srv_t *bd) 945 945 { 946 946 vbds_part_t *part = bd_srv_part(bd); … … 953 953 } 954 954 955 static int vbds_bd_close(bd_srv_t *bd)955 static errno_t vbds_bd_close(bd_srv_t *bd) 956 956 { 957 957 vbds_part_t *part = bd_srv_part(bd); … … 967 967 } 968 968 969 static int vbds_bd_read_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt,969 static errno_t vbds_bd_read_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt, 970 970 void *buf, size_t size) 971 971 { 972 972 vbds_part_t *part = bd_srv_part(bd); 973 973 aoff64_t gba; 974 int rc;974 errno_t rc; 975 975 976 976 log_msg(LOG_DEFAULT, LVL_DEBUG2, "vbds_bd_read_blocks()"); … … 993 993 } 994 994 995 static int vbds_bd_sync_cache(bd_srv_t *bd, aoff64_t ba, size_t cnt)995 static errno_t vbds_bd_sync_cache(bd_srv_t *bd, aoff64_t ba, size_t cnt) 996 996 { 997 997 vbds_part_t *part = bd_srv_part(bd); 998 998 aoff64_t gba; 999 int rc;999 errno_t rc; 1000 1000 1001 1001 log_msg(LOG_DEFAULT, LVL_DEBUG2, "vbds_bd_sync_cache()"); … … 1017 1017 } 1018 1018 1019 static int vbds_bd_write_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt,1019 static errno_t vbds_bd_write_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt, 1020 1020 const void *buf, size_t size) 1021 1021 { 1022 1022 vbds_part_t *part = bd_srv_part(bd); 1023 1023 aoff64_t gba; 1024 int rc;1024 errno_t rc; 1025 1025 1026 1026 log_msg(LOG_DEFAULT, LVL_DEBUG2, "vbds_bd_write_blocks()"); … … 1042 1042 } 1043 1043 1044 static int vbds_bd_get_block_size(bd_srv_t *bd, size_t *rsize)1044 static errno_t vbds_bd_get_block_size(bd_srv_t *bd, size_t *rsize) 1045 1045 { 1046 1046 vbds_part_t *part = bd_srv_part(bd); … … 1055 1055 } 1056 1056 1057 static int vbds_bd_get_num_blocks(bd_srv_t *bd, aoff64_t *rnb)1057 static errno_t vbds_bd_get_num_blocks(bd_srv_t *bd, aoff64_t *rnb) 1058 1058 { 1059 1059 vbds_part_t *part = bd_srv_part(bd); … … 1071 1071 { 1072 1072 vbds_part_t *part; 1073 int rc;1073 errno_t rc; 1074 1074 service_id_t svcid; 1075 1075 … … 1094 1094 1095 1095 /** Translate block segment address with range checking. */ 1096 static int vbds_bsa_translate(vbds_part_t *part, aoff64_t ba, size_t cnt,1096 static errno_t vbds_bsa_translate(vbds_part_t *part, aoff64_t ba, size_t cnt, 1097 1097 aoff64_t *gba) 1098 1098 { … … 1105 1105 1106 1106 /** Register service for partition */ 1107 static int vbds_part_svc_register(vbds_part_t *part)1107 static errno_t vbds_part_svc_register(vbds_part_t *part) 1108 1108 { 1109 1109 char *name; 1110 1110 service_id_t psid; 1111 1111 int idx; 1112 int rc;1112 errno_t rc; 1113 1113 1114 1114 idx = part->lpart->index; … … 1152 1152 1153 1153 /** Unregister service for partition */ 1154 static int vbds_part_svc_unregister(vbds_part_t *part)1155 { 1156 int rc;1154 static errno_t vbds_part_svc_unregister(vbds_part_t *part) 1155 { 1156 errno_t rc; 1157 1157 1158 1158 log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_part_svc_unregister(" … … 1169 1169 1170 1170 /** Update service names for any partition whose index has changed. */ 1171 static int vbds_part_indices_update(vbds_disk_t *disk)1171 static errno_t vbds_part_indices_update(vbds_disk_t *disk) 1172 1172 { 1173 1173 label_part_info_t lpinfo; 1174 int rc;1174 errno_t rc; 1175 1175 1176 1176 log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_part_indices_update()"); … … 1219 1219 1220 1220 /** Get block size wrapper for liblabel */ 1221 static int vbds_label_get_bsize(void *arg, size_t *bsize)1221 static errno_t vbds_label_get_bsize(void *arg, size_t *bsize) 1222 1222 { 1223 1223 vbds_disk_t *disk = (vbds_disk_t *)arg; … … 1226 1226 1227 1227 /** Get number of blocks wrapper for liblabel */ 1228 static int vbds_label_get_nblocks(void *arg, aoff64_t *nblocks)1228 static errno_t vbds_label_get_nblocks(void *arg, aoff64_t *nblocks) 1229 1229 { 1230 1230 vbds_disk_t *disk = (vbds_disk_t *)arg; … … 1233 1233 1234 1234 /** Read blocks wrapper for liblabel */ 1235 static int vbds_label_read(void *arg, aoff64_t ba, size_t cnt, void *buf)1235 static errno_t vbds_label_read(void *arg, aoff64_t ba, size_t cnt, void *buf) 1236 1236 { 1237 1237 vbds_disk_t *disk = (vbds_disk_t *)arg; … … 1240 1240 1241 1241 /** Write blocks wrapper for liblabel */ 1242 static int vbds_label_write(void *arg, aoff64_t ba, size_t cnt, const void *data)1242 static errno_t vbds_label_write(void *arg, aoff64_t ba, size_t cnt, const void *data) 1243 1243 { 1244 1244 vbds_disk_t *disk = (vbds_disk_t *)arg;
Note:
See TracChangeset
for help on using the changeset viewer.