Changeset 00aece0 in mainline for uspace/lib/block/libblock.c


Ignore:
Timestamp:
2012-02-18T16:47:38Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4449c6c
Parents:
bd5f3b7 (diff), f943dd3 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/block/libblock.c

    rbd5f3b7 r00aece0  
    891891}
    892892
     893/** Get TOC from device.
     894 *
     895 * @param service_id Service ID of the block device.
     896 * @param session    Starting session.
     897 *
     898 * @return Allocated TOC structure.
     899 * @return NULL on failure.
     900 *
     901 */
     902toc_block_t *block_get_toc(service_id_t service_id, uint8_t session)
     903{
     904        devcon_t *devcon = devcon_search(service_id);
     905        assert(devcon);
     906       
     907        toc_block_t *toc = NULL;
     908       
     909        fibril_mutex_lock(&devcon->comm_area_lock);
     910       
     911        async_exch_t *exch = async_exchange_begin(devcon->sess);
     912        int rc = async_req_1_0(exch, BD_READ_TOC, session);
     913        async_exchange_end(exch);
     914       
     915        if (rc == EOK) {
     916                toc = (toc_block_t *) malloc(sizeof(toc_block_t));
     917                if (toc != NULL) {
     918                        memset(toc, 0, sizeof(toc_block_t));
     919                        memcpy(toc, devcon->comm_area,
     920                            min(devcon->pblock_size, sizeof(toc_block_t)));
     921                }
     922        }
     923       
     924       
     925        fibril_mutex_unlock(&devcon->comm_area_lock);
     926       
     927        return toc;
     928}
     929
    893930/** Read blocks from block device.
    894931 *
Note: See TracChangeset for help on using the changeset viewer.