Changeset ed903174 in mainline for uspace/lib/libblock/libblock.c
- Timestamp:
- 2010-02-10T23:51:23Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e70edd1
- Parents:
- b32c604f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/libblock/libblock.c
rb32c604f red903174 1 1 /* 2 * Copyright (c) 2008 Jakub Jermar 3 * Copyright (c) 2008 Martin Decky 2 * Copyright (c) 2008 Jakub Jermar 3 * Copyright (c) 2008 Martin Decky 4 4 * All rights reserved. 5 5 * … … 81 81 size_t comm_size; 82 82 void *bb_buf; 83 bn_t bb_addr;83 aoff64_t bb_addr; 84 84 size_t pblock_size; /**< Physical block size. */ 85 85 cache_t *cache; 86 86 } devcon_t; 87 87 88 static int read_blocks(devcon_t *devcon, bn_t ba, size_t cnt);89 static int write_blocks(devcon_t *devcon, bn_t ba, size_t cnt);88 static int read_blocks(devcon_t *devcon, aoff64_t ba, size_t cnt); 89 static int write_blocks(devcon_t *devcon, aoff64_t ba, size_t cnt); 90 90 static int get_block_size(int dev_phone, size_t *bsize); 91 static int get_num_blocks(int dev_phone, bn_t *nblocks);91 static int get_num_blocks(int dev_phone, aoff64_t *nblocks); 92 92 93 93 static devcon_t *devcon_search(dev_handle_t dev_handle) … … 214 214 } 215 215 216 int block_bb_read(dev_handle_t dev_handle, bn_t ba)216 int block_bb_read(dev_handle_t dev_handle, aoff64_t ba) 217 217 { 218 218 void *bb_buf; … … 334 334 } 335 335 336 long key = b->boff;336 unsigned long key = b->boff; 337 337 hash_table_remove(&cache->block_hash, &key, 1); 338 338 … … 382 382 * @return EOK on success or a negative error code. 383 383 */ 384 int block_get(block_t **block, dev_handle_t dev_handle, bn_t boff, int flags)384 int block_get(block_t **block, dev_handle_t dev_handle, aoff64_t boff, int flags) 385 385 { 386 386 devcon_t *devcon; … … 657 657 * @return EOK on success or a negative return code on failure. 658 658 */ 659 int block_seqread(dev_handle_t dev_handle, off_t *bufpos, size_t *buflen,660 off_t *pos, void *dst, size_t size)661 { 662 off_t offset = 0;659 int block_seqread(dev_handle_t dev_handle, size_t *bufpos, size_t *buflen, 660 aoff64_t *pos, void *dst, size_t size) 661 { 662 size_t offset = 0; 663 663 size_t left = size; 664 664 size_t block_size; … … 690 690 } 691 691 692 if (*bufpos == (off_t)*buflen) {692 if (*bufpos == *buflen) { 693 693 /* Refill the communication buffer with a new block. */ 694 694 int rc; … … 718 718 * @return EOK on success or negative error code on failure. 719 719 */ 720 int block_read_direct(dev_handle_t dev_handle, bn_t ba, size_t cnt, void *buf)720 int block_read_direct(dev_handle_t dev_handle, aoff64_t ba, size_t cnt, void *buf) 721 721 { 722 722 devcon_t *devcon; … … 746 746 * @return EOK on success or negative error code on failure. 747 747 */ 748 int block_write_direct(dev_handle_t dev_handle, bn_t ba, size_t cnt,748 int block_write_direct(dev_handle_t dev_handle, aoff64_t ba, size_t cnt, 749 749 const void *data) 750 750 { … … 789 789 * @return EOK on success or negative error code on failure. 790 790 */ 791 int block_get_nblocks(dev_handle_t dev_handle, bn_t *nblocks)791 int block_get_nblocks(dev_handle_t dev_handle, aoff64_t *nblocks) 792 792 { 793 793 devcon_t *devcon; … … 808 808 * @return EOK on success or negative error code on failure. 809 809 */ 810 static int read_blocks(devcon_t *devcon, bn_t ba, size_t cnt)810 static int read_blocks(devcon_t *devcon, aoff64_t ba, size_t cnt) 811 811 { 812 812 int rc; … … 816 816 UPPER32(ba), cnt); 817 817 if (rc != EOK) { 818 printf("Error %d reading %d blocks starting at block %" PRIu BN818 printf("Error %d reading %d blocks starting at block %" PRIuOFF64 819 819 " from device handle %d\n", rc, cnt, ba, 820 820 devcon->dev_handle); … … 835 835 * @return EOK on success or negative error code on failure. 836 836 */ 837 static int write_blocks(devcon_t *devcon, bn_t ba, size_t cnt)837 static int write_blocks(devcon_t *devcon, aoff64_t ba, size_t cnt) 838 838 { 839 839 int rc; … … 843 843 UPPER32(ba), cnt); 844 844 if (rc != EOK) { 845 printf("Error %d writing %d blocks starting at block %" PRIu BN845 printf("Error %d writing %d blocks starting at block %" PRIuOFF64 846 846 " to device handle %d\n", rc, cnt, ba, devcon->dev_handle); 847 847 #ifndef NDEBUG … … 866 866 867 867 /** Get total number of blocks on block device. */ 868 static int get_num_blocks(int dev_phone, bn_t *nblocks)868 static int get_num_blocks(int dev_phone, aoff64_t *nblocks) 869 869 { 870 870 ipcarg_t nb_l, nb_h; … … 873 873 rc = async_req_0_2(dev_phone, BD_GET_NUM_BLOCKS, &nb_l, &nb_h); 874 874 if (rc == EOK) { 875 *nblocks = ( bn_t) MERGE_LOUP32(nb_l, nb_h);875 *nblocks = (aoff64_t) MERGE_LOUP32(nb_l, nb_h); 876 876 } 877 877
Note:
See TracChangeset
for help on using the changeset viewer.