Changeset 1923501 in mainline for uspace/app/bithenge/block.c


Ignore:
Timestamp:
2012-05-25T04:15:57Z (12 years ago)
Author:
Sean Bartell <wingedtachikoma@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ce683ed3
Parents:
743ce51
Message:

Bithenge: use separate functions instead of casts.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bithenge/block.c

    r743ce51 r1923501  
    5151} block_blob_t;
    5252
     53static inline block_blob_t *block_from_blob(bithenge_blob_t *base)
     54{
     55        return (block_blob_t *)base;
     56}
     57
     58static inline bithenge_blob_t *blob_from_block(block_blob_t *blob)
     59{
     60        return &blob->base;
     61}
     62
    5363static int block_size(bithenge_blob_t *base, aoff64_t *size)
    5464{
    55         block_blob_t *blob = (block_blob_t *)base;
     65        block_blob_t *blob = block_from_blob(base);
    5666        *size = blob->size;
    5767        return EOK;
     
    6171    aoff64_t *size)
    6272{
    63         block_blob_t *blob = (block_blob_t *)base;
     73        block_blob_t *blob = block_from_blob(base);
    6474        if (offset > blob->size)
    6575                return ELIMIT;
     
    7080static int block_destroy(bithenge_blob_t *base)
    7181{
    72         block_blob_t *blob = (block_blob_t *)base;
     82        block_blob_t *blob = block_from_blob(base);
    7383        block_fini(blob->service_id);
    7484        free(blob);
     
    113123        if (!blob)
    114124                return ENOMEM;
    115         rc = bithenge_new_random_access_blob(&blob->base, &block_ops);
     125        rc = bithenge_new_random_access_blob(blob_from_block(blob),
     126            &block_ops);
    116127        if (rc != EOK) {
    117128                free(blob);
Note: See TracChangeset for help on using the changeset viewer.