Changes in uspace/lib/block/block.c [b7fd2a0:38d150e] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/block/block.c
rb7fd2a0 r38d150e 52 52 #include <stdio.h> 53 53 #include <stacktrace.h> 54 #include <str_error.h>55 54 #include <offset.h> 56 55 #include <inttypes.h> … … 88 87 } devcon_t; 89 88 90 static errno_t read_blocks(devcon_t *, aoff64_t, size_t, void *, size_t);91 static errno_t write_blocks(devcon_t *, aoff64_t, size_t, void *, size_t);89 static int read_blocks(devcon_t *, aoff64_t, size_t, void *, size_t); 90 static int write_blocks(devcon_t *, aoff64_t, size_t, void *, size_t); 92 91 static aoff64_t ba_ltop(devcon_t *, aoff64_t); 93 92 … … 107 106 } 108 107 109 static errno_t devcon_add(service_id_t service_id, async_sess_t *sess,108 static int devcon_add(service_id_t service_id, async_sess_t *sess, 110 109 size_t bsize, aoff64_t dev_size, bd_t *bd) 111 110 { … … 146 145 } 147 146 148 errno_t block_init(service_id_t service_id, size_t comm_size)147 int block_init(service_id_t service_id, size_t comm_size) 149 148 { 150 149 bd_t *bd; … … 156 155 } 157 156 158 errno_t rc = bd_open(sess, &bd);157 int rc = bd_open(sess, &bd); 159 158 if (rc != EOK) { 160 159 async_hangup(sess); … … 209 208 } 210 209 211 errno_t block_bb_read(service_id_t service_id, aoff64_t ba)210 int block_bb_read(service_id_t service_id, aoff64_t ba) 212 211 { 213 212 void *bb_buf; 214 errno_t rc;213 int rc; 215 214 216 215 devcon_t *devcon = devcon_search(service_id); … … 270 269 }; 271 270 272 errno_t block_cache_init(service_id_t service_id, size_t size, unsigned blocks,271 int block_cache_init(service_id_t service_id, size_t size, unsigned blocks, 273 272 enum cache_mode mode) 274 273 { … … 307 306 } 308 307 309 errno_t block_cache_fini(service_id_t service_id)308 int block_cache_fini(service_id_t service_id) 310 309 { 311 310 devcon_t *devcon = devcon_search(service_id); 312 311 cache_t *cache; 313 errno_t rc;312 int rc; 314 313 315 314 if (!devcon) … … 381 380 * device. 382 381 * 383 * @return EOK on success or a nerror code.384 */ 385 errno_t block_get(block_t **block, service_id_t service_id, aoff64_t ba, int flags)382 * @return EOK on success or a negative error code. 383 */ 384 int block_get(block_t **block, service_id_t service_id, aoff64_t ba, int flags) 386 385 { 387 386 devcon_t *devcon; … … 390 389 link_t *link; 391 390 aoff64_t p_ba; 392 errno_t rc;391 int rc; 393 392 394 393 devcon = devcon_search(service_id); … … 578 577 * @param block Block of which a reference is to be released. 579 578 * 580 * @return EOK on success or a nerror code.581 */ 582 errno_t block_put(block_t *block)579 * @return EOK on success or a negative error code. 580 */ 581 int block_put(block_t *block) 583 582 { 584 583 devcon_t *devcon = devcon_search(block->service_id); … … 586 585 unsigned blocks_cached; 587 586 enum cache_mode mode; 588 errno_t rc = EOK;587 int rc = EOK; 589 588 590 589 assert(devcon); … … 699 698 * @param block_size Block size to be used for the transfer. 700 699 * 701 * @return EOK on success or a n errorcode on failure.702 */ 703 errno_t block_seqread(service_id_t service_id, void *buf, size_t *bufpos,700 * @return EOK on success or a negative return code on failure. 701 */ 702 int block_seqread(service_id_t service_id, void *buf, size_t *bufpos, 704 703 size_t *buflen, aoff64_t *pos, void *dst, size_t size) 705 704 { … … 735 734 if (*bufpos == *buflen) { 736 735 /* Refill the communication buffer with a new block. */ 737 errno_t rc;736 int rc; 738 737 739 738 rc = read_blocks(devcon, *pos / block_size, 1, buf, … … 758 757 * @param src Buffer for storing the data. 759 758 * 760 * @return EOK on success or anerror code on failure.761 */ 762 errno_t block_read_direct(service_id_t service_id, aoff64_t ba, size_t cnt, void *buf)759 * @return EOK on success or negative error code on failure. 760 */ 761 int block_read_direct(service_id_t service_id, aoff64_t ba, size_t cnt, void *buf) 763 762 { 764 763 devcon_t *devcon; … … 777 776 * @param src The data to be written. 778 777 * 779 * @return EOK on success or anerror code on failure.780 */ 781 errno_t block_write_direct(service_id_t service_id, aoff64_t ba, size_t cnt,778 * @return EOK on success or negative error code on failure. 779 */ 780 int block_write_direct(service_id_t service_id, aoff64_t ba, size_t cnt, 782 781 const void *data) 783 782 { … … 796 795 * @param cnt Number of blocks. 797 796 * 798 * @return EOK on success or anerror code on failure.799 */ 800 errno_t block_sync_cache(service_id_t service_id, aoff64_t ba, size_t cnt)797 * @return EOK on success or negative error code on failure. 798 */ 799 int block_sync_cache(service_id_t service_id, aoff64_t ba, size_t cnt) 801 800 { 802 801 devcon_t *devcon; … … 813 812 * @param bsize Output block size. 814 813 * 815 * @return EOK on success or anerror code on failure.816 */ 817 errno_t block_get_bsize(service_id_t service_id, size_t *bsize)814 * @return EOK on success or negative error code on failure. 815 */ 816 int block_get_bsize(service_id_t service_id, size_t *bsize) 818 817 { 819 818 devcon_t *devcon; … … 830 829 * @param nblocks Output number of blocks. 831 830 * 832 * @return EOK on success or anerror code on failure.833 */ 834 errno_t block_get_nblocks(service_id_t service_id, aoff64_t *nblocks)831 * @return EOK on success or negative error code on failure. 832 */ 833 int block_get_nblocks(service_id_t service_id, aoff64_t *nblocks) 835 834 { 836 835 devcon_t *devcon = devcon_search(service_id); … … 847 846 * @param data Buffer that receives the data 848 847 * 849 * @return EOK on success or anerror code on failure.850 */ 851 errno_t block_read_bytes_direct(service_id_t service_id, aoff64_t abs_offset,848 * @return EOK on success or negative error code on failure. 849 */ 850 int block_read_bytes_direct(service_id_t service_id, aoff64_t abs_offset, 852 851 size_t bytes, void *data) 853 852 { 854 errno_t rc;853 int rc; 855 854 size_t phys_block_size; 856 855 size_t buf_size; … … 898 897 * 899 898 * @return Allocated TOC structure. 900 * @return EOK on success or anerror code.901 * 902 */ 903 errno_t block_read_toc(service_id_t service_id, uint8_t session, void *buf,899 * @return EOK on success or negative error code. 900 * 901 */ 902 int block_read_toc(service_id_t service_id, uint8_t session, void *buf, 904 903 size_t bufsize) 905 904 { … … 917 916 * @param src Buffer for storing the data. 918 917 * 919 * @return EOK on success or anerror code on failure.920 */ 921 static errno_t read_blocks(devcon_t *devcon, aoff64_t ba, size_t cnt, void *buf,918 * @return EOK on success or negative error code on failure. 919 */ 920 static int read_blocks(devcon_t *devcon, aoff64_t ba, size_t cnt, void *buf, 922 921 size_t size) 923 922 { 924 923 assert(devcon); 925 924 926 errno_t rc = bd_read_blocks(devcon->bd, ba, cnt, buf, size);925 int rc = bd_read_blocks(devcon->bd, ba, cnt, buf, size); 927 926 if (rc != EOK) { 928 printf("Error % sreading %zu blocks starting at block %" PRIuOFF64929 " from device handle %" PRIun "\n", str_error_name(rc), cnt, ba,927 printf("Error %d reading %zu blocks starting at block %" PRIuOFF64 928 " from device handle %" PRIun "\n", rc, cnt, ba, 930 929 devcon->service_id); 931 930 #ifndef NDEBUG … … 944 943 * @param src Buffer containing the data to write. 945 944 * 946 * @return EOK on success or anerror code on failure.947 */ 948 static errno_t write_blocks(devcon_t *devcon, aoff64_t ba, size_t cnt, void *data,945 * @return EOK on success or negative error code on failure. 946 */ 947 static int write_blocks(devcon_t *devcon, aoff64_t ba, size_t cnt, void *data, 949 948 size_t size) 950 949 { 951 950 assert(devcon); 952 951 953 errno_t rc = bd_write_blocks(devcon->bd, ba, cnt, data, size);952 int rc = bd_write_blocks(devcon->bd, ba, cnt, data, size); 954 953 if (rc != EOK) { 955 printf("Error % swriting %zu blocks starting at block %" PRIuOFF64956 " to device handle %" PRIun "\n", str_error_name(rc), cnt, ba, devcon->service_id);954 printf("Error %d writing %zu blocks starting at block %" PRIuOFF64 955 " to device handle %" PRIun "\n", rc, cnt, ba, devcon->service_id); 957 956 #ifndef NDEBUG 958 957 stacktrace_print();
Note:
See TracChangeset
for help on using the changeset viewer.