Changeset 5c5c346a in mainline


Ignore:
Timestamp:
2012-05-31T04:01:28Z (12 years ago)
Author:
Sean Bartell <wingedtachikoma@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
50985c34
Parents:
4b16422
Message:

Bithenge: file blobs

Location:
uspace/app/bithenge
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bithenge/Makefile

    r4b16422 r5c5c346a  
    3535        blob.c \
    3636        block.c \
     37        file.c \
    3738        test.c
    3839
  • uspace/app/bithenge/block.c

    r4b16422 r5c5c346a  
    112112        aoff64_t size;
    113113        rc = block_get_bsize(service_id, &bsize);
    114         if (rc != EOK)
     114        if (rc != EOK) {
     115                block_fini(service_id);
    115116                return rc;
     117        }
    116118        rc = block_get_nblocks(service_id, &nblocks);
    117         if (rc != EOK)
     119        if (rc != EOK) {
     120                block_fini(service_id);
    118121                return rc;
     122        }
    119123        size = bsize * nblocks;
    120124
    121125        // Create blob
    122126        block_blob_t *blob = malloc(sizeof(*blob));
    123         if (!blob)
     127        if (!blob) {
     128                block_fini(service_id);
    124129                return ENOMEM;
     130        }
    125131        rc = bithenge_new_random_access_blob(blob_from_block(blob),
    126132            &block_ops);
    127133        if (rc != EOK) {
    128134                free(blob);
     135                block_fini(service_id);
    129136                return rc;
    130137        }
  • uspace/app/bithenge/test.c

    r4b16422 r5c5c346a  
    4040#include "blob.h"
    4141#include "block.h"
     42#include "file.h"
    4243
    4344static void
     
    8384        bithenge_blob_destroy(blob);
    8485
     86        bithenge_new_file_blob(&blob, "/textdemo");
     87        printf("Data from file:/textdemo: ");
     88        print_blob(blob);
     89        bithenge_blob_destroy(blob);
     90
    8591        return 0;
    8692}
Note: See TracChangeset for help on using the changeset viewer.