Changeset 4046b2f4 in mainline for uspace/lib/block/libblock.c
- Timestamp:
- 2011-08-30T17:35:04Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7a72ce1a
- Parents:
- c3d19ac
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/block/libblock.c
rc3d19ac r4046b2f4 93 93 static int get_block_size(async_sess_t *, size_t *); 94 94 static int get_num_blocks(async_sess_t *, aoff64_t *); 95 static int read_toc(async_sess_t *, uint8_t); 95 96 static aoff64_t ba_ltop(devcon_t *, aoff64_t); 96 97 … … 891 892 } 892 893 894 /** Get TOC from device. 895 * 896 * @param service_id Service ID of the block device. 897 * @param session Starting session. 898 * @param data Buffer to read TOC into. 899 * 900 * @return EOK on success. 901 * @return Error code on failure. 902 * 903 */ 904 int block_get_toc(service_id_t service_id, uint8_t session, void *data) 905 { 906 devcon_t *devcon = devcon_search(service_id); 907 assert(devcon); 908 909 fibril_mutex_lock(&devcon->comm_area_lock); 910 911 int rc = read_toc(devcon->sess, session); 912 if (rc == EOK) 913 memcpy(buf, devcon->comm_area, devcon->pblock_size); 914 915 fibril_mutex_unlock(&devcon->comm_area_lock); 916 917 return rc; 918 } 919 893 920 /** Read blocks from block device. 894 921 * … … 981 1008 } 982 1009 1010 /** Get TOC from block device. */ 1011 static int read_toc(async_sess_t *sess, uint8_t session) 1012 { 1013 async_exch_t *exch = async_exchange_begin(sess); 1014 int rc = async_req_1_0(exch, BD_READ_TOC, session); 1015 async_exchange_end(exch); 1016 1017 return rc; 1018 } 1019 983 1020 /** Convert logical block address to physical block address. */ 984 1021 static aoff64_t ba_ltop(devcon_t *devcon, aoff64_t lba)
Note:
See TracChangeset
for help on using the changeset viewer.