Changeset 3abf70c7 in mainline for uspace/lib/block


Ignore:
Timestamp:
2014-08-16T22:33:41Z (11 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
da79df42
Parents:
35b8bfe
Message:

libblock is not the best place to define SCSI structures.

Location:
uspace/lib/block
Files:
2 edited

Legend:

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

    r35b8bfe r3abf70c7  
    877877 *
    878878 * @return Allocated TOC structure.
    879  * @return NULL on failure.
    880  *
    881  */
    882 toc_block_t *block_get_toc(service_id_t service_id, uint8_t session)
     879 * @return EOK on success or negative error code.
     880 *
     881 */
     882int block_read_toc(service_id_t service_id, uint8_t session, void *buf,
     883    size_t bufsize)
    883884{
    884885        devcon_t *devcon = devcon_search(service_id);
    885         toc_block_t *toc = NULL;
    886         int rc;
    887        
    888         assert(devcon);
    889        
    890         toc = (toc_block_t *) malloc(sizeof(toc_block_t));
    891         if (toc == NULL)
    892                 return NULL;
    893        
    894         rc = bd_read_toc(devcon->bd, session, toc, sizeof(toc_block_t));
    895         if (rc != EOK) {
    896                 free(toc);
    897                 return NULL;
    898         }
    899        
    900         return toc;
     886       
     887        assert(devcon);
     888        return bd_read_toc(devcon->bd, session, buf, bufsize);
    901889}
    902890
  • uspace/lib/block/block.h

    r35b8bfe r3abf70c7  
    9999};
    100100
    101 typedef struct {
    102         uint16_t size;
    103         uint8_t first_session;
    104         uint8_t last_session;
    105        
    106         uint8_t res0;
    107         uint8_t adr_ctrl;
    108         uint8_t first_track;
    109         uint8_t res1;
    110        
    111         uint32_t first_lba;
    112 } __attribute__((packed)) toc_block_t;
    113 
    114101extern int block_init(exch_mgmt_t, service_id_t, size_t);
    115102extern void block_fini(service_id_t);
     
    129116extern int block_get_bsize(service_id_t, size_t *);
    130117extern int block_get_nblocks(service_id_t, aoff64_t *);
    131 extern toc_block_t *block_get_toc(service_id_t, uint8_t);
     118extern int block_read_toc(service_id_t, uint8_t, void *, size_t);
    132119extern int block_read_direct(service_id_t, aoff64_t, size_t, void *);
    133120extern int block_read_bytes_direct(service_id_t, aoff64_t, size_t, void *);
Note: See TracChangeset for help on using the changeset viewer.